Skip to content

Fix dead-code/unused-import warnings across backend feature matrix#300

Merged
smunini merged 2 commits into
mainfrom
fix/build-warnings-feature-gates
Jul 20, 2026
Merged

Fix dead-code/unused-import warnings across backend feature matrix#300
smunini merged 2 commits into
mainfrom
fix/build-warnings-feature-gates

Conversation

@smunini

@smunini smunini commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Summary

cargo build (default features R4, sqlite, ui) reported two dead-code warnings in crates/hfs/src/main.rsbuild_embedded_job_store and composite_ops — each compiled unconditionally (or on just sqlite) while its only callers live behind backend features not in the default set.

Rather than silence with #[allow(dead_code)], this gates each item to the feature combination where it is actually reachable. Verifying across the backend feature matrix surfaced the same class of pre-existing warnings in the non-default mongodb/s3 builds, which are cleaned up in the same pass.

Changes

crates/hfs/src/main.rs

  • build_embedded_job_storeall(sqlite, any(mongodb, all(s3, elasticsearch))) — standalone S3 deliberately doesn't wire bulk export
  • composite_ops, build_search_registry (+ its test) → elasticsearch / all(s3, elasticsearch)
  • validate_shared_sqlite_audit_path (+ its test) → sqlite
  • standalone_ops, seed_search_parametersany(sqlite, postgres, mongodb)
  • wire_reindexany(sqlite, postgres, mongodb, elasticsearch)
  • Bulk-export imports and ReindexOperation/SearchParameterExtractor imports → matching gates

crates/persistence/src/lib.rs

  • default_fhir_versionany(sqlite, postgres, mongodb, elasticsearch) (the S3 config carries no fhir_version field)

No functional behavior changes — compile-time gating only.

Verification

  • Default cargo build (full workspace): clean
  • 15 backend feature combinations (sqlite/postgres/mongodb/s3/elasticsearch and mixes): all clean
  • Test compilation for default, postgres-only, and s3,elasticsearch: clean
  • The two re-gated tests still run/pass

https://claude.ai/code/session_019rC2FHkrJ7uuiiZHDcYmvM

smunini added 2 commits July 18, 2026 07:22
The default `cargo build` reported two dead-code warnings in
`crates/hfs/src/main.rs` (`build_embedded_job_store`, `composite_ops`):
each was compiled unconditionally (or on just `sqlite`) but its only
callers live behind backend features not in the default set.

Rather than silence with `#[allow(dead_code)]`, gate each item to the
feature combination where it is actually reachable. The same class of
pre-existing warnings in the non-default `mongodb`/`s3` builds is cleaned
up at the same time:

- build_embedded_job_store: all(sqlite, any(mongodb, all(s3, elasticsearch)))
- composite_ops / build_search_registry (+test): elasticsearch / all(s3, elasticsearch)
- validate_shared_sqlite_audit_path (+test): sqlite
- standalone_ops, seed_search_parameters: any(sqlite, postgres, mongodb)
- wire_reindex: any(sqlite, postgres, mongodb, elasticsearch)
- bulk-export + reindex imports: matching gates
- helios-persistence default_fhir_version: any(sqlite, postgres, mongodb, elasticsearch)
  (the S3 config carries no fhir_version field)

No functional behavior changes — compile-time gating only. Verified clean
across 15 backend feature combinations plus default/postgres/s3+es test
compiles.

Claude-Session: https://claude.ai/code/session_019rC2FHkrJ7uuiiZHDcYmvM
Resolves conflicts in crates/hfs/src/main.rs:
- `SearchParameterExtractor` import dropped (main removed its last use);
  the feature gate stays on the remaining `ReindexOperation` import.
- `seed_search_parameters` renamed to main's `seed_conformance_resources`
  (now seeds CompartmentDefinitions and every provisioned tenant) while
  keeping this branch's `any(sqlite, postgres, mongodb)` gate; its new
  helper `provisioned_tenants` gets the same gate, since the seeder is
  its only caller.

Claude-Session: https://claude.ai/code/session_019oB9RGbkGJoBzjWQErD4kh
@codecov

codecov Bot commented Jul 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@smunini
smunini merged commit a8c6735 into main Jul 20, 2026
18 checks passed
@smunini
smunini deleted the fix/build-warnings-feature-gates branch July 20, 2026 00:18
aacruzgon added a commit that referenced this pull request Jul 20, 2026
)

Conflict in crates/hfs/src/main.rs: main gated wire_reindex behind
any(sqlite, postgres, mongodb, elasticsearch) to fix dead-code warnings
in the S3-only build (#300), while this branch had extended it with the
cluster job store (reindex_cluster_store + worker spawning).

Resolution keeps the cluster-capable wire_reindex and applies main's
feature gate to both it and reindex_cluster_store — neither is reachable
in an S3-only build, since every call site lives in a standalone
(sqlite/postgres/mongodb) or composite (*-elasticsearch) serve path.

Tests: hfs cluster unit tests pass; cargo check clean (0 warnings) on
default, R4+s3, R4+s3+es, and R4+sqlite+es+ui; CI-style clippy clean
with --all-features.

Claude-Session: https://claude.ai/code/session_01Xu9e637x8LFsRmvSbLACZv
aacruzgon added a commit that referenced this pull request Jul 20, 2026
The E1 durability warning helper's only non-test caller sits behind
cfg(feature = "elasticsearch") (composite modes only exist there), so
the default sqlite build reported it as dead code — the same class of
warning main just cleaned up in #300. Gate it any(test, elasticsearch)
so its unit tests still compile in every feature combination.

Tests: hfs cluster unit tests pass on default features.

Claude-Session: https://claude.ai/code/session_01Xu9e637x8LFsRmvSbLACZv
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