Commit c2e438b
committed
fix(warp-core): classify every occupied create target as PreconditionMismatch
record.ty was checked before expects_creation in the Some(record) arm,
so create-from-absence against an existing node with the wrong type
returned NodeTypeMismatch instead of PreconditionMismatch --
contradicting ADR 0024's own stated contract that every occupied
create target refuses uniformly as a precondition failure, regardless
of what specifically differs.
Found by Codex's automated review on PR #686. Moved the
expects_creation check to the top of the Some(record) arm, before the
type/attachment checks that exist to serve the update path. This also
simplified the code: the now-unreachable expects_creation branches
inside the attachment-lookup ternary and the redundant standalone
check after it are gone.
Updated create_from_absence_refuses_when_the_node_exists_with_the_wrong_type
to expect PreconditionMismatch. This left NodeTypeMismatch completely
untested, so added
update_precondition_refuses_when_the_node_has_the_wrong_type proving
it's still correctly reachable on the update path, where a caller who
correctly expected the node to exist named the wrong type.
24 tests pass (was 23); full pipeline suite green.1 parent 658daec commit c2e438b
2 files changed
Lines changed: 78 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2443 | 2443 | | |
2444 | 2444 | | |
2445 | 2445 | | |
| 2446 | + | |
| 2447 | + | |
| 2448 | + | |
| 2449 | + | |
| 2450 | + | |
| 2451 | + | |
| 2452 | + | |
| 2453 | + | |
| 2454 | + | |
| 2455 | + | |
| 2456 | + | |
| 2457 | + | |
| 2458 | + | |
2446 | 2459 | | |
2447 | 2460 | | |
2448 | 2461 | | |
| |||
2451 | 2464 | | |
2452 | 2465 | | |
2453 | 2466 | | |
2454 | | - | |
2455 | | - | |
2456 | | - | |
2457 | | - | |
2458 | | - | |
| 2467 | + | |
2459 | 2468 | | |
2460 | | - | |
2461 | | - | |
2462 | | - | |
2463 | 2469 | | |
2464 | 2470 | | |
2465 | 2471 | | |
| |||
Lines changed: 64 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1978 | 1978 | | |
1979 | 1979 | | |
1980 | 1980 | | |
1981 | | - | |
1982 | | - | |
1983 | | - | |
1984 | | - | |
1985 | | - | |
1986 | | - | |
| 1981 | + | |
| 1982 | + | |
| 1983 | + | |
| 1984 | + | |
| 1985 | + | |
| 1986 | + | |
| 1987 | + | |
| 1988 | + | |
| 1989 | + | |
| 1990 | + | |
1987 | 1991 | | |
1988 | 1992 | | |
1989 | 1993 | | |
| |||
2024 | 2028 | | |
2025 | 2029 | | |
2026 | 2030 | | |
2027 | | - | |
| 2031 | + | |
2028 | 2032 | | |
2029 | 2033 | | |
2030 | 2034 | | |
| |||
2412 | 2416 | | |
2413 | 2417 | | |
2414 | 2418 | | |
| 2419 | + | |
| 2420 | + | |
| 2421 | + | |
| 2422 | + | |
| 2423 | + | |
| 2424 | + | |
| 2425 | + | |
| 2426 | + | |
| 2427 | + | |
| 2428 | + | |
| 2429 | + | |
| 2430 | + | |
| 2431 | + | |
| 2432 | + | |
| 2433 | + | |
| 2434 | + | |
| 2435 | + | |
| 2436 | + | |
| 2437 | + | |
| 2438 | + | |
| 2439 | + | |
| 2440 | + | |
| 2441 | + | |
| 2442 | + | |
| 2443 | + | |
| 2444 | + | |
| 2445 | + | |
| 2446 | + | |
| 2447 | + | |
| 2448 | + | |
| 2449 | + | |
| 2450 | + | |
| 2451 | + | |
| 2452 | + | |
| 2453 | + | |
| 2454 | + | |
| 2455 | + | |
| 2456 | + | |
| 2457 | + | |
| 2458 | + | |
| 2459 | + | |
| 2460 | + | |
| 2461 | + | |
| 2462 | + | |
| 2463 | + | |
| 2464 | + | |
| 2465 | + | |
| 2466 | + | |
| 2467 | + | |
| 2468 | + | |
| 2469 | + | |
| 2470 | + | |
| 2471 | + | |
0 commit comments