feat(dx): env-name parity check and branch-ledger sweeper (report-only)#596
Conversation
Wave 3b — two repo-hygiene tools. - scripts/check-env-parity.mjs: reconciles env-var NAMES (never values) across the canonical env.ts Zod schema, check-ci-env.mjs, and — opt-in, names-only — GitHub secrets (--gh) and Railway vars (--railway). Reports expected secrets missing from a live source and live names unknown to env.ts. Directly targets the RAG_QUERY_HASH_SECRET-missing class. Offline by default. - scripts/sweep-branch-ledger.mjs: builds the branch inventory the cleanup guide mandates (ahead/behind + cherry-pick-aware unique-content check, since squash merges defeat ancestry --merged), flags deletion candidates, and notes which branches are already in the review ledger. REPORT ONLY — never deletes/edits. - tests/repo-hygiene.test.ts: 4 tests for the pure name/ledger parsers + parity diff. Verified: 4/4 vitest, offline env-parity run, sweep smoke, tsc, eslint, prettier — all green. No provider calls (live sources are opt-in flags). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
📝 WalkthroughSummary by CodeRabbit
WalkthroughAdds two Node-based repository hygiene CLIs: one checks environment-name parity across local and live sources, and the other reports remote branches with no unique content. Npm scripts and Vitest coverage are included. ChangesRepository hygiene tooling
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant checkEnvParity
participant LocalSources
participant LiveSource
checkEnvParity->>LocalSources: Read schema and CI environment names
checkEnvParity->>LiveSource: Query GitHub or Railway variable names
LiveSource-->>checkEnvParity: Return names or query failure
checkEnvParity-->>checkEnvParity: Report parity and exit status
sequenceDiagram
participant sweepBranchLedger
participant Ledger
participant Git
sweepBranchLedger->>Git: Optionally fetch origin
sweepBranchLedger->>Ledger: Read tracked branch names
sweepBranchLedger->>Git: Compare remote branches with origin/main
Git-->>sweepBranchLedger: Return branch metrics
sweepBranchLedger-->>sweepBranchLedger: Print report-only results
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
✨ Simplify code
Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1db8d1508c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| "E2E_USER_EMAIL", | ||
| "E2E_USER_PASSWORD", |
There was a problem hiding this comment.
Separate CI-only E2E secrets from Railway requirements
When --railway is used, these CI-only E2E credentials are passed through the same EXPECTED_SECRETS list as runtime secrets, so a correctly configured Railway environment will be reported as missing E2E_USER_EMAIL/E2E_USER_PASSWORD and the command exits 1. The repo's deployment matrix documents those two as “CI only” and “GitHub repo secrets” (docs/deployment-architecture.md:294-299), so this makes the new Railway parity check fail in the intended production-runtime context or encourages putting test-account credentials into Railway unnecessarily.
Useful? React with 👍 / 👎.
| ahead, | ||
| behind, | ||
| uniqueCommits, | ||
| inLedger: ledgerBranches.has(short), |
There was a problem hiding this comment.
Match ledger entries by HEAD and cleanup scope
This marks a branch as present in the review ledger based only on the branch name, but the cleanup guide requires matching branch/ref, reviewed HEAD, and branch-cleanup scope before a cleanup pass may skip review. If a branch has an older non-cleanup ledger row or has advanced since review, the inventory will still print ledger yes, which can cause operators to skip the required unique-content/diff check before acting on deletion candidates.
Useful? React with 👍 / 👎.
What
Wave 3b — two repo-hygiene tools (both offline by default, no provider calls).
scripts/check-env-parity.mjs— reconciles env-var NAMES (never values) across the canonicalenv.tsZod schema,check-ci-env.mjs, and — opt-in, names-only — GitHub secrets (--gh) and Railway vars (--railway). Reports expected secrets missing from a live source and live names unknown toenv.ts. Directly targets theRAG_QUERY_HASH_SECRET-missing-broke-CI class.scripts/sweep-branch-ledger.mjs— builds the branch inventorydocs/branch-cleanup-guide.mdmandates (ahead/behind + cherry-pick-aware unique-content check, since squash merges defeat ancestry--merged), flags deletion candidates, and notes which branches are already in the review ledger. REPORT ONLY — never deletes or edits anything.tests/repo-hygiene.test.ts— 4 tests for the pure name/ledger parsers + parity diff.Verification
4/4 vitest, offline
check:env-parityrun (70 known names, all expected secrets present),sweep:branch-ledgersmoke,tsc --noEmit, eslint, prettier — all green.🤖 Generated with Claude Code