Skip to content

feat(seer): Add a pre-commit hook that regenerates the Seer nav snapshot - #131556

Merged
TooGood007 merged 4 commits into
masterfrom
nvelnambi/seer-nav-snapshot-check
Nov 19, 2026
Merged

TooGood007 merged 4 commits into
masterfrom
nvelnambi/seer-nav-snapshot-check

Conversation

@TooGood007

@TooGood007 TooGood007 commented Nov 17, 2026 •

Copy link
Copy Markdown
Member
  • Adds a seer-nav-snapshot pre-commit hook that keeps src/sentry/seer/nav_snapshot.generated.json in sync with the frontend nav it's generated from. Previously, a nav change could merge and leave Seer's links and nav summary stale.
  • The hook runs on every commit (always_run). Nav files import constants from anywhere in the frontend, so any file list could miss a change. It takes well under a second.
  • If the snapshot is stale, the hook regenerates it and fails with the git add command to run. If the generator itself crashes, the hook only warns, so commits are never blocked; the CI check in ci(seer): Check the Seer nav snapshot in CI #131728 catches that case.
  • Also regenerates the snapshot against current master, which had drifted (the gen-ai-conversations flag was removed and a Service Accounts settings page was added).

@github-actions github-actions Bot added Scope: Frontend Automatically applied to PRs that change frontend components Scope: Backend Automatically applied to PRs that change backend components labels Nov 17, 2026
@TooGood007
TooGood007 force-pushed the nvelnambi/seer-nav-snapshot-check branch from f997eb3 to 8009526 Compare November 18, 2026 23:35
@TooGood007 TooGood007 changed the title ci(seer): Check the Seer nav snapshot in pre-commit and CI feat(seer): Add a pre-commit hook that regenerates the Seer nav snapshot Nov 18, 2026
@github-actions github-actions Bot removed the Scope: Frontend Automatically applied to PRs that change frontend components label Nov 18, 2026

@sentry-junior sentry-junior Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. --hook only swallows failures from parse_checkout, so a parser break (including the _ALIAS_SOURCES hash check) warns instead of blocking unrelated commits, and a stale snapshot is rewritten and fails the commit as intended. The files regex covers everything parser.py/summary.py read directly (router/routes.tsx and feature */routes modules included), and imported constants are explicitly left to the CI check. The pre-commit lint job already ran this hook on this PR (it touches tools/seer_nav/) and passed against the regenerated snapshot. Since pre-commit.yml applies hook fixes on non-draft PRs, a stale snapshot will also get auto-committed there, which is a nice side effect.

Comment thread .pre-commit-config.yaml Outdated
Comment on lines +76 to +77
# The files tools/seer_nav reads. String constants the nav files import are not
# listed; the CI check catches those.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking: as written, the CI check in #131728 doesn't catch these either. It's gated on its own file list, which also leaves out imported constants. For example, static/app/views/explore/conversations/settings.ts defines EXPLORE_AGENTS_SUB_PATH, which the snapshot's /explore/agents/ entry comes from. I suggested on #131728 that the CI job always run, which would make this comment true.

It might be worth doing the same here, with always_run: true instead of files:, if the generator is quick enough to run on every commit. That would also remove the need to keep this list in sync with CI's, and the two have already drifted apart (CI watches all of views/settings/, this hook watches three files there).

@TooGood007
TooGood007 marked this pull request as ready for review November 19, 2026 21:37
@TooGood007
TooGood007 requested review from a team as code owners November 19, 2026 21:37
@TooGood007
TooGood007 merged commit e14d987 into master Nov 19, 2026
80 checks passed
@TooGood007
TooGood007 deleted the nvelnambi/seer-nav-snapshot-check branch November 19, 2026 21:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants