Step 3: manifest semantics (V-L2-D1 explicit Constraints + V-L2-E1 conflict-detection + V-L2-O1 init flags)#37
Closed
hyperpolymath wants to merge 1 commit into
Closed
Conversation
…init
Step 3 of the bottom-up plan. Three issues in one commit because the
changes interlock on OctadConfig's shape and DatabaseConfig's
effective_backend signature.
V-L2-D1 — explicit `enable_constraints`:
Constraints was a first-class concern in ADR-0001 but was treated
in code as "implied when count > 2". Promoted to an explicit
OctadConfig field with serde default = true. The "+ 1 if count > 2"
arithmetic in enabled_count is gone; the new implementation is a
straight popcount over the six optional toggles plus 2 inherent
dimensions. print_status reads enable_constraints directly.
Two new unit tests assert the count is bounded by 2..=8 across
all 64 toggle combinations and that the arithmetic is exact.
V-L2-E1 — refuse conflicting backend/target_db:
effective_backend was value-based: `backend != "postgresql"` was
used as a proxy for "user-set", which silently picked sqlite when
a user explicitly set `backend = "postgresql"` alongside a legacy
`target-db = "sqlite"`. Replaced with a fall-through match that
errors loudly on conflict and returns `Ok(default)` otherwise.
Signature is now `Result<&str>`; callers in main.rs + print_status
propagate. Four new unit tests cover each branch (conflict,
agreement, modern-only, legacy-only, default).
V-L2-O1 — init_manifest reads Default + adds --force/--name:
Template values are now derived from OctadConfig::default() rather
than hardcoded strings, so flipping a default in code automatically
flows into the generated file. Added --force (overwrite existing)
and --name (override project name) flags to `verisimiser init`.
A regression test asserts the OctadConfig::default() invariant the
template depends on.
Test fixtures in codegen/{overlay,query}.rs and the integration test
add the new enable_constraints field. tests/integration_test.rs's
backward-compat case calls .effective_backend().unwrap() for the
new Result signature.
Verified locally:
- cargo fmt --all -- --check clean
- cargo clippy --all-targets -- -D warnings clean
- cargo test reports 42 lib + 9 integration = 51 tests, 0 failed
(was 35 + 9 = 44; +7 manifest unit tests)
Closes #34, #35, #36
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Step 3 — manifest semantics. Three interlocking issues in one commit; ~234 LOC of code + tests.
Stacked on #33 (Step 2). Merge order: #24 → #33 → this PR.
What changes
V-L2-D1:
OctadConfig.enable_constraints: boolis now an explicit field with serde defaulttrue. The "implied Constraints when count > 2" arithmetic inenabled_countis gone; replaced with a straight popcount.print_statusreads the field directly. Two new tests cover the 2..=8 bound across all 64 toggle combinations and exact arithmetic. Closes V-L2-D1: explicit enable_constraints + cap enabled_count at 8 #34.V-L2-E1:
DatabaseConfig::effective_backendreturnsResult<&str>. Value-based tie-breaking (backend != "postgresql"as a proxy for "user-set") is replaced with explicit conflict detection. Setting bothbackend = "postgresql"and legacytarget-db = "sqlite"no longer silently picks sqlite — it errors loudly. Four new tests cover the five branches. Closes V-L2-E1: refuse manifests that set both backend and target_db conflictingly #35.V-L2-O1:
init_manifesttemplate values are derived fromOctadConfig::default()so flipping a default in code automatically updates the file.verisimiser initgains--force(overwrite existing) and--name(override project name). Closes V-L2-O1: init_manifest reads from Default + adds --force / --name flags #36.Test plan
cargo fmt --all -- --checkcleancargo clippy --all-targets -- -D warningscleancargo testreports 42 lib + 9 integration = 51 tests, 0 failed (up from 35 + 9)🤖 Generated with Claude Code