Skip to content

feat(library-selection): #214 wire resolve_cached into teensy + stm32 orchestrators#217

Merged
zackees merged 1 commit intomainfrom
feat/214-orchestrator-cache-wiring
May 10, 2026
Merged

feat(library-selection): #214 wire resolve_cached into teensy + stm32 orchestrators#217
zackees merged 1 commit intomainfrom
feat/214-orchestrator-cache-wiring

Conversation

@zackees
Copy link
Copy Markdown
Member

@zackees zackees commented May 10, 2026

Summary

  • Add resolve_framework_library_sources_cached(...) and library_select_kv_store() in crates/fbuild-build/src/framework_libs.rs. The cached entry routes through fbuild_library_select::cache::resolve_cached and falls back to the uncached resolver on any KvStore backend error so a degraded cache cannot poison a build.
  • Wire the teensy and stm32 orchestrators (crates/fbuild-build/src/{teensy,stm32}/orchestrator.rs) to construct CacheKeyInputs from the framework's PackageInfo (install path, version) and a stable toolchain triple, and call the cached helper when the process-shared KvStore is available.
  • The KvStore is opened lazily under fbuild_paths::get_cache_root().join(\"library-selection\") so it honors FBUILD_DEV_MODE and FBUILD_CACHE_DIR.
  • Refresh docs/architecture/library-selection.md: Phase 4 has shipped and is wired; cache-key section now points at cache.rs; Phase 8.b cleanup is essentially done.

This unblocks Phase 7 warm-cache benches (#215) — there is now a warm path to measure.

Closes #214
Refs #205

Test plan

  • uv run soldr cargo test -p fbuild-build --lib framework_libs — 5 tests pass (4 existing uncached + 1 new cached_resolution_round_trips_through_kvstore).
  • uv run soldr cargo test -p fbuild-library-select — 16/16 tests pass (9 resolver + 7 cache).
  • uv run soldr cargo clippy --workspace --all-targets -- -D warnings — clean (only pre-existing MSRV-mismatch warnings, no new diagnostics).
  • uv run soldr cargo build --workspace — clean.
  • RUSTDOCFLAGS=\"-D warnings\" uv run soldr cargo doc --no-deps -p fbuild-build — clean.

… orchestrators

Phase 4 of #205 (PR #212) shipped `resolve_cached(...)` with a
`zccache_artifact::KvStore` backend, but no production code called it —
every build re-ran the LDF walk from scratch. This wires the cache into
the two orchestrators that already use `framework_libs`.

framework_libs.rs gains:
- `resolve_framework_library_sources_cached(...)` — the cached counterpart
  to the existing uncached entry point. Falls back to the uncached path
  on KvStore backend errors (open/read/write) so a degraded cache can
  never poison a build, mirroring the corrupt-entry recovery already in
  `cache.rs`.
- `library_select_kv_store()` — process-shared `KvStore` opened lazily
  via `OnceLock`, rooted under `fbuild_paths::get_cache_root()` so it
  honors `FBUILD_DEV_MODE` and `FBUILD_CACHE_DIR`. Returns `None` on
  open failure and callers degrade gracefully.

teensy + stm32 orchestrators construct `CacheKeyInputs` from the
framework's `PackageInfo` (install path, version) plus a stable
toolchain triple (`teensy-arm-none-eabi`, `stm32-arm-none-eabi`) and
route through the cached helper when the KvStore is available.

Tests:
- New `cached_resolution_round_trips_through_kvstore` exercises miss →
  hit on the public cached entry through a tempdir-backed KvStore.
- All 4 existing framework_libs tests still pass (uncached path).
- All 16 fbuild-library-select tests still pass.

Docs:
- `docs/architecture/library-selection.md` status, cache-key, and
  future-work sections refreshed; Phase 4 is no longer "not yet shipped"
  and Phase 8.b dead-helper cleanup is essentially done.

Closes #214
Refs #205

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

coderabbitai Bot commented May 10, 2026

Warning

Rate limit exceeded

@zackees has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 39 minutes and 28 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 668f5f4f-d122-4f44-9c00-9316fa70ebcb

📥 Commits

Reviewing files that changed from the base of the PR and between eb4e6de and cf3f3cb.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (5)
  • crates/fbuild-build/Cargo.toml
  • crates/fbuild-build/src/framework_libs.rs
  • crates/fbuild-build/src/stm32/orchestrator.rs
  • crates/fbuild-build/src/teensy/orchestrator.rs
  • docs/architecture/library-selection.md
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/214-orchestrator-cache-wiring

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 and usage tips.

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.

#205 follow-up: wire library-selection cache into orchestrators (teensy, stm32)

1 participant