Skip to content

CR-2026-034: flagged in the C interpreter, and in the harness that measures it - #34

Merged
reissjason merged 1 commit into
masterfrom
cr/2026-034-c-flagged
Aug 25, 2026
Merged

CR-2026-034: flagged in the C interpreter, and in the harness that measures it#34
reissjason merged 1 commit into
masterfrom
cr/2026-034-c-flagged

Conversation

@reissjason

Copy link
Copy Markdown
Contributor

The construct #32 named as the largest remaining gap. Attempted vectors went 453 → 488, all passing, and flagged is no longer a reason a corpus schema cannot be reached.

The representation

Reuses what match and tlv already have: match_var holds the name of the field carrying the mask, and each group is a case_def_t whose match_value is its bit position and whose body is placed above field_count — the invariant #32 established, for the same reason.

The mask field must declare var_name. The interpreter records a value in its variable table only where a field declares one, while a YAML flagged refers to a field by name — so no corpus schema carries var: for it, and the harness patches it in when building.

A builder that forgets gets SCHEMA_ERR_MATCH, not a silent decode of nothing: var_get returns 0 for a miss, which for a bitmask is indistinguishable from "no bits set". A new var_has() tells the two apart. The reference interpreter raises in the same case ("Flagged field reference not found"), which is what this matches.

Coverage

Six of the 34 flagged schemas build now; the rest are blocked by transform (26), bitfield_string (24) or computed fields — not by flagged. There's a test asserting a flagged schema is genuinely built and its var_name patched, because "0 differ" proves nothing if no group ever fires — I checked one decodes with flags = 0x0003 and both bits firing.

A message that misattributed

no constructor for type 'u32le16' read as a C gap when C has FIELD_TYPE_U32LE16 and decodes it correctly — it's a harness limitation. The report now says which side each limit is on, the same care the tlv and flagged reasons already took. That distinction is load-bearing in a report whose whole purpose is telling C's gaps from the harness's.

repeat is now the last construct C has no field type for, and at 3 schemas it's worth less than widening the harness for transform and bitfield_string.

Slips, all mine, all in scaffolding

  • CR-2026-033: tlv in the C interpreter, and in the harness that measures it #32's test anchored on "FIELD_TYPE_TLV\n} field_type_t;" — pinning TLV as the last enum member, incidental and broken the moment this appended FIELD_TYPE_FLAGGED. Compares positions now.
  • One assertion here read a doc comment through a byte-count window that caught its tail and missed its opening, and searched for a phrase the wrapped comment breaks across a line. Failed twice on a header saying exactly what it asserts. Anchored on the comment block with whitespace normalised.
  • Twice while editing AGENTS.md I wrote a multi-edit script that aborted on a bad anchor and silently wrote nothing — the second time my --amend then committed unchanged content. Now I verify every anchor before writing any.

Verification

Suite Result
Python 2706 passed, 4 skipped
make test-c 3 C binaries pass; harness 488/488, 0 differ
make selftest ALL 3 SELFTESTS PASSED
vector-verdicts 1250 vectors, both paths 100%, 0 disagreements
encode-round-trip 1163 of 1239, 0 unexplained
validate-devices / score-check / docs-index-check pass

Only the C header and the harness changed, so the other four implementations are untouched.

🤖 Generated with Claude Code

…asures it

The construct CR-2026-033 named as the largest remaining gap. Attempted vectors
went 453 -> 488, all passing, and `flagged` is no longer a reason a corpus schema
cannot be reached.

The representation reuses what match and tlv already have: match_var holds the
name of the field carrying the mask, and each group is a case_def_t whose
match_value is its bit position and whose field_start/field_count point at a body
placed above field_count - the invariant CR-2026-033 established, for the same
reason.

The mask field must declare var_name. This interpreter records a value in its
variable table only where a field declares one, while a YAML `flagged` refers to a
field by name, so no corpus schema carries `var:` for it and the harness patches it
in when building. A builder that forgets gets SCHEMA_ERR_MATCH rather than a silent
decode of nothing: var_get returns 0 for a miss, which for a bitmask is
indistinguishable from "no bits set", so a new var_has() tells the two apart. The
reference interpreter raises in the same case and this matches it.

Six of the 34 flagged schemas are built now; the rest are blocked by `transform`
(26), `bitfield_string` (24) or computed fields - not by `flagged`. A test asserts
a flagged schema is genuinely built and its var_name patched, because "0 differ"
proves nothing if no group ever fires.

Also corrected a skip message that misattributed a harness limit to the
interpreter: `no constructor for type 'u32le16'` read as a C gap when C has
FIELD_TYPE_U32LE16 and decodes it correctly. The message now says which side each
limit is on, which is the same care the tlv and flagged reasons already took.

Three slips of mine, all in test scaffolding and all the same family. CR-2026-033's
test anchored on "FIELD_TYPE_TLV\n} field_type_t;", pinning TLV as the last enum
member - incidental, and broken the moment this appended FIELD_TYPE_FLAGGED after
it. Then one assertion here read a doc comment through a byte-count window that
captured its tail and missed its opening, and searched for a phrase the wrapped
comment breaks across a line, so it failed twice on a header that says exactly what
it asserts. Anchored on the comment block with whitespace normalised.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@reissjason
reissjason merged commit e95f5b3 into master Aug 25, 2026
5 checks passed
@reissjason
reissjason deleted the cr/2026-034-c-flagged branch August 25, 2026 20:14
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