Skip to content

chore: regenerate third-party notices in the pre-commit hook, untrack static/index.html - #57

Merged
dylanh724 merged 2 commits into
mainfrom
chore/attribution-precommit-guard
Dec 3, 2026
Merged

dylanh724 merged 2 commits into
mainfrom
chore/attribution-precommit-guard

Conversation

@dylanh724

@dylanh724 dylanh724 commented Dec 3, 2026 •

Copy link
Copy Markdown
Member

Summary

The "Attribution is current" CI job has failed on five PRs since v1.0.1 (three pushes in a row on one of them), every time for the same reason: a dependency change was committed without bun run licenses:generate. Nothing caught it locally.

  • New scripts/ensure-attribution.mjs, run from the husky pre-commit hook. When a commit stages a file the notices are generated from (Cargo.lock, bun.lock, src-tauri/about.toml, src-tauri/about.hbs, vite.config.js, the generator itself), it regenerates ATTRIBUTION.md and THIRD-PARTY-NOTICES.txt and stages them into that commit. Any other commit exits immediately.
  • Refuses the commit when cargo-about is missing or is not the version ci.yml pins, since a different version produces output CI rejects anyway. The pinned version is read from ci.yml, so there is one place to bump it. SKIP_ATTRIBUTION=1 is the escape hatch.
  • Does not touch the website checkout. The guard passes a new --skip-www flag to the generator; bun run licenses:generate (the release flow) still updates the sibling echophrase-www data file, so the site keeps listing what the last release ships.
  • static/index.html is no longer tracked. It is vite build output that names hashed files under the gitignored static/_app/, so the committed copy was stale after every build and a broken page on a fresh clone. It is now in .gitignore.
  • Docs: CLAUDE.md, CONTRIBUTING.md, and a ### Developers CHANGELOG entry.

Limits: the guard only runs for people with git hooks installed (bun install sets them up), and CI remains the backstop. It reads the working-tree lockfile, not the staged copy.

Test plan

  • Commit with no generator input staged: exits in 0.09s
  • Cargo.lock staged with cookie downgraded: notices regenerated and staged in 29s, static/index.html left clean
  • Pinned cargo-about version changed to one not installed: commit refused with the install command
  • --force regeneration returns the tree to match main
  • The guard ran for real on this PR's second commit (generator staged): notices already current, website checkout untouched
  • cargo check -p echophrase --no-default-features passes on Windows with static/ in fresh-clone state and no index.html
  • Not tested: a machine with no cargo-about at all; the guard on macOS / Linux; a Rust build without index.html on macOS / Linux (the Rust CI jobs do not run for this diff)

The 'Attribution is current' CI job failed on five PRs because a lockfile change was committed without bun run licenses:generate. scripts/ensure-attribution.mjs now runs from the husky pre-commit hook: when a commit stages a generator input it regenerates the notices and stages them, and it refuses the commit when cargo-about is missing or not the version ci.yml pins. Other commits exit immediately.
… the website repo

static/index.html is vite build output that names hashed files under the gitignored static/_app/, so the committed copy was stale after every build and broken on a fresh clone; the app compiles without it. The pre-commit attribution guard now passes --skip-www so a dependency commit does not rewrite the sibling website checkout.
@dylanh724 dylanh724 changed the title chore: regenerate third-party notices in the pre-commit hook chore: regenerate third-party notices in the pre-commit hook, untrack static/index.html Dec 3, 2026
@dylanh724
dylanh724 merged commit 5522b29 into main Dec 3, 2026
5 checks passed
@dylanh724
dylanh724 deleted the chore/attribution-precommit-guard branch December 3, 2026 07:40
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