Skip to content

build: tune the release profile, drop the no-op feature flag, and share test helpers - #8

Open
ctxswitch wants to merge 1 commit into
cleanup/phase-5-configfrom
cleanup/phase-6-build-docs-tests
Open

build: tune the release profile, drop the no-op feature flag, and share test helpers#8
ctxswitch wants to merge 1 commit into
cleanup/phase-5-configfrom
cleanup/phase-6-build-docs-tests

Conversation

@ctxswitch

Copy link
Copy Markdown
Owner

Summary

Final phase of six. Based on cleanup/phase-5-config (#7).

Build. Added [profile.release] with lto = "thin" and codegen-units = 1 — a
performance-sensitive server was shipping untuned. Dropped CARGO_FEATURES ?= --all-features and its six expansions from the Makefile; the crate has no
[features] table, so it was a no-op on every target, and the build help text that
promised "every feature enabled" went with it.

Docs. AGENTS.md claimed Cargo auto-discovers the integration tests. It does not —
they live in a subdirectory, so each is an explicit [[test]] target in Cargo.toml,
and a new file needs a new entry. Corrected, with a note on how the new shared-helper
module is included without becoming a target itself.

Test scaffolding. The oneshot call/request wrapper duplicated across
channels.rs, build_cache.rs, local_artifacts.rs, and maintenance.rs moves to
tests/integration/common/mod.rs. The bind-and-serve block repeated eight times in
cacheprog_test.rs becomes one serve(app) helper. The SpacePolicy literal repeated
four times in space_test.rs becomes ledger_from(source). ring_test.rs loses a
dangling comment and gains an honest test name.

Also folds in one cross-phase fix, described under Review notes.

Verification

make ci clean, including clippy --all-targets -- -D warnings.

docker build . succeeds — this was the end-of-sweep check that the release
profile and the dependency removal from an earlier PR in this stack do not break the
release build.

Assertion accounting across the scaffolding changes: test and assertion counts are
byte-identical before and after in every touched file except cacheprog_test.rs,
which drops exactly one test and its three assertions — the deliberate deletion below.

  • make ci
  • Documentation and examples are accurate
  • New or changed behavior has test coverage

Operational impact

Release binaries are now built with thin LTO and a single codegen unit: slower builds,
faster binary. No runtime behaviour, configuration, storage format, route, or metric
changes.

Review notes

One deletion, verified before removing it.
foreground_get_waits_for_the_inflight_prefetch_download was deleted as subsumed by
the queued variant that follows it. The subsumption is genuine, not assumed:
begin_download runs at enqueue time, before limit.acquire_owned(), so "actively
downloading" and "queued behind the semaphore" are the same entry in the same
inflight map, and the foreground get performs the same single
download_in_progress lookup, pending.changed().await, and disk recheck for both.
The queued test exercises the strictly harder precondition and carries an assertion
the deleted one lacked — a released flag proving the get actually blocked rather
than racing through.

Two planned items were already resolved by earlier PRs in the stack, and correctly
changed nothing.
The stale doc comment in proxy/mod.rs went out with the function
it was glued to. And docs/operations.md needed no metric updates: every string
literal in src/telemetry.rs was diffed between the base commit and HEAD, yielding
only six new literals, all tracing field names and messages. The agent metrics look
changed under a name grep only because they moved from format!("flywheel_agent_ {suffix}") to full literals; extracting the (name, help) pairs at both revisions
gives 19 identical pairs in identical order.

One fix from outside this phase's scope is included, deliberately. The container
build surfaced warning: value assigned to observation is never read in
observe_prefetch_body, which the earlier consolidation introduced. It looked like a
miscounting bug — completed transfers recorded as cancelled — so it was tested rather
than assumed: driving a body to completion through observe_prefetch_body with a
probe recorder shows the recorder receives completed = true. Drop reads the field,
so the metric was always correct and the warning is a false positive.

It is still worth fixing, because it is a latent CI break: local rustc is 1.91.0 and
the container's is 1.97.1, and the expanded unused_assignments lint only fires on the
newer one — so clippy -- -D warnings would fail on a current toolchain even though
it passes here. The flag is now written through a complete() method, which is what
the original plan specified anyway. Folded into this PR rather than sent back through
the stack, since rebasing five stacked branches to place a three-line change would
cost more review than it saves; cherry-pick it onto #5 instead if you would rather it
sat with the code it belongs to.

Noted, not fixed: tests/integration/package_proxies.rs has four more call-family
helpers and two inline .oneshot(...) sites that could sit on common::call. It was
not on this phase's list; the module is in place for a follow-up.

…re test helpers

The release profile was never set, so a performance-sensitive server shipped
untuned; it now uses thin LTO and a single codegen unit. CARGO_FEATURES was
--all-features against a crate with no [features] table, a no-op on every target.
AGENTS.md claimed Cargo auto-discovers the integration tests, but each is an
explicit [[test]] target because they live in a subdirectory.

Test scaffolding: the oneshot call wrapper duplicated across four integration
suites moves to a shared common module, the bind-and-serve block repeated eight
times in cacheprog_test.rs becomes one serve helper, and the SpacePolicy literal
repeated four times in space_test.rs becomes ledger_from. Deletes
foreground_get_waits_for_the_inflight_prefetch_download, which the queued variant
that follows it strictly subsumes: begin_download runs before the semaphore
acquire, so both tests observe the same entry through the same wait, and the
queued one additionally asserts the get actually blocked.

Also writes PrefetchObservation's completion flag through a method. Drop reads it,
so the behaviour was already correct -- confirmed by driving a body to completion
and asserting the recorder sees completed -- but a newer rustc reads the direct
field assignment in the stream's final arm as a dead store, which would fail
clippy -D warnings on the toolchain the container builds with.
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