Commit 0c6b540
manifest: explicit Constraints + conflict-detection + Default-driven 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>1 parent f227c60 commit 0c6b540
5 files changed
Lines changed: 234 additions & 86 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
289 | 289 | | |
290 | 290 | | |
291 | 291 | | |
| 292 | + | |
292 | 293 | | |
293 | 294 | | |
294 | 295 | | |
| |||
309 | 310 | | |
310 | 311 | | |
311 | 312 | | |
| 313 | + | |
312 | 314 | | |
313 | 315 | | |
314 | 316 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
343 | 343 | | |
344 | 344 | | |
345 | 345 | | |
| 346 | + | |
346 | 347 | | |
347 | 348 | | |
348 | 349 | | |
| |||
364 | 365 | | |
365 | 366 | | |
366 | 367 | | |
| 368 | + | |
367 | 369 | | |
368 | 370 | | |
369 | 371 | | |
| |||
384 | 386 | | |
385 | 387 | | |
386 | 388 | | |
| 389 | + | |
387 | 390 | | |
388 | 391 | | |
389 | 392 | | |
390 | 393 | | |
391 | | - | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
392 | 398 | | |
393 | 399 | | |
394 | 400 | | |
| |||
403 | 409 | | |
404 | 410 | | |
405 | 411 | | |
| 412 | + | |
406 | 413 | | |
407 | 414 | | |
408 | 415 | | |
409 | 416 | | |
410 | | - | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
411 | 421 | | |
412 | 422 | | |
413 | 423 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
37 | 43 | | |
38 | 44 | | |
39 | 45 | | |
| |||
86 | 92 | | |
87 | 93 | | |
88 | 94 | | |
89 | | - | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
90 | 100 | | |
91 | 101 | | |
92 | 102 | | |
| |||
104 | 114 | | |
105 | 115 | | |
106 | 116 | | |
107 | | - | |
| 117 | + | |
108 | 118 | | |
109 | 119 | | |
110 | 120 | | |
| |||
139 | 149 | | |
140 | 150 | | |
141 | 151 | | |
142 | | - | |
| 152 | + | |
143 | 153 | | |
144 | 154 | | |
145 | 155 | | |
| |||
183 | 193 | | |
184 | 194 | | |
185 | 195 | | |
186 | | - | |
187 | | - | |
| 196 | + | |
188 | 197 | | |
189 | 198 | | |
190 | 199 | | |
| |||
0 commit comments