Skip to content

Commit 206ce38

Browse files
codex1: clarify value roundtrip contract
1 parent 72a8feb commit 206ce38

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

core-no-std-plan.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,11 @@ Current semantics draft:
126126
- Formatter-core canonical output is idempotent on the tested subset of root maps/lists/values, variants, strings, comments, and composite-root-key shapes.
127127
- Exact owned `Value` roundtrip through the compact core path is expected on the tested subset except for the explicit exclusions below.
128128
- Exact owned `Value` roundtrip through the legacy formatter/parser path is expected on the tested subset except for the explicit exclusions below.
129+
- For owned `Value` roundtrip checks, "exact" means `Value` equality after parse/serialize, not preservation of original source spelling or internal numeric storage kind.
129130
- Current explicit non-guarantees and tolerated boundaries:
130131
- Exact owned legacy `Value::format` roundtrip is not guaranteed for unit variants with empty payloads; they serialize as quoted strings.
131132
- Exact owned legacy/core `Value` roundtrip is not guaranteed for `null`/`true`/`false` in map-key position; both parse paths canonicalize those keys to strings.
133+
- Exact owned `Value` roundtrip does not imply preservation of lexical number spelling or `f32` vs `f64` internal storage identity.
132134
- Byte-for-byte preservation of commas, braces, indentation, or trivia is not guaranteed.
133135
- Legacy parity is guaranteed only on the documented and tested overlapping formatter subset.
134136
- Remaining unsupported or merely tolerated ambiguous forms should be promoted into this list as fuzz/property exclusions are reviewed.
@@ -329,7 +331,7 @@ Tasks:
329331
- [ ] Keep byte-level parser fuzzing in place
330332
- [ ] Keep hidden-Unicode rejection fuzzing in place
331333
- [ ] Keep typed-path fuzzing in place
332-
- [-] Stabilize value-roundtrip fuzzing around documented guarantees
334+
- [x] Stabilize value-roundtrip fuzzing around documented guarantees
333335
- [ ] Add every real fuzz-found bug as a normal regression test
334336
- [ ] Add longer-running fuzz jobs outside the fast CI lane
335337

@@ -451,4 +453,5 @@ Entries:
451453
- `2026-03-31 | codex1 | WS3 | Added formatter-core roundtrip coverage for literal keys plus multiline basic/literal string tokens in both key and value position | string-family coverage is broader, but full writer determinism across all nested shapes is still not declared complete`
452454
- `2026-03-31 | codex1 | WS1/WS8 | Documented and regression-tested the owned-Value exact-roundtrip exclusions already assumed by fuzzing: legacy unit variants collapse to strings, and core keyword map keys canonicalize to string keys | next contract work is to decide whether any additional fuzz exclusions should be promoted to documented non-guarantees`
453455
- `2026-03-31 | codex1 | WS1/WS8 | Added a short semantics draft to the tracker and tightened the documented exact-roundtrip exclusions: legacy and core keyword map keys canonicalize to strings, legacy unit variants collapse to strings, and fuzz-contract comments now point at tested behavior | next semantics work is to finish the remaining unsupported/tolerated ambiguity list rather than leave it implied`
456+
- `2026-03-31 | codex1 | WS1/WS8 | Clarified that owned-Value 'exact roundtrip' means Value equality rather than source spelling or numeric storage identity, and marked the value-roundtrip fuzz contract task complete | next semantics work is to review whether any remaining exclusions still need to be promoted from implementation detail to documented non-guarantee`
454457
- `2026-03-31 | codex2 | WS7/WS9 | Added scripts/run_benchmark_baseline.sh and benchmark-data/README.md with a reproducible local baseline for bench_parse and bench_core_vs_serde at 477118a | next performance slice is release-size tracking or stronger benchmark automation`

fuzz/fuzz_targets/value_roundtrip.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ fuzz_target!(|data: &[u8]| {
1616
let core_text = value.to_string_with_core();
1717
let reparsed_core = Value::from_str_with_core(&core_text)
1818
.expect("core serializer output should parse with the core parser");
19+
// "Exact" here means Value equality after parse/serialize, not
20+
// preservation of source spelling or internal numeric storage kind.
1921
assert_eq!(reparsed_core, value);
2022
}
2123

@@ -24,6 +26,8 @@ fuzz_target!(|data: &[u8]| {
2426
let reparsed_legacy: Value = legacy_text
2527
.parse()
2628
.expect("legacy formatter output should parse with the legacy parser");
29+
// "Exact" here means Value equality after parse/serialize, not
30+
// preservation of source spelling or internal numeric storage kind.
2731
assert_eq!(reparsed_legacy, value);
2832
}
2933
});

0 commit comments

Comments
 (0)