Skip to content

finding(types): zod-mirror-parity.test.ts's header says "16 pairs" where the ledger holds 18 — the one figure in that sentence no headerFigures pin covers, so it compiles and tests green while wrong #8458

Description

@os-zhuang

Finding (observation, awaiting first grading). Filed unlabelled and unassigned — grading and domain:* belong to triage. Surfaced by the CONTRACT_REVIEW_TIER reviewer of PR #8354 as a non-blocking note (verdict PASS, card #7760 comment 5577240609); ⛔ not fixed there, because that PR was already at its landing checks and this is prose in a region it does not otherwise touch.

⚠️ Provenance is split, and stated as such rather than blurred: two halves below are this seat's own reading at 35f49ff1c; the count of 18 is the contract reviewer's measurement and this seat did not re-derive it. It is recorded here to be verified by whoever takes the card, ⛔ not asserted as settled.

The sentence

packages/types/src/__tests__/zod-mirror-parity.test.ts, header docblock, read at 35f49ff1c (PR #8354's head) — verbatim:

⛔ That repaired no mirror and no declaration: it made a face
READABLE that had been unknown. 19 keys across 16 pairs LEFT (13 entries
emptied)
because the reading they recorded was the annotation, and 3 keys
ENTERED …

Measured by the PR #8354 contract reviewer: 18 distinct pairs, not 16 — 13 emptied plus 5 reduced, the five named as AppComponentSchema, DashboardComponentSchema, PageNodeSchema, ObjectViewSchema, DetailViewSchema. ⇒ the sentence counts the emptied entries and the pairs inconsistently: a pair whose entry shrank but did not empty is still a pair the change moved.

Why it stays green — this seat's own reading

The file pins its header figures with headerFigures(spelling: RegExp) (:3056), which asserts the spelling occurs exactly once and returns its capture groups as numbers. Every call site pins an entries/keys spelling:

:3084  /\*\*SPEC-DERIVED \((\d+) entr(?:y|ies), (\d+) keys?\)\*\*/
:3085  /\*\*LOCAL \((\d+) entr(?:y|ies), (\d+) keys?\)\*\*/
:3086  /\*\*(\d+) entries \/ (\d+) keys\*\* — (\d+) \/ (\d+) spec-derived, (\d+) \/ (\d+) local\./
:3089  /\*\*(\d+) entries\*\* in `UnmirroredDeclared`, \*\*(\d+) keys\*\* across them/

No headerFigures regex matches a "pairs" figure.19 keys across 16 pairs is unpinned prose sitting inside a docblock whose other numbers are all machine-checked. It compiles, and tsc -p tsconfig.test.json and vitest are both green with it wrong.

That is the exact rot this header warns about in its own words, three lines above the defect:

restate one without checking that the pin's spelling still reaches it.

The neighbouring figures (23 entries / 36 keys / 47 arms, and the 6 / 30 / 0 / 11 split) are covered and did move correctly with PR #8354. Only the pairs figure escaped.

Radius

What this needs

  1. Re-derive the pairs count (⛔ do not adopt 18 from this card — that is the mistake this card is about) and correct the sentence, in the test file and in PR fix(types): give seven recursion-breaking zod mirrors their declaration as both type arguments #8354's body if it has not merged.
  2. Decide whether the figure should be pinned at all. Two honest options, and the choice is the card's real content:
    • add a headerFigures spelling for it, so it cannot rot again — but every pinned figure is a maintenance cost on every future ledger move; or
    • drop the pairs figure from the sentence, keeping only the pinned entries/keys/arms. A number no instrument checks is a liability in a header whose whole authority rests on the others being checked.
  3. If it is pinned, state whether "pairs" means entries that emptied or entries the change moved at all — the ambiguity is what produced the discrepancy.

Not a duplicate of

Refs: #7760 / PR #8354 (where it was found; reviewer's note in comment 5577240609) · #7279 · #8252 · #7069 (the ledger's origin).

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions