feat(#1726): G1-G6 portability AST rules; fix all offenders; delete the ratchet (Phase 4) (#1731)

Phase 4 of epic #1702. Closes #1726.
This commit is contained in:
Tom Boucher
2026-06-25 18:24:39 -04:00
committed by GitHub
parent 2990305f78
commit f08b177215
88 changed files with 2038 additions and 377 deletions

View File

@@ -269,7 +269,7 @@ function parseFrontmatterField(content, field) {
* against the Hunk Verification Table without raw substring matching.
*/
function parsePipeTable(content, expectedHeaderTokens) {
const lines = content.split('\n');
const lines = content.split(/\r?\n/);
for (let i = 0; i < lines.length - 1; i++) {
const headerLine = lines[i].trim();
const sepLine = (lines[i + 1] || '').trim();
@@ -332,7 +332,7 @@ describe('reapply-patches workflow contract (#1469)', () => {
].map((m) => m[1]);
assert.ok(blocks.length > 0, 'update.md must define at least one <execution_context> block');
const includes = blocks
.flatMap((blk) => blk.split('\n'))
.flatMap((blk) => blk.split(/\r?\n/))
.map((l) => l.trim())
.filter((l) => l.startsWith('@'))
.map((l) => l.replace(/^@/, ''));
@@ -381,7 +381,7 @@ describe('reapply-patches gated hunk verification (#1999)', () => {
// assert it both names the table and defines an explicit gate
// condition tied to the `verified` column.
const content = fs.readFileSync(workflowPath, 'utf8');
const step5Match = content.match(/^##\s+Step 5[^\n]*\n([\s\S]*?)(?=^##\s|Z)/m);
const step5Match = content.match(/^##\s+Step 5[^\r\n]*\r?\n([\s\S]*?)(?=^##\s|Z)/m);
assert.ok(step5Match, 'reapply-patches workflow must contain a "## Step 5" section');
const step5 = step5Match[1];
assert.ok(
@@ -405,7 +405,7 @@ describe('reapply-patches gated hunk verification (#1999)', () => {
test('Step 5 also halts when the Hunk Verification Table is absent (Step 4 produced nothing)', () => {
// Independent gate: missing-table is a separate halt path from any-no-row.
const content = fs.readFileSync(workflowPath, 'utf8');
const step5Match = content.match(/^##\s+Step 5[^\n]*\n([\s\S]*?)(?=^##\s|Z)/m);
const step5Match = content.match(/^##\s+Step 5[^\r\n]*\r?\n([\s\S]*?)(?=^##\s|Z)/m);
assert.ok(step5Match, 'Step 5 section must exist');
const step5 = step5Match[1];
const handlesAbsent = /(table is absent|table is missing|missing.*table|absent.*table)/i.test(step5);