fix(anatomy): R5.4 field segments and code spans on the generator alphabet, wiki and liquid brackets refused in list items, linear guard

This commit is contained in:
bchanot committed 2026-10-23 13:58:14 +02:00
1 parent 1b12d90325
commit aeb5050502
10 files changed
+325 -48

No files matched your search

@@ -5,7 +5,8 @@
* (a special character in six positions, whitespace patterns, Markdown constructs) is placed
* in a change title, rationale and question, a cited reference and a changed label, and the
* sha256 of the raw and formatted CHANGELOG and REVIEW-REPORT are frozen (400 of the probes
* come from a seeded generator, so unknown classes surface on their own). `MAKE_R5_ORACLES=1` writes
* come from a seeded generator, so unknown classes surface on their own; eight pairs open a
* construct in one field and close it in the question). `MAKE_R5_ORACLES=1` writes
* crates/core/tests/oracles/r5/markdown-sweep.json.
*/
import { createHash } from 'node:crypto'
@@ -185,7 +186,19 @@ function probes(): string[] {
return [...CHARACTERS.flatMap(positions), ...PATTERNS, ...randomProbes(400)]
}
function changesFile(probe: string, referenceId: string) {
/** Openers in the title, the rationale and every other field, closers in the question. */
const SPLIT = [
['[[', ']]'],
['[[ a', 'b ]]'],
['[[a', 'b]]'],
['{%', '%}'],
['[x', '](y)'],
['*a', 'b*'],
['_a', 'b_'],
['<b', '>'],
]
function changesFile(probe: string, referenceId: string, closer = probe) {
return {
changes: [
{
@@ -195,7 +208,7 @@ function changesFile(probe: string, referenceId: string) {
title: { fr: `Titre ${probe}`, en: 'Title' },
rationale: `Raison ${probe} fin.`,
reference_ids: [],
question: `Question ${probe} ?`,
question: `Question ${closer} ?`,
ops: [
{
op: 'add',
@@ -232,8 +245,8 @@ function changesFile(probe: string, referenceId: string) {
}
}
async function run(probe: string, referenceId = 'probe_ref') {
const file = changesFile(probe, referenceId)
async function run(probe: string, referenceId = 'probe_ref', closer = probe) {
const file = changesFile(probe, referenceId, closer)
const changeset = ChangesetSchema.parse(file)
const baseline = miniSheet()
const result = applyChangeset(baseline, MINI_REFERENCES, changeset)
@@ -256,7 +269,7 @@ async function run(probe: string, referenceId = 'probe_ref') {
legacyAnomalies: [],
})
return {
probe,
probe: closer === probe ? probe : `${probe}|${closer}`,
reference_id: referenceId,
changes_file: file,
changelog_raw_sha256: sha256(changelogRaw),
@@ -273,6 +286,9 @@ describe('R5.4 Markdown sweep oracle', () => {
// A cited id ending with `_` puts a closing underscore in a generated code span.
for (const probe of ['to_do', 'a_b c', 'x'])
rows.push(await run(probe, 'probe_ref_'))
// A construct opened in one field and closed in another of the same line.
for (const [opener, closer] of SPLIT)
rows.push(await run(opener, 'probe_ref', closer))
const oracle = {
baseline: miniSheet(),
references: MINI_REFERENCES,