Skip to content

refactor: remove redundant feature gates, promote index into full - #6747

Merged
bug-ops merged 3 commits into
mainfrom
refactor/feature-flags-audit
Aug 25, 2026
Merged

refactor: remove redundant feature gates, promote index into full#6747
bug-ops merged 3 commits into
mainfrom
refactor/feature-flags-audit

Conversation

@bug-ops

@bug-ops bug-ops commented Aug 25, 2026

Copy link
Copy Markdown
Owner

Summary

Audited all 184 Cargo feature keys across the workspace (root Cargo.toml + 28 crates), classified each as either an unconditional/always-on candidate or a genuinely required modularity boundary, and implemented the ratified classification:

  • Removed 27 feature keys (184 -> 157) that provided no real build-time or binary-size benefit: empty markers (deep-link, cocoon), keys already unconditionally enabled by non-optional dependencies (llm-planning, zeph-core/sysinfo), and single-tiny-subfeature gates (registry). Fixed zeph-skills's miner feature to declare explicit dep: prefixes instead of silently synthesizing 5 implicit feature keys.
  • Added index to the desktop/full bundles instead of removing its gate — it carries real per-crate dependency weight (+43 packages for zeph-agent-context) that removing the gate would have unconditionally charged to every consumer, including published-crate users. This is the first time full compiles the zeph-index integration; fixed an E0063 in zeph-agent-context test code the new combination exposed.
  • Dropped testing from the full bundle (breaking change)full drives release-build-full, which was silently shipping mock LLM providers in release binaries. Consumers relying on --features full for test doubles must now request testing explicitly.

Kept gated, with reasoning verified per-crate (not just at the workspace-root binary, which hides published-crate consumer cost): sqlite/postgres and metal/cuda (mutually exclusive backends, sqlite/postgres enforced by compile_error!), profiling (spec 035 FR-002 requires it compile to a no-op when disabled), zeph-skills/qdrant, zeph-a2a/{card-signing,ibct,server}, zeph-core/scheduler (load-bearing propagation marker), session (coverage status is Partial, deferred out of this PR), zeph-acp/unstable-cancel-request (deliberate opt-in per #5362).

Also: fixed 6 CI workflows whose hand-copied feature strings had drifted from Cargo.toml, amended specs 001/029 to record the new classification rules and bundle composition, rewrote the stale book/src/reference/feature-flags.md page, and fixed config/default.toml and book/src/advanced/acp.md, which referenced now-removed flags.

Net effect: 0 added package-dependency cost for the entire removed-gate set.

Process

Produced via a 3-round architect/critic classification pass before any code was touched (.local/plan/feature-flags-classification.md, v3 — ratified, 0 open questions), followed by implementation, parallel test-coverage + adversarial-critique validation, and code review with one fix-review cycle (2 blocking documentation issues found and fixed: stale config/default.toml flag references, stale book/src/advanced/acp.md unstable-flag examples that would hard-fail with unknown feature).

Test plan

  • cargo +nightly fmt --check
  • cargo clippy --profile ci --workspace --all-targets --features "desktop,ide,server,chat,pdf,scheduler,testing" -- -D warnings
  • cargo nextest run --workspace --lib --bins on default features (scheduler,sqlite) — 14879/14879 passed
  • cargo nextest run --workspace --features full --lib --bins — 15608/15608 passed
  • cargo test --doc --workspace --features "desktop,ide,server,chat,pdf,scheduler"
  • RUSTFLAGS="-D warnings" cargo check --workspace --all-targets --features desktop,ide,server,chat,pdf,scheduler --locked
  • Rustdoc gate (RUSTFLAGS="-D warnings" RUSTDOCFLAGS="--deny rustdoc::broken_intra_doc_links" cargo doc --no-deps --workspace ...)
  • --no-default-features --features full,sqlite and full,postgres both compile clean
  • sqlite/postgres mutual-exclusion compile_error! guard re-verified (fires correctly both-enabled and neither-enabled)
  • cargo metadata --no-deps reports exactly 157 feature keys post-refactor
  • Live smoke test: zeph doctor with --features full and [index] enabled = true
  • Dead-cfg sweep: zero leftover references to any of the 27 removed feature keys
  • Testing playbook + coverage-status rows added (.local/testing/playbooks/feature-flags.md, .local/testing/coverage-status.md)

Two pre-existing, out-of-scope issues surfaced during validation (not fixed here, filed for follow-up): a zeph-core rustdoc failure specific to the untested profiling-alloc combination, and an orphaned zeph-experiments/mock feature with no code consumer.

Classify all 184 workspace feature keys (root + 28 crates) and remove
the 27 that provide no real modularity benefit: several are empty
markers (deep-link, cocoon), several are already unconditionally
enabled by non-optional dependencies (llm-planning, zeph-core/sysinfo),
and several gate a single tiny reqwest sub-feature (registry). Convert
their #[cfg(feature = ...)] sites to unconditional code and their
optional deps to mandatory ones. Fix zeph-skills's `miner` feature to
declare explicit dep: prefixes instead of silently synthesizing 5
implicit feature keys.

Add `index` to the `desktop`/`full` bundles instead of removing its
gate, since it pulls in real per-crate dependency weight (+43 packages
for zeph-agent-context) that a REMOVE would have unconditionally
charged every consumer, including published-crate users. This is the
first time `full` compiles the zeph-index integration; fix an E0063 in
zeph-agent-context test code the new combination exposed.

Drop `testing` from the `full` bundle (breaking): `full` drove
release-build-full, silently shipping mock LLM providers in release
binaries. Consumers relying on `--features full` for test doubles must
now request `testing` explicitly.

Explicitly keep gated: sqlite/postgres and metal/cuda (mutually
exclusive backends), profiling (spec 035 FR-002 requires it compile to
a no-op when disabled), zeph-skills/qdrant, zeph-a2a/{card-signing,
ibct,server} (all carry real per-crate package cost once measured
correctly, not via the workspace-root binary), zeph-core/scheduler
(load-bearing propagation marker), session (coverage status is
Partial, deferred), and zeph-acp/unstable-cancel-request (deliberate
opt-in per #5362).

Update the 6 CI workflows whose hand-copied feature strings had
drifted from Cargo.toml, amend specs 001/029 to match the new
classification rules and bundle composition, rewrite the stale
book/src/reference/feature-flags.md page, and fix two other
user-facing docs (config/default.toml, book/src/advanced/acp.md) that
referenced now-removed flags.

Net effect: 184 -> 157 feature keys, 0 added package-dependency cost
for the removed set.
@github-actions github-actions Bot added refactor Code refactoring without functional changes documentation Improvements or additions to documentation llm zeph-llm crate (Ollama, Claude) skills zeph-skills crate rust Rust code changes core zeph-core crate dependencies Dependency updates config Configuration file changes ci CI/CD configuration size/XL Extra large PR (500+ lines) and removed refactor Code refactoring without functional changes labels Aug 25, 2026
@bug-ops
bug-ops enabled auto-merge (squash) August 25, 2026 01:12
@github-actions github-actions Bot added the refactor Code refactoring without functional changes label Aug 25, 2026
Removing the cocoon feature gate elsewhere in this branch made
AnyProvider::Cocoon(CocoonProvider) an unconditional enum variant,
growing the future returned by handle_run_baseline past clippy's
large_futures threshold (16624 bytes) under the bench feature build.
Box the two call sites per clippy's own suggested fix.
@bug-ops
bug-ops merged commit 1ce4f8d into main Aug 25, 2026
58 checks passed
@bug-ops
bug-ops deleted the refactor/feature-flags-audit branch August 25, 2026 01:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci CI/CD configuration config Configuration file changes core zeph-core crate dependencies Dependency updates documentation Improvements or additions to documentation llm zeph-llm crate (Ollama, Claude) refactor Code refactoring without functional changes rust Rust code changes size/XL Extra large PR (500+ lines) skills zeph-skills crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant