Skip to content

Declare diagnostic position precision, and specify the consumer manifest - #9

Merged
ambroise-leclerc merged 2 commits into
mainfrom
agent/declare-position-precision
Aug 15, 2026
Merged

ambroise-leclerc merged 2 commits into
mainfrom
agent/declare-position-precision

Conversation

@ambroise-leclerc

Copy link
Copy Markdown
Contributor

Summary

The question

A case pins an exact line and column. spec/diagnostics.md defined 0 as "unknown" for an emitted diagnostic and said nothing about a case, so whether an implementation reporting 0 satisfies a case pinning 9 was undefined — and that decides whether a line-accurate implementation can claim a phase at all.

TrustSC hit it immediately. Its parser is line-oriented and trims each line, so no column survives; it agrees with every syntax case on acceptance, code and line, and had no defined standing. Under a strict reading it could not claim syntax despite being correct about everything the phase covers except a position it never claimed to produce.

The rule

Precision is declared, not assumed. A consumer names positions in its manifest and a claimed phase is checked at that precision:

positions Reports A case's pinned position is
full line and column matched exactly
line-only line only line matched exactly; column must be 0
none neither both must be 0

The declaration is checked in both directions. Reporting more position than declared fails, so an implementation cannot quietly gain precision without amending its manifest, and cannot quietly lose it either. A wrong non-zero position fails at every precision.

The alternative — exact match only — would have made claims rarer without making them more informative, and would have pushed a line-accurate implementation toward claiming nothing rather than claiming something true.

Consumer manifest

governance/versioning.md now gives the manifest's shape and states that a phase claimed at reduced precision still counts as claimed for the change-acceptance rule. Precision is a property of the implementation rather than of a phase, so it is declared once rather than per capability.

Alias policy

compat/mdx-e-aliases-v0.1.json said MduX "accepts these aliases for one release". MduX has no diagnostic input path and accepts nothing — it emits canonical identifiers and exposes the map as legacyId(). The policy now describes that.

Acceptance

CONTRIBUTING.md requires proof from every implementation claiming the affected capability before a change to accepted semantics lands. Both claim syntax:

This PR should stay open until both are green against the candidate commit.

Validation

  • python3 tools/validate.py — OK (5 cases, 22 diagnostics)
  • git diff --check — clean

A case pins an exact line and column, while spec/diagnostics.md defined
`0` only for an emitted diagnostic. Whether an implementation reporting an
unknown position satisfies a case pinning a known one was therefore
undefined, and it decides whether a line-accurate implementation can claim
a phase at all. TrustSC hit this immediately: its parser is line-oriented
and reports no column, so it agreed with every syntax case on acceptance,
code and line while having no defined standing.

Precision is now declared rather than assumed. A consumer names `positions`
in its manifest and a claimed phase is checked at that precision, so a
line-accurate implementation can claim a phase honestly instead of choosing
between an unsupportable claim and no claim at all. The declaration is
checked in both directions: reporting more position than declared fails, so
precision cannot be gained or lost silently, and a wrong non-zero position
fails at every precision.

The consumer manifest was referenced by the README but never specified.
governance/versioning.md now gives its shape and says a phase claimed at
reduced precision still counts as claimed for the change-acceptance rule.

The MDX-E alias policy said MduX "accepts these aliases for one release".
MduX has no diagnostic input path and accepts nothing; it emits canonical
identifiers and exposes the map as legacyId() for consumers still matching
the old ones. The policy now describes what ships.

Closes #7.
Copilot AI lite review requested due to automatic review settings August 15, 2026 15:27

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the MedUI contract documentation to (1) define how diagnostic positions pinned by conformance cases are matched when an implementation cannot report full position precision, and (2) formally specify the consumer manifest format that implementations use to declare capabilities and position precision. It also corrects the stated policy around legacy MDX-E### aliases to reflect how MduX actually exposes the mapping.

Changes:

  • Define manifest-declared diagnostic position precision (full / line-only / none) and how conformance cases are matched at that precision.
  • Specify the expected medui-conformance.toml shape, including how reduced-precision claims interact with the “all claimants must pass” acceptance rule.
  • Update the MDX-E### alias policy text to describe a historical mapping rather than “accepted aliases”.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
spec/diagnostics.md Adds conformance-case position matching rules based on consumer-declared precision.
governance/versioning.md Documents the consumer manifest and ties positions to the acceptance rule semantics.
decisions/MEDUI-DEC-005-diagnostics-and-conformance.md Records the “precision is declared” decision at a stable/normative level.
compat/mdx-e-aliases-v0.1.json Updates the policy blurb to reflect the legacy mapping purpose and non-acceptance as input.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread governance/versioning.md Resolved
Comment thread spec/diagnostics.md Resolved

@ambroise-leclerc ambroise-leclerc left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review completed. Two contract ambiguities should be resolved before merge; details are inline. Validation at f22f604 passed (python3 tools/validate.py: 5 cases, 22 diagnostics; git diff --check: clean), and both cited consumer PRs are currently green against this candidate.

Comment thread governance/versioning.md Resolved
Comment thread spec/diagnostics.md Resolved
Both reviewers read the position table's last column as constraining the
*fixture* rather than the reported diagnostic, which would lead a harness
to zero or ignore the pinned values. The column now says "Required
reported position", the cells name which side each constraint applies to,
and the opening paragraph states that a case always pins a full position
and is never rewritten, zeroed, or adjusted for a consumer.

The manifest was an example, not a specification: nothing said which keys
were required, what `repository` identified, whether `version` had to
agree with `commit`, or what an unknown key meant. Two harnesses could
therefore accept contradictory manifests while each claimed conformance.

- `repository` identifies the contract repository, never the consumer's.
- `commit` alone identifies the contract. `version` is informational and
  never consulted, so `0.1.0-candidate` against a `VERSION` of `0.1.0` is
  the ordinary case rather than a mismatch to reconcile.
- An unknown key is an error, so a misspelled `capabilties` fails instead
  of silently claiming nothing. An empty `capabilities` is an error for
  the same reason: a harness reading it asserts nothing while reporting
  success.

schemas/consumer-manifest.schema.json states the constraints in
machine-readable form, describing the parsed structure since the file on
disk is TOML. validate.py checks the schema against the prose - required
keys, unknown-key rejection, the capability set and the precision set - so
the two cannot drift; each check verified to fail when mutated.
ambroise-leclerc added a commit to Compliatory/MduX that referenced this pull request Aug 15, 2026
The contract now specifies the consumer manifest rather than only showing
an example, after review of Compliatory/MedUI#9 pointed out that two
harnesses could otherwise accept contradictory manifests while each
claimed conformance. An unknown key is an error there, so a misspelled
capabilties fails rather than silently claiming nothing; this reader
ignored extra keys, and now does not.

The same revision fixes the position table, whose last column read as a
constraint on the fixture rather than on the reported diagnostic. This
harness already implemented it the intended way - it compares what the
parser reported against what the case pins - so no behaviour changes here.
ambroise-leclerc added a commit to Compliatory/TrustSC that referenced this pull request Aug 15, 2026
Review of Compliatory/MedUI#9 specified the consumer manifest and fixed
the position table, whose last column read as a constraint on the fixture
rather than on the reported diagnostic. This harness already implemented
it the intended way and already rejects unknown manifest keys, which the
contract now requires, so only the pin moves.
@ambroise-leclerc
ambroise-leclerc merged commit 9eb3ace into main Aug 15, 2026
2 checks passed
@ambroise-leclerc
ambroise-leclerc deleted the agent/declare-position-precision branch August 15, 2026 17:24
AM-L pushed a commit to Compliatory/TrustSC that referenced this pull request Aug 15, 2026
* Adopt shared MedUI contract

* Drive shared conformance from the pinned cases

The shared conformance test copied its expectations into Rust instead of
reading the pinned checkout, and returned early whenever
MEDUI_CONFORMANCE_DIR was unset. Both defeat the point: MedUI could change
an expected code or position without TrustSC noticing, and dropping the env
var from CI would have left the suite green while asserting nothing --
exactly the silent skip of a claimed phase that MEDUI-DEC-005 forbids.

- Every expectation now comes from the pinned case.json. The harness walks
  conformance/**/case.json, checks each declared phase against its
  directory, and asserts code, line and column against that data.
- A missing checkout under CI is a hard failure; locally it prints an
  explicit skip notice.
- A claimed capability must name a phase the harness can observe and must
  be backed by a case that actually ran. Claiming semantics, layout or
  safety fails with a pointer to the missing compile_medui_source adapter
  rather than running those cases through the parser.
- medui-conformance.toml is now the single source of the pin; CI derives
  its checkout ref from it, so the workflow and the manifest cannot drift.

parse_screen is line-oriented and trims each line, so no column reaches
Diagnostic::column while every shared case pins one. The new positions key
records that deviation instead of dropping the assertion: "line-only"
requires each diagnostic to carry no column at all, so a positioned lexer
fails the suite until positions is set to "full" and the pinned columns are
genuinely checked. Whether an implementation reporting an unknown position
satisfies a case pinning a known one is undefined in the shared contract
and needs a MEDUI-DEC-005 clarification.

crates/ takes no third-party dependencies, so the manifest and the JSON
subset the cases use are read directly. Both readers are strict -- escapes,
floats, null, duplicate keys and unknown manifest keys all fail loudly --
so nothing can be misread into a vacuous pass.

* Assign diagnostic codes where errors are raised

classify() recovered a MEDUI-E### identity by substring-matching the
error's Display output, but spec/diagnostics.md says a message "may be
reworded" while a code's meaning is stable -- so a stable identity depended
on prose. Rewording any format! string silently reclassified its
diagnostic, and nothing tested the mapping.

Each of the 116 raise sites in trustsc-ui-dsl-authoring now names its own
code, carried on the error itself. ValidationError gains an optional
opaque code and the crate that raises the error assigns it; trustsc-core
still owns no registry.

Removing the message matching fixes what it got wrong:

- duplicate node id reported E010 rather than E014, inside the syntax
  phase medui-conformance.toml claims.
- E031 (unknown text key) and E070 were unreachable: no message contained
  the substrings their branches looked for. E031 now has its raise site;
  E070 stays unemitted because the requirement rule is enforced per
  component schema, not by @safety_critical, so the shared safety case
  would still not pass and safety remains unclaimed.
- Missing text keys, locale gaps and text budget overruns all collapsed
  into E010; they now report E031, E032 and E050.
- "exceeds available surface" missed the branch testing for "exceeds the
  available surface" and fell through to E010; surface and overflow
  conditions now report E052 and E051.
- unsupported charset, clock format, layout and system event, and unknown
  image packages and templates, reported E010 by accident. They report it
  deliberately through code::UNREGISTERED, which marks the 24 conditions
  the pinned registry has no code for so they stay greppable and can be
  raised upstream.

compile_medui_source_to_rust flattened every failure into one untagged
error; a single diagnostic now keeps its identity, which is how the
duplicate-node-id test caught it.

Three tests guard the result: a table pinning parse-time sources to codes,
a compile-time pair covering E014 and E030, and a scan asserting no
untagged raise site remains.

* Emit the shared finding envelope, and re-pin to the position rule

Re-pins to Compliatory/MedUI f22f604, which defines what a case's pinned
position means for an implementation that cannot report one. `positions`
is no longer a TrustSC-local workaround pending an answer: the contract
now specifies the key, so the harness implements a contract rule and
supports all three declared precisions. A phase claimed at reduced
precision is still claimed, which is what lets `syntax` stand here.

trustsc-medui-check gains `--format=json`, emitting the envelope from
schemas/diagnostic.schema.json: `file` is the path the run was given
rather than the empty string the schema forbids, and unknown positions are
`0` rather than `null`, which is what the schema requires and what
spec/diagnostics.md defines `0` to mean. A clean run emits the envelope
too, so a consumer parses one shape either way.

The MedUI Studio DTO is deliberately unchanged. Its `/api/screens` body is
an editor API whose frontend reads snake_case throughout (screen_name,
color_token, stream_source); it is not the shared envelope, and reshaping
it would break that frontend to satisfy a schema it was never claiming to
meet. The envelope belongs to the checking tool, which is where it now is.

The new test validates the emitted JSON against the schema in the *pinned*
checkout rather than a copy, so a required member added upstream fails
here instead of silently making the output non-conformant. Verified by
mutation: an undeclared member, a null position, and an empty file each
fail it, and a missing checkout fails it under CI.

serde_json is already reviewed SOUP; docs/governance/soup-register.toml
records the new integration path.

* Re-pin to c8cc45e

Review of Compliatory/MedUI#9 specified the consumer manifest and fixed
the position table, whose last column read as a constraint on the fixture
rather than on the reported diagnostic. This harness already implemented
it the intended way and already rejects unknown manifest keys, which the
contract now requires, so only the pin moves.

* Address MedUI contract review feedback

* Render MedUI diagnostic metadata
AM-L pushed a commit to Compliatory/MduX that referenced this pull request Aug 15, 2026
* Adopt shared MedUI contract

* Keep conformance checkout outside source tree

* Support ephemeral conformance checkout

* Read conformance path portably

* Avoid mixing headers with standard module

* Scope MSVC environment warning to test helper

* Drive shared conformance from the pinned cases

The shared syntax scenario copied its expectations into C++ and returned
early when MEDUI_CONFORMANCE_DIR was unset. The early return left the Then
lambda before checks.raise(), so the scenario reported success having
asserted nothing at all, and no workflow failed when the variable was
absent. MEDUI-DEC-005 says a consumer must not silently skip a claimed
phase, and that is the decision this branch's PR adopts.

- Every expectation now comes from the pinned case.json, read with
  mdux.evidence.json. The suite walks conformance/**/case.json, checks each
  declared phase against its directory, and asserts acceptance, code, line
  and column against that data.
- A missing checkout under CI is a hard failure; offline it says on stderr
  that nothing shared was checked.
- A claimed capability must name a phase this suite can observe and must be
  backed by a case that ran. Claiming semantics, layout or safety fails
  with a pointer to the missing resolver, solver and golden passes rather
  than being evaluated by a parser that cannot see them.
- medui-conformance.toml is the single source of the pin: all four
  workflows derive their checkout ref from it, so the manifest and the
  workflows cannot drift. The commit no longer appears as a literal outside
  the ADR citations, which are permanent references to a decision revision.

sanitizers.yml runs the whole ctest suite, medui_tools_spec included, so it
needs the pinned checkout for the same reason the toolchain legs do -
without it the new CI gate would fail there, correctly, on a job that had
never been given the contract.

The reader is strict where the JSON module is permissive: Value::elements()
yields an empty span for anything that is not an array, which would read a
malformed diagnostics member as "no expectations", so the kind is checked
rather than the span trusted.

Note for review: this was written on macOS/AppleClang, outside the GCC 16 /
MSVC / Clang 20 module toolchains, so it has not been compiled locally -
the preset is disabled on this host and the import-std UUID is pinned to
CMake 4.1.1. The workflow YAML parses; the C++ is checked against the
module interfaces by reading only.

* Re-pin to the position rule and declare full precision

Compliatory/MedUI f22f604 defines what a case's pinned position means for
an implementation that cannot report one, and specifies the consumer
manifest that until now was referenced but never described.

MduX's lexer carries exact 1-based UTF-8 byte columns, so it declares
positions = "full" and every pinned position is matched in full. The
harness reads the key rather than assuming it: a declaration this file
ignored would be a declaration nothing checks, and the rule is symmetric,
so reporting more position than declared fails too. line-only and none are
handled because the manifest may name them, not because MduX needs them.

The alias policy correction in the same upstream commit resolves the other
half: MduX emits canonical identifiers and exposes legacyId() for
consumers still matching MDX-E###, which is now what the compat manifest
says instead of claiming MduX accepts them as input.

* Reject unknown manifest keys, and re-pin to c8cc45e

The contract now specifies the consumer manifest rather than only showing
an example, after review of Compliatory/MedUI#9 pointed out that two
harnesses could otherwise accept contradictory manifests while each
claimed conformance. An unknown key is an error there, so a misspelled
capabilties fails rather than silently claiming nothing; this reader
ignored extra keys, and now does not.

The same revision fixes the position table, whose last column read as a
constraint on the fixture rather than on the reported diagnostic. This
harness already implemented it the intended way - it compares what the
parser reported against what the case pins - so no behaviour changes here.

* Address PR review feedback
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.

2 participants