test(editor): make content-integrity catch backslash-punct load loss

The generative oracle shipped green over the escape-tokenizer bug: its atoms
held only backslash-before-letter (which survives), and both oracles are too
weak for a first-load loss — survives/includes never ran on the missing class,
and convergence passes because the drop happens once then stabilizes. Add
backslash-before-punctuation atoms to the generative pool and a direct
byte-exact source-fidelity assertion for the escape class (regex/glob/UNC/
line-leading star), which is strictly stronger than survives+converges.

Fails on the pre-fix escape-active parser, passes on the neutralized one.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Sergey Kozyrenko
2026-07-02 02:24:36 +07:00
co-authored by Claude Opus 4.8
parent f04c9da10f
commit 4ddb76f9ff
@@ -44,6 +44,9 @@ const ATOMS = [
'<br>',
'match \\d+ then \\w*',
'C:\\Users\\bob\\a.txt',
'regex \\.php files',
'glob \\* and \\?',
'escaped \\[ \\| \\+ here',
'&lt;script&gt;',
'AT&T',
'x &amp; y',
@@ -104,4 +107,17 @@ describe('generative content-integrity — atoms survive load↔serialize across
}
}
});
// Source-fidelity is strictly stronger than the survives/converges oracles above: a backslash-escaped
// punctuation char is dropped on the FIRST load and then converges, so convergence passes while the byte
// is already gone. Assert byte-exact round-trip for the escape class directly.
it.each([
'regex \\.php and \\d+',
'glob \\* \\? and range \\[a-z\\]',
'table \\| pipe and plus \\+',
'unc \\\\server\\\\share double \\\\',
'\\* line-leading star, not a bullet',
])('round-trips %s byte-identical', (source) => {
expect(roundTrip(source)).toBe(source);
});
});