Skip to content

build: duplicate entry ids are not detected by the build itself; the second page silently overwrites the first #81

Closed

Description

@TMHSDigital

Why it matters
validate.mjs catches duplicate ids, so CI is safe, but npm run build alone does not. loadEntries keeps both entries and a Map keyed by id keeps the last body, so writeEntryPages writes dist/entry/<id>/index.html twice and the surviving page mixes one entry's metadata with the other's body. A contributor who previews with npm run build sees a plausible page and never learns there is a clash until CI fails, or worse, if someone deploys a local build.

Evidence

  • site/build.mjs:75-77 (loadEntries, bodies.set(id, …)), :472-474 (writeEntryPages); no uniqueness check in between.

Suggested approach
Track ids in a Set inside loadEntries and push duplicate id "<id>" (<file1>, <file2>) to errors, which already aborts the build. Add a unit test once the helper is exported (see the test-coverage issue).

Done when
node site/build.mjs fails with a named error on a duplicate id.

Activity

  1. TMHSDigital commented on Oct 22, 2026

    @TMHSDigital
    OwnerAuthor

    Resolved by #124, merged to main in 1e1cfb8.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpriority: mediumWorth doing soon

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions