Skip to content

perf: bound serve freshness to provider-declared compile inputs (#1005) - #1029

Merged
e54-bot merged 2 commits into
mainfrom
fix/1005-declared-inputs
Oct 29, 2026
Merged

e54-bot merged 2 commits into
mainfrom
fix/1005-declared-inputs

Conversation

@e54-bot

@e54-bot e54-bot commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator

What changed

Completes #1005 criterion 3 for provider-backed inputs, on the owner-chosen
LPP declaration route (provider side shipped in opy-rs#659 / LPP 1.7+).

  • wright-lpp: adds LPP_COMPILE_INPUTS_PROTOCOL_VERSION ("1.7") to the
    supported-version list, Capabilities.compileInputs,
    CompileResult.compileInputs, and protocol_version_at_least.
    Artifact-format negotiation now accepts LPP 1.4 or later so a 1.7
    session keeps mapped-text-v1.
  • wright-driver: entry-based provider sessions negotiate 1.7 first and
    fall back to the highest mutual version; the advertised compileInputs
    result rides ResolvedInput into Loaded.
  • loaded_fingerprint hashes the declared observation set —
    file contents, directory entry lists, missing paths, symlink targets —
    when the provider advertised the capability. Providers without it
    (including mapped artifacts whose files table omits compile-time
    .js inputs, opy-rs#654), check-only loads, and non-provider inputs
    keep the member-list and whole-tree fingerprints unchanged.
  • LppSourceProvider moves to source_provider/lpp.rs to keep both
    files under the source-size limit.
  • Docs: agent-contract.md freshness wording and
    cli/integration.md negotiation description updated.

How verified

  • cargo fmt --all -- --check — clean.
  • cargo clippy --workspace --all-targets -- -D warnings — clean.
  • cargo test --workspace — 80 test binaries, all passing, including:
    • staged provider tests: one compile per check; declared-input
      edits (main.opy, hook.js) each invalidate once while
      notes.md and added undeclared files do not; an undeclaring
      provider keeps whole-tree behavior;
    • wire-level fake-process tests: 1.7 negotiation and fallback to the
      highest mutual version; a compileInputs field sent without the
      advertised capability is ignored and the wide fingerprint stands;
    • digest_declared_inputs unit coverage for file, directory,
      missing-path, and symlink observations.
  • git diff --check and the repository size guard — clean.
  • Real-provider validation: built opy-provider (opy-rs 0.3.28 with
    compileInputs support) + wright against the locale-hook fixture —
    wright check/compile succeed end-to-end, and a wright serve
    walk produced snapshot generations [1, 1, 1, 2, 3]: unchanged
    request and notes.md edit reuse the snapshot; declared .js and
    .opy edits each reload once.

Unverified

  • Nothing known. The mock-provider tests that require
    LPP_MOCK_PROVIDER remain #[ignore]d as before.

Entry-based provider sessions now negotiate LPP 1.7 and carry the
provider's `compileInputs` declaration — every path its compile
observed — onto the resolved input. The freshness check hashes exactly
that observation set: file contents, directory entry lists, missing
paths, and symlink targets. A provider without the capability or a
check-only load keeps the member-list and whole-tree fingerprints, so
undeclaring providers behave exactly as before.

Artifact-format negotiation now accepts any session at LPP 1.4 or
later so 1.7 sessions keep mapped-text artifacts.

LppSourceProvider moves to source_provider/lpp.rs to keep both files
under the source-size limit.

Fixes #1005
…ts (#1005)

An advertised-but-empty `compileInputs` declaration degenerated the
snapshot fingerprint to a constant, so no later disk change could ever
invalidate it; treat an empty declaration as undeclared so the load
falls back to the whole-tree fingerprint. A declared path that is not a
regular file (FIFO, socket, device) could block `std::fs::read` forever
inside the freshness check; hash a kind marker for non-file kinds
instead of reading contents.
@e54-bot

e54-bot commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator Author

Both review findings are fixed in 280d679:

  • Finding 1 (empty compileInputs freezes staleness detection): loaded_fingerprint now treats an empty declared set as undeclared and falls back to the whole-tree fingerprint (src/service/state.rs). Regression test: an_empty_compile_input_declaration_keeps_staleness_detection.
  • Finding 2 (digest_declared_inputs reads non-file kinds): the content read is gated on meta.is_file(); symlinks, directories, and missing paths are unchanged, and every other kind hashes an "other" marker so a FIFO/socket/device can never block the freshness check (src/input.rs). Regression test: digest_declared_inputs_does_not_block_on_a_fifo.

Verified: the new tests plus the existing declared-input and LPP freshness tests pass; cargo fmt --all -- --check, cargo clippy --workspace --all-targets --all-features -- -D warnings, cargo test --workspace --all-targets --all-features, and git diff --check are all clean.

The PR is ready for follow-up review.

@e54-bot
e54-bot merged commit 5915a02 into main Oct 29, 2026
36 checks passed
@e54-bot
e54-bot deleted the fix/1005-declared-inputs branch October 29, 2026 05:26
@github-project-automation github-project-automation Bot moved this from Backlog to Done in Make Workshop Great Again Oct 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

2 participants