|
| 1 | +--- |
| 2 | +name: audit-public-operation-contracts |
| 3 | +description: Audit new or materially changed Jacobian mathematical operations for public-domain mismatches, hidden work expansion, lossy exact results, source-unbound conclusions, and producer-consumer incompatibility. Use for operation-contract reviews and adjacent-domain searches; do not use for general repository, CI, MCP-discovery, or security audits. |
| 4 | +--- |
| 5 | + |
| 6 | +# Audit Public Operation Contracts |
| 7 | + |
| 8 | +Audit whether a Jacobian operation is a bounded, truthful, composable |
| 9 | +mathematical instrument. Treat the request model, native value, kernel or |
| 10 | +backend adapter, result model, declaration, examples, and downstream consumers |
| 11 | +as one contract. |
| 12 | + |
| 13 | +Before auditing, read the current relevant sections of: |
| 14 | + |
| 15 | +- `AGENTS.md`; |
| 16 | +- `docs/reference/domain-operation-library.md`; |
| 17 | +- `docs/reference/testing-strategy.md`; and |
| 18 | +- `docs/reference/mathematical-backends.md` when a backend is involved. |
| 19 | + |
| 20 | +Use those files as the policy authority. Do not copy their general rules into |
| 21 | +the report. |
| 22 | + |
| 23 | +## Establish the audit boundary |
| 24 | + |
| 25 | +Record the revision, operation IDs, owner domain, changed paths, backend and |
| 26 | +version when relevant, and whether the request is audit-only or also authorizes |
| 27 | +implementation. Local investigation never authorizes commits, pushes, issue or |
| 28 | +PR changes, comments, or thread resolution. |
| 29 | + |
| 30 | +Map each operation end to end: |
| 31 | + |
| 32 | +```text |
| 33 | +public request model |
| 34 | + -> canonical domain value and admission |
| 35 | + -> native kernel or private backend adapter |
| 36 | + -> exact result conversion and invariant validation |
| 37 | + -> canonical result and downstream consumers |
| 38 | +``` |
| 39 | + |
| 40 | +Inspect generated schema, declaration text, examples, and MCP-visible errors |
| 41 | +when the public projection is in scope. Do not infer the public contract from |
| 42 | +the implementation alone. |
| 43 | + |
| 44 | +## Complete the contract preflight |
| 45 | + |
| 46 | +Fill the review artifact from `domain-operation-library.md`. For every produced |
| 47 | +mathematical value, additionally answer: |
| 48 | + |
| 49 | +- What owner-defined canonical type is returned? |
| 50 | +- Which downstream operations consume it? |
| 51 | +- Can its serialized value enter those consumers unchanged? |
| 52 | +- Does it retain parent, presentation, ordered axes, ambient dimension, and |
| 53 | + normalization where meaningful? |
| 54 | +- What context survives empty, zero, identity, and other degenerate values? |
| 55 | +- Is a decision or certificate bound to the exact source value it concerns? |
| 56 | +- Can validation replay its defining relation within the admitted work bound? |
| 57 | + |
| 58 | +Classify each output as a canonical value, source-bound result, or display |
| 59 | +projection. A display projection must not masquerade as a composable value. |
| 60 | + |
| 61 | +## Probe the recurrent failure classes |
| 62 | + |
| 63 | +Use small deterministic reproductions before broad mutation. Check for: |
| 64 | + |
| 65 | +- a request accepted beyond the kernel or backend's mathematical domain; |
| 66 | +- input, intermediate, algorithmic-work, or exact-result growth omitted from |
| 67 | + admission, especially exponentiation, dense products, closure, and replay; |
| 68 | +- backend units, multiplicities, generators, witnesses, parents, or axes lost |
| 69 | + during conversion; |
| 70 | +- exact properties inferred from the shape of lossy output; |
| 71 | +- a result model that accepts a forged conclusion, certificate, or derived |
| 72 | + value independently of its source; |
| 73 | +- parallel producer and consumer representations that require caller-side |
| 74 | + reconstruction; |
| 75 | +- empty or singular values that lose their ambient mathematical context; |
| 76 | +- implicit coercion across rings, fields, parents, presentations, or axes; |
| 77 | +- implementation semantics that disagree with title, description, scope, |
| 78 | + method, examples, or result field names; and |
| 79 | +- a private backend imported or exposed at the public namespace boundary. |
| 80 | + |
| 81 | +When a finding depends on a maintained library, verify its current documented |
| 82 | +domain and semantics against official documentation and the pinned version. |
| 83 | +Generated documentation summaries are discovery aids; confirm consequential |
| 84 | +claims in source, tests, or release documentation. |
| 85 | + |
| 86 | +## Search for the shared mechanism |
| 87 | + |
| 88 | +After proving a defect, search the owner domain, shared helper, and every caller |
| 89 | +of that helper for the same mechanism. Keep the search causal: do not turn one |
| 90 | +finding into an unbounded repository audit. Report each adjacent candidate as |
| 91 | +confirmed, disproved, or untested. |
| 92 | + |
| 93 | +Prefer a root repair at the owning layer: |
| 94 | + |
| 95 | +- admission for unsupported or excessive requests; |
| 96 | +- canonical value ownership for composition failures; |
| 97 | +- adapter conversion for backend information loss; |
| 98 | +- result validation for source authenticity and reconstruction; or |
| 99 | +- declaration/schema text for a public semantic mismatch. |
| 100 | + |
| 101 | +Do not use result validation to compensate for overbroad admission, and do not |
| 102 | +add source-text lint rules for mathematical properties. |
| 103 | + |
| 104 | +## Require discriminating evidence |
| 105 | + |
| 106 | +For a confirmed bug, first preserve a focused behavioral regression that fails |
| 107 | +on the base for the intended reason when feasible. Then use the smallest |
| 108 | +relevant evidence: |
| 109 | + |
| 110 | +- accepted and immediately rejected boundary cases; |
| 111 | +- reconstruction or defining-identity properties; |
| 112 | +- producer -> serialization -> consumer closure, including a degenerate value; |
| 113 | +- independent mutation of source and conclusion fields; |
| 114 | +- a bounded independent oracle or metamorphic property for mathematical logic; |
| 115 | +- catalog invocation for public projection changes; and |
| 116 | +- the owner lane named in `CONTRIBUTING.md`. |
| 117 | + |
| 118 | +Examples are necessary evidence for discoverability, not proof of mathematical |
| 119 | +correctness. Generic fuzzing can expose validation gaps but cannot replace a |
| 120 | +domain invariant or independent oracle. |
| 121 | + |
| 122 | +## Report the audit |
| 123 | + |
| 124 | +Lead with the conclusion. For every confirmed finding include the affected |
| 125 | +operation, public claim, minimal reproduction, observed result, mathematical or |
| 126 | +architectural invariant violated, shared root mechanism, affected siblings, |
| 127 | +smallest repair, and regression evidence. Separate confirmed facts from |
| 128 | +hypotheses and list meaningful proof gaps. |
| 129 | + |
| 130 | +If implementation was authorized, preserve unrelated work, make focused |
| 131 | +changes with their tests, run the owning validation, and report only evidence |
| 132 | +that actually ran. Do not perform external mutations without explicit |
| 133 | +authorization. |
0 commit comments