Skip to content

fix(resolver): ship empty primer when generator script unavailable#425

Merged
jdx merged 1 commit intomainfrom
claude/goofy-williamson-27c1f2
Apr 30, 2026
Merged

fix(resolver): ship empty primer when generator script unavailable#425
jdx merged 1 commit intomainfrom
claude/goofy-williamson-27c1f2

Conversation

@jdx
Copy link
Copy Markdown
Contributor

@jdx jdx commented Apr 30, 2026

Summary

  • Fix run 25189018599: release-plz failed publishing aube-resolver@1.5.2 because cargo publish --verify runs the build script from target/package/aube-resolver-1.5.2/, where the workspace-level scripts/generate-primer.mjs is unreachable.
  • When the bundled primer data file is missing AND the generator script can't be located, fall back to an empty primer instead of panicking. Runtime already tolerates an empty PRIMER_INDEX and falls through to network packument fetches.

Repro

Locally cargo package -p aube-resolver (the verify pass) failed the same way before this fix and now succeeds.

Test plan

  • cargo build -p aube-resolver
  • cargo clippy -p aube-resolver --all-targets -- -D warnings
  • cargo test -p aube-resolver --lib primer
  • cargo package -p aube-resolver (verify step compiles cleanly)

After merge, re-run release-plz to finish the partially-published v1.5.2 (aube-util/manifest/settings/lockfile/store/linker/registry already shipped; resolver/scripts/workspace/aube still pending).

🤖 Generated with Claude Code


Note

Low Risk
Low risk build-script change that only affects the fallback path when primer data is missing; main risk is unintentionally shipping without bundled primer data, which should degrade performance but not correctness.

Overview
Makes aube-resolver’s build.rs resilient when packaging/publishing: if the primer data file is missing and the workspace scripts/generate-primer.mjs can’t be found, it now writes an empty primer blob/index and exits instead of attempting generation.

If AUBE_PRIMER_PATH is explicitly set to a non-file, it still panics; otherwise generation proceeds as before when the script is available.

Reviewed by Cursor Bugbot for commit f3dcca9. Bugbot is set up for automated code reviews on this repo. Configure here.

cargo publish --verify builds inside target/package/aube-resolver-N/,
where scripts/generate-primer.mjs at the workspace root is no longer
reachable. When neither the bundled data file nor the generator script
is available, fall back to an empty primer instead of panicking. Runtime
already tolerates an empty PRIMER_INDEX and falls through to network
packument fetches.

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

greptile-apps Bot commented Apr 30, 2026

Greptile Summary

This PR fixes a cargo publish --verify failure for aube-resolver by detecting when both the bundled primer data file and the workspace generator script are unavailable (e.g., inside target/package/) and writing an empty primer blob instead of panicking. The runtime uses option_env!("AUBE_PRIMER_GENERATED_AT") (returning Option<&str>) rather than env!(), so the missing env var from the early-return path is handled gracefully at compile time.

Confidence Score: 5/5

Safe to merge — change is minimal, well-scoped, and the fallback path is correctly wired to the runtime's existing tolerance for an empty primer.

Single-file change with a straightforward fallback. The potentially tricky omission of AUBE_PRIMER_GENERATED_AT is already handled by option_env! in primer.rs. Both output files (primer-packages.bin, primer_index.rs) are still written before the early return. No logic errors found.

No files require special attention.

Important Files Changed

Filename Overview
crates/aube-resolver/build.rs Adds a graceful fallback to an empty primer blob when the primer data file is missing and the workspace generator script is unreachable, fixing cargo publish --verify failures in the packaged crate.

Reviews (1): Last reviewed commit: "fix(resolver): ship empty primer when ge..." | Re-trigger Greptile

@github-actions
Copy link
Copy Markdown

Benchmark changes

Versions:

  • aube: 1.5.1 -> 1.5.2
  • pnpm: 11.0.1 -> 11.0.3

Public ratios: warm installs vs Bun 3x -> 5x; warm installs vs pnpm 9x -> 12x.

Benchmark aube bun pnpm
Fresh install (warm cache) 237ms -> 504ms (+113%) 728ms -> 2746ms (+277%) 2104ms -> 5940ms (+182%)
CI install (warm cache, GVS disabled) 564ms -> 3183ms (+464%) 742ms -> 2613ms (+252%) 2094ms -> 5654ms (+170%)
CI install (cold cache, GVS disabled) 2282ms -> 9156ms (+301%) 1895ms -> 10408ms (+449%) 5439ms -> 10045ms (+85%)

f3dcca9 vs aecb50f | aube/bun/pnpm | 3 scenarios | 3 runs | 500mbit/50ms | generated by Codex.

@jdx jdx merged commit c30a8d7 into main Apr 30, 2026
20 checks passed
@jdx jdx deleted the claude/goofy-williamson-27c1f2 branch April 30, 2026 22:08
jdx added a commit that referenced this pull request May 1, 2026
## Summary

The v1.6.0 release shipped to GitHub but only with darwin-arm64 and the
two windows tarballs — all four Linux targets failed to upload, and the
downstream npm/COPR/PPA publish jobs all failed too. Fixes the three
independent root causes:

- **`crates/aube-resolver/build.rs`** panics via `.expect()` when `node`
is absent. The cross-rs Docker container that builds Linux release
binaries and the Fedora COPR mock chroot that builds the SRPM both have
`scripts/generate-primer.mjs` visible (mounted / bundled in the source
tarball) but no `node` binary, so the existing "no script → empty
primer" fallback (#425) doesn't trigger. Fall back on
`ErrorKind::NotFound` from `Command::status()` so the same empty-primer
path covers all three "no node" environments. Verified locally with `env
-i` + a node-less PATH: emits `cargo:warning=node not found in PATH;
shipping empty primer` and builds clean.
- **`publish-npm`** fails with `Unsupported GitHub Actions runner
environment: "self-hosted". Only "github-hosted" runners are supported
when publishing with provenance.` Move the job from the namespace runner
to `ubuntu-latest`. Trusted Publishing requires a github-hosted OIDC
identity; the publish job is otherwise light enough that the namespace
runner saves nothing.
- **`ppa-publish`** fails at `dput` with `Connection failed, aborting.
Check your network` — namespace runners block outbound FTP (port 21) to
`ppa.launchpad.net`. Move to `ubuntu-latest` which allows it.

After merge, re-run the failed jobs against `v1.6.0` to backfill the
missing Linux assets and complete the npm/COPR/PPA publishes.

## Test plan

- [x] `cargo build -p aube-resolver` from a node-less PATH falls back to
the empty primer with the new `cargo:warning=`
- [x] `cargo build -p aube-resolver` with node present still generates
the primer and builds normally
- [x] `cargo clippy -p aube-resolver --all-targets -- -D warnings` clean
- [x] `cargo fmt --check` clean
- [ ] Re-run release-plz upload-assets for `v1.6.0` after merge →
confirm Linux tarballs land on the GH release
- [ ] Re-run `publish-npm` for `v1.6.0` → confirm `@endevco/aube*` lands
on npmjs.com with provenance
- [ ] Re-run `copr-publish` for `v1.6.0` → confirm Fedora
42/43/44/rawhide builds succeed
- [ ] Re-run `ppa-publish` for `v1.6.0` → confirm dput uploads the
source package

🤖 Generated with [Claude Code](https://claude.com/claude-code)

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Medium Risk**
> Moderate risk because it changes release/publishing CI runners and
alters `aube-resolver` build-time primer generation behavior (now
falling back to an empty primer when `node` is unavailable), which could
affect release packaging and runtime performance if mis-triggered.
> 
> **Overview**
> Unblocks release publishing by switching the `publish-npm` and
`ppa-publish` GitHub Actions jobs from the self-hosted namespace runner
to `ubuntu-latest` to satisfy npm Trusted Publishing provenance
requirements and allow outbound FTP for Launchpad `dput` uploads.
> 
> Makes `crates/aube-resolver/build.rs` resilient to environments where
the primer generator script exists but `node` is not installed:
`generate()` now returns a boolean and treats `ErrorKind::NotFound` as a
non-fatal condition (emitting a `cargo:warning=`) so builds fall back to
shipping an empty primer instead of panicking.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
fa90723. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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