Skip to content

fix: ignore Anchor's .anchor/ generated directory (closes #67)#68

Open
tomazzi14 wants to merge 1 commit into
mainfrom
fix/diff-filter-anchor-dir
Open

fix: ignore Anchor's .anchor/ generated directory (closes #67)#68
tomazzi14 wants to merge 1 commit into
mainfrom
fix/diff-filter-anchor-dir

Conversation

@tomazzi14
Copy link
Copy Markdown
Collaborator

Summary

Adds .anchor/ to GENERATED_DIR_PREFIXES in packages/diff-filter so Anchor framework artifacts (test-ledger state, program-test snapshots, IDL caches) don't leak into PR diffs scored by Sonnet.

Closes #67.

Why

target/ (Cargo) was already in the list, but .anchor/ is regenerated separately by anchor build / anchor test and lives next to it. Since this repo uses Anchor at contracts/solana/, every PR touching the escrow program was sending regenerated ledger artifacts to the AI scorer.

Changes

  • packages/diff-filter/src/patterns.ts — one-line addition (.anchor/) to GENERATED_DIR_PREFIXES with a doc comment explaining the relationship to Cargo's target/.
  • packages/diff-filter/tests/classify.test.ts — three new test cases:
    • .anchor/test-ledger/genesis.bin (top-level)
    • contracts/solana/.anchor/test-ledger/rocksdb/CURRENT (nested, mirrors the real repo path)
    • contracts/solana/.anchor/program-logs/escrow.log (nested log dir)

The existing nested-prefix matcher in classifyPath (normalized.includes("/" + prefix)) handles the realistic contracts/solana/.anchor/... path for free — no behavior changes there, the new entry just plugs into the existing logic.

Test plan

  • pnpm --filter @ghbounty/diff-filter test → 71/71 pass (3 new + 68 existing)
  • pnpm typecheck clean across the workspace
  • pnpm test no regressions
  • Manual repro: classifyPath("contracts/solana/.anchor/test-ledger/genesis.bin") returns { ignore: true, reason: "generated_dir" }

Out of scope

  • Other Solana-toolchain caches (e.g. .solana/, solana-test-validator-* ledgers created outside the workspace). Open separate issues if those show up in real PRs.
  • Anchor's target/idl/*.json (already covered by the existing target/ prefix).

🤖 Generated with Claude Code

`packages/diff-filter` already filtered Cargo's `target/` but missed
`.anchor/` — the directory the Anchor framework writes during
`anchor build` / `anchor test` (test-ledger state, program-test
snapshots, IDL caches).

This repo uses Anchor at `contracts/solana/`, so PRs touching the
escrow program were leaking regenerated ledger artifacts into the
diff Sonnet scored. The fix is a one-line addition to
`GENERATED_DIR_PREFIXES`; the existing nested-prefix check (`includes("/" + prefix)`)
covers the realistic path `contracts/solana/.anchor/...` for free.

Tests added in `classify.test.ts`:
  - `.anchor/test-ledger/genesis.bin`            (top-level)
  - `contracts/solana/.anchor/test-ledger/...`   (nested, the actual repo path)
  - `contracts/solana/.anchor/program-logs/...`

71/71 in @ghbounty/diff-filter pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented May 8, 2026

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

Project Deployment Actions Updated (UTC)
gh-bounty-frontend Ready Ready Preview, Comment May 8, 2026 2:19pm
ghbounty-mcp Ready Ready Preview, Comment May 8, 2026 2:19pm

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.

diff-filter: ignore Anchor's .anchor/ generated directory

1 participant