@azure-id/orc 1.4.2 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/CHANGELOG.md +111 -0
  2. package/README.md +46 -46
  3. package/bin/cli.js +5918 -400
  4. package/bin/mockrun-catalog.js +4 -0
  5. package/bin/verify-contracts.js +4475 -4410
  6. package/bin/verify-package.js +21 -2
  7. package/bin/webui/api.js +108 -8
  8. package/bin/webui/app.html +9 -0
  9. package/bin/webui/css/06-responsive.css +14 -0
  10. package/bin/webui/css/panels/test.css +132 -0
  11. package/bin/webui/fixtures/index.js +23 -1
  12. package/bin/webui/fixtures/test.js +547 -0
  13. package/bin/webui/i18n/en/common.json +1 -0
  14. package/bin/webui/i18n/en/nav.json +1 -0
  15. package/bin/webui/i18n/en/overview.json +4 -0
  16. package/bin/webui/i18n/en/test.json +141 -0
  17. package/bin/webui/i18n/id/common.json +1 -0
  18. package/bin/webui/i18n/id/nav.json +1 -0
  19. package/bin/webui/i18n/id/overview.json +4 -0
  20. package/bin/webui/i18n/id/test.json +141 -0
  21. package/bin/webui/js/01-i18n.js +1 -0
  22. package/bin/webui/js/panels/challenge.js +8 -3
  23. package/bin/webui/js/panels/overview.js +10 -0
  24. package/bin/webui/js/panels/test.js +733 -0
  25. package/bin/webui/serve.js +572 -557
  26. package/mock-run/orc-test.md +327 -0
  27. package/package.json +1 -1
  28. package/templates/agents/MODEL-MAPPING.md +2 -0
  29. package/templates/agents/orc-test-designer-opus-5-high.md +158 -0
  30. package/templates/agents/orc-test-interpreter-opus-5-low.md +130 -0
  31. package/templates/commands/orc-test.md +66 -0
  32. package/templates/skills/_shared/extra-dispatch.md +1346 -1337
  33. package/templates/skills/_shared/live-target.md +188 -0
  34. package/templates/skills/_shared/phases/trace.md +2 -2
  35. package/templates/skills/_shared/wait.md +241 -240
  36. package/templates/skills/orc-test/SKILL.md +233 -0
@@ -0,0 +1,188 @@
1
+ # Shared contract — the LIVE TARGET
2
+
3
+ > Canonical prose for `/orc-test`. Any lane that sends a request to a running
4
+ > system, or reports what a running system did, reads this file. A spine keeps
5
+ > the TOKEN and a pointer here — never a forked copy of the prose.
6
+
7
+ ORC has always written tests and never run one. Phase 6.5 (`generate_tests`)
8
+ authors `test-generator/<slug>/` and never executes it, which is the right call
9
+ for a build pipeline: running a suite is the user's business, and a red test is
10
+ sometimes the test being wrong.
11
+
12
+ `/orc-test` is the mirror image, and the two are different products:
13
+
14
+ | | Phase 6.5 `test-generator/` | `/orc-test` |
15
+ |---|---|---|
16
+ | Writes into the project's test tree | yes — a shipped deliverable | **never** |
17
+ | Runs anything | **never** | always — that is the entire lane |
18
+ | Output | test cases | **observations** |
19
+ | Gates a ship | never | never — it is standalone |
20
+
21
+ **A test that ran is a FACT; a test that was written is an OPINION.** Everything
22
+ below falls out of that one line.
23
+
24
+ ---
25
+
26
+ ## The split
27
+
28
+ > **The CLI EXECUTES and MEASURES. The model DESIGNS and INTERPRETS.**
29
+
30
+ - Sending an HTTP request, recording the request and the response to disk,
31
+ comparing a status or a shape against a declared expectation, deriving a
32
+ boundary matrix from a typed parameter, polling a health endpoint, diffing the
33
+ code surface against the live surface — **deterministic, in `bin/cli.js`, at
34
+ zero model tokens, repeatable.**
35
+ - Deciding what a valid `POST /orders` body semantically needs, which field is
36
+ the object id a BOLA probe should swap, what "logged in" means in this repo,
37
+ whether a 500 body is a leak — **model work, dispatched, and always anchored
38
+ to an evidence file on disk.**
39
+
40
+ **A model never sends a request. The CLI never decides what a response means.**
41
+
42
+ ---
43
+
44
+ ## The three contract tokens
45
+
46
+ They join the family — `a lane that answers its own interview question`, `a lane
47
+ that picks its own favourite`, `a lane that fixes what it judged`, `a lane that
48
+ picks its own council`, `a lane that reads its own document`, `a lane that sends
49
+ work off Claude without saying so`, `a lane that re-does work the worktree
50
+ already contains`, `a lane that waits without a hand-back`, `a lane that
51
+ re-dispatches over a live attempt` — taking it to **twelve**.
52
+
53
+ ### 1. `a lane that reports a result it did not observe`
54
+
55
+ Every row in the ledger carries an `evidence` path, or it is not a result. No
56
+ evidence → **`unknown`**, never `pass` and never `fail`. This is *unknown is not
57
+ zero* and *measured is not unknown*, applied to a verdict.
58
+
59
+ There are three verdicts and there is no fourth:
60
+
61
+ | verdict | means |
62
+ |---|---|
63
+ | `pass` | observed, and it matched the declared expectation |
64
+ | `fail` | observed, and it did not |
65
+ | `unknown` | **not observed** — connection refused, a timeout, a precondition not met, an identity absent, the tier skipped |
66
+
67
+ `unknown` is an honest state. It keeps its slot in the report and it never
68
+ becomes a pass — the `/orc-pact` UNCHECKABLE rule, and for the same reason.
69
+
70
+ **A flake is recorded, never retried away.** There is no retry count and there
71
+ is no key for one. If the same case answers differently across two runs, the
72
+ report says so, and *that instability is the finding*.
73
+
74
+ ### 2. `a lane that sends traffic to a target nobody authorized`
75
+
76
+ The target is DECLARED at `init`, FROZEN to `target.md`, and every single
77
+ request is fenced to that origin. **A redirect off-origin is followed by
78
+ nothing** — it is recorded as a finding and dropped.
79
+
80
+ - There is **no config key that names a target.** A stored default target is how
81
+ a scan reaches the wrong host.
82
+ - On a remote target, `--authorized "<who authorized this, and where it is
83
+ recorded>"` is REQUIRED. ORC cannot verify authorization and does not pretend
84
+ to — **it records that the user asserted it, and makes the assertion
85
+ impossible to skip.** The statement is reprinted verbatim at the head of every
86
+ report.
87
+ - `--destructive allow | deny`, with `--reason` REQUIRED on `allow`. Per run,
88
+ per target, never a config key: a config that once said yes is on for the run
89
+ you needed it off.
90
+
91
+ Traffic discipline, because ORC's own run must not be the incident:
92
+
93
+ - `test_max_rps` and a fixed small concurrency. **The CLI paces** — it is not a
94
+ suggestion.
95
+ - **A 429 is a RESULT, not an error.** It means rate limiting works. Record it,
96
+ back off, do not push through.
97
+ - **Failed-auth attempts against one identity are capped** at a low fixed
98
+ number. Account lockout would end the run and, on preprod, somebody's
99
+ afternoon.
100
+ - Every request carries a stable `User-Agent` and an `X-Orc-Test-Run: <slug>`
101
+ header, so the target's own logs can identify and exclude the traffic.
102
+
103
+ ### 3. `a lane that fixes the system under test`
104
+
105
+ If the system will not come up, `/orc-test` **STOPS**, prints exactly what it
106
+ ran and the tail of the output, and hands back.
107
+
108
+ It never edits source. It never installs a dependency into the project. It never
109
+ relaxes a check to make its own run go green.
110
+
111
+ Same shape as `/orc-challenge`: **ORC observes, the user fixes, ORC
112
+ re-observes** — and a session that just fixed the code cannot be trusted to
113
+ measure it.
114
+
115
+ ---
116
+
117
+ ## Evidence, and redaction
118
+
119
+ Per case, under `evidence/<case-id>/`: the exact request, the exact response
120
+ (status, headers, body, timing), and a reproducible `curl`.
121
+
122
+ **Redaction is structural, not a review step.** The evidence writer replaces
123
+ every known credential value and every `Authorization` / `Cookie` /
124
+ `Set-Cookie` value with a stable placeholder **before the bytes reach disk**.
125
+ ORC does not do the "last 6 characters" convention: the report is meant to be
126
+ readable in a PR, and a tail is still a secret when the vault is small.
127
+
128
+ **The run folder is never staged.** Not by this lane, not by any other. Evidence
129
+ contains real response bodies from a real system — the most sensitive thing ORC
130
+ writes to disk. The lane says so once, loudly, and offers the one `.gitignore`
131
+ line; it does not edit `.gitignore` itself (the `mock-examples/` precedent).
132
+
133
+ ---
134
+
135
+ ## Remote is a different lane in a trench coat
136
+
137
+ **R1 — On a remote target, source is a HYPOTHESIS, not a fact.**
138
+ Everything derived from the repo is labelled `source-derived` in the ledger. A
139
+ case that depended on it and failed is reported as `unknown` FIRST, with "the
140
+ deployed build may not be this commit" named as a candidate cause, before it is
141
+ ever reported as a defect. The CLI records the target's build fingerprint if one
142
+ is exposed and prints the comparison; if none is exposed it says so and never
143
+ guesses.
144
+
145
+ **R2 — On a remote target, ORC never claims it cleaned up.**
146
+ Every state-changing request gets a run marker, and the run writes `changes.md`:
147
+ every mutation in order, with the request that made it and the request that
148
+ would undo it *if one exists*. If no undo exists, the row says so.
149
+ **ORC prints the undo; the user runs it.**
150
+
151
+ ---
152
+
153
+ ## Config — five keys, and the five that were REFUSED
154
+
155
+ The lane has exactly five keys: `test_gate`, `test_security_tier`,
156
+ `test_max_rps`, `test_case_budget`, `test_ui_driver`.
157
+
158
+ The five below were proposed and refused. They are written down HERE, with the
159
+ reason, so nobody proposes them again — and so that a later release adding one
160
+ has to argue with a sentence rather than with a silence.
161
+
162
+ | Refused | Why |
163
+ |---|---|
164
+ | `test_auto_fix` | It is the lane's premise, inverted. **`a lane that fixes the system under test` has broken this contract** — a key for it would be a switch that turns the contract off. |
165
+ | `test_destructive` | A permission to write to somebody's system must be PER RUN, for THAT target, with a recorded reason. A stored default is a permission nobody remembers granting, applied to a target nobody was thinking about. |
166
+ | `test_target_url` | A stored default target is exactly how a scan reaches the wrong host. Nothing in this lane has a default it could guess, and the target is frozen at `init` by a person who typed it. |
167
+ | `test_retries` | **A flake is recorded, never retried away.** The instability IS the finding, and a retry count is a setting whose only function is to hide it. |
168
+ | `test_skip_auth_probe` | A switch on a check is a switch that turns off the check people most need. If a probe cannot run here, the honest answer is `UNCHECKABLE` with its reason — not a setting that makes the row disappear. |
169
+
170
+ The shape of every one of those reasons is the same: a key you can switch off is
171
+ off on the run you needed it for.
172
+
173
+ ---
174
+
175
+ ## What this lane will never do
176
+
177
+ 1. **Edit the system under test.** Not to fix a boot failure, not to add a
178
+ `data-testid`, not to relax a check.
179
+ 2. **Write into the project's test tree.** That is Phase 6.5's job.
180
+ 3. **Commit or stage anything.**
181
+ 4. **Report a category it did not measure.** `UNCHECKABLE` keeps its slot.
182
+ 5. **Exploit.** It demonstrates a CONDITION, not an extraction. Confirming an
183
+ exploit is a human's decision on a human's authority.
184
+ 6. **Retry a flake into a pass.**
185
+ 7. **Gate a ship.** `test_gate` warns; it has no `block`.
186
+ 8. **Send traffic anywhere but the frozen origin.**
187
+ 9. **Install anything into the user's project.**
188
+ 10. **Name a person.** A red test is not a performance review.
@@ -63,7 +63,7 @@ run_meta: # FIRST packet of the run ONLY; omit thereafter
63
63
  # plan | claude | poly | learn | verify | pattern |
64
64
  # prsetup | prdriver | quick | grill | route |
65
65
  # brainstorm | pact | boundary | handoff | budget |
66
- # aftermath | export | challenge | doc
66
+ # aftermath | export | challenge | doc | test
67
67
  # (`ultra` = an /orc-ultra run; the ONLY lane the orc
68
68
  # spine can emit besides `orc`. No other value here
69
69
  # is legal — a lane no entry point opens is a lane
@@ -97,7 +97,7 @@ decisions: > # free text — the WHY layer
97
97
  | Build lanes | `orc` (incl. ultra), `orc-mini`, `orc-fast` | per phase — full orc ≈ 7–9 (ultra adds U0 + judge packets); orc-mini batches to 3 (intake+plan, execution, ship); orc-fast to 2 (preflight+dispatch, gate+ship) |
98
98
  | Multi-dispatch | `orc-wiki`, `orc-pr-driver` (lane `prdriver`) | orc-wiki: one per scan-batch boundary (the points that already run the registration sync / offer the pause) + the end-of-run packet. orc-pr-driver: one per LAYER boundary (each layer's green gate closes) + the end-of-run packet |
99
99
  | Composed | `orc-diy` | one packet per ENABLED phase group, **minimum 2** — the flow shape is user-composed, so the count is too (the compiled flow carries this block automatically) |
100
- | Iterative | `orc-quick`, `orc-challenge` (lane `challenge`), `orc-doc` (lane `doc`) | **one packet per completed numbered entry** + the end-of-run `FINISH` packet — the lane loops on user requests, so the count follows entries, not phases. For `orc-challenge` the unit is one completed ITERATION (C2→C8), and the packet goes out at the stop; on a PASS it is the `FINISH` packet. **Several trace files for one cycle is CORRECT** — several sessions ran, and `orc stats` counts several. For `orc-doc` the unit is one completed WAVE, and the packet is the LAST step of the stop sequence |
100
+ | Iterative | `orc-quick`, `orc-challenge` (lane `challenge`), `orc-doc` (lane `doc`), `orc-test` (lane `test`) | **one packet per completed numbered entry** + the end-of-run `FINISH` packet — the lane loops on user requests, so the count follows entries, not phases. For `orc-challenge` the unit is one completed ITERATION (C2→C8), and the packet goes out at the stop; on a PASS it is the `FINISH` packet. **Several trace files for one cycle is CORRECT** — several sessions ran, and `orc stats` counts several. For `orc-doc` the unit is one completed WAVE, and the packet is the LAST step of the stop sequence. For `orc-test` the unit is one completed CYCLE (T2→T9), and the packet goes out at the stop |
101
101
  | Single-dispatch | `orc-claude`, `orc-plan`, `orc-analyze` + `orc-analyze-mini` (both lane token `analyze`), `orc-pattern`, `orc-verify`, `orc-learn`, `orc-poly`, `orc-pr-setup` (lane `prsetup`), `orc-grill`, `orc-route`, `orc-brainstorm` (lane `brainstorm`), `orc-pact` (lane `pact`), `orc-boundary` (lane `boundary`), `orc-handoff` (lane `handoff`), `orc-budget` (lane `budget`), `orc-aftermath` (lane `aftermath`), `orc-export` (lane `export`) | **exactly ONE mandatory end-of-run packet** |
102
102
 
103
103
  **`context-combiner` is NOT a lane — it is a PHASE inside the analyze run.** It