Repository navigation
ci: regenerate bun.nix automatically - #1909
Conversation
Run the bun.nix generator as a treefmt formatter on nix/tools/*/bun.lock so autofix.ci commits regenerated derivations on dependency PRs, and drop the manually dispatched Renovate workflow it replaces.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
ccusage-guide | 10c39f3 | Commit Preview URL Branch Preview URL |
Oct 17 2026, 12:31 PM |
ccusage
@ccusage/ccusage-darwin-arm64
@ccusage/ccusage-darwin-x64
@ccusage/ccusage-linux-arm64
@ccusage/ccusage-linux-x64
@ccusage/ccusage-win32-x64
commit: |
ccusage performance comparisonPR SHA: 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: |
ccusage performance comparisonPR SHA: 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: |
treefmt-nix excludes *.lock by default, so a bun.lock formatter never runs. Call generate-bun-nix directly in the autofix.ci job instead.
ccusage performance comparisonPR SHA: 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: |
ccusage performance comparisonPR SHA: 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: |
There was a problem hiding this comment.
✅ No new issues found — standing instructions prevent formal approval, so this is a comment-only review with no requested changes.
Reviewed changes covered the full diff on PR #1909 (autofix-driven bun.nix regeneration).
- Autofix generates Bun derivations:
autofix.yamlrunsnix run .#generate-bun-nixbeforenix fmt, so Renovatebun.lockbumps get a matchingbun.nixwithout a hand run. - Manual Renovate workflow removed: the 222-line
renovate-bun-nix.yamldispatch/inspect/generate/publish chain is deleted with no remaining repo references. - Generator comment updated:
nix/treefmt.nixnow documents autofix.ci as the automatic caller instead of Renovate.
muse-spark-1.3-contributor (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
1 issue found across 3 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name=".github/workflows/autofix.yaml">
<violation number="1" location=".github/workflows/autofix.yaml:28">
P1: This executes the pull request’s flake as the Bun generator, so a PR can replace `generateBunNix` or make it modify arbitrary files that the following autofix step publishes. Run the generator from a trusted base revision, then validate and stage only `nix/tools/*/bun.nix` before pushing.
(Based on your team's feedback about validating generated Bun derivation paths and staging the allowed patch.) [7e0a998c-14aa-42d6-8b21-92e4ce083220]</violation>
</file>
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
| with: | ||
| disk-job: preflight | ||
| - name: Regenerate Bun derivations | ||
| run: nix run .#generate-bun-nix |
There was a problem hiding this comment.
P1: This executes the pull request’s flake as the Bun generator, so a PR can replace generateBunNix or make it modify arbitrary files that the following autofix step publishes. Run the generator from a trusted base revision, then validate and stage only nix/tools/*/bun.nix before pushing.
(Based on your team's feedback about validating generated Bun derivation paths and staging the allowed patch.) [7e0a998c-14aa-42d6-8b21-92e4ce083220]
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At .github/workflows/autofix.yaml, line 28:
<comment>This executes the pull request’s flake as the Bun generator, so a PR can replace `generateBunNix` or make it modify arbitrary files that the following autofix step publishes. Run the generator from a trusted base revision, then validate and stage only `nix/tools/*/bun.nix` before pushing.
(Based on your team's feedback about validating generated Bun derivation paths and staging the allowed patch.) [7e0a998c-14aa-42d6-8b21-92e4ce083220]</comment>
<file context>
@@ -24,6 +24,8 @@ jobs:
with:
disk-job: preflight
+ - name: Regenerate Bun derivations
+ run: nix run .#generate-bun-nix
- name: Apply formatting and lint fixes
run: |
</file context>
There was a problem hiding this comment.
@cubic-dev-ai Hardened in 10c39f3. After the generator runs, the step now discards every staged, modified, or untracked change outside nix/tools/*/bun.nix (git restore --staged --worktree plus git clean, both scoped with an exclude pathspec), so that step can only contribute bun.nix changes to the fix.
I kept the generator on the PR's flake rather than the base revision. The next step already runs nix fmt from the same PR flake, so pinning just this generator wouldn't change the trust boundary. Running the PR's own generator also lets PRs that change the generator get tested. autofix.ci runs with a read-only token, and PRs here are collaborator-gated.
There was a problem hiding this comment.
✅ No new issues found — the new commit scopes the generator's file writes to
bun.nixonly.
Reviewed changes reviewed the single new commit since the prior Pullfrog review.
- Constrained generator output to
bun.nix: theRegenerate Bun derivationsstep now restores tracked changes and cleans untracked files everywhere exceptnix/tools/*/bun.nix, so onlybun.nixupdates reachnix fmtand the autofix push.
muse-spark-1.3-contributor (free via Pullfrog for OSS) | 𝕏
ccusage performance comparisonPR SHA: 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: |
ccusage performance comparisonPR SHA: 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: |
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).

Renovate PRs that bump a
nix/tools/*/bun.lockleave the siblingbun.nixstale, so thebun-nixflake check fails until someone runsjust gen-bun-nixby hand (most recently on #1908).Approach
The existing autofix.ci workflow now runs
nix run .#generate-bun-nixbeforenix fmt. autofix.ci pushes through its GitHub App, so its commit retriggers CI and no PAT is needed. It runs on every PR, so manifest-only bumps andlockFileMaintenancePRs are covered too. bun2nix only parses the lockfile, so no network access or package installs are involved, and an up-to-date tree produces no diff.The manually dispatched
renovate-bun-nix.yamlworkflow is removed. It needed someone to start it, and because it pushed withGITHUB_TOKEN, its commit did not retrigger CI.Other options I ruled out:
postUpgradeTasks: the hosted app rejects them (see fix(renovate): gate Bun regeneration manually #1747).bun.lock: treefmt-nix excludes*.lockby default, so it never runs.Testing
775f1dcc, which has the stalebun.nix,nix run .#generate-bun-nixproduced anix/toolstree byte-identical to the hand-made fix751e20a5. A laternix fmt -- --no-cachechanged 0 files.main, the generator leaves the tree unchanged, so autofix pushes nothing to unrelated PRs.nix fmt -- --fail-on-change(actionlint, zizmor, nixfmt) passes on the changed files.Summary by cubic
Regenerates
bun.nixautomatically on dependency PRs so Renovate bumps tobun.lockno longer leave thebun-nixflake check failing until someone runsjust gen-bun-nixby hand.nix run .#generate-bun-nixbefore formatting, keeping only changes tonix/tools/*/bun.nixand discarding the rest. A treefmt formatter wouldn't work because treefmt-nix excludes*.lockfiles by default.renovate-bun-nix.yamlworkflow, which required someone to trigger it and pushed withGITHUB_TOKENso its commit didn't retrigger CI.Written for commit 10c39f3. Summary will update on new commits.
Summary by CodeRabbit