Skip to content

improvement(audits): ratchet unused exports, explicit any, and file names - #8550

Merged
waleedlatif1 merged 11 commits into
stagingfrom
improvement/agent-guardrails
Oct 2, 2026
Merged

waleedlatif1 merged 11 commits into
stagingfrom
improvement/agent-guardrails

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • Add three ratchet audits so agents can't add new debt while existing debt gets paid down. Each has a sorted baseline next to the script, fails on any new violation, and fails on stale entries (run --update) so the baseline only shrinks:
    • check:unused-exports — knip unused exports, types, and duplicate exports (7,022 baselined). Same knip pass also gates unreachable files/deps, so check:dead-code is dropped from check:audits to avoid running knip twice. Package entry exports stay public (includeEntryExports: false)
    • check:explicit-any — per-file counts of explicit any (3,686) and non-null ! (3,440) via one Biome pass (~2.5s)
    • check:file-names — kebab-case, no -utils/-helpers inside utils//helpers/, and no file that repeats its folder's name in lib/executor/providers/stores/hooks/serializer and packages/*/src (171 baselined). Failures print the expected short name
  • Ship skill: local test gate now runs root bun run test, which includes test:scripts (the suite that a workspace-scoped run skips)
  • CLAUDE.md naming and TypeScript bullets point at the checks that enforce them

Type of Change

  • Improvement (tooling / guardrails)

Testing

  • bun run check:audits (56/56), bun run test:scripts (341/341), bun run lint, bunx turbo run type-check
  • Each check proven able to fail with throwaway probes: new any, new unused export, orphan file, camelCase and stuttering file names, stale baseline entry

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing (new tests pass the test-audit authoring gate)
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

🤖 Generated with Claude Code

@waleedlatif1
waleedlatif1 requested a review from a team as a code owner October 2, 2026 00:15
@vercel

vercel Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
docs Ready Ready Preview Oct 2, 2026 2:32am UTC

Request Review

@greptile-apps

greptile-apps Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Medium risk] Adds code-quality audit scripts and ratcheting baselines.

The PR appears safe to merge based on the new changes reviewed.

Summary

This PR adds baseline-backed audits for unused exports, explicit any and non-null assertions, and file names. It also updates the ship test gate and makes small test and configuration cleanups. The changes since the previous review tighten Next.js route-name validation and move suppression checks ahead of baseline updates.

Reviews (6) · Last reviewed commit: "improvement(audits): fail on unparsable ..."

Comment thread scripts/check-explicit-any.ts
Comment thread scripts/check-explicit-any.ts Outdated
Comment thread scripts/check-explicit-any.ts

@cubic-dev-ai cubic-dev-ai 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.

All reported issues were addressed across 11 files

Tip: instead of fixing issues one by one fix them all with cubic

Re-trigger cubic

Comment thread scripts/check-explicit-any.ts Outdated
Comment thread scripts/check-unused-exports.ts Outdated
Comment thread scripts/check-file-names.ts Outdated
Comment thread scripts/check-explicit-any.ts Outdated
Comment thread scripts/check-explicit-any.ts
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

Comment thread scripts/check-explicit-any.ts Outdated
Comment thread scripts/check-explicit-any.ts Outdated

@cubic-dev-ai cubic-dev-ai 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.

All reported issues were addressed across 11 files

Tip: cubic can generate docs of your entire codebase and keep them up to date. Try it here.

Fix all with cubic | Re-trigger cubic

Comment thread scripts/check-file-names.ts
Comment thread scripts/check-explicit-any.ts Outdated
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai 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.

All reported issues were addressed across 11 files

Tip: cubic can generate docs of your entire codebase and keep them up to date. Try it here.

Fix all with cubic | Re-trigger cubic

Comment thread scripts/check-explicit-any.ts
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai 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.

No issues found across 11 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Tip: cubic can generate docs of your entire codebase and keep them up to date. Try it here.

Re-trigger cubic

check:unused-exports runs knip once with the dead-code issue types gated at
zero plus exports/types/duplicates compared against a shrink-only baseline
of path#symbol entries. Package entry exports stay public surface via an
explicit includeEntryExports: false. run-audits skips check:dead-code since
this pass covers it.
… file

check:explicit-any runs Biome's noExplicitAny and noNonNullAssertion rules
(off repo-wide) and fails when a file's count rises or drops without a
baseline update.
check:file-names flags non-kebab-case paths, utils/helpers files that repeat
their folder's role, and files that repeat their parent folder's name, with
the expected short name in the failure output.
…ts from the export ratchet

knip's dependencies include also reports optionalPeerDependencies, which the
strict list dropped. Gate every non-ratchet issue key so a new type fails
closed. Generated contract files are excluded via ignoreIssues so rerunning
their generators cannot trip the ratchet (359 baseline entries dropped).
Print a rename hint when a baselined symbol moves files.
…ssions, name-check root scripts

Anchor biome's build/out/uploads ignores to the real output and runtime
dirs so apps/sim/lib/uploads and the uploads API routes are linted and
counted by check:explicit-any (baseline grows only under those paths).
check:explicit-any fails on biome-ignore comments for its two rules.
check:file-names scans root scripts/ and vitest.shared.ts, allows Next.js
interception segments and dot-prefixed names, ignores the old path of an
unstaged mv, and points tool-mandated names at its allowlist. All three
ratchets print a rename hint instead of only the shrink instruction.
…ly covered uploads files, anchor suppression detection to comments
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1
waleedlatif1 force-pushed the improvement/agent-guardrails branch from 92b4510 to 9fec91e Compare October 2, 2026 02:16
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

Comment thread scripts/check-explicit-any.ts
Comment thread scripts/check-explicit-any.ts Outdated

@cubic-dev-ai cubic-dev-ai 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.

All reported issues were addressed across 17 files

You've manually re-run cubic several times on this PR. Each manual re-review checks the full PR again and counts toward your usage quota. To preserve your usage limits, we recommend letting cubic automatically review new commits.
Tip: cubic can generate docs of your entire codebase and keep them up to date. Try it here.

Fix all with cubic | Re-trigger cubic

Comment thread scripts/check-file-names.ts Outdated
Comment thread knip.jsonc
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai 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.

No issues found across 17 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

You've manually re-run cubic several times on this PR. Each manual re-review checks the full PR again and counts toward your usage quota. To preserve your usage limits, we recommend letting cubic automatically review new commits.
Tip: cubic can generate docs of your entire codebase and keep them up to date. Try it here.

Re-trigger cubic

@waleedlatif1
waleedlatif1 merged commit 2cef19f into staging Oct 2, 2026
58 of 59 checks passed
@waleedlatif1
waleedlatif1 deleted the improvement/agent-guardrails branch October 2, 2026 02:43

This branch was successfully deployed

1 active deployment
Preview — 095703c0 Deployed Oct 2, 2026 by vercel[bot]
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