Skip to content

tests: the escape-spelling cases really contain escapes - #45

Merged
sinkog merged 1 commit into
develfrom
tests/real-escape-spellings
Nov 8, 2026
Merged

sinkog merged 1 commit into
develfrom
tests/real-escape-spellings

Conversation

@sinkog

@sinkog sinkog commented Nov 8, 2026

Copy link
Copy Markdown
Member

What

Tests and one spec sentence only. Two cases in the merged tests, and a sentence in canonical-json.md, were meant to carry a u-escape and did not: the tool that wrote them had turned the escape into the character it stands for.

  • plan_noop_exactness_test.go, "escaped text": it compared the same text twice, so it could not fail.
  • m4a_gate_test.go, the "escapes" spelling in TestEquivalentSpellingsOfDesiredAndObservedGiveOnePlanDigest: identical to the plain spelling.
  • canonical-json.md: the sentence read ("a" is "a") instead of ("<u-escape of a>" is "a").

The canonicalizer was never wrong, and the language-neutral vectors (canonical_json_vectors.json, plan_digest_vectors.json, written by a different route) do contain real escapes, so the property itself was covered. These two Go cases and the sentence were not what they claimed to be.

The change

  • backslash is a hex-escaped constant ("\x5c") in m4a_helpers_test.go, so nothing between the file and the compiler can rewrite an escape built on it.
  • Both cases now build their escape from it; the escapes row in the m4a test asserts that its inputs really contain a u-escape (a setup guard: it fails instead of silently testing identical text).
  • The spec sentence is restored.

Evidence

  • Mutant that stops decoding u-escapes in the canonicalizer: the two repaired cases fail; the previous versions of the same two cases passed under the same mutant (shown on the unmodified tests from devel). That is the point of the PR.
  • Unmutated tree: the full suite passes; gofmt, vet, staticcheck clean; doc link check OK.

Not in this PR

No behaviour change in the module. No module.wasm change. No merge without explicit owner GO.

🤖 Generated with Claude Code

Two cases in the merged tests, and a sentence in canonical-json.md, were meant to carry a
u-escape and did not: the tool that wrote them had turned the escape into the character it
stands for, so the plan-noop 'escaped text' case compared the same text twice, the m4a
'escapes' spelling was identical to the plain one, and the spec said '"a" is "a"'. The
canonicalizer was never wrong and the language-neutral vectors (written another way) do
contain real escapes, but those two Go cases could not fail.

The backslash is now a hex-escaped constant, the escapes row asserts that it carries a
u-escape, and the spec sentence is restored. Shown with a mutant that stops decoding
u-escapes: the two repaired cases fail, and they passed under the same mutant before.

---
[signing-metadata]
key = cic-my-sign-key
signature = vault:v1:MEYCIQD15Hiy8IcjBJu4nTEPjqTsuYRv3mcSTUgz6AsdzvipIQIhAI0vYKOleMecnrrbV6/zuitxGCAsMGN1w83wAL9mml6C
hash-algorithm = sha256
digest = TVa6vWHN8U7jxEzkCqpS8hnHd2/6h//soXCwxZ7bHcM=

[certificate]
-----BEGIN CERTIFICATE-----
MIICBjCCAaygAwIBAgIUSnRMR6RPnEbg296XWPOqq/u5PCwwCgYIKoZIzj0EAwIw
QzELMAkGA1UEBhMCSFUxGTAXBgNVBAoMEENlbnRyYWxJbmZyYUNvcmUxGTAXBgNV
BAMMEENJQyBEZXZlbG9wZXIgQ0EwHhcNMjYwMzIwMTMyMjU5WhcNMjYxMjMxMTMy
MjU5WjBFMQswCQYDVQQGEwJIVTEZMBcGA1UECgwQQ2VudHJhbEluZnJhQ29yZTEb
MBkGA1UEAwwSR2Fib3IgWm9sdGFuIFNpbmtvMFkwEwYHKoZIzj0CAQYIKoZIzj0D
AQcDQgAEIG2CVmTfmLB9pLLclj7YmP2eedAjklpy4LGrU2ijoiy6Xqpuybv7OgJe
i+ez31s65NEV8+X/ByeX1cstR988z6N8MHowCQYDVR0TBAIwADAdBgNVHQ4EFgQU
yZN6AIX/TNnIJ9GwAa/NRN3ujHAwHwYDVR0jBBgwFoAUXn6CHYzPUqU4JVP8g+OS
WeDYjhcwDgYDVR0PAQH/BAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEF
BQcDBDAKBggqhkjOPQQDAgNIADBFAiEA+bFzXRoJ4PCQbhAAtpkcMjt0vNj5rEW0
lOMBGDNyaWkCIB1vmM7PcZzv/c9bIrxF5kqv6QXomouhByUfeNUTbpKW
-----END CERTIFICATE-----
@sinkog
sinkog marked this pull request as ready for review November 8, 2026 13:50
@sinkog
sinkog merged commit eda4aeb into devel Nov 8, 2026
1 check passed
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.

1 participant