Repository navigation
fix: un-orphan build()'s #[cfg(native)] from with_secret_resolver - #1566
Conversation
f305df4 (#1500 §3 SecretRef) inserted FlureeBuilder::with_secret_resolver BETWEEN build()'s doc comment and its #[cfg(feature = "native")] attribute, so the gate landed on with_secret_resolver instead: - build() was left cfg-less, so any no-native compile pulled in its native-only body (storage_path / FileStorage / FileNameService) and failed; - with_secret_resolver became native + iceberg, over-gating the no-native BYO-IAM SecretRef surface it exists for behind native. Move with_secret_resolver (its own doc + #[cfg(iceberg)]) after build(), rejoining build()'s doc with its #[cfg(native)]. with_secret_resolver is now gated on iceberg ONLY. Two follow-ons so the no-native featureset is actually clean, not merely compiling: gate WARM_BUDGET_{NUMERATOR,DENOMINATOR} on native (their only consumer, warm_budget_bytes(), already is) and inline a format arg in the not(native) build_local_storage_from_config. Verified: cargo check + clippy -D warnings for -p fluree-db-api --no-default-features --features aws,iceberg,shacl FAILED before and are clean after; native default + iceberg and the --all-features --all-targets clippy CI gate still pass. --all-features and workspace builds structurally mask this class of bug via feature unification -- native is always on there, so no existing CI job ever compiles the no-native combination downstream lambda consumers use. Supersedes the never-landed 988b1af, which fixed the same gate on the browse-parity lineage but never reached main.
aaj3f
left a comment
There was a problem hiding this comment.
Surgical and verified: the orphaned #[cfg(native)] is reattached to build(), with_secret_resolver is re-gated on iceberg only (un-hiding the no-native SecretRef surface it exists for), and the two follow-ons make the no-native featureset clippy-clean rather than merely compiling. I reproduced both directions in an isolated worktree — parent commit fails cargo check -p fluree-db-api --no-default-features --features aws,iceberg,shacl with exactly the claimed E0609 storage_path / E0433 FileStorage / E0433 FileNameService, and HEAD passes both check and clippy -D warnings on that combination — and solo's green rust-lambdas CI at the f8d3267 pin (fluree/solo#888) independently confirms the downstream consumers compile again.
The one thing I'd suggest (if not now than as a follow-up): a CI gate that compiles the no-native combination, because feature unification guarantees the current matrix can never catch this class and this is its second occurrence.
Adherence to repo commitments:
- Testing:
⚠️ No automated guard added — inherent to the class (it needs a feature-combination compile gate, not a unit test); verified manually in both directions here, and the recommended CI check is the durable fix.
Recommend merge — and merge this before fluree/solo#888, which pins this exact head; once merged (fluree/db uses merge commits, so f8d3267 stays reachable from main), the solo pin is durable.
Notes without a diff anchor:
.github/workflows/ci.yml (not in this diff — no honest anchor, so this belongs in the review body) — optional but strongly recommended. The commit body itself names the structural gap: feature unification means --all-features and workspace builds are always-native, so no CI job ever compiles the no-native combination downstream lambda consumers use — which is exactly why f305df480 shipped broken and every solo Lambda build died at the 3a87233 pin. This is now the second incarnation of the class (over-gating/under-gating that only no-native surfaces). A single cheap gate closes it permanently: cargo check -p fluree-db-api --no-default-features --features aws,iceberg,shacl (34 s incremental in my run; a few minutes cold) — or cargo clippy … -- -D warnings for the stricter version that also catches the dead-const hygiene this PR had to patch. Without it, the next attribute drift ships the same way and is again discovered by solo's build breaking.
…conflict-free review Single conflict: fluree-db-api/src/lib.rs — convergent cfg-orphan fix. Both #1566 and the audit side moved build()'s #[cfg(native)] doc block below with_secret_resolver (kept iceberg-gated). The cfg fix is byte-identical on both sides; resolved the lone doc-wording hunk to main's #1566 text, so the merged file equals origin/main's api/lib.rs (zero diff, no audit feature lost). hash_join.rs, optional.rs, planner.rs auto-merged (disjoint hunks: audit #1477 fast-path vs main cypher #1553).
Problem
fluree-db-apidoes not compile for any consumer usingdefault-features = false. On currentmain:f305df480(#1500 §3,ConfigValue::SecretRef) insertedFlureeBuilder::with_secret_resolverbetweenbuild()'s doc comment and its#[cfg(feature = "native")]attribute, so the gate attached to the wrong function:Two consequences:
build()was left cfg-less, so a no-native compile pulls in its native-only body (storage_path/FileStorage/FileNameService) and fails.with_secret_resolverbecamenative+iceberg, over-gating the no-native BYO-IAMSecretRefsurface it was added for behindnative.Fix
Move
with_secret_resolver(with its own doc comment and#[cfg(iceberg)]) afterbuild(), rejoiningbuild()'s doc comment with its#[cfg(native)].with_secret_resolveris now gated onicebergonly.Two follow-ons so the no-native featureset is genuinely clean rather than merely compiling — both pre-existing, both invisible until the crate could compile at all on this featureset:
WARM_BUDGET_{NUMERATOR,DENOMINATOR}gated onnative(their only consumer,warm_budget_bytes(), already is) — otherwise twodead_codewarnings.#[cfg(not(feature = "native"))] build_local_storage_from_config— otherwise aclippy::uninlined_format_argsdenial.Why CI never caught this
--all-featuresand workspace builds structurally mask this class of bug through feature unification:nativeis always on, so no existing job ever compiles the no-native combination downstream lambda consumers actually use. Worth adding that exact featureset as a CI job; not done here to keep this reviewable.Verification
check -p fluree-db-api --no-default-features --features aws,iceberg,shaclclippysame featureset,-D warningscheck -p fluree-db-api --features iceberg(native default)clippy -p fluree-db-api --all-features --all-targets -D warningscargo fmt --all -- --checkBehavior under
--all-featuresis unchanged — the cfg expansion is identical to before, so the workspace test suite is unaffected by construction.Note on history
988b1affb(Andrew Johnson, Jul 20) fixed this same gate and is onaudit-program/land-on-main,feat/materialize-builder,perf/browse-parity,perf/family-c-filter-joinandperf/audit-mainmerge-base— but it never reachedmain. This commit supersedes it; those branches will resolve on their next merge from main.The bug was reported against
3a87233donfix/upsert-staging-new-subject-scan, with a request to cherry-pick there. That branch is already merged into main, so fixing it on main instead covers it and the 15 other live refs descending fromf305df480that still carry the orphaned gate.