Skip to content

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
step2-hash-chainfrom
step3-manifest
Closed

Step 3: manifest semantics (V-L2-D1 explicit Constraints + V-L2-E1 conflict-detection + V-L2-O1 init flags)#37
hyperpolymath wants to merge 1 commit into
step2-hash-chainfrom
step3-manifest

Conversation

@hyperpolymath
Copy link
Copy Markdown
Owner

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: bool is now an explicit field with serde default true. The "implied Constraints when count > 2" arithmetic in enabled_count is gone; replaced with a straight popcount. print_status reads 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_backend returns Result<&str>. Value-based tie-breaking (backend != "postgresql" as a proxy for "user-set") is replaced with explicit conflict detection. Setting both backend = "postgresql" and legacy target-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_manifest template values are derived from OctadConfig::default() so flipping a default in code automatically updates the file. verisimiser init gains --force (overwrite existing) and --name (override project name). Closes V-L2-O1: init_manifest reads from Default + adds --force / --name flags #36.

Test plan

🤖 Generated with Claude Code

…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>
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