fix(T12030): preserve semicolons inside note: atom payloads (#1126) - #1133
Open
kryptobaseddev wants to merge 2 commits into
Open
fix(T12030): preserve semicolons inside note: atom payloads (#1126)#1133kryptobaseddev wants to merge 2 commits into
kryptobaseddev wants to merge 2 commits into
Conversation
The evidence atom parser naively split on every ';', which truncated note: payloads that contain semicolons (e.g. multi-sentence waivers). Replace with a boundary-aware regex that splits only at semicolons preceding known atom-kind prefixes (commit:, files:, tool:, etc.). - Add shared typed EVIDENCE_ATOM_KINDS constant (contracts) — one list for the discriminated union, the boundary regex, and error messages. - Build KIND_BOUNDARY_REGEX from EVIDENCE_ATOM_KINDS + state modifier. - Derive unknown-kind error text from the same constant. - Add 9 focused regression tests: single note with semicolons, mixed note+hard-evidence, unknown-kind rejection, state:MERGED boundary, trailing semicolons, unknown-kind-like text absorption. - 117 contracts tests pass; zero failures from this change.
kryptobaseddev
force-pushed
the
task/T12030
branch
from
August 2, 2026 05:00
123c258 to
8b63fb3
Compare
…ayloads (#1126) The boundary-aware split preserved semicolons in every atom payload, causing regressions: commit:abc1234; produced sha=abc1234; instead of abc1234, and ;; between atoms leaked into structured payloads. Fix is kind-aware: - Strip leading ; from every chunk (leftover from ;; separator artifacts) - For non-note atoms, strip trailing ;+ from the payload (the old naive split consumed those as empty chunks) - Note payloads preserve every character including trailing ; as real punctuation Add 12 regression tests: trailing ; on commit/files/pr/tool/test-run/url/ decision, repeated ;; across non-note atoms, trailing ;; after multi-atom, mid-payload ; in url, and mixed note/non-note with separators. 129 contracts tests pass (81 evidence-atom-schema + 48 satisfies-atom).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The evidence atom parser (
parseEvidenceString) naively split on every;, which truncatednote:payloads containing semicolons. A note likenote:AC1 verified via satisfy; AC2 tool:lint; AC3 documentedwould be incorrectly broken into multiple chunks, causing malformed-atom errors.Closes #1126.
Fix (2 commits)
Commit 1: Boundary-aware split
EVIDENCE_ATOM_KINDS— a typedreadonlyconstant array covering every recognized atom kind (shared SSoT for the discriminated union, boundary regex, and error messages).KIND_BOUNDARY_REGEX— splits at;only when followed by a knownkind:prefix. Semicolons insidenote:payloads are preserved.statein the parser-prefix list sopr:357;state:MERGEDstill splits correctly.;inside a note stays as note content — only standalone atoms with truly unknown kinds are rejected.Commit 2: Compatibility — strip trailing separator semicolons
commit:abc1234;→ sha=abc1234;(regression),;;between atoms leaked into structured payloads.;from every chunk (leftover from;;separator artifacts), and strip trailing;from non-note atom payloads (the old naive split consumed those as empty chunks). Note payloads preserve every character including trailing;as real punctuation.Changes (2 files)
packages/contracts/src/evidence-atom-schema.tsEVIDENCE_ATOM_KINDS,PARSER_PREFIXES,KIND_BOUNDARY_REGEX; kind-aware split + trailing-strippackages/contracts/src/__tests__/evidence-atom-schema.test.ts;/;;across non-note atoms, mixed atoms, mid-payload;in urls)Test Results