From 848bc4b2aba5af8875637ec5a2f1ea32ca34c0e6 Mon Sep 17 00:00:00 2001 From: ArchonVII Date: Thu, 9 Jul 2026 23:04:59 -0500 Subject: [PATCH 1/2] fix(anomaly-triage): parse documented metadata fields Refs #110 --- .../unreleased/110-parse-anomaly-metadata.md | 3 ++ .github/workflows/anomaly-triage.yml | 2 +- docs/repo-update-log.md | 9 +++++ scripts/workflow-structure.test.mjs | 33 +++++++++++++++++++ 4 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 .changelog/unreleased/110-parse-anomaly-metadata.md diff --git a/.changelog/unreleased/110-parse-anomaly-metadata.md b/.changelog/unreleased/110-parse-anomaly-metadata.md new file mode 100644 index 0000000..2726278 --- /dev/null +++ b/.changelog/unreleased/110-parse-anomaly-metadata.md @@ -0,0 +1,3 @@ +### Fixed + +- Accept the documented bold metadata form in anomaly triage entries while retaining compatibility with the legacy colon placement. Explicit severity, file, relatedness, and downstream-repo routing fields are no longer discarded. diff --git a/.github/workflows/anomaly-triage.yml b/.github/workflows/anomaly-triage.yml index bb2fd44..d23e965 100644 --- a/.github/workflows/anomaly-triage.yml +++ b/.github/workflows/anomaly-triage.yml @@ -113,7 +113,7 @@ jobs: const fields = {}; const bodyLines = []; for (const line of rest.split('\n')) { - const m = /^-\s+\*\*([^*]+)\*\*:\s*(.+)$/.exec(line); + const m = /^-\s+\*\*([^*:]+?)(?::\*\*|\*\*:)\s*(.+)$/.exec(line); if (m) { fields[m[1].trim().toLowerCase()] = m[2].trim(); } else { diff --git a/docs/repo-update-log.md b/docs/repo-update-log.md index fc30ada..88bdd8d 100644 --- a/docs/repo-update-log.md +++ b/docs/repo-update-log.md @@ -15,6 +15,15 @@ This log records agent-visible repository changes that should be easy to audit l - **Propagation:** none | pending | completed ``` +## 2026-07-09 - Anomaly-triage documented metadata parsing + +- **Issue/PR:** #110 / (pending) +- **Branch:** agent/codex/110-parse-anomaly-metadata +- **Changed paths:** .github/workflows/anomaly-triage.yml, scripts/workflow-structure.test.mjs, .changelog/unreleased/110-parse-anomaly-metadata.md, docs/repo-update-log.md +- **What changed:** The anomaly parser now accepts both the documented `**Field:** value` metadata form and the legacy `**Field**: value` form. The former previously lost severity, file, explicit relatedness, and downstream-repo fields, which a live #106 proof exposed when `Related to PR: yes` was routed as an unrelated issue. +- **Verification:** TDD RED: `npx vitest run scripts/workflow-structure.test.mjs` reported 1 failed / 22 passed for the documented colon placement. GREEN: the same command reported 23 passed. Full `npm test` reported 9 files / 181 tests passed. `C:\Users\josep\go\bin\actionlint.exe .github\workflows\anomaly-triage.yml` and `git diff --check` exited 0; the latter emitted only a working-tree LF-to-CRLF warning. +- **Propagation:** pending `v1` tag movement and `archon-setup` reusable-workflow snapshot refresh after merge; callers do not change. + ## 2026-07-09 - Anomaly-triage caller write permissions - **Issue/PR:** #106 / #107 diff --git a/scripts/workflow-structure.test.mjs b/scripts/workflow-structure.test.mjs index 2b1a8e3..fe552bd 100644 --- a/scripts/workflow-structure.test.mjs +++ b/scripts/workflow-structure.test.mjs @@ -245,6 +245,39 @@ describe('anomaly-triage caller permission contract', () => { }); }); +describe('anomaly-triage metadata parser contract', () => { + it('accepts the documented and legacy bold-field colon placement', () => { + const body = readWorkflow('anomaly-triage'); + const parserLine = body + .split(/\r?\n/) + .find((line) => line.includes('const m = /^-')); + const regexSource = parserLine?.match(/const m = \/(.+)\/\.exec\(line\);/)?.[1]; + + expect(regexSource).toBeTruthy(); + const metadataLine = new RegExp(regexSource); + + const documentedFields = Object.fromEntries( + [ + '- **Severity:** high', + '- **File:** src/example.mjs', + '- **Related to PR:** yes', + '- **Downstream repo:** ArchonVII/example', + ].map((line) => metadataLine.exec(line)?.slice(1)), + ); + + expect(documentedFields).toEqual({ + Severity: 'high', + File: 'src/example.mjs', + 'Related to PR': 'yes', + 'Downstream repo': 'ArchonVII/example', + }); + expect(metadataLine.exec('- **Related to PR**: yes')?.slice(1)).toEqual([ + 'Related to PR', + 'yes', + ]); + }); +}); + describe('pr-policy workflow contract source', () => { it('uses the shared PR contract validator instead of inline body regexes', () => { const body = readWorkflow('pr-policy'); From 5889285458c55004008f3cf16a3fddcb32ebb7e1 Mon Sep 17 00:00:00 2001 From: ArchonVII Date: Thu, 9 Jul 2026 23:05:57 -0500 Subject: [PATCH 2/2] docs(ops): record anomaly parser delivery Refs #110 --- docs/repo-update-log.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/repo-update-log.md b/docs/repo-update-log.md index 88bdd8d..940897c 100644 --- a/docs/repo-update-log.md +++ b/docs/repo-update-log.md @@ -17,7 +17,7 @@ This log records agent-visible repository changes that should be easy to audit l ## 2026-07-09 - Anomaly-triage documented metadata parsing -- **Issue/PR:** #110 / (pending) +- **Issue/PR:** #110 / #111 - **Branch:** agent/codex/110-parse-anomaly-metadata - **Changed paths:** .github/workflows/anomaly-triage.yml, scripts/workflow-structure.test.mjs, .changelog/unreleased/110-parse-anomaly-metadata.md, docs/repo-update-log.md - **What changed:** The anomaly parser now accepts both the documented `**Field:** value` metadata form and the legacy `**Field**: value` form. The former previously lost severity, file, explicit relatedness, and downstream-repo fields, which a live #106 proof exposed when `Related to PR: yes` was routed as an unrelated issue.