Skip to content

test: api round-trip expects mx's attribution stamp instead of stripping it#232

Merged
webern merged 1 commit into
mainfrom
claude/fix-226-encoding-shell
Jun 20, 2026
Merged

test: api round-trip expects mx's attribution stamp instead of stripping it#232
webern merged 1 commit into
mainfrom
claude/fix-226-encoding-shell

Conversation

@webern

@webern webern commented Jun 20, 2026

Copy link
Copy Markdown
Owner

Summary

Resolves #226. mx stamps its provenance <software> into <identification>/<encoding> on every api write (core::withStamp via serializeWithAttribution) — an intended feature, not a bug. The round-trip harness previously stripped the stamp from the output before comparing, which left behind an empty <encoding>/<identification> shell the source never had, so any file lacking an identification failed with a spurious add (the single biggest blocker on the corpus).

This makes the harness expect the stamp instead of stripping it: it adds the same stamp to the expected (original) document so both sides carry it. The comparison now asserts the stamp is present and in its schema-correct slot — a write that drops or misplaces it fails. addMxAttribution mirrors core::withStamp (create identification/encoding in schema position if absent, drop any prior mx stamp, append the current one last), so a source that already carries an mx stamp (e.g. k016a) is handled too.

Unblocks three corpus files whose only divergence was the stamp shell, now pinned in roundtrip-baseline.txt:

  • lysuite/ly33c_Spanners_Slurs.xml
  • lysuite/ly33g_Slur_ChordedNotes.xml
  • lysuite/ly52b_Breaks.xml

Testing

  • mxtest-api-roundtrip regression over the pinned baseline: 4 passed, 0 failed
  • Discovery confirms the 3 new files PASS; the previously-pinned k016a still passes (its pre-existing stamp is dropped and re-added correctly)
  • clang-format --Werror clean on the changed file

References

…ing it

mx stamps its provenance <software> into <identification>/<encoding> on every
api write (core::withStamp via serializeWithAttribution) -- an intended feature,
not a bug. The round-trip harness used to strip the stamp from the output before
comparing, which left behind an empty <encoding>/<identification> shell the
source never had, so a file with no identification failed with a spurious add.

Expect the stamp instead of stripping it: add the same stamp to the expected
(original) document so both sides carry it. The comparison now asserts the stamp
is present and in its schema-correct slot -- a write that drops or misplaces it
fails. This matches the decision that stamping is intended output.

Unblocks three files whose only divergence was the stamp shell; pin them in the
baseline.

Closes #226
@webern webern added testing non-breaking fixes or implementation that do not require breaking changes ai Issues opened by, or through, a coding agent. labels Jun 20, 2026 — with Claude
@github-actions

Copy link
Copy Markdown

gen-quality gen/

gen-quality: 84.5 / 100   (floor 84.5, +0.0)

  structure     86.5  x0.50   [fn 90.5 / file 82.6]
  cyclomatic    88.4  x0.25
  cognitive     76.6  x0.25

  409 functions across 31 files, 7702 lines (largest file 1044)
  max cc 56  max cognitive 44  max fn loc 152

Worst offenders (top 5 per axis; full lists in score.json):
  cyclomatic gen/xsd/analyze.py:311     report                             56
  cyclomatic gen/plates/build.py:956    _validate_config_against_ir        35
  cyclomatic gen/press/context.py:145   plate_context                      34
  cyclomatic gen/__main__.py:46         _ir                                23
  cyclomatic gen/tests/test_ir.py:102   _check_references                  20
  cognitive  gen/xsd/analyze.py:311     report                             44
  cognitive  gen/ir/resolve.py:119      flat_elements                      40
  cognitive  gen/tests/test_ir.py:102   _check_references                  38
  cognitive  gen/press/context.py:145   plate_context                      37
  cognitive  gen/xsd/analyze.py:207     _sccs                              37
  size       gen/xsd/analyze.py:311     report                             152
  size       gen/press/context.py:145   plate_context                      96
  size       gen/plates/build.py:533    _value_plate                       89
  size       gen/plates/build.py:956    _validate_config_against_ir        89
  size       gen/ir/resolve.py:119      flat_elements                      78

Commit 022067fd629a4dc2f22d4495b9b2bb5403f84fbd.

@github-actions

Copy link
Copy Markdown

Coverage report

Core-dev coverage src/private/mx/core/

Metric Coverage Covered / Total
Lines 77.9% 28539 / 36624
Functions 74.4% 6360 / 8550
Branches 50.7% 22672 / 44725

API coverage src/private/mx/{api,impl,utility}/

Metric Coverage Covered / Total
Lines 72.7% 5432 / 7468
Functions 60.3% 1831 / 3034
Branches 43.7% 4538 / 10375

Core HTML report | API HTML report

Commit 022067fd629a4dc2f22d4495b9b2bb5403f84fbd.

@webern webern merged commit 53cf32d into main Jun 20, 2026
7 checks passed
@webern webern deleted the claude/fix-226-encoding-shell branch June 20, 2026 20:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai Issues opened by, or through, a coding agent. non-breaking fixes or implementation that do not require breaking changes testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

api: round-trip injects a spurious &lt;identification&gt;/&lt;encoding&gt; not in the source

1 participant