Repository navigation
feat(seer): Add a pre-commit hook that regenerates the Seer nav snapshot - #131556
Conversation
f997eb3 to
8009526
Compare
There was a problem hiding this comment.
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.
| # The files tools/seer_nav reads. String constants the nav files import are not | ||
| # listed; the CI check catches those. |
There was a problem hiding this comment.
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).
seer-nav-snapshotpre-commit hook that keepssrc/sentry/seer/nav_snapshot.generated.jsonin sync with the frontend nav it's generated from. Previously, a nav change could merge and leave Seer's links and nav summary stale.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.git addcommand 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.gen-ai-conversationsflag was removed and a Service Accounts settings page was added).