Skip to content

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

Description

@zackees

Context

Phase 4 of #205 (PR #212) shipped the resolve_cached(...) helper in crates/fbuild-library-select/src/cache.rs with a zccache_artifact::KvStore backend and 7 cache tests. The helper is correct in isolation but no production code calls itframework_libs::resolve_framework_library_sources (the orchestrator entry point) still calls the uncached resolve(...).

Result: every build re-runs the LDF walk from scratch even though the resolver output is a pure function and the cache infrastructure is in place. This is the prerequisite for Phase 7 warm-cache benches (bench/fastled-examples) — there is no warm path to measure today.

Scope

  1. Add a cached entry point in crates/fbuild-build/src/framework_libs.rs (e.g. resolve_framework_library_sources_cached) that takes the same (libraries, project_dir, src_dir) plus CacheKeyInputs and a KvStore.
  2. Open a process-shared KvStore rooted at ~/.fbuild/cache/library-selection/ (or the daemon equivalent under dev/prod paths via fbuild-paths).
  3. Update crates/fbuild-build/src/teensy/orchestrator.rs:163 and crates/fbuild-build/src/stm32/orchestrator.rs:114 to call the cached variant. Construct CacheKeyInputs from the orchestrator's Framework (install path, version) and the platform's compiler triple.
  4. Refresh docs/architecture/library-selection.md status block (Phase 4 has shipped; the gating note pointing at zccache#130 is stale).
  5. Add a test in framework_libs.rs that round-trips through the cached variant and asserts a second call hits.

Out of scope

  • ESP32 / AVR orchestrators — they don't call resolve_framework_library_sources today; tracked separately if needed.
  • Cache eviction / LRU — zccache_artifact::KvStore handles its own retention.
  • Phase 7 warm bench harness (separate follow-up).

Acceptance

  • All existing 16 library-select tests + 4 framework_libs tests still pass.
  • New cache-hit test passes.
  • cargo doc --no-deps -p fbuild-build clean.
  • Workspace clippy -D warnings clean.

Refs: #205 Phase 7 prep; closes Phase 4 production wiring.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions