Skip to content

test(baseline): cover carriage return and backslash in the canonical corrections form - #112

Merged
bketelsen merged 1 commit into
mainfrom
test/corrections-cr-backslash
Nov 14, 2026
Merged

bketelsen merged 1 commit into
mainfrom
test/corrections-cr-backslash

Conversation

@frostyard-machines

Copy link
Copy Markdown

Why

The B2 baseline test compares each record under .memory/corrections/ with the canonical form of core ADR-0081: JSON.stringify(record, null, 2) + "\n". #108 made the Go serializer (jsonStringify) write the same bytes as JSON.stringify, but the table in TestCorrectionsProblems had no explicit case for 2 escapes: a carriage return (\r) and a backslash (\\).

What

Test-only change in internal/baseline/repository_baseline_test.go. 5 new rows in TestCorrectionsProblems, beside the newline pair:

Evidence field Expected
e \r passes
e \u000d fails: not in canonical form
e \u000D fails: not in canonical form
e \\ passes
e \u005c fails: not in canonical form

No code, docs or behavior change. The serializer from #108 already writes these escapes; these rows guard them.

Evidence

  • go test ./internal/baseline/ -run TestCorrectionsProblems -v: the 5 new rows pass.
  • Revert test: in a scratch worktree of the PR head, the \\ and \r branches of jsonStringify were removed and the same test ran. 3 rows fail on assertions:
    • a_carriage_return_as_\r_passes: "not in canonical form", want none
    • a_carriage_return_as_\u000d_fails: no problem, want "not in canonical form"
    • a_backslash_as_\\_passes: "not in canonical form", want none
  • Local make ci before the push: verify, vuln, test-race, test-packages-docker and build-cross pass. test-integration could not run here: the host has rootless Podman in place of Docker, and apt's _apt user cannot read the bind-mounted test repository (Permission denied). This PR does not touch test/; CI runs the integration suite with Docker.

Fixes #110

…corrections form

The canonical form of a correction record is JSON.stringify(record, null, 2)
plus a newline (core ADR-0081). JSON.stringify writes a carriage return as \r
and a backslash as \\. The B2 table had no case for either escape.

Add 5 cases: \r and \\ pass; \u000d, \u000D and \u005c fail with
"not in canonical form".

Fixes #110
@github-actions github-actions Bot added the level:L3 Skim label Nov 14, 2026
@codecov

codecov Bot commented Nov 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@frostyard-machines

Copy link
Copy Markdown
Author

Cross-review: Ready, Blocking: none, no findings.

  • Reviewer: openai/gpt-6.1-sol; coder: anthropic/claude-opus-5-5
  • Base 0534bfd18a0f3edbf6124ea158d7a7c0a7464328, head b4c9c1cd1847cc029917e61d01f825ad9ac223cb
  • Scope: internal/baseline/repository_baseline_test.go (all changed rows and the helpers they use)
  • Revert test (scratch worktree of the head, \\ and \r branches of jsonStringify removed): 3 rows fail on assertions, as listed in the PR body.
  • CI at the head: make ci, codecov/patch and pr-triage pass (the integration suite included).

@frostyard-machines frostyard-machines added the ready-for-human Reviewed, CI green: ready for Brian to review and merge label Nov 14, 2026
@bketelsen
bketelsen added this pull request to the merge queue Nov 14, 2026
Merged via the queue into main with commit 6c8d560 Nov 14, 2026
4 checks passed
@bketelsen
bketelsen deleted the test/corrections-cr-backslash branch November 14, 2026 20:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

level:L3 Skim ready-for-human Reviewed, CI green: ready for Brian to review and merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test: canonical form cases for \r and backslash

2 participants