Skip to content

Fix: generate.js failed to run — AST catalogue block inserted three times - #28

Merged
emmanuelgjr merged 1 commit into
mainfrom
fix/generate-duplicate-ast-block
Aug 28, 2026
Merged

Fix: generate.js failed to run — AST catalogue block inserted three times#28
emmanuelgjr merged 1 commit into
mainfrom
fix/generate-duplicate-ast-block

Conversation

@emmanuelgjr

Copy link
Copy Markdown
Contributor

scripts/generate.js throws on every invocation on main:

SyntaxError: Identifier 'AST_IDS' has already been declared

The T-A10-01 migration script was not idempotent and was run more than once, leaving three copies of the Agentic Skills catalogue block and three const AST_IDS declarations. Duplicate keys in an object literal are legal, so the catalogue itself was still correct — but a duplicate const is not, so the generator would not load at all.

CI did not catch it: the workflow runs validate.js and stats:check, neither of which loads generate.js.

Fix

Collapses the three blocks into one AST01AST10 catalogue and the three declarations into one.

Regenerating afterwards produces byte-identical output for all 51 entries and docs/data.js — confirming the duplicates were inert beyond the syntax error, and that nothing generated while the file was broken is wrong.

Also corrects the file header, which still described "41 entries" and a DSGAI21 upper bound.

Verification

  • node --check scripts/generate.js — clean
  • node scripts/generate.js — runs; 51 entries, docs/data.js, docs/incidents.js all written
  • git diff after regeneration — empty
  • validate.js — 0 errors, 283 passed
  • stats:check — green

🤖 Generated with Claude Code

…imes

The T-A10-01 migration script was not idempotent and was run more than
once, so scripts/generate.js carried three copies of the Agentic Skills
catalogue block and three `const AST_IDS` declarations. Duplicate keys in
an object literal are legal; a duplicate `const` is not, so the file threw

    SyntaxError: Identifier 'AST_IDS' has already been declared

on every invocation. CI did not catch it because the workflow runs
validate.js and stats:check, neither of which loads generate.js.

Collapses the three blocks into one AST01-AST10 catalogue and the three
declarations into one. Regenerating produces byte-identical output for all
51 entries and docs/data.js, which confirms the duplicates were inert
beyond the syntax error.

Also corrects the file header, which still described 41 entries and a
DSGAI21 upper bound.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@emmanuelgjr
emmanuelgjr merged commit c57c417 into main Aug 28, 2026
2 checks passed
@emmanuelgjr
emmanuelgjr deleted the fix/generate-duplicate-ast-block branch August 28, 2026 20:57
emmanuelgjr added a commit that referenced this pull request Aug 28, 2026
…#30)

* CI: run the generator and assert its output matches what is committed

generate.js sat broken on main for several commits (#28) and nothing
caught it, because no job ran it: the Content Validation workflow runs
validate.js and stats:check, neither of which loads the generator. A
file that produces every entry in data/entries/ and both webapp data
bundles had no coverage at all.

Adds a "Generator reproducibility" job that runs generate.js and then
asserts `git diff --exit-code` over data/entries, docs/data.js and
docs/incidents.js. That catches three things the previous jobs could
not: the generator failing to load, a hand-edit to a generated file,
and a source change that was never regenerated.

Also brings the path filters up to date — they still listed three source
directories, so nothing under ast-top10/ triggered validation, and a
change to generate.js itself triggered nothing.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* CI: let validate.yml trigger on changes to itself

Without this the workflow cannot verify its own edits — the new
Generator reproducibility job did not run on the PR that added it,
because .github/ was not in the path filters.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant