Skip to content

SCRIP-METRIC-004: validate derived source units before repinning public gallery #286

Closed

Description

@andy-zen-dev

Latent contract mismatch in pinned full-work gallery

In the merged scriptorium/full_work_gallery.py (source blob e3d94d8c8290f8954325a28206aeb416a770a13a) the renderer declares display units for ten supported metrics but does not independently verify the unit field in a newly approved Beketova derived JSON. The two current pinned Git blobs are correct: local audit of source units was 10/10. The issue is a future-repin integrity regression: changing source data plus its reviewed hash could leave unit: ratio displayed as %.

Existing staged handoff, not yet published

/mnt/data/Scriptorium-Gallery-Unit-Contract-20261021.zip (local archive provided in chat) includes apply_unit_contract.py and 3 repin-aware negative tests. It was prepared for the old #276 head 61a32b6...; now #276 is merged. Its original GitHub update_file was denied, and the handoff's 3/3 smoke tests do not substitute for canonical CI. Do not replay the denied mutation unchanged or switch endpoints to circumvent it.

Acceptance

  • Revalidate against fresh master, existing source JSON and current metric schema; preserve the same ten-row declaration (no second registry).
  • Match Beketova unit to the canonical declared source unit (percent maps to display %, words to display types for unique forms, occurrences/1000_words to the display rate). Grin's diagnostic rows do not have this field and must not be assigned invented source units.
  • Negative tests with deliberately repinned source JSON detect swapped percentage/rate/count units even when the new Git blob hash matches changed bytes.
  • Keep full-work chart/chart units, pinned source identity, M2 0/5 and translation boundaries. Full canonical tests and installed gallery CI must pass before merge.
  • Scope only a later independently selected unit; no duplicate issue if Reader 0.3: canonical two-work analysis, charts and reproducible exports #278 has already implemented and validated this behavior.
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