Repository navigation
Define candidate rendered-check profiles and evidence identities - #28
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
Several R04 hash conformance vectors embed an inconsistent check.id in the evidence identity (using extent-equality instead of rgba8-sha256), which can mislead consumers implementing identity matching.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR advances the MedUI shared contract to the 0.3.0 candidate line by defining versioned optional observation profiles (rendered-check and evidence aggregation), their identities/schemas, and a portable synthetic corpus plus validator/test coverage to prevent silent profile/coverage regressions.
Changes:
- Bumps
VERSIONto0.3.0and updates versioning/decision docs to reflect the candidate delivery of MEDUI-DEC-007. - Introduces optional profile registry + spec, new/updated JSON schemas, and conformance vectors/cases for rendered checks and evidence identity/completeness.
- Extends
tools/validate.pywith dependency-free schema checking + profile/case coverage validation, and adds CI regression unit tests.
File summaries
| File | Description |
|---|---|
| VERSION | Bumps contract line to 0.3.0 candidate. |
| tools/validate.py | Adds schema subset validation and profile/case registry + coverage checks. |
| tools/test_validate.py | Adds regression tests ensuring validator rejects corrupted candidate inputs. |
| tools/test_schema_check.py | Adds regression tests for the dependency-free schema checker. |
| tools/schema_check.py | Adds dependency-free JSON Schema subset checker used by repository validation. |
| spec/profiles.md | Defines optional 0.3.0 candidate profile semantics and rule set. |
| schemas/profile-case.schema.json | Adds schema for portable profile observation vectors. |
| schemas/evidence.schema.json | Adds schema for evidence identity/rows/obligations. |
| schemas/diagnostic.schema.json | Updates schema $id to 0.3 minor line. |
| schemas/contract-case.schema.json | Adds schema for schema expectation cases (valid/invalid documents). |
| schemas/consumer-manifest.schema.json | Updates $id to 0.3 and adds optional profiles claims. |
| schemas/case.schema.json | Updates schema $id to 0.3 minor line. |
| README.md | Documents new profiles/ directory purpose. |
| profiles/registry.json | Registers candidate profiles and their rule IDs. |
| governance/versioning.md | Updates current candidate line text and documents optional profiles manifest key. |
| decisions/MEDUI-DEC-007-rendered-check-profiles.md | Points DEC-007 delivery to the 0.3.0 profile contract and corpus. |
| conformance/README.md | Documents profile vectors and contract-schema case structure/expectations. |
| conformance/profiles/tint-wrong.json | Adds R03 negative tint-composition vector. |
| conformance/profiles/tint-two-too-far.json | Adds R03 negative tint-composition vector (2 composites). |
| conformance/profiles/tint-two-round.json | Adds R03 positive tint-composition vector (2 composites). |
| conformance/profiles/tint-one-too-far.json | Adds R03 negative tint-composition vector (1 composite). |
| conformance/profiles/tint-one-round.json | Adds R03 positive tint-composition vector (1 composite). |
| conformance/profiles/tint-no-full-tint.json | Adds R03 negative tint-composition vector (missing exact tint sample). |
| conformance/profiles/tint-missing.json | Adds R03 negative tint-composition vector (tint absent). |
| conformance/profiles/tint-exact.json | Adds R03 positive tint-composition vector (exact tint). |
| conformance/profiles/tint-empty.json | Adds R03 negative tint-composition vector (no samples). |
| conformance/profiles/tint-blend.json | Adds R03 positive tint-composition blend vector. |
| conformance/profiles/tint-background.json | Adds R03 positive tint-composition vector with non-black background. |
| conformance/profiles/identity-screen.json | Adds E01/E02 identity mismatch vector (screen differs). |
| conformance/profiles/identity-scenario.json | Adds E01/E02 identity mismatch vector (scenario differs). |
| conformance/profiles/identity-producer.json | Adds E01/E02 identity mismatch vector (producer differs). |
| conformance/profiles/identity-node.json | Adds E01/E02 identity mismatch vector (node differs). |
| conformance/profiles/identity-locale.json | Adds E01/E02 identity mismatch vector (locale differs). |
| conformance/profiles/identity-key-order.json | Adds E01/E02 identity equivalence vector (key order differs). |
| conformance/profiles/identity-frame.json | Adds E01/E02 identity mismatch vector (frame differs). |
| conformance/profiles/identity-contract.json | Adds E01/E02 identity mismatch vector (contract differs). |
| conformance/profiles/identity-configuration.json | Adds E01/E02 identity mismatch vector (configuration differs). |
| conformance/profiles/identity-check.json | Adds E01/E02 identity mismatch vector (check differs). |
| conformance/profiles/identity-capture.json | Adds E01/E02 identity mismatch vector (capture differs). |
| conformance/profiles/identity-backend.json | Adds E01/E02 identity mismatch vector (backend differs). |
| conformance/profiles/identity-assets.json | Adds E01/E02 identity mismatch vector (assets digest differs). |
| conformance/profiles/identity-artifact.json | Adds E01/E02 identity mismatch vector (artifact digest differs). |
| conformance/profiles/hash-outside.json | Adds R04 hash vector (golden outside capture bounds). |
| conformance/profiles/hash-missing.json | Adds R04 hash vector (missing baseline => missing-baseline). |
| conformance/profiles/hash-mismatch.json | Adds R04 hash vector (digest mismatch). |
| conformance/profiles/hash-match.json | Adds R04 hash vector (digest match). |
| conformance/profiles/hash-empty.json | Adds R04 hash vector (empty rectangle hashes empty string). |
| conformance/profiles/hash-crop.json | Adds R04 hash vector (cropped golden region). |
| conformance/profiles/hash-backend.json | Adds R04 hash vector (backend identity mismatch). |
| conformance/profiles/extent-overflow.json | Adds R01 extent-equality negative vector (overflow). |
| conformance/profiles/extent-offset.json | Adds R01 extent-equality negative vector (offset). |
| conformance/profiles/extent-inset.json | Adds R01 extent-equality negative vector (inset). |
| conformance/profiles/extent-exact.json | Adds R01 extent-equality positive vector (exact). |
| conformance/profiles/extent-empty.json | Adds R01 extent-equality negative vector (empty ink). |
| conformance/profiles/evidence-unsupported.json | Adds E02/E03 vector covering unsupported row outcome aggregation. |
| conformance/profiles/evidence-unexpected.json | Adds E02/E03 vector covering unexpected rows vs empty obligations. |
| conformance/profiles/evidence-pass.json | Adds E02/E03 positive aggregation vector. |
| conformance/profiles/evidence-omitted.json | Adds E02/E03 vector covering missing row for obligation. |
| conformance/profiles/evidence-not-run.json | Adds E02/E03 vector covering not-run row outcome. |
| conformance/profiles/evidence-missing-baseline.json | Adds E02/E03 vector covering missing-baseline row outcome. |
| conformance/profiles/evidence-fail.json | Adds E02/E03 vector covering fail row outcome. |
| conformance/profiles/evidence-empty.json | Adds E02/E03 vector covering empty obligations + no rows => not-run. |
| conformance/profiles/evidence-duplicate.json | Adds E02/E03 vector covering duplicate rows for one obligation. |
| conformance/profiles/evidence-duplicate-obligation.json | Adds E02/E03 vector covering duplicate obligations. |
| conformance/profiles/containment-overflow.json | Adds R02 ink-containment negative vector (overflow beyond margin). |
| conformance/profiles/containment-margin.json | Adds R02 ink-containment positive vector (inside expanded margin). |
| conformance/profiles/containment-inset.json | Adds R02 ink-containment positive vector (inset). |
| conformance/profiles/containment-exact.json | Adds R02 ink-containment positive vector (exact). |
| conformance/profiles/containment-empty.json | Adds R02 ink-containment positive vector (empty ink passes). |
| conformance/contracts/report-unsupported.json | Adds evidence schema valid-case for unsupported outcome. |
| conformance/contracts/report-unknown-outcome.json | Adds evidence schema invalid-case for unknown outcome. |
| conformance/contracts/report-pass.json | Adds evidence schema valid-case for pass outcome. |
| conformance/contracts/report-not-run.json | Adds evidence schema valid-case for not-run outcome. |
| conformance/contracts/report-missing-screen.json | Adds evidence schema invalid-case missing required identity field. |
| conformance/contracts/report-missing-scenario.json | Adds evidence schema invalid-case missing required identity field. |
| conformance/contracts/report-missing-profile.json | Adds evidence schema invalid-case missing required identity field. |
| conformance/contracts/report-missing-producer.json | Adds evidence schema invalid-case missing required identity field. |
| conformance/contracts/report-missing-node.json | Adds evidence schema invalid-case missing required identity field. |
| conformance/contracts/report-missing-locale.json | Adds evidence schema invalid-case missing required identity field. |
| conformance/contracts/report-missing-frame.json | Adds evidence schema invalid-case missing required identity field. |
| conformance/contracts/report-missing-contract.json | Adds evidence schema invalid-case missing required identity field. |
| conformance/contracts/report-missing-configuration.json | Adds evidence schema invalid-case missing required identity field. |
| conformance/contracts/report-missing-check.json | Adds evidence schema invalid-case missing required identity field. |
| conformance/contracts/report-missing-capture.json | Adds evidence schema invalid-case missing required identity field. |
| conformance/contracts/report-missing-baseline.json | Adds evidence schema valid-case for missing-baseline outcome. |
| conformance/contracts/report-missing-backend.json | Adds evidence schema invalid-case missing required identity field. |
| conformance/contracts/report-missing-assets.json | Adds evidence schema invalid-case missing required identity field. |
| conformance/contracts/report-missing-artifact.json | Adds evidence schema invalid-case missing required identity field. |
| conformance/contracts/report-fail.json | Adds evidence schema valid-case for fail outcome. |
| conformance/contracts/report-extra-identity.json | Adds evidence schema invalid-case for extra identity member. |
| conformance/contracts/report-duplicate-obligation.json | Adds evidence schema invalid-case for duplicate obligations. |
| conformance/contracts/manifest-unknown-key.json | Adds manifest schema invalid-case for unknown manifest key. |
| conformance/contracts/manifest-profiles.json | Adds manifest schema valid-case for optional profiles claims. |
| conformance/contracts/manifest-profile-version.json | Adds manifest schema invalid-case for unknown profile version. |
| conformance/contracts/manifest-profile-unknown.json | Adds manifest schema invalid-case for unknown profile id. |
| conformance/contracts/manifest-profile-extra.json | Adds manifest schema invalid-case for extra claim member. |
| conformance/contracts/manifest-profile-empty.json | Adds manifest schema invalid-case for empty profiles array. |
| conformance/contracts/manifest-profile-duplicate.json | Adds manifest schema invalid-case for duplicate claims. |
| conformance/contracts/manifest-legacy.json | Adds manifest schema valid-case for legacy manifest without profiles. |
| .github/workflows/ci.yml | Runs validator and Python unit tests in CI. |
Review details
Suppressed comments (7)
conformance/profiles/hash-match.json:90
- In this R04 vector the identity embedded in
baselineIdentity.check.idis set toextent-equality, but the vector is exercising thergba8-sha256check. Because identity matching is part of the contract, the baseline identity should use the same check ID/version as the hash check.
conformance/profiles/hash-mismatch.json:90 baselineIdentity.check.idisextent-equalitybut this is anrgba8-sha256check vector. Keeping the check ID aligned with the exercised check avoids teaching consumers the wrong identity fields.
conformance/profiles/hash-missing.json:90baselineIdentity.check.idisextent-equalitybut this vector is forrgba8-sha256; identity should name the exercised check.
conformance/profiles/hash-empty.json:90baselineIdentity.check.idisextent-equalitybut this is anrgba8-sha256vector; keep the identity’s check ID consistent with the hash check.
conformance/profiles/hash-crop.json:90baselineIdentity.check.idisextent-equalitybut this vector isrgba8-sha256; update identity to match the exercised check.
conformance/profiles/hash-outside.json:90baselineIdentity.check.idisextent-equalitybut this is anrgba8-sha256vector; align identity’s check ID with the hash check.
conformance/profiles/hash-backend.json:90baselineIdentity.check.idisextent-equalitybut this vector is forrgba8-sha256; update identity to use the hash check ID.
- Files reviewed: 100/100 changed files
- Comments generated: 8
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
ambroise-leclerc
left a comment
There was a problem hiding this comment.
Review — candidate rendered-check profiles and evidence identities (#28)
Reviewed from the MduX side, as the consumer that will pin this corpus for MduX #314. Overall this is a solid, well-scoped delivery of what MEDUI-DEC-007 deferred: four separately-versioned rendered checks with fixed arithmetic, a derived evidence identity, an optional manifest claim, and a dependency-free validator with regression tests. The spec/profiles.md prose is precise and the legacy-migration guidance ("map explicitly, run old and candidate together, no silent relabelling") is exactly right.
Below are the points that need resolving before MduX can execute this as a pinned candidate corpus, ordered by how much they matter to a consumer.
1. R03 tint tolerance: n/2 vs a measured n, and the arithmetic model
R03 fixes the per-composite rounding envelope at "at most n/2 UNORM units (inclusive)" and models n composites as t + (b-t)*(1-a)^n.
MduX's colorHash() (src/verify/Verify.cpp, couldBeBlend()) uses n UNORM units per channel, not n/2, and this is not an oversight — it is tuned to a cross-toolchain hardware measurement recorded in MduX #261. The verify-golden-two-coverage-rounding unit test pins a real pixel (215,134,135) rendered identically under lavapipe on the GCC, Clang and MSVC legs, for a two-composite node (Theme.Colors.Fault over Theme.Colors.TopbarBackground, a 10-unit red span). At ±1 (= n/2 for n=2) the feasible-coverage intersection is empty and the pixel is rejected; ±2 admits it.
Two questions follow:
- Is
±n/2intended to be normative for real GPU captures, or only for the round-to-nearest model of synthetic composites? If the former, a conformant R03 checker rejects a frame MduX's committedendoscope-monitorscreen actually produces, and MduX cannot claimtint-composition/1without failing its own hardware regression. If MduX's measurement is right, the bound should ben. - MduX's
couldBeBlend()narrows a single feasible-coverage interval per channel and intersects (distance ± allowanceoverspan), i.e. it does not compound(1-a)^n— it treats a two-composite pixel as one effective coverage. R03's(1-a)^nand MduX's linear model agree on "≥1 sample exactly equals the tint" but can disagree on the envelope. Please confirm the intended model and add a narrow-span (~10 UNORM) two-composite vector — the currenttint-*fixtures all use wide spans (200/100), which is precisely the regime wheren/2vsndoes not bite.
This is the one item most likely to block a clean #314.
2. configuration digest is required but undefined
evidence.schema.json requires identity.configuration as ^[0-9a-f]{64}$, and E01 says "backend and rendering configuration digest ... synthetic and the digest of the synthetic configuration." But nothing defines what object is hashed or how to produce that digest. Every fixture uses the placeholder eeee….
E01's guarantee is "different configurations never satisfy each other's obligations" — but its dual, same configuration ⇒ same digest, is unachievable without a canonical configuration schema + encoding. Two real consumers will each invent their own configuration object and never pair. This is the same class of problem ADR-007 decision 5 (MduX) and MEDUI-DEC-004 already navigate for other digests. Please either (a) add schemas/configuration.schema.json with a canonical encoding, or (b) scope configuration to an opaque per-producer string that is only ever compared within one producer's reports, and say so explicitly.
3. assets is a single SHA-256; real screens have several
identity.assets is one ^[0-9a-f]{64}$. A MedUI screen typically binds a font package, one text package per locale, an image package, and (for MduX) a shader package — each already digested. Collapsing them to one value needs a defined combination (ordered concatenation? a Merkle root over sorted (role,id,digest)?). ADR-015 D3 says "ordered asset identities/digests" (plural). Recommend assets be an array of {id, digest} or a defined canonical roll-up; the spec should state which.
4. Fixture identity blocks do not reflect the check under test
Every captureIdentity/baselineIdentity in every fixture carries check: {id: "extent-equality", version: 1} regardless of the operation — e.g. hash-missing.json and hash-crop.json are R04 (rgba8-sha256) cases whose identity says extent-equality. The schema's enum permits it, so the validator does not catch it, but a corpus meant to be authoritative should have identities that match the check. Worth a cross-field check in validate.py (inputs.check == captureIdentity.check.id for rendered-check operations).
5. Empty-content policies vs consumers that refuse degenerate input upstream
- R02 — "Empty ink passes." MduX's ink-containment obligation is only ever raised for a text node with a non-empty run;
TextExpectation::create()refuses an empty run (EmptyRun) before a check exists. MduX can implement the standalone R02 predicate to returnpassonink: null, but its integrated path will never exercise that branch. - R04 — "Empty rectangles hash the empty byte string."
hash-empty.jsonexpectspassagainstSHA-256(""). MduX'srawImageDigest()refuses a non-positive ROI (DigestRoiDegenerate).
Neither is a defect in the contract, but please state whether a consumer reporting unsupported for these degenerate cases still counts as "complete applicable passing cases" for the profile claim, or whether the standalone predicate must implement them. A zero-area authored golden is not something either compiler emits, so this only matters for the pure-predicate corpus.
6. Canonical encoding of a committed evidence report
E01 says identity comparison is fieldwise and key-order-independent — good for comparison. But MduX commits its evidence report (generated/screen/<id>/verification.json) and byte-compares it across four toolchain legs (evidence.screen.<id>). If MduX adopts the shared envelope, it needs a canonical serialization or it must keep verification.json in MduX's own canonical form and emit the shared report as a derived, uncommitted artifact. Please clarify the contract's intent: is a MedUI evidence report meant to be byte-stable/committable, or strictly a comparison input?
7. backend has no canonical spelling
backend is a free minLength: 1 string ("synthetic", "lavapipe", …). "lavapipe" vs "llvmpipe" vs "Mesa lavapipe" would fail identity pairing between consumers that mean the same thing. Consider an enum or a documented canonicalization rule, at least for the backends the two known consumers use.
8. Smaller notes
evidence.schema.jsonhardcodesidentity.profile.idas{"const": "MEDUI-PROFILE-RENDERED"}andcheck.version/profile.versionas{"const": 1}. Every version bump or second rendered profile edits the schema by hand and moves its$id. Acceptable for a candidate, but a note that these trackprofiles/registry.jsonwould help.tools/schema_check.pymatchespatternwithre.search, notre.fullmatch. The current schemas all anchor with^…$so it is equivalent today; an unanchored pattern added later would validate too loosely. A one-line switch tofullmatch(or asserting anchors incheck_schema) closes it.errors()resolves$refwithtarget[part], which raisesKeyErroron a dangling ref rather than reporting it.check_schemacould verify every#/$defs/...target exists.- The
hash-emptybaseline ise3b0c442…b855(SHA-256 of the empty string) — correct, and a nice touch, but worth a comment in the fixture since it reads as a magic constant.
For MduX #314 specifically
MduX has a fifth rendered check with no shared equivalent: localizedTextPresence() compares a run's per-glyph baked coverage against the atlas (glyph-shape identity, not extent). R01–R04 have no glyph-shape rule. Please confirm the contract's intent that a consumer may run implementation-local checks alongside its claimed shared checks, provided the shared ones have complete passing corpus — spec/profiles.md's migration paragraph implies this but does not say it outright.
None of the above blocks the direction; items 1–3 are the ones that need a concrete answer before MduX can pin this as 0.3.0-rc and run its corpus. Happy to prototype the MduX-side mapping against a revised candidate SHA.
|
Addressed in 35f5a09.
Validation passes: 27 compiler cases, 64 profile cases, 37 schema cases, and all 19 regression tests. Consumer execution at the candidate SHA remains required. |
ambroise-leclerc
left a comment
There was a problem hiding this comment.
Follow-up — 35f5a09
Re-reviewed the correction commit against every point raised. All resolved, and cleanly.
1 — R03 tint tolerance. The model is now b + (t-b)*a with a single effective coverage and an inclusive ±n per-channel allowance, feasible-coverage intervals intersected with [0,1], and the zero-span channel handled as "differ from the constant by at most n". This is bit-for-bit the semantics of MduX's couldBeBlend(). tint-narrow-two / tint-narrow-one / tint-narrow-foreign pin the exact (215,134,135) over (209,214,219) toward (219,51,46) case from MduX #261 — one composite fails, two pass, a foreign green channel fails at two — and I re-derived all three by hand against the new rule: they match. The old wide-span fixtures were correctly re-computed for the new model. The amendment note and the link to MduX's test file at a3f8b6d make the provenance auditable.
2 — configuration. Now an opaque producer-scoped token; MedUI defines no cross-producer object or canonical hash, and cross-consumer conformance is explicitly at the operation-outcome level rather than row pairing. Workable — MduX binds its own token to all rendering settings.
3 — assets. Now an ordered {id,digest} array with [a-z0-9][a-z0-9./_-]* IDs, strictly ascending, no roll-up. report-asset-legacy-rollup (single string) is now valid:false; report-asset-list, -free, -invalid-id, assets-unsorted, assets-duplicate-id cover it. Maps directly onto MduX's BoundArtifact roles (font/…, text/…, image/…, shader/…).
4 — fixture identities. Fixed in the vectors and enforced: validate.py now rejects a captureIdentity/baselineIdentity check that differs from the rendered-check operation.
5 — degenerate-input policy. spec/profiles.md now states it outright: every vector applies to the claim including empty ink and zero-area regions, a standalone predicate must produce the expected outcome, and unsupported does not satisfy the claim. Unambiguous — MduX will implement standalone R02/R04 that handle the degenerate cases its integrated path refuses.
6 — canonical encoding. "The evidence envelope is a parsed comparison input ... MedUI prescribes no canonical report serialization. Consumers may retain their own canonical committed reports and emit this envelope as a derived artifact." Exactly what MduX needs — verification.json stays MduX-canonical and byte-compared, the MedUI envelope is derived.
7 — backend. Producer-scoped exact string, no aliasing, comparison at operation-outcome level. Fine.
8 — smaller notes. $ref resolution now fails gracefully with a message; main() wraps ValueError; the re.search/anchor behaviour is documented; the schema's profile/check consts are cross-checked against the registry and spec/profiles.md in validate.py.
Implementation-local checks ("including glyph-shape checks, may run alongside the shared checks; they neither replace shared cases nor change their outcomes") settles MduX's localizedTextPresence() — it stays local.
python3 tools/validate.py → OK (27 / 64 / 37); 19/19 tests pass on my checkout.
From the MduX side this is ready to pin as a v0.3.0-rc. #314 becomes executable on merge; see the note there for the remaining MduX-side work (manifest claim + parser, the E01 identity envelope, the standalone-predicate corpus harness).
The accepted rendered-check decision lacked profile identities, evidence schemas, and a shared corpus. This delivers the 0.3.0 candidate: separate extent-equality, ink-containment, tint-composition, and RGBA8 SHA-256 checks, plus complete evidence identity and independently supplied obligations. Missing baselines and omitted checks cannot produce a passing aggregate.
R03 specifies common effective coverage with one UNORM unit of allowance per composite, including the recorded narrow-span regression. Evidence uses explicit ordered asset identities and producer-scoped configuration/backend identifiers. Reports are parsed comparison inputs; no native artifact or canonical serialized report bytes are required.
Adds optional manifest claims, 64 public observation vectors, 37 schema cases, and dependency-free schema/coverage validation with CI regression tests. Existing compiler outcomes remain unchanged; local checks may coexist, and legacy obligations retain their identities during migration.
Validation:
python3 tools/validate.pypasses (27 compiler cases, 64 profile cases, 37 schema cases); all 19 tests pass withpython3 -m unittest discover -s tools -p 'test_*.py';git diff --checkpasses. An independent rational-arithmetic check confirms all 16 tint expectations. The seven previously documented diagnostic coverage gaps remain unchanged.This is a candidate contract, not consumer conformance evidence. Consumers must execute their claimed corpus at an exact candidate SHA before advertising support or establishing a final release. The independent interaction/binding/presentation/pixel delivery is stacked in #29.
Closes #15.