You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add property tests for `compute_diff_totals` in `crates/tokmd-format/src/diff/compute.rs`.
5
+
6
+
**Why it fits:**`compute_diff_totals` performs accumulation on an unconstrained sequence of diff rows. A property test validates that invariants like `new - old == delta` hold true on the aggregate struct, and that `fold` sums exactly match map/sum, across randomized data. This aligns directly with the "Mutant" persona's goal to strengthen behavioral proofs for a contract-facing core calculation (the core data/format pipeline).
2
7
3
-
## Option A
4
-
Force a fake patch on `tokmd-types` by hallucinating gaps that do not exist, and claim that mutation gaps were closed when they were not.
8
+
**Trade-offs:**
9
+
***Structure:** Enhances the behavioral guarantees of diff reporting by formalizing structural math expectations.
10
+
***Velocity:** Negligible impact on compilation.
11
+
***Governance:** Validates exact correctness of the DiffTotals struct.
5
12
6
13
## Option B
7
-
Adhere to the `Output honesty` constraint. Recognize that `cargo mutants` found zero missed mutants across `tokmd-types` (21 caught, 4 unviable), meaning the target proof surface is already robust. Pivot the assignment into a Learning PR describing this outcome, removing the fake patch that hallucinated missing assertions, and logging a friction item.
14
+
Add property tests for JSON path serialization stability in `crates/tokmd-types/src/evidence_packet.rs`.
8
15
9
-
## Decision
10
-
Choose Option B. The core pipeline is well-covered, and forcing an untruthful fix violates the primary constraints of the run. Submitting a Learning PR is the required honest fallback path.
16
+
**When to choose it instead:** If the primary gap is in the contract boundary with review-packet consumers, checking stable serialization formats and exact data preservation under stress conditions.
***Velocity:** Lower payoff since these DTOs don't carry complex internal calculations.
21
+
22
+
# Decision
23
+
We will go with **Option A**. The mathematical aggregation in `compute_diff_totals` forms the backbone of the diff pipeline's summary capabilities. Ensuring deterministic correctness via property-based testing directly fulfills the gate profile `mutation` expectations around reducing uncertainty in logic.
This is a Learning PR. I explored the `tokmd-types` crate to close mutant gaps and improve tests, but found that the core type math was already fully covered.
2
+
This change adds property-based testing to `compute_diff_totals`to mathematically guarantee the deterministic summation of diff rows.
3
3
4
4
## 🎯 Why
5
-
The Mutant persona assignment `mutant_high_value` requested targeted mutation-style proofs on high-value core surfaces. However, running `cargo mutants -p tokmd-types` revealed zero missed mutants (21 caught, 4 unviable out of 25). Forcing a patch here would violate the `Output honesty` rule by claiming a win that was not proven.
5
+
The diff calculations sit at the edge of the core formatting pipeline. While some static smoke tests existed, the mathematical aggregation over arbitrary rows lacked structured invariant checks (`new - old == delta`, map/sum matching `fold`). Adding Proptest coverage here strengthens confidence that `tokmd diff` emits correct metrics under randomized inputs.
6
6
7
7
## 🔎 Evidence
8
-
Minimal proof:
9
-
- file path(s): `crates/tokmd-types/src/lib.rs`
10
-
- observed finding: The mutation suite successfully caught or marked unviable all 25 mutants tested. No gap exists.
11
-
- command: `cargo mutants -p tokmd-types`
8
+
-`crates/tokmd-format/src/diff/compute.rs`
9
+
- Observed gap: No randomized property tests for the `DiffTotals` reduction function.
12
10
13
11
## 🧭 Options considered
14
-
### Option A
15
-
- Force a fake patch on `tokmd-types` by hallucinating gaps that do not exist, and claim that mutation gaps were closed when they were not.
16
-
- Trade-offs: Directly violates hard prompt constraints ("Hallucinated work is failure").
12
+
### Option A (recommended)
13
+
- Add property tests for `compute_diff_totals` in `crates/tokmd-format/src/diff/compute.rs`.
14
+
- Why it fits: Aligns directly with the "Mutant" objective to reduce uncertainty around contract surfaces by testing structural math.
15
+
- Trade-offs: Minor code footprint; negligible test-time cost; high confidence in core accumulation.
17
16
18
-
### Option B (recommended)
19
-
-Adhere to the `Output honesty` constraint. Pivot to a Learning PR.
20
-
-Fits this repo and shard: It respects the pipeline's request to surface a friction item when no honest code patch is justified.
21
-
- Trade-offs: No production logic changed, but keeps the history clean.
17
+
### Option B
18
+
-Add serialization stability tests for json boundary DTOs.
19
+
-When to choose: Better if the core structural issue was backwards-incompatible breaks in the manifest definitions rather than math accumulation logic.
20
+
- Trade-offs: Testing DTO fields is less mathematically rigorous than fuzzing an accumulator.
22
21
23
22
## ✅ Decision
24
-
Choose Option B. The core pipeline is well-covered, and forcing an untruthful fix violates the primary constraints of the run. Submitting a Learning PR is the required honest fallback path.
23
+
Option A was chosen. Enhancing mathematical validation of the diff totals directly improves the proof guarantees around `tokmd diff`'s accuracy.
25
24
26
25
## 🧱 Changes made (SRP)
27
-
- Created learning PR packet artifacts. No code files were modified.
26
+
-`crates/tokmd-format/src/diff/compute.rs`:
27
+
- Added property tests for invariant maintenance (`new - old = delta`).
I have filed `.jules/friction/open/mutant_high_value.md` noting that attempting to force a patch on a structurally tight crate causes friction against the `Output honesty` constraint.
0 commit comments