Proof Portal
jsonparser
ProbeLabs36 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
- human:buger · lead_engineer
- Reviewed
- Jul 27, 2026, 06:53 UTC
History
- Created
- Apr 13, 2026, 17:15 UTC · human:cli
- Modified
- Jul 27, 2026, 06:53 UTC · human:buger
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
- TestSetEmptyKeyPathComponentempty_key_path_test.go:175
- FuzzSetNativefuzz_native_test.go:136
- TestCodeMCDC_CreateInsertComponentEmptyKeymcdc_code_supplement_test.go:128
- TestCodeMCDC_CalcAllocateSpaceEmptyKeymcdc_code_supplement_test.go:139
- TestCodeMCDC_LastTokenNewlinemcdc_code_supplement_test.go:60
- TestCodeMCDC_LastTokenCarriageReturnmcdc_code_supplement_test.go:69
- TestCodeMCDC_LastTokenTabmcdc_code_supplement_test.go:76
- TestCodeMCDC_LastTokenSpacemcdc_code_supplement_test.go:83
- TestMCDC_SYS_REQ_009_Row1_TriggerFalsemcdc_spec_witnesses_test.go:227exercises 1 condition scenario
- TestSetSupplementalArrayInsertionCoveragemcdc_supplement_test.go:337
- TestObligation_SYS_REQ_009obligation_evidence_test.go:159
- TestPropertySetRoundTripproperty_test.go:523
- TestPropertySameTreeEquivalenceproperty_test.go:797
- TestPropertyBufferOpsPureproperty_test.go:841
- TestOracleSetRoundTripreference_oracle_test.go:508
- TestOracleSetPr286Regressionreference_oracle_test.go:609
- TestSetAutoCoerce_KI3set_spec_test.go:109
- TestSetCreatesMissingEntryInExistingArrayset_spec_test.go:36exercises 1 condition scenario
- TestFuzzSetHarnessCoverageset_spec_test.go:54
- TestSetArrayIndexUnderObjectMalformedJSON_KI3set_spec_test.go:65
- TestSetset_spec_test.go:9exercises 4 condition scenarios
- TestSetDoesNotMutateInputBackingArrayWhenGrowingv131_regression_test.go:29
Its place
This requirement shown inside its trace neighbourhood — the parents it satisfies, the code and tests attached to it, and its findings.
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 — if you change this requirement, what else may need re-checking, and what it in turn depends on.
Impact
Blast radius — if you change this requirement, what else may need re-checking, and what it in turn depends on.
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)
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.