Skip to content

fix(nix): stop the dev shell from copying the whole repository - #1917

Merged
ryoppippi merged 2 commits into
mainfrom
fix/nix-agent-skills-fileset
Oct 18, 2026
Merged

ryoppippi merged 2 commits into
mainfrom
fix/nix-agent-skills-fileset

Conversation

@ryoppippi

@ryoppippi ryoppippi commented Oct 18, 2026 •

Copy link
Copy Markdown
Member

Summary

nix/agent-skills.nix built the local skills source with nix-filter using the repository root (root = ./..). That makes Nix copy the whole checkout into the store on every dev shell evaluation (source path '<repo>/' is uncacheable in -vvvvv logs). So editing any file gave a new root store path, and the dev shell evaluation had to start from scratch.

This switches to lib.fileset.toSource { root = ./..; fileset = ../.agents/skills; }, so evaluation only reads .agents/skills.

Verification

  • nix eval .#devShells.aarch64-darwin.default.drvPath -vvvvv after editing an unrelated file no longer copies the repository root.
  • The dev shell drvPath is unchanged.
  • .#agent-skills-bundle builds to the same store path before and after the change (h5gr2073…-ccusage-agent-skills-bundle).

Summary by cubic

Fixes the Nix dev shell from copying the whole repository into the store on every evaluation, and drops the nix-filter input entirely.

nix/agent-skills.nix built the local skills source with nix-filter rooted at the repository, so editing any file produced a new root store path and dev shell evaluation restarted from scratch. It now uses lib.fileset.toSource constrained to .agents/skills; the agent-skills-bundle store path is unchanged.

  • The remaining nix-filter uses map onto nixpkgs lib: nix/rust-src.nix becomes a lib.fileset union and nix/checks.nix becomes lib.cleanSourceWith with the same directory excludes.
  • The resulting check and Rust sources contain the same file lists as before, and the nix-filter flake input is removed from flake.nix and flake.lock.

Written for commit 7383ff5. Summary will update on new commits.

View guided diff Turn on auto-fix

Summary by CodeRabbit

  • Chores
    • Updated how local skills and Rust project sources are selected for Nix builds; the included project files and local skill availability remain unchanged.
    • Refined repository source filtering to exclude generated or bundled directories such as node_modules, target, dist, and coverage.

Drop nix-filter

The remaining nix-filter uses are replaced with nixpkgs lib, and the input is removed from flake.nix / flake.lock:

  • nix/rust-src.nix: lib.fileset.unions over rust, flake.lock, ccusage.example.json, package.json.
  • repoSrc in nix/checks.nix: lib.cleanSourceWith with the same node_modules / target / dist / coverage directory excludes.

The src file lists for ccusage-clippy, config-schema, and oxlint are the same as on main. config-example, bun-nix, and agent-skills build, and nix flake check --no-build passes.

The agent-skills source was built with nix-filter rooted at the repository,
which forces the entire checkout into the store during every dev shell
evaluation. Any edited file therefore produced a new root store path and the
dev shell evaluation had to start from scratch.

Use lib.fileset.toSource so only .agents/skills is read. The resulting
agent-skills bundle store path is unchanged.
@coderabbitai

coderabbitai Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 5bee9fed-ba84-44d2-b584-803653f904c5
📥 Commits

Reviewing files that changed from the base of the PR and between afc6080 and 7383ff5.

⛔ Files ignored due to path filters: 1
  • flake.lock is excluded by !**/*.lock
📒 Files selected for processing: 5
  • .agents/skills/skill-creator/SKILL.md
  • flake.nix
  • nix/checks.nix
  • nix/rust-src.nix
  • nix/tests.nix
💤 Files with no reviewable changes: 1
  • flake.nix

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.

📝 Walkthrough

Nix source selection now uses lib.fileset and lib.cleanSourceWith in place of nix-filter. The flake input and related module arguments are updated, and the skill documentation reflects the new source selection.

Changes: Nix source filtering

Layer / File(s) Summary
Select local and Rust sources
nix/agent-skills.nix, nix/rust-src.nix, .agents/skills/skill-creator/SKILL.md
localSkills and rustSrc now use lib.fileset.toSource to select their existing paths. The skill documentation describes the local source selection.
Update check source filtering and module wiring
nix/checks.nix, nix/tests.nix, flake.nix
nix/checks.nix uses lib.cleanSourceWith to exclude directories named node_modules, target, dist, or coverage. The test module passes lib to rust-src.nix, and the nix-filter flake input is removed.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 7383f

No actionable merge-blocking issue was found. Normal Nix build and check validation remains appropriate before merging.

Pre-merge checks: Passed 5
Check name Status Explanation
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly identifies the main change: preventing the Nix dev shell from copying the entire repository. It matches the pull request objective and changed files.
Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0 files. (4 skipped: 4 unsupported.)

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
ccusage-guide 7383ff5 Commit Preview URL

Branch Preview URL
Oct 18 2026, 12:39 PM

@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 1 file

View guided diff | Turn on auto-fix | Re-trigger cubic

@pullfrog pullfrog 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 new issues found.

Reviewed changes cover the dev-shell store-copy fix in this run:

  • Scoped skills source to fileset — nix/agent-skills.nix now builds localSkills with lib.fileset.toSource over ../.agents/skills instead of nix-filter from the repository root, so unrelated edits no longer invalidate the dev-shell evaluation.
  • Preserved bundle layout — sources.local keeps subdir = ".agents/skills" against a root-anchored source, so discovery, allowlist, selection, and bundle outputs are unchanged.

Pullfrog  | View workflow run | Using muse-spark-1.3-contributor (free via Pullfrog for OSS) | 𝕏

@pkg-pr-new

pkg-pr-new Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

ccusage

npx https://pkg.pr.new/ccusage@1917

@ccusage/ccusage-darwin-arm64

npx https://pkg.pr.new/@ccusage/ccusage-darwin-arm64@1917

@ccusage/ccusage-darwin-x64

npx https://pkg.pr.new/@ccusage/ccusage-darwin-x64@1917

@ccusage/ccusage-linux-arm64

npx https://pkg.pr.new/@ccusage/ccusage-linux-arm64@1917

@ccusage/ccusage-linux-x64

npx https://pkg.pr.new/@ccusage/ccusage-linux-x64@1917

@ccusage/ccusage-win32-x64

npx https://pkg.pr.new/@ccusage/ccusage-win32-x64@1917

commit: 7383ff5

The remaining nix-filter uses map directly onto nixpkgs lib: the Rust
build subset becomes a lib.fileset union, and the repository-wide check
source becomes lib.cleanSourceWith with the same directory excludes. The
resulting sources contain the same file lists as before.
@github-actions

Copy link
Copy Markdown
Contributor

ccusage performance comparison

PR SHA: afc6080124a3
Base SHA: b9efb84ee7ca

Performance comparison skipped.

Base package URL was not ready before 300.000s. Fixture performance comparison requires a base package when --base-dir is not provided.

Base package: b9efb84ee7ca

@github-actions

Copy link
Copy Markdown
Contributor

ccusage performance comparison

PR SHA: afc6080124a3
Base SHA: b9efb84ee7ca

Performance comparison skipped.

Base package URL was not ready before 300.000s. Fixture performance comparison requires a base package when --base-dir is not provided.

Base package: b9efb84ee7ca

@pullfrog pullfrog 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.

Caution

This PR introduces a Nix evaluation break in the new cleanSourceWith filter that must be fixed before merging.

Reviewed changes since the prior pullfrog review (afc6080):

  • Dropped the nix-filter flake input — removed from flake.nix and flake.lock.
  • Rewrote the Rust source subset on lib.fileset — nix/rust-src.nix now uses lib.fileset.toSource with a lib.fileset.unions over rust, flake.lock, ccusage.example.json, and package.json, and both call sites thread lib instead of nixFilter.
  • Rewrote the repo-wide check source on lib.cleanSourceWith — repoSrc in nix/checks.nix keeps the same node_modules / target / dist / coverage directory excludes via a basename filter.
  • Updated the skill-creator doc wording — .agents/skills/skill-creator/SKILL.md now references the lib.fileset source instead of nix-filter.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using muse-spark-1.3-contributor (free via Pullfrog for OSS) | 𝕏

Comment thread nix/checks.nix Resolved
@github-actions

Copy link
Copy Markdown
Contributor

ccusage performance comparison

PR SHA: 7383ff58af7f
Base SHA: b9efb84ee7ca

Performance comparison skipped.

Base package URL was not ready before 300.000s. Fixture performance comparison requires a base package when --base-dir is not provided.

Base package: b9efb84ee7ca

@github-actions

Copy link
Copy Markdown
Contributor

ccusage performance comparison

PR SHA: 7383ff58af7f
Base SHA: b9efb84ee7ca

Performance comparison skipped.

Base package URL was not ready before 300.000s. Fixture performance comparison requires a base package when --base-dir is not provided.

Base package: b9efb84ee7ca

@ryoppippi
ryoppippi merged commit 46edb28 into main Oct 18, 2026
50 checks passed
@ryoppippi
ryoppippi deleted the fix/nix-agent-skills-fileset branch October 18, 2026 12:50
Buster210 added a commit to Buster210/ccusage that referenced this pull request Oct 20, 2026
Upstream tip: c76874e (2026-10-20, chore(pricing): update models.dev snapshot)
Previous fork base: 0c58b88 (the upstream commit this fork was synced to)

Synced 83 upstream commits on top of 0c58b88: 56 automated pricing
snapshot refreshes and the following meaningful ones:

  1cd29f5 chore(deps): update pnpm to v12.13.0 (ccusage#1907)
  e4f63ba chore(deps): update node.js to >=24.22.0 (ccusage#1908)
  130e502 ci: regenerate bun.nix automatically (ccusage#1909)
  259ec33 feat(adapter): report stored cost in JSON model breakdowns (ccusage#1903)
  c1eb448 chore: release v20.0.35 (ccusage#1901)
  2a0875f ci(pricing): update snapshots on push to main and daily instead of hourly (ccusage#1914)
  b090428 chore(deps): update github/codeql-action action to v4.39.0 (ccusage#1912)
  4dcf7f5 fix(nix): pin models-dev-gen remeda to models.dev's version and stop Renovate drift (ccusage#1915)
  46edb28 fix(nix): stop the dev shell from copying the whole repository (ccusage#1917)
  58ec8f1 fix(nix): let commits succeed in worktrees without a loaded dev shell (ccusage#1920)
  a570a6f fix(nix): vendor Cargo deps without import-from-derivation (ccusage#1918)
  f6d28c5 fix(antigravity): map model IDs 1418/1419 to gemini-4-argon (ccusage#1905)
  ce439e5 fix(antigravity): map model ID 1050 to gemini-3.1-flash-lite (ccusage#1902)
  e62a66f chore(deps): update pnpm to v12.14.0 (ccusage#1923)
  117ae68 ci(nix): make the macOS Nix cache save a trimmed store with the Crane layers (ccusage#1921)
  7a063a0 ci: shorten the Windows native build critical path (ccusage#1924)
  85ebca3 perf(rust): move pricing snapshots into a leaf crate (ccusage#1922)
  8fe3f47 perf(nix): build Crane layers with the binary's feature resolution (ccusage#1925)
  ac289aa perf(pricing): give the pricing refresh a verify-only TLS 1.3 rustls provider (ccusage#1927)
  d097f74 chore(deps): update rust crate rustls to 0.23.46 (ccusage#1928)
  f8aaf89 docs: use the compact pkg.pr.new URL for bunx previews [ci skip] (ccusage#1929)
  f56bb3d chore: release v20.0.36 (ccusage#1916)
  aaafb41 chore(deps): update dependency vitepress-plugin-group-icons to ^1.8.1 (ccusage#1931)
  0861e7f fix(claude): count requestless resp_ content blocks once (ccusage#1935)
  867c9f3 chore: release v20.0.37 (ccusage#1933)
  fa40bfd chore(deps): update songmu/tagpr action to v1.21.3 (ccusage#1937)
  de99d15 chore(deps): update rust crate zstd to 0.14.3 (ccusage#1936)

Fork wins kept: the SQLite on-disk cache with --live-only and the per-namespace
ledger, the pi adapter and its per-path namespaces, the OpenCode V2 loader, the
FxHash/Cow hot paths, the table renderer, clear-cache, and the tag-only release
workflow. Upstream's own release and tagpr machinery stays out.

Hand-resolved conflicts:

  rust/adapters/claude/src/lib.rs: upstream's resp_ message-id dedupe (ccusage#1935) lands
    beside the fork's requestless replay and collapse_replays rules.
  rust/adapters/claude/src/README.md: upstream's wording for the msg_/resp_ exception.
  rust/Cargo.toml: zstd 0.14.3, keeping the fork's exact `=` pin style.
  .github/workflows/release.yaml: the fork's tag-only release, without upstream's
    tagpr job or the songmu/tagpr action bump.
  apps/ccusage/package.json, docs/package.json, package.json: keep 20.0.34;
    upstream's 20.0.37 bump is dropped.
  packages/ccusage-*/package.json (6 files): stay deleted; the fork ships no npm
    wrapper packages and the release workflow does not read them.
  rust/adapters/claude/src/daily.rs: stays deleted; the fork's daily path lives in
    lib.rs and shares the dedupe helper the fix changes.

Fixes made while landing this sync, folded in so the merge stands green on its own:

  fix(ci): save the Nix store from the native build composites. The nested
    cache-nix-action read an empty primary-key at post-job and every native
    build failed; upstream's defer-save pattern is the fix.
  fix(rust): keep the agent-recorded cost for deleted sources. The recorded_cost
    ledger column carries it, so storedCost survives a deleted file. The ledger
    schema version stays at 2: the column is not a LedgerEntry field, so the blob
    layout is unchanged and the previously released binary keeps working.
  fix(rust): make the file fingerprint helper private, the one hawk finding. It is
    inherited from the pre-sync master, not introduced here.

Keep 20.0.34 numbering; DO NOT push a v20.0.34 tag from this fork (release.yaml
would publish fork bytes under upstream identity).
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