Skip to content

Preserve typed prepaint block variants - #45

Open
isomorphisms wants to merge 1 commit into
mainfrom
types/prepaint-block-sum
Open

Preserve typed prepaint block variants#45
isomorphisms wants to merge 1 commit into
mainfrom
types/prepaint-block-sum

Conversation

@isomorphisms

Copy link
Copy Markdown
Owner

Erased distinction

The ib-prepaint parser already validates six block records, their exact field counts, nonempty rows, and heading levels 1–6. It then discarded that result into kind: String, level: int, and an arbitrary positional List<String>. The Android renderer had to recover the variant with a string switch and unchecked indexes.

Change

  • replace the string source tag with SourceKind;
  • replace integer heading levels with the six-case HeadingLevel established by the wire parser;
  • replace the generic Block payload with a closed family of HeadingBlock, TextBlock, LinkBlock, RowBlock, FormBlock, and ImageBlock, each carrying only its own named fields;
  • make revision and variant constructors private so parsing/plain-text conversion are the construction boundary;
  • keep arbitrary visible prose, labels, captions, link text, and the honest complete proposition primitive.

The interchange grammar and painted behavior do not change. This is the Android adapter retaining information that the existing parser has already proved, not a new browser type hierarchy.

Newly rejected

  • no caller can construct a block from an arbitrary string kind and arbitrary field list;
  • no caller can construct a heading block from an arbitrary integer such as 7;
  • a row constructor cannot retain an empty cell list.

The checked-in refusal fixtures compile those first two invalid consumers and require the compiler to reject them.

Verification

Exact branch head: c7f5ea96e260e8ff4f0f774fd0d3a60752a6f8bb

Local:

$ sh android-prepaint/tests/verify_typed_model.sh
typed prepaint model: positive behavior and refusals passed

$ git diff --check
(no output)

GitHub Actions remains responsible for the Android SDK unit/lint/APK path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant