Skip to content

feat(dx): env-name parity check and branch-ledger sweeper (report-only)#596

Merged
BigSimmo merged 1 commit into
mainfrom
claude/repo-hygiene
Jul 13, 2026
Merged

feat(dx): env-name parity check and branch-ledger sweeper (report-only)#596
BigSimmo merged 1 commit into
mainfrom
claude/repo-hygiene

Conversation

@BigSimmo

Copy link
Copy Markdown
Owner

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 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-broke-CI class.
  • scripts/sweep-branch-ledger.mjs — builds the branch inventory docs/branch-cleanup-guide.md 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 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-parity run (70 known names, all expected secrets present), sweep:branch-ledger smoke, tsc --noEmit, eslint, prettier — all green.

🤖 Generated with Claude Code

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>
@supabase

supabase Bot commented Jul 13, 2026

Copy link
Copy Markdown

This pull request has been ignored for the connected project sjrfecxgysukkwxsowpy because there are no changes detected in supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@BigSimmo
BigSimmo enabled auto-merge (squash) July 13, 2026 14:41
@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 35e4aba4-646a-47fc-b3fc-7d56b878f24e

📥 Commits

Reviewing files that changed from the base of the PR and between 3325a12 and 1db8d15.

📒 Files selected for processing (4)
  • package.json
  • scripts/check-env-parity.mjs
  • scripts/sweep-branch-ledger.mjs
  • tests/repo-hygiene.test.ts

📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Added commands to check environment-variable parity across configured sources.
    • Added a report-only command to review remote branches and identify branches with no unique changes.
    • Reports can be displayed as formatted tables or JSON.
  • Tests

    • Added automated coverage for environment checks, parity reporting, and branch-ledger parsing.

Walkthrough

Adds 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.

Changes

Repository hygiene tooling

Layer / File(s) Summary
Environment parity checking
scripts/check-env-parity.mjs, tests/repo-hygiene.test.ts
Parses environment names, compares canonical and live sets, reports missing or unknown names, and exits nonzero for hard parity problems.
Branch ledger sweep
scripts/sweep-branch-ledger.mjs, tests/repo-hygiene.test.ts
Parses ledger branches, compares remote branches with origin/main, and reports deletion candidates without modifying repositories or files.
Maintenance command wiring
package.json
Registers npm scripts for both Node-based checks.

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
Loading
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
Loading
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/repo-hygiene
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch claude/repo-hygiene

Comment @coderabbitai help to get the list of available commands.

@BigSimmo
BigSimmo merged commit 1483c3d into main Jul 13, 2026
17 of 18 checks passed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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".

Comment on lines +34 to +35
"E2E_USER_EMAIL",
"E2E_USER_PASSWORD",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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 👍 / 👎.

@BigSimmo
BigSimmo deleted the claude/repo-hygiene branch July 13, 2026 16:37
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