Proof Portal
jsonparser
ProbeLabs23 findings · 123 requirementsWhen Set is called with a provided path, the parser shall either replace the existing addressed value, create a type-consistent missing path and return the updated JSON document, or return KeyPathNotFoundError when the requested mutation path is not usable for the provided input.
Specification
The requirement exactly as authored — its complete prose text and, where present, the formal FRETish sentence it compiles to.
When Set is called with a provided path, the parser shall either replace the existing addressed value, create a type-consistent missing path and return the updated JSON document, or return KeyPathNotFoundError when the requested mutation path is not usable for the provided input. 'Type-consistent' means each path segment's kind matches its resolved parent container: object-key segments under object parents, array-index [N] segments under array parents. A path component whose kind mismatches its parent (e.g. [N] under an object, or an object-key under an array at a depth where the parent must be inferred) is 'not usable for the provided input' and shall surface KeyPathNotFoundError. (Cross-type mismatch currently produces malformed JSON output instead — tracked as DEFECT-260726-MFPA / KI-3.) SetString is the auto-quoting Set variant: SetString(data, val, keys...) is equivalent to Set(data, Escape(val), keys...) where Escape RFC-8259-encodes val as a JSON string literal including surrounding quotes, so callers can pass a Go string directly without manually quoting it.
the parser shall always satisfy !set_path_is_provided | set_target_exists | set_creates_missing_path | set_returns_updated_document | set_returns_not_found_error
Rationale & tags
Why this requirement exists, and how it is categorised.
Rationale & tags
Why this requirement exists, and how it is categorised.
Set is the documented experimental mutation helper and must preserve defined behavior for addressed path updates and invalid mutation inputs.
Verification & provenance
How this requirement was checked: the review trail, edit history, and the machine-analysis status terms (each ⓘ explains what it means).
Review
- Status
- approved
- Reviewer
- Buger · lead_engineer
- Reviewed
- Jul 27, 2026, 06:53 UTC
History
- Created
- Apr 13, 2026, 17:15 UTC · Created via CLI
- Modified
- Jul 27, 2026, 06:53 UTC · Buger
Change history
Every recorded revision of this requirement's source file — newest first, each with its commit message and the diff for that change.
Obligations
What this requirement must witness to be considered satisfied — the required evidence, and the tests that discharge each one.
4 obligations · 2 discharged · 2 not yet witnessed
Browse the catalogueBehavior at limits, thresholds, and edge-of-range values.
Set on an array-index path component [N] where N >= len(array) silently overwrites element 0 or another existing element the caller did not address, destroying data and returning a mutated document with no error (PR #286 regression class).
Applying the operation twice produces the same result as applying once.
Set on the same (input, path, value) tuple yields a different document on a second call (e.g. idempotency regression where repeated Set inserts the path twice), corrupting cache or diff layers.
- nominalrequiredpresentCovered by 1 test
Behavior when inputs are syntactically or structurally invalid.
Set with an array-index path component [N] whose parent in the addressed JSON is an OBJECT (or vice-versa) emits malformed JSON output and returns it with nil error (DEFECT-260726-MFPA / KI-3); the caller has no signal that the returned bytes are unparseable.
- negativerequiredpresentCovered by 1 test
- nominalrequiredpresentCovered by 1 test
Set on a multi-segment path drives createInsertComponent to emit array scaffolding at the wrong depth or offset; a regression overwrites a sibling element or builds malformed JSON, silently corrupting the nested structure (SYS-REQ-110 hazard class).
Formula evidence
The formal formula behind this requirement, the variables it is written over, and the tests that exercise it (each term is explained inline).
Formula evidence
The formal formula behind this requirement, the variables it is written over, and the tests that exercise it (each term is explained inline).
FRETish formula
the parser shall always satisfy !set_path_is_provided | set_target_exists | set_creates_missing_path | set_returns_updated_document | set_returns_not_found_error
Variables
| Name | Type | Direction | Description |
|---|---|---|---|
| set_path_is_provided | — | True when Set is called with at least one mutation path segment. | |
| set_target_exists | — | True when the full addressed Set path already exists in the input JSON. | |
| set_creates_missing_path | — | True when Set creates the missing addressed path inside a valid target container. | |
| set_returns_updated_document | — | True when Set returns the updated JSON document for the addressed mutation case. | |
| set_returns_not_found_error | — | True when Set returns `KeyPathNotFoundError` because the requested mutation path is not usable for the provided input. |
Witnesses· 6 scenarios total
- TestMCDC_SYS_REQ_009_Row1_TriggerFalseexercises 1 condition scenario
- TestSetexercises 4 condition scenarios
- TestSetCreatesMissingEntryInExistingArrayexercises 1 condition scenario
MC/DC truth table· 6 rows
Each row assigns the formula's conditions (T/F) and shows the Result— the formula's value for that input row, not a test pass/fail. A row proves a condition when flipping only that condition flips the outcome. The test that covers each row is linked.
mcdc:ignoreNo-actionfalse-result row satisfied by designUncoveredneeds a covering test| # | set_creates_missing_path | set_path_is_provided | set_returns_not_found_error | set_returns_updated_document | set_target_exists | Result | Proves | Covering test |
|---|---|---|---|---|---|---|---|---|
| 1 | F | F | F | F | F | T | set_path_is_provided | |
| 2 | F | T | F | F | F | F | set_creates_missing_path | |
| 3 | F | T | F | F | T | T | set_target_exists | |
| 4 | F | T | F | T | F | T | set_returns_updated_document | |
| 5 | F | T | T | F | F | T | set_returns_not_found_error | |
| 6 | T | T | F | F | F | T | set_creates_missing_path |
Its place
How this requirement connects — what proves it, what it affects, and what it rests on. Authored links only here; automatically derived links come from the audit index.
Loading graph…
Trace evidence
The concrete artifacts linked to this requirement — implementing code, verifying tests, documents, and the findings raised against it.
Impact
Blast radius — authored trace links only (automatically derived links come from the audit index and aren't shown here).
Impact
Blast radius — authored trace links only (automatically derived links come from the audit index and aren't shown here).
If you change this
Files to re-check (5)
- append.goappend.go
- escape.goescape.go
- fuzz.gofuzz.go
- parser.goparser.go
- path_compiler.gopath_compiler.go
Tests to re-run (13)
- empty_key_path_test.goempty_key_path_test.go
- escape_test.goescape_test.go
- fuzz_native_test.gofuzz_native_test.go
- issues_56_107_229_test.goissues_56_107_229_test.go
- mcdc_code_supplement_test.gomcdc_code_supplement_test.go
- mcdc_spec_witnesses_test.gomcdc_spec_witnesses_test.go
- mcdc_supplement_test.gomcdc_supplement_test.go
- obligation_evidence_test.goobligation_evidence_test.go
- path_compiler_test.gopath_compiler_test.go
- property_test.goproperty_test.go
- reference_oracle_test.goreference_oracle_test.go
- set_spec_test.goset_spec_test.go
- v131_regression_test.gov131_regression_test.go
What this rests on
Parent requirements (1)
Changes
Semantic changes that move or scope this requirement — the intended work touching it. Each links to the full change.
Discussions
Discuss this with the proof team. Nothing changes in your audit automatically — you open a request and a staff member records any outcome inside the thread.