draht-codex 2026.11.5 → 2026.11.14-1
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.
- package/.codex-plugin/plugin.json +1 -1
- package/CHANGELOG.md +6 -0
- package/README.md +1 -0
- package/package.json +2 -2
- package/skills/test-audit/CAMPAIGN.md +118 -0
- package/skills/test-audit/SKILL.md +168 -0
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -140,6 +140,7 @@ Disciplines:
|
|
|
140
140
|
- `model-tiering` — advisor and orchestrator patterns for cost-efficient model selection
|
|
141
141
|
- `saga-spawner` — saga-graph reconciliation loop for unattended repo advancement as a cloud routine
|
|
142
142
|
- `tdd-workflow` — red→green→refactor discipline, commit conventions, cycle violations
|
|
143
|
+
- `test-audit` — authoring gates, evidence-led test audits, and subsystem campaigns that preserve owner-boundary contracts
|
|
143
144
|
- `verification-gate` — evidence before claims: run the command that proves it before saying "done"
|
|
144
145
|
|
|
145
146
|
Creative:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "draht-codex",
|
|
3
|
-
"version": "2026.11.
|
|
3
|
+
"version": "2026.11.14-1",
|
|
4
4
|
"description": "Draht GSD, multi-agent, TDD and DDD workflows as a Codex plugin. Install with `npx draht-codex install`.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"prepublishOnly": "node ../../scripts/sync-draht-tools.mjs && node ../../scripts/generate-skills-artifacts.mjs --check && node ../../scripts/sync-checks-runtime.mjs --check"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@draht/tools": "2026.11.
|
|
30
|
+
"@draht/tools": "2026.11.14-1"
|
|
31
31
|
},
|
|
32
32
|
"keywords": [
|
|
33
33
|
"codex",
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
# Test-pruning campaign
|
|
2
|
+
|
|
3
|
+
Campaign mode prunes one subsystem's whole test surface in one PR: a plugin
|
|
4
|
+
such as `extensions/telegram`, or one core area. The value bar, retention bar,
|
|
5
|
+
candidate evidence, and validation in [SKILL.md](SKILL.md) apply to every
|
|
6
|
+
lane. This file adds the order of work and the lessons of a full campaign.
|
|
7
|
+
Each step ends on its completion criterion; do not start the next step early.
|
|
8
|
+
|
|
9
|
+
## 1. Baseline
|
|
10
|
+
|
|
11
|
+
Record the subsystem's test and support line counts and every test file's
|
|
12
|
+
pass/fail state at a pinned `main` SHA. Keep baseline failures in their own
|
|
13
|
+
list: they may be real product bugs rather than stale tests.
|
|
14
|
+
|
|
15
|
+
Done when every in-scope test file has a recorded baseline result.
|
|
16
|
+
|
|
17
|
+
## 2. Lanes and inventory
|
|
18
|
+
|
|
19
|
+
Split the surface into **lanes** along production owner boundaries, not file
|
|
20
|
+
prefixes. Example lanes include accounts, commands, dispatch, inbound,
|
|
21
|
+
outbound, persistence, transport, shared, harness, and live/QA scenarios.
|
|
22
|
+
Include the subsystem's cases at shared core boundaries and its QA
|
|
23
|
+
and live-proof harness tests.
|
|
24
|
+
|
|
25
|
+
Done when every test file and QA scenario the subsystem owns belongs to exactly
|
|
26
|
+
one lane.
|
|
27
|
+
|
|
28
|
+
## 3. Read-only ledger per lane
|
|
29
|
+
|
|
30
|
+
Use a read-only agent per lane when delegation is available and permitted;
|
|
31
|
+
otherwise inspect the lanes sequentially. The agent reads every assigned test
|
|
32
|
+
in full, including parameter tables. It also reads the production owners and
|
|
33
|
+
their entry points, callers, history, and CI routing. Each test declaration
|
|
34
|
+
goes into a written **ledger** with one mark. An `it.each` is one declaration
|
|
35
|
+
unless its rows need different marks; then mark each row.
|
|
36
|
+
|
|
37
|
+
- `R`: retain, naming the contract and the bug it catches; a retained test that
|
|
38
|
+
only moves to a better-named file stays `R` with the move noted;
|
|
39
|
+
- `F`: retain the contract but repair the assertion, such as a vacuous negative
|
|
40
|
+
that passes when only one of several items is missing;
|
|
41
|
+
- `C`: consolidate, naming the owner that absorbs the assertion first: a sibling
|
|
42
|
+
table case, a stronger boundary suite, or the shared owner in another package;
|
|
43
|
+
- `D`: delete, naming the proof that remains, or why no contract exists.
|
|
44
|
+
|
|
45
|
+
Judge a test by its assertions, not its name. A test named for retiring a
|
|
46
|
+
progress window might only assert that the window was _not_ cleared.
|
|
47
|
+
|
|
48
|
+
Done when every declaration in the lane has a mark and an evidence line.
|
|
49
|
+
|
|
50
|
+
## 4. Layer plan per lane
|
|
51
|
+
|
|
52
|
+
Treat the per-test ledger as input, not as the edit list. A second read-only
|
|
53
|
+
pass, starting from the ledger, looks for the redundant **layer**. For example,
|
|
54
|
+
several dispatch suites may replay a shared compositor through one mocked
|
|
55
|
+
preview despite stronger real-stream and HTTP-fixture suites. Name the
|
|
56
|
+
**keeper** suite for each contract. Prefer the real transport boundary with a
|
|
57
|
+
fake network over a mocked collaborator. Correct any ledger errors this pass
|
|
58
|
+
finds.
|
|
59
|
+
|
|
60
|
+
Done when each lane plan names its retired files, its keeper per contract, the
|
|
61
|
+
assertions to carry into keepers, and the test-only production seams unlocked.
|
|
62
|
+
|
|
63
|
+
## 5. Cutover
|
|
64
|
+
|
|
65
|
+
Edit lane by lane. Serialize changes to shared harnesses and support files
|
|
66
|
+
through one owner. With each lane, remove the test-only production seams it
|
|
67
|
+
unlocks: injection parameters, getters, reset exports, and indirection layers.
|
|
68
|
+
Register moved suites in CI routing and test inventories. Update shrink-only
|
|
69
|
+
line-cap baselines. Put durable test-ownership rules in the subsystem's
|
|
70
|
+
`AGENTS.md`, drawn from mistakes this campaign actually found.
|
|
71
|
+
|
|
72
|
+
Done when every lane plan is applied and each lane's keepers pass.
|
|
73
|
+
|
|
74
|
+
## 6. Preservation review
|
|
75
|
+
|
|
76
|
+
Before claiming completion, have independent reviewers compare deleted
|
|
77
|
+
coverage against the keepers when delegation is available and permitted,
|
|
78
|
+
one reviewer per boundary group. Otherwise perform a separate preservation
|
|
79
|
+
pass and disclose the lack of independent review. They look for
|
|
80
|
+
contracts that lost their only proof. They also look for new assertions that
|
|
81
|
+
cannot fail, such as a rejection row the production code never reaches. The
|
|
82
|
+
review must distinguish a genuine lost contract from an unreachable assertion.
|
|
83
|
+
|
|
84
|
+
For each restored contract, make one deliberate **mutation** of the production
|
|
85
|
+
owner and confirm the keeper goes red. Then restore the source byte for byte.
|
|
86
|
+
|
|
87
|
+
Done when every reported gap is restored or rejected with source evidence, and
|
|
88
|
+
every restored contract has a caught mutation.
|
|
89
|
+
|
|
90
|
+
## 7. Product defects
|
|
91
|
+
|
|
92
|
+
A baseline failure that survives into a keeper is a bug report. Fix it at its
|
|
93
|
+
owner as a separate commit, and prove it through the real user flow, with a
|
|
94
|
+
**control** run that reverts the fix and shows the old behavior. Record
|
|
95
|
+
unrelated product discrepancies you find as follow-ups instead of fixing them
|
|
96
|
+
in the campaign.
|
|
97
|
+
|
|
98
|
+
Done when each repaired defect has a failing control and a passing candidate
|
|
99
|
+
on the same harness.
|
|
100
|
+
|
|
101
|
+
## 8. Reconcile and hand off
|
|
102
|
+
|
|
103
|
+
Campaigns can outlive many base-branch commits. Update from the base using
|
|
104
|
+
the repository's merge or rebase convention. When the base modified a file the
|
|
105
|
+
campaign deleted, preserve the new contract in the keeper before retaining
|
|
106
|
+
the deletion. Confirm every new regression added on the base still has a home.
|
|
107
|
+
Rerun the whole subsystem suite and repeat live proof on the reconciled head.
|
|
108
|
+
|
|
109
|
+
Expect review tooling to see a truncated file list on a diff this large.
|
|
110
|
+
Record maintainer decisions for generic compatibility flags in the PR evidence
|
|
111
|
+
rather than editing gates.
|
|
112
|
+
|
|
113
|
+
Hand off with the [SKILL.md](SKILL.md) report, plus:
|
|
114
|
+
|
|
115
|
+
- baseline and final test/support line counts, with production counted separately;
|
|
116
|
+
- lanes, retired layers, and keepers;
|
|
117
|
+
- preservation gaps found and their mutations;
|
|
118
|
+
- product defects with control and candidate proof.
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: test-audit
|
|
3
|
+
description: "Invoke whenever writing, changing, reviewing, or sweeping tests. Authoring gate for new tests plus audit workflow for low-value, implementation-coupled, or duplicative tests and the test-only production seams they demand."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Test Audit
|
|
7
|
+
|
|
8
|
+
Three modes, one value bar. Authoring mode gates every new or changed test at
|
|
9
|
+
write time. Audit mode runs focused sweeps of tests that re-assert source,
|
|
10
|
+
duplicate stronger proof, couple behavior to implementation, or keep test-only
|
|
11
|
+
production seams alive. Continue broad audits as separate coherent follow-up
|
|
12
|
+
PRs; optimize for confidence, not deletion count. Campaign mode prunes one
|
|
13
|
+
whole subsystem's test surface (every test file a plugin or core area owns);
|
|
14
|
+
before starting one, read [CAMPAIGN.md](CAMPAIGN.md).
|
|
15
|
+
|
|
16
|
+
## Authoring gate
|
|
17
|
+
|
|
18
|
+
Before adding any test, answer four questions; a missing answer means do not
|
|
19
|
+
add it yet:
|
|
20
|
+
|
|
21
|
+
1. What observable behavior, invariant, or independent contract does it protect?
|
|
22
|
+
2. What credible regression makes it fail?
|
|
23
|
+
3. Why does existing coverage not already catch that failure? Each contract has
|
|
24
|
+
one primary test owner at the strongest boundary; another layer needs its
|
|
25
|
+
own distinct risk, such as a transport or lifecycle failure the owner cannot
|
|
26
|
+
reach. Prefer extending a table-driven case or shared fixture over a
|
|
27
|
+
near-duplicate test; consolidate duplicated setup in the same change.
|
|
28
|
+
4. Does it need a production seam (export, flag, wrapper, injection hook) that no
|
|
29
|
+
production caller needs? If yes, move the test to the real boundary instead.
|
|
30
|
+
|
|
31
|
+
Then check the test against every [junk pattern](#junk-patterns); a match fails
|
|
32
|
+
the gate unless the [retention bar](#retention-bar) names the contract it
|
|
33
|
+
independently guards. A test that would break under behavior-preserving
|
|
34
|
+
refactoring is asserting implementation, not behavior; rewrite it at the
|
|
35
|
+
owning boundary before landing it.
|
|
36
|
+
|
|
37
|
+
Bug regression tests must fail on the pre-fix code for the intended reason and
|
|
38
|
+
pass after the owner-boundary repair. A regression test that never demonstrably
|
|
39
|
+
failed proves the mock, not the fix. One regression at the owner boundary
|
|
40
|
+
covers the bug; do not replay the same scenario at every layer it crosses.
|
|
41
|
+
|
|
42
|
+
## Junk patterns
|
|
43
|
+
|
|
44
|
+
The shared checklist for both modes: the authoring gate rejects a new test that
|
|
45
|
+
matches one, and audits hunt for existing tests that do.
|
|
46
|
+
|
|
47
|
+
- assertion-free coverage probes;
|
|
48
|
+
- self-comparisons and identity copiers;
|
|
49
|
+
- copied fixtures, inventories, manifests, or export lists;
|
|
50
|
+
- exact source, import, or string greps;
|
|
51
|
+
- private predicate or call-shape tests duplicated at real boundaries;
|
|
52
|
+
- duplicate invocations of the same contract;
|
|
53
|
+
- provider-local replays of shared helpers;
|
|
54
|
+
- tests whose only purpose is preserving test-only exports, globals, or wrappers;
|
|
55
|
+
- dead production code whose only callers are tests;
|
|
56
|
+
- expected values produced by the helper or renderer under test;
|
|
57
|
+
- mocks that implement the asserted behavior, or one identical mock standing in
|
|
58
|
+
for different APIs;
|
|
59
|
+
- fixtures that supply the receipt, admission, or callback ordering the owner
|
|
60
|
+
should produce, or persistence asserted against a store the path never writes;
|
|
61
|
+
- capability tests that restate declared flags instead of exercising the
|
|
62
|
+
delivery or acknowledgement the flag promises;
|
|
63
|
+
- negative controls that pass for an unrelated reason, such as a denial from a
|
|
64
|
+
different guard or a rejection the production path never reaches;
|
|
65
|
+
- names or fixtures that promise more than the input exercises, such as a
|
|
66
|
+
"retires the window" test asserting the window was not cleared.
|
|
67
|
+
|
|
68
|
+
## Value bar
|
|
69
|
+
|
|
70
|
+
Tests justify their maintenance cost by protecting behavior, a credible
|
|
71
|
+
regression, or an independently meaningful contract. In an audit, an existing
|
|
72
|
+
test that must change for behavior-preserving source reorganization is suspect,
|
|
73
|
+
not automatically deletable; the authoring gate still rejects new ones.
|
|
74
|
+
|
|
75
|
+
Before judging a candidate, read the complete test and production owner, its
|
|
76
|
+
entry point, callers, callees, sibling implementations, overlapping tests, CI
|
|
77
|
+
routing, and relevant history. Read root and scoped `AGENTS.md` files first.
|
|
78
|
+
When the test claims dependency-backed behavior, inspect the dependency source
|
|
79
|
+
or types directly.
|
|
80
|
+
|
|
81
|
+
## Discovery
|
|
82
|
+
|
|
83
|
+
Keep discovery read-only and report evidence before editing. For broad scope,
|
|
84
|
+
run parallel discovery lanes when available:
|
|
85
|
+
|
|
86
|
+
- core and packages (`src/`, `packages/`);
|
|
87
|
+
- plugins (`extensions/`);
|
|
88
|
+
- UI, apps, scripts, and tooling;
|
|
89
|
+
- a cross-cutting pattern sweep.
|
|
90
|
+
|
|
91
|
+
Outside campaign mode, prefer a few high-confidence candidates over a large
|
|
92
|
+
speculative inventory. Hunt for the [junk patterns](#junk-patterns).
|
|
93
|
+
|
|
94
|
+
## Retention bar
|
|
95
|
+
|
|
96
|
+
Keep a test when it independently enforces a public API, plugin SDK, protocol,
|
|
97
|
+
config, migration, storage, security, platform, default, prompt-byte, generated
|
|
98
|
+
cross-language, package, release, or architecture contract. Also keep:
|
|
99
|
+
|
|
100
|
+
- call ordering when order is observable behavior;
|
|
101
|
+
- regressions with a credible failure mode;
|
|
102
|
+
- source inspection when it is the cheapest independent guard: it fails when
|
|
103
|
+
the contract changes (the user-facing key, byte, or path) and survives an
|
|
104
|
+
identifier-only refactor;
|
|
105
|
+
- a retained test that fails on the baseline: treat it as a possible product
|
|
106
|
+
bug, reproduce it, and repair the owner rather than deleting it.
|
|
107
|
+
|
|
108
|
+
Static or slow is not a deletion reason. A test that resembles implementation
|
|
109
|
+
may still be the independent contract; prove otherwise before removing it.
|
|
110
|
+
|
|
111
|
+
## Candidate evidence
|
|
112
|
+
|
|
113
|
+
Record every field below before editing. A missing field means the candidate is
|
|
114
|
+
not ready for deletion:
|
|
115
|
+
|
|
116
|
+
- exact test name and location;
|
|
117
|
+
- what failure it can actually detect;
|
|
118
|
+
- non-test callers of the covered production or support seam;
|
|
119
|
+
- stronger remaining owner-boundary proof, or why no proof is needed;
|
|
120
|
+
- relevant history and the reason the test or seam exists;
|
|
121
|
+
- production or test-support deletion unlocked;
|
|
122
|
+
- risk and the focused validation command.
|
|
123
|
+
|
|
124
|
+
## Edit shape
|
|
125
|
+
|
|
126
|
+
Choose one coherent owner-boundary batch. Delete obsolete test-only exports,
|
|
127
|
+
globals, wrappers, and dead production paths instead of preserving aliases.
|
|
128
|
+
Move retained regressions to their canonical owners. Consolidate repeated
|
|
129
|
+
package or dependency assertions into one generic contract.
|
|
130
|
+
|
|
131
|
+
Prefer net-negative production LOC. Do not add replacement tests that restate
|
|
132
|
+
the same implementation, and do not convert uncertain candidates into cleanup
|
|
133
|
+
to increase deletion counts.
|
|
134
|
+
|
|
135
|
+
## Validation
|
|
136
|
+
|
|
137
|
+
Never edit source or tests while a test runner is running in the checkout.
|
|
138
|
+
Follow the repository's test commands, concurrency limits, and approval rules.
|
|
139
|
+
|
|
140
|
+
1. Run the smallest owner and sibling tests using the repository's prescribed
|
|
141
|
+
runner.
|
|
142
|
+
2. For removed source greps or plan assertions, run the executable script or
|
|
143
|
+
dry-run that owns the real contract.
|
|
144
|
+
3. Run targeted formatting, then `git diff --check`.
|
|
145
|
+
4. Run the changed-file or full validation gate required by repository policy.
|
|
146
|
+
5. Inspect `git diff --numstat`; report production/tooling separately from
|
|
147
|
+
tests and test support.
|
|
148
|
+
6. After final audit edits, review the diff for lost contracts and follow the
|
|
149
|
+
repository's review requirements.
|
|
150
|
+
|
|
151
|
+
## Landing and continuation
|
|
152
|
+
|
|
153
|
+
Commit, push, open a PR, or land only when authorized and permitted by the
|
|
154
|
+
repository's contribution rules. Land one coherent change at a time; after
|
|
155
|
+
landing, refresh from the current base branch and rerun read-only discovery
|
|
156
|
+
for the next high-confidence batch.
|
|
157
|
+
|
|
158
|
+
## Handoff
|
|
159
|
+
|
|
160
|
+
Report:
|
|
161
|
+
|
|
162
|
+
- root cause and removed low-value categories;
|
|
163
|
+
- production owner simplifications;
|
|
164
|
+
- retained false positives and why they remain valuable;
|
|
165
|
+
- focused and full proof actually run;
|
|
166
|
+
- production versus test LOC;
|
|
167
|
+
- PR and merge state;
|
|
168
|
+
- named follow-ups.
|