============================================================================= SEQUENCE fuzzer (closes Dimension 2: interaction / sequence coverage) ============================================================================= Every existing fuzzer runs ONE operation per input. Real bugs live in SEQ
(t *testing.T, state []byte, op string, path []string, val []byte)
| 493 | // returns the new state. Returns (newState, ok). ok=false means the op |
| 494 | // errored and the sequence should restart from a prior valid state. |
| 495 | func applySequenceStep(t *testing.T, state []byte, op string, path []string, val []byte) ([]byte, bool) { |
| 496 | t.Helper() |
| 497 | defer func() { |
| 498 | if r := recover(); r != nil { |
| 499 | t.Errorf("PANIC in sequence step %s (NO-PANIC violation): %v\n%s\nstate=%q path=%v", |
| 500 | op, r, debug.Stack(), state, path) |
| 501 | } |
| 502 | }() |
| 503 | clone := make([]byte, len(state)) |
| 504 | copy(clone, state) |
| 505 | switch op { |
| 506 | case "set": |
| 507 | out, err := Set(clone, val, path...) |
| 508 | if err != nil { |
| 509 | return state, false |
| 510 | } |
| 511 | return out, true |
| 512 | case "delete": |
| 513 | out := Delete(clone, path...) |
| 514 | return out, true |
| 515 | } |
| 516 | return state, false |
| 517 | } |
| 518 | |
| 519 | // assertAfterStep runs the post-step invariants: no panic (caught above), |
| 520 | // json.Valid (when input was valid + shape matches), and the per-step |
no test coverage detected