Skip to content

fix(baseline): match the empty check of core check-corrections.mjs - #19

Merged
bketelsen merged 3 commits into
mainfrom
lucilla/corrections-canonical-bytes
Nov 14, 2026
Merged

bketelsen merged 3 commits into
mainfrom
lucilla/corrections-canonical-bytes

Conversation

@frostyard-machines

@frostyard-machines frostyard-machines commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The B2 baseline check (tests/test_baseline.py, check_b2) ports core's scripts/check-corrections.mjs (core ADR-0081). Its empty check for scope, correction and evidence used str.strip(). Core uses JavaScript trim, and the 2 white-space sets differ:

  • Python removes U+0085 and U+001C to U+001F; core keeps them, so a value of only U+0085 is not empty in core and was refused here.
  • Python keeps U+FEFF; core removes it, so a value of only U+FEFF is empty in core and passed here.

The check now strips the JavaScript set (JS_WHITESPACE). It also refuses NaN, Infinity and -Infinity as invalid JSON, as JSON.parse does. canonical_correction already followed the ADR-0081 byte rules; new cases now pin them (raw U+2028 and U+2029, lowercase lone surrogate, escaped pair, \u003c, \^_).

Risk tier

Risk tier: 3 — the label risk:high comes from tests/** (L2, "governance: the checks of the verification policy and of the workflows"). Matched path: tests/test_baseline.py. Why safe: only the B2 check (check_correction) and its cases change; the checks of the verification policy and of the workflows, scripts/, apps.json and the workflows do not change. The record file is not a risk path.

Verification

  • make verify green (189 tests).
  • Each new case agrees with core's check-corrections.mjs at 3d3d5c703fc24db3734408765171938a97840f4c (the same file in a temporary tree, node check-corrections.mjs --root <tree>): U+FEFF, U+2028, spaces → fail; U+0085, \^_, U+180E → pass; NaN → fail; the canonical cases as listed above.
  • Revert test: with the old .strip() and json.loads, the U+FEFF, U+0085, U+001F and NaN cases fail.
  • Risk path touched: named above.
  • Blocking review point fixed: guard added (the cases above) and 1 file added under .memory/corrections/.

Cross-review

The B2 port refused a blank scope, correction or evidence with
str.strip(), whose white-space set differs from JavaScript trim, which
core check-corrections.mjs uses: it removes U+0085 and U+001C to U+001F
and keeps U+FEFF. The port now strips the JavaScript set, and refuses
NaN and Infinity as invalid JSON, as JSON.parse does (core ADR-0081).
@github-actions github-actions Bot added level:L2 Read the diff risk:high Touches a high-risk path (ADR-0068) labels Nov 14, 2026
Core check-corrections.mjs fails a symbolic link at .memory before it
reads either form (linkedMemory). The B2 port checked links only at
.memory/corrections and its entries, so it followed a linked .memory.
Also add the cases for an escaped U+2029 and U+007F, a lone trail
surrogate, and Infinity and -Infinity.
@bketelsen
bketelsen merged commit 820cf49 into main Nov 14, 2026
4 checks passed
@frostyard-machines
frostyard-machines deleted the lucilla/corrections-canonical-bytes branch November 14, 2026 02:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

level:L2 Read the diff ready-for-human Reviewed, CI green: ready for Brian to review and merge risk:high Touches a high-risk path (ADR-0068)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants