@homericintelligence/athena-opencode 0.5.1 → 0.5.2

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 (40) hide show
  1. package/package.json +1 -1
  2. package/skills/_cli.py +7 -4
  3. package/skills/_plugin.json +1 -0
  4. package/skills/_support/docs/dependency-resolution.md +49 -38
  5. package/skills/_support/docs/policies/development.md +16 -2
  6. package/skills/_support/docs/principles/README.md +191 -168
  7. package/skills/_support/docs/principles/details/p065-verify-before-claiming-completion.md +7 -5
  8. package/skills/_support/docs/review/README.md +5 -1
  9. package/skills/_support/docs/review/behavior-first-testing.md +5 -0
  10. package/skills/_support/docs/review/common.md +44 -9
  11. package/skills/_support/docs/review/issue-planning.md +36 -9
  12. package/skills/advise/SKILL.md +82 -74
  13. package/skills/advise/scripts/list_retrievable_skills.py +17 -5
  14. package/skills/advise/scripts/resolve_knowledge_checkout.py +533 -0
  15. package/skills/brainstorm/SKILL.md +3 -0
  16. package/skills/change-review/scripts/resolve_scope.py +25 -11
  17. package/skills/finalize-plan/SKILL.md +10 -3
  18. package/skills/git-worktrees/SKILL.md +1 -1
  19. package/skills/git-worktrees/scripts/prepare_worktree.py +18 -5
  20. package/skills/learn/SKILL.md +136 -59
  21. package/skills/pr-review/SKILL.md +33 -15
  22. package/skills/pr-review/references/criteria.md +3 -0
  23. package/skills/pr-review/references/delivery.md +136 -18
  24. package/skills/pr-review/references/evidence.md +92 -12
  25. package/skills/pr-review/scripts/collect_evidence.py +101 -22
  26. package/skills/pr-review/scripts/deliver_go.py +701 -0
  27. package/skills/pr-review/scripts/diff_context.py +28 -11
  28. package/skills/pr-review/scripts/materialize_snapshot.py +29 -10
  29. package/skills/pr-review/scripts/resolve_pr.py +24 -10
  30. package/skills/realign/SKILL.md +516 -0
  31. package/skills/realign/references/aislop-integration.md +215 -0
  32. package/skills/realign/references/architecture-and-structure.md +271 -0
  33. package/skills/realign/references/control-flow-and-errors.md +344 -0
  34. package/skills/realign/references/tests-dependencies-and-security.md +261 -0
  35. package/skills/realign/scripts/resolve_assessment.py +1525 -0
  36. package/skills/simplify/SKILL.md +174 -0
  37. package/skills/systematic-debugging/SKILL.md +2 -0
  38. package/skills/systematic-debugging/scripts/repository_evidence.py +17 -4
  39. package/skills/tidy/SKILL.md +13 -1
  40. package/skills/tidy/scripts/run_tidy.py +51 -3
@@ -0,0 +1,344 @@
1
+ # Control flow and error catalog
2
+
3
+ Use this catalog with the
4
+ [errors and reliability profile](../../_support/docs/review/common.md#errors-and-reliability) and the
5
+ [language-routing contract](../../_support/docs/review/language-routing.md). Apply the error model of the
6
+ target language. Exceptions, error values, result types, status values, and cancellation signals can
7
+ carry the same policy concerns.
8
+
9
+ Handle a failure at the nearest responsible boundary. This is the nearest boundary that has enough
10
+ policy context to complete recovery, cleanup, compensation, bounded retry, redaction, translation,
11
+ termination, or another specified outcome. It is not always the local function. It is not always the
12
+ outermost boundary. If a layer cannot complete the outcome, preserve the cause and propagate the
13
+ failure.
14
+
15
+ Do not infer a defect from branch count, nesting depth, exception count, or a generated diagnostic.
16
+ Confirm a reachable behavior or architecture effect. Route the lead to `retain` when the evidence
17
+ does not support a change.
18
+
19
+ ## Branch or guard structure that hides a state model
20
+
21
+ - **Signal:** Nested conditions, repeated predicates, Boolean flags, early exits, and switch branches
22
+ encode combinations of the same domain state. Different branches perform the same transition or
23
+ use incompatible transition rules.
24
+ - **Required evidence:** Enumerate the reachable states and transitions. Identify repeated decisions,
25
+ unreachable paths, or inconsistent outcomes. Bind them to a contract, caller, or test. A complexity
26
+ score or nesting threshold is not sufficient evidence.
27
+ - **Impact:** State the incorrect transition, hidden invariant, duplicate policy, or maintenance
28
+ action that the flow causes.
29
+ - **Legitimate counterexample:** Retain explicit branches when they are the clearest form of a small
30
+ decision. Retain a decision table or state machine when the domain has necessary states and the
31
+ repository makes their transitions explicit.
32
+ - **Smallest safe correction:** Name the state or predicate one time at its owner. Use an existing
33
+ state type, decision table, or guard form when it makes the transitions explicit. Do not add a
34
+ framework only to reduce nesting.
35
+ - **Validation:** Test each applicable transition, boundary value, and invalid state. Confirm that the
36
+ refactor starts from a green behavior baseline.
37
+ - **Routing owner:** Use `realign` for state or policy restructuring. Use `simplify` when branch
38
+ deletion is the complete evidence-backed correction. Use `systematic-debugging` first when a
39
+ branch has a current behavior defect.
40
+ - **Applicable principles:** [P012](../../_support/docs/principles/README.md#p012),
41
+ [P014](../../_support/docs/principles/README.md#p014),
42
+ [P019](../../_support/docs/principles/README.md#p019),
43
+ [P020](../../_support/docs/principles/README.md#p020),
44
+ [P070](../../_support/docs/principles/README.md#p070),
45
+ [P072](../../_support/docs/principles/README.md#p072), and
46
+ [P075](../../_support/docs/principles/README.md#p075).
47
+ - **Sources:** [Athena behavior-first testing contract](../../_support/docs/review/behavior-first-testing.md),
48
+ [AISlop rule catalog](https://github.com/scanaislop/aislop/blob/v0.16.0/docs/rules.md), and
49
+ [a practitioner discussion of generated nesting and broad catches](https://news.ycombinator.com/item?id=45535937).
50
+
51
+ ## Duplicate validation or validation at the wrong boundary
52
+
53
+ - **Signal:** Core functions repeatedly check a representation that an earlier trusted boundary
54
+ already validated. Parsing, normalization, validation, and operation occur in many layers. An
55
+ external or trust boundary has no validation, while downstream code adds defensive guards.
56
+ - **Required evidence:** Identify the trust and construction boundaries. Trace the value from its
57
+ untrusted form to its trusted form. Show the duplicated invariant or the path that can bypass
58
+ validation. Similar checks are not sufficient evidence when they enforce different contracts.
59
+ - **Impact:** State the inconsistent rejection, missing protection, branch growth, type erosion, or
60
+ duplicate maintenance that the placement causes.
61
+ - **Legitimate counterexample:** Retain independent checks for different trust boundaries. Retain a
62
+ check near a destructive operation when state can change after initial validation. Retain defense
63
+ in depth when the controls do not share one failure cause.
64
+ - **Smallest safe correction:** Parse and validate at each applicable trust boundary. Pass a trusted
65
+ representation to core logic. Remove downstream checks only after all bypass paths and time-of-use
66
+ changes are excluded.
67
+ - **Validation:** Test malformed, boundary, and valid inputs at the public boundary. Test direct
68
+ internal entry points when they are supported contracts. Run the repository-selected type and
69
+ schema checks.
70
+ - **Routing owner:** Use `realign` to move or strengthen a validation boundary. Use `simplify` for
71
+ duplicate checks only after evidence proves that the authoritative boundary is complete.
72
+ - **Applicable principles:** [P011](../../_support/docs/principles/README.md#p011),
73
+ [P012](../../_support/docs/principles/README.md#p012),
74
+ [P014](../../_support/docs/principles/README.md#p014),
75
+ [P015](../../_support/docs/principles/README.md#p015),
76
+ [P019](../../_support/docs/principles/README.md#p019),
77
+ [P072](../../_support/docs/principles/README.md#p072),
78
+ [P053](../../_support/docs/principles/README.md#p053),
79
+ [P054](../../_support/docs/principles/README.md#p054), and
80
+ [P076](../../_support/docs/principles/README.md#p076).
81
+ - **Sources:** [Athena architecture and simplicity profile](../../_support/docs/review/common.md#architecture-and-simplicity),
82
+ [GitHub guidance for review of generated code](https://docs.github.com/en/copilot/tutorials/review-ai-generated-code),
83
+ and [AISlop rule catalog](https://github.com/scanaislop/aislop/blob/v0.16.0/docs/rules.md).
84
+
85
+ ## Hidden default or semantic fallback
86
+
87
+ - **Signal:** A catch, error branch, null-coalescing path, or feature fallback returns an empty,
88
+ cached, permissive, or default result without a public contract for that result. The caller cannot
89
+ distinguish success from degraded operation.
90
+ - **Required evidence:** Trace the reachable failure to the fallback and its consumers. Identify the
91
+ stated result contract, security state, freshness rule, and observability requirement. A default
92
+ value is not sufficient evidence when it is part of the documented contract.
93
+ - **Impact:** State the incorrect success signal, stale result, denied diagnostic, weakened security,
94
+ or state divergence that the fallback causes.
95
+ - **Legitimate counterexample:** Retain a documented graceful-degradation mode when it keeps correct
96
+ and secure operation. Retain a fail-safe outer boundary when its contract requires continued
97
+ service, records sufficient evidence, and puts state in a safe condition.
98
+ - **Smallest safe correction:** Make the degraded outcome explicit or propagate the failure to the
99
+ nearest responsible boundary. Remove a fallback only when all consumers can handle the corrected
100
+ contract.
101
+ - **Validation:** Test dependency failure, stale data, invalid input, and degraded operation that
102
+ apply. Verify the public status, error, state, and structured diagnostic.
103
+ - **Routing owner:** Use `realign` for fallback-policy or boundary repair. Use `simplify` only when
104
+ the fallback is dead or redundant and safe deletion is complete.
105
+ - **Applicable principles:** [P014](../../_support/docs/principles/README.md#p014),
106
+ [P019](../../_support/docs/principles/README.md#p019),
107
+ [P029](../../_support/docs/principles/README.md#p029),
108
+ [P030](../../_support/docs/principles/README.md#p030),
109
+ [P031](../../_support/docs/principles/README.md#p031),
110
+ [P032](../../_support/docs/principles/README.md#p032),
111
+ [P033](../../_support/docs/principles/README.md#p033),
112
+ [P034](../../_support/docs/principles/README.md#p034), and
113
+ [P036](../../_support/docs/principles/README.md#p036).
114
+ - **Sources:** [Athena errors and reliability profile](../../_support/docs/review/common.md#errors-and-reliability),
115
+ [AISlop rule catalog](https://github.com/scanaislop/aislop/blob/v0.16.0/docs/rules.md), and
116
+ [a reproduced exception-handling regression report](https://github.com/anthropics/claude-code/issues/40355).
117
+
118
+ ## Error handling without policy ownership
119
+
120
+ - **Signal:** A local function catches or converts all failures but cannot recover, retry, compensate,
121
+ redact, translate a public contract, or stop correctly. An outer boundary handles unrelated
122
+ failures with one outcome. Intermediate layers repeatedly change the error form.
123
+ - **Required evidence:** Map the initial cause through each boundary. For every handler, identify its
124
+ policy decision and ability to complete that decision. Show the consumer contract and state after
125
+ failure. Catch width alone is not sufficient evidence.
126
+ - **Impact:** State the lost cause, incorrect response, duplicate handling, unsafe continuation, or
127
+ policy coupling that the boundary causes.
128
+ - **Legitimate counterexample:** Retain local handling when it completes a specified recovery or
129
+ cleanup policy. Retain an outer safety boundary when it must isolate one request, task, or event and
130
+ it records the failure before safe continuation.
131
+ - **Smallest safe correction:** Keep handling at the nearest boundary that owns the outcome. If the
132
+ current layer has no outcome to select, preserve type, cause, and useful context, and propagate one
133
+ time. Do not move all handling to the outermost boundary as a universal rule.
134
+ - **Validation:** Test each public error outcome, recovery path, cleanup path, and failure state.
135
+ Verify language-specific cause chaining or error wrapping. Confirm that one policy owner handles
136
+ each failure.
137
+ - **Routing owner:** Use `realign` for error-boundary repair. Use `systematic-debugging` before repair
138
+ when evidence shows an active failure. Route a redundant catch that can be deleted without another
139
+ structural change to `simplify`.
140
+ - **Applicable principles:** [P012](../../_support/docs/principles/README.md#p012),
141
+ [P019](../../_support/docs/principles/README.md#p019),
142
+ [P029](../../_support/docs/principles/README.md#p029),
143
+ [P030](../../_support/docs/principles/README.md#p030),
144
+ [P031](../../_support/docs/principles/README.md#p031),
145
+ [P032](../../_support/docs/principles/README.md#p032).
146
+ - **Sources:** [Athena errors and reliability profile](../../_support/docs/review/common.md#errors-and-reliability),
147
+ [Exception Handling Bugs in Python](https://doi.org/10.1016/j.infsof.2026.108264), and
148
+ [a practitioner discussion of blanket catches](https://news.ycombinator.com/item?id=45535937).
149
+
150
+ ## Duplicate handling or lost causal information
151
+
152
+ - **Signal:** Code catches, logs, and throws the same failure without a policy decision. It converts
153
+ all causes to one string, Boolean, null value, or generic status. Several layers emit the same
154
+ failure as separate incidents. A replacement error omits the initial cause.
155
+ - **Required evidence:** Trace error identity, cause, context, and diagnostics from source to the
156
+ responsible boundary. Identify the information that a caller or operator needs. Similar log
157
+ messages alone are not sufficient evidence.
158
+ - **Impact:** State the incorrect classification, duplicate alert, lost diagnosis, false success, or
159
+ public-contract error that results.
160
+ - **Legitimate counterexample:** Retain a local span event, metric, or context addition when it has a
161
+ distinct observability purpose and keeps correlation. Retain public translation that intentionally
162
+ redacts sensitive detail while the internal cause remains available to the authorized operator.
163
+ - **Smallest safe correction:** Select one policy owner for handling. Preserve the language-specific
164
+ causal chain when context or a public error type is added. Emit one operator incident with stable
165
+ correlation. Do not expose secrets to preserve diagnostics.
166
+ - **Validation:** Test error classification and public translation. Inspect the cause chain and
167
+ structured diagnostics. Confirm that failure telemetry is neither absent nor duplicated.
168
+ - **Routing owner:** Use `realign` for error-contract or observability ownership changes. Use
169
+ `simplify` when removal of an unchanged catch or duplicate log is the complete safe correction.
170
+ - **Applicable principles:** [P014](../../_support/docs/principles/README.md#p014),
171
+ [P019](../../_support/docs/principles/README.md#p019),
172
+ [P029](../../_support/docs/principles/README.md#p029),
173
+ [P030](../../_support/docs/principles/README.md#p030),
174
+ [P031](../../_support/docs/principles/README.md#p031),
175
+ [P032](../../_support/docs/principles/README.md#p032), and
176
+ [P047](../../_support/docs/principles/README.md#p047).
177
+ - **Sources:** [Athena language-routing contract](../../_support/docs/review/language-routing.md),
178
+ [AISlop rule catalog](https://github.com/scanaislop/aislop/blob/v0.16.0/docs/rules.md), and
179
+ [a reproduced exception-handling regression report](https://github.com/anthropics/claude-code/issues/40355).
180
+
181
+ ## Unsafe or duplicate retry policy
182
+
183
+ - **Signal:** A loop retries all failures, has no finite budget, or repeats a non-idempotent effect.
184
+ Several layers retry the same operation. Timeouts cause retries that continue after the caller has
185
+ stopped. A circuit breaker or backoff is added without dependency-failure evidence.
186
+ - **Required evidence:** Identify the retry owner, transient-failure classification, total deadline,
187
+ attempt budget, idempotency or reconciliation mechanism, and retries in lower or higher layers.
188
+ Show the duplicate effect or availability requirement. The presence or absence of retry code alone
189
+ is not sufficient evidence.
190
+ - **Impact:** State the duplicate side effect, request amplification, delayed failure, capacity loss,
191
+ or unmet availability contract.
192
+ - **Legitimate counterexample:** Retain a repository or client-library retry when it has the complete
193
+ policy, obeys the caller deadline, and makes repeated effects safe. Do not require retry for a
194
+ permanent failure or an operation that cannot repeat safely.
195
+ - **Smallest safe correction:** Give one responsible boundary the retry policy. Make the operation
196
+ idempotent or reconcilable before retry. Classify transient failures and use a finite budget within
197
+ the caller deadline. Add backoff or a circuit breaker only when operation evidence requires it.
198
+ - **Validation:** Use controlled failure injection. Test the maximum attempt count, permanent
199
+ failure, deadline, cancellation, repeated side effects, and success after a transient failure.
200
+ - **Routing owner:** Use `realign`. Use `systematic-debugging` first for a reproduced retry defect.
201
+ Use `simplify` when an extra retry layer can be removed with no other contract change.
202
+ - **Applicable principles:** [P012](../../_support/docs/principles/README.md#p012),
203
+ [P014](../../_support/docs/principles/README.md#p014),
204
+ [P019](../../_support/docs/principles/README.md#p019),
205
+ [P029](../../_support/docs/principles/README.md#p029),
206
+ [P030](../../_support/docs/principles/README.md#p030),
207
+ [P037](../../_support/docs/principles/README.md#p037),
208
+ [P038](../../_support/docs/principles/README.md#p038), and
209
+ [P070](../../_support/docs/principles/README.md#p070).
210
+ - **Sources:** [Athena errors and reliability profile](../../_support/docs/review/common.md#errors-and-reliability)
211
+ and [AWS guidance for timeouts and retries](https://aws.amazon.com/builders-library/timeouts-retries-and-backoff-with-jitter/).
212
+
213
+ ## Missing or broken timeout and cancellation propagation
214
+
215
+ - **Signal:** An external operation, lock, queue wait, or child task has no applicable bound. Code
216
+ catches or replaces cancellation. A child operation outlives its owner. A timeout is reported as
217
+ success or as an unrelated failure.
218
+ - **Required evidence:** Identify the lifecycle owner, caller deadline, cancellation source, cleanup
219
+ duties, and result contract. Show a reachable unbounded wait, orphaned operation, or lost
220
+ cancellation. A function without a timeout parameter is not sufficient evidence.
221
+ - **Impact:** State the resource leak, capacity loss, stale write, delayed shutdown, or incorrect
222
+ caller outcome.
223
+ - **Legitimate counterexample:** Retain a process-lifetime task, local bounded computation, or
224
+ framework-managed deadline when its owner and termination contract are explicit. Retain a cleanup
225
+ operation after cancellation when it has its own safe bound.
226
+ - **Smallest safe correction:** Propagate the existing cancellation or deadline through the supported
227
+ interface. Give child work the owner lifecycle. On cancellation, stop new work and release owned
228
+ resources. Preserve the cancellation outcome.
229
+ - **Validation:** Use controlled time and explicit synchronization. Test cancellation before start,
230
+ during work, and during cleanup. Test deadline expiry and shutdown. Do not use a wall-clock sleep
231
+ as the only proof.
232
+ - **Routing owner:** Use `realign`. Use `systematic-debugging` first when the repository has a
233
+ reproduced hang or orphaned task. Use `simplify` only for a proven unused timeout wrapper.
234
+ - **Applicable principles:** [P012](../../_support/docs/principles/README.md#p012),
235
+ [P014](../../_support/docs/principles/README.md#p014),
236
+ [P019](../../_support/docs/principles/README.md#p019),
237
+ [P029](../../_support/docs/principles/README.md#p029),
238
+ [P030](../../_support/docs/principles/README.md#p030),
239
+ [P039](../../_support/docs/principles/README.md#p039),
240
+ [P070](../../_support/docs/principles/README.md#p070), and
241
+ [P082](../../_support/docs/principles/README.md#p082).
242
+ - **Sources:** [Athena behavior-first testing contract](../../_support/docs/review/behavior-first-testing.md),
243
+ [Athena language-routing contract](../../_support/docs/review/language-routing.md), and
244
+ [AWS guidance for timeouts and retries](https://aws.amazon.com/builders-library/timeouts-retries-and-backoff-with-jitter/).
245
+
246
+ ## Partial state change without atomicity or compensation
247
+
248
+ - **Signal:** One logical operation writes multiple state owners and can stop between writes. A catch
249
+ continues after partial progress without a state contract. Compensation is best-effort but has no
250
+ durable progress, idempotency, or reconciliation rule.
251
+ - **Required evidence:** Identify the invariant, commit boundaries, irreversible step, each failure
252
+ point, and state after interruption. Show that one transaction is possible or that the distributed
253
+ workflow needs compensation. Multiple writes are not sufficient evidence when partial progress is
254
+ the documented state.
255
+ - **Impact:** State the lost update, duplicate effect, unrecoverable state, incorrect resume, or
256
+ operator action that can result.
257
+ - **Legitimate counterexample:** Retain an eventually consistent or resumable workflow when progress,
258
+ reconciliation, idempotency, and operator recovery are explicit and tested. Retain independent
259
+ writes when they do not share an invariant.
260
+ - **Smallest safe correction:** Use one existing transaction when all changes share its boundary. If
261
+ one transaction is not possible, record durable progress and define idempotent compensation or
262
+ roll-forward. Put the irreversible action after applicable validation and reversible work.
263
+ - **Validation:** Inject a failure at each material step. Test retry, compensation, resume, duplicate
264
+ delivery, and rollback or roll-forward. Verify the invariant after each outcome.
265
+ - **Routing owner:** Use `realign`. Use `systematic-debugging` first for reproduced data loss or state
266
+ corruption. A dead rollback path can use `simplify` only after the replacement recovery contract is
267
+ proved.
268
+ - **Applicable principles:** [P011](../../_support/docs/principles/README.md#p011),
269
+ [P012](../../_support/docs/principles/README.md#p012),
270
+ [P014](../../_support/docs/principles/README.md#p014),
271
+ [P019](../../_support/docs/principles/README.md#p019),
272
+ [P021](../../_support/docs/principles/README.md#p021),
273
+ [P044](../../_support/docs/principles/README.md#p044),
274
+ [P045](../../_support/docs/principles/README.md#p045),
275
+ [P046](../../_support/docs/principles/README.md#p046),
276
+ [P070](../../_support/docs/principles/README.md#p070), and
277
+ [P083](../../_support/docs/principles/README.md#p083).
278
+ - **Sources:** [Athena errors and reliability profile](../../_support/docs/review/common.md#errors-and-reliability)
279
+ and [Microsoft compensating-transaction guidance](https://learn.microsoft.com/en-us/azure/architecture/patterns/compensating-transaction).
280
+
281
+ ## Unclear resource or task lifetime
282
+
283
+ - **Signal:** A file, connection, lock, transaction, subscription, temporary file, child process, or
284
+ asynchronous task has no clear owner. Cleanup occurs only on success. Cleanup failure replaces the
285
+ initial failure without an explicit policy. A detached task has no result consumer.
286
+ - **Required evidence:** Trace acquisition, ownership transfer, use, release, and all failure exits.
287
+ Identify the repository or language lifetime convention. Show a reachable leak, deadlock, orphan,
288
+ lost failure, or invalid cleanup order. Manual cleanup alone is not sufficient evidence.
289
+ - **Impact:** State the resource exhaustion, blocked progress, data loss, duplicate work, or lost
290
+ diagnostic that can result.
291
+ - **Legitimate counterexample:** Retain a process-lifetime pool, framework-owned resource, or detached
292
+ operation when its owner, shutdown, failure, and capacity contracts are explicit. Retain explicit
293
+ cleanup when the language does not supply a safer construct.
294
+ - **Smallest safe correction:** Give the resource one owner. Use the repository's existing scoped
295
+ lifetime mechanism. Release resources on every applicable exit. Preserve the initial cause when
296
+ cleanup also fails, according to the public error policy.
297
+ - **Validation:** Test success, operation failure, cleanup failure, cancellation, and repeated use.
298
+ Use repository tools that can detect leaks, races, or unreleased locks when the execution boundary
299
+ permits them.
300
+ - **Routing owner:** Use `realign`. Use `systematic-debugging` first for a reproduced leak, race, or
301
+ deadlock. Use `simplify` when an unused resource layer can be removed safely.
302
+ - **Applicable principles:** [P012](../../_support/docs/principles/README.md#p012),
303
+ [P014](../../_support/docs/principles/README.md#p014),
304
+ [P019](../../_support/docs/principles/README.md#p019),
305
+ [P029](../../_support/docs/principles/README.md#p029),
306
+ [P030](../../_support/docs/principles/README.md#p030),
307
+ [P032](../../_support/docs/principles/README.md#p032), and
308
+ [P079](../../_support/docs/principles/README.md#p079).
309
+ - **Sources:** [Athena language-routing contract](../../_support/docs/review/language-routing.md),
310
+ [Athena errors and reliability profile](../../_support/docs/review/common.md#errors-and-reliability), and
311
+ [Exception Handling Bugs in Python](https://doi.org/10.1016/j.infsof.2026.108264).
312
+
313
+ ## Detached or uncoordinated concurrent work
314
+
315
+ - **Signal:** Code starts parallel work without a measured need, shared-state contract, result owner,
316
+ sibling-failure policy, cancellation rule, or capacity bound. One task failure is ignored while
317
+ other tasks continue to change state.
318
+ - **Required evidence:** Identify the concurrency requirement, task owner, shared state,
319
+ synchronization, maximum work, failure aggregation, and cancellation path. Show a reachable race,
320
+ orphan, duplicate effect, or resource growth. Parallel syntax alone is not sufficient evidence.
321
+ - **Impact:** State the incorrect result, state race, failure loss, shutdown delay, or capacity
322
+ problem.
323
+ - **Legitimate counterexample:** Retain repository-standard structured concurrency or a supervised
324
+ background task when ownership, failure, cancellation, and resource limits are explicit. Retain
325
+ concurrency when reproducible measurements show its need.
326
+ - **Smallest safe correction:** Use the existing lifecycle owner and structured concurrency
327
+ mechanism. Collect every result. Define sibling behavior after failure. Propagate cancellation and
328
+ cap concurrent work. Remove concurrency only when behavior and measured requirements permit it.
329
+ - **Validation:** Use deterministic synchronization and race detection when available. Test one and
330
+ multiple failures, cancellation, shutdown, capacity, and ordering-independent outcomes.
331
+ - **Routing owner:** Use `realign`. Use `systematic-debugging` first for a reproduced race or lost
332
+ result. Use `simplify` when unnecessary concurrency can be removed with no behavior change.
333
+ - **Applicable principles:** [P012](../../_support/docs/principles/README.md#p012),
334
+ [P014](../../_support/docs/principles/README.md#p014),
335
+ [P019](../../_support/docs/principles/README.md#p019),
336
+ [P020](../../_support/docs/principles/README.md#p020),
337
+ [P070](../../_support/docs/principles/README.md#p070),
338
+ [P072](../../_support/docs/principles/README.md#p072),
339
+ [P080](../../_support/docs/principles/README.md#p080), and
340
+ [P082](../../_support/docs/principles/README.md#p082).
341
+ - **Sources:** [Athena errors and reliability profile](../../_support/docs/review/common.md#errors-and-reliability),
342
+ [Athena behavior-first testing contract](../../_support/docs/review/behavior-first-testing.md),
343
+ [Athena language-routing contract](../../_support/docs/review/language-routing.md), and
344
+ [Notes on structured concurrency](https://vorpus.org/blog/notes-on-structured-concurrency-or-go-statement-considered-harmful/).
@@ -0,0 +1,261 @@
1
+ # Tests, dependencies, security, and evidence
2
+
3
+ Read the [shared review contract](../../_support/docs/review/common.md), the
4
+ [behavior-first testing contract](../../_support/docs/review/behavior-first-testing.md), and the
5
+ [language-routing contract](../../_support/docs/review/language-routing.md) before you use this catalog.
6
+ Apply the [ASD-STE100 technical-English policy](../../TECHNICAL_ENGLISH.md) to the assessment and
7
+ repair output.
8
+
9
+ Use each pattern as an investigation signal. Do not infer authorship from a pattern. Do not make a
10
+ finding until the required evidence shows an effect on behavior, architecture, security, or
11
+ maintenance. A scanner result, metric, test name, or passing command is not sufficient evidence.
12
+
13
+ ## Test theater, weak oracles, and mock-only proof
14
+
15
+ - **Signal:** A test asserts mock calls, private call order, snapshots of internal layout, or fixed
16
+ values without an observable product result. Expected values come from the implementation or the
17
+ same speculative hypothesis as the change. A snapshot or golden file has no authoritative
18
+ contract. The product path can be absent or wrong while the test stays green.
19
+ - **Required evidence:** Identify the product contract. Trace the test input through real product
20
+ code to the assertion. Bind an independent oracle, property, metamorphic relation, canonical
21
+ implementation, or authoritative example. Show the missing connection between the assertion and
22
+ the contract. Inspect the substitute boundary, test runner, and applicable callers. Try a bounded
23
+ falsification or negative control before you trust the oracle.
24
+ - **Impact:** A regression can pass the suite. A refactor can require test changes although product
25
+ behavior does not change. A self-derived oracle can certify the same incorrect assumption as the
26
+ implementation.
27
+ - **Legitimate counterexample:** A controlled substitute represents a real external boundary. The
28
+ test exercises core product code and asserts the observable result or failure contract. An
29
+ approved snapshot or golden file is itself the public compatibility contract.
30
+ - **Smallest safe correction:** Keep substitutes only at external boundaries. Assert the observable
31
+ contract. Derive expected results independently from the implementation. Add the smallest
32
+ falsifying, boundary, or property case that distinguishes the incorrect hypothesis. Remove
33
+ duplicate implementation assertions only after the behavior test gives equivalent coverage.
34
+ - **Validation:** Run the focused test and confirm that it selects an applicable test. Exercise the
35
+ product path and the applicable failure path. Confirm that a controlled wrong implementation or
36
+ counterexample makes the test fail. Use repository-approved mutation testing only when it is
37
+ already available and proportionate to the risk.
38
+ - **Routing owner:** Use `realign` for test-architecture repair. Use `systematic-debugging` when the
39
+ test exposes an observed defect. Use `simplify` for proven duplicate or obsolete tests.
40
+ - **Applicable principles:** [P022](../../_support/docs/principles/README.md#p022),
41
+ [P027](../../_support/docs/principles/README.md#p027),
42
+ [P028](../../_support/docs/principles/README.md#p028),
43
+ [P064](../../_support/docs/principles/README.md#p064), and
44
+ [P067](../../_support/docs/principles/README.md#p067).
45
+ - **Sources:** [Athena behavior-first testing](../../_support/docs/review/behavior-first-testing.md),
46
+ [Are Coding Agents Generating Over-Mocked Tests? An Empirical Study](https://andrehora.github.io/pub/2026-msr-agents-over-mocked-tests.pdf),
47
+ [EvalPlus](https://arxiv.org/abs/2305.01210), and
48
+ [OpenAI Codex issue 40639](https://github.com/openai/codex/issues/40639).
49
+
50
+ ## Asynchronous false-green tests and empty selection
51
+
52
+ - **Signal:** A test starts asynchronous work but does not await or join it. An exception occurs
53
+ after the runner reports success. A filtered command selects no tests. A test fixture hides
54
+ cancellation, timeout, or cleanup behavior.
55
+ - **Required evidence:** Inspect the test signature, scheduler boundary, returned task or promise,
56
+ runner configuration, and assertion path. Record the selected-test count. Trace asynchronous
57
+ failures to the runner result.
58
+ - **Impact:** The suite can report success before the behavior finishes. Failure, cancellation, and
59
+ cleanup regressions can be invisible.
60
+ - **Legitimate counterexample:** A framework-required event handler cannot return an awaitable value,
61
+ and a separate observable completion contract captures its result and errors.
62
+ - **Smallest safe correction:** Await or join all work that is part of the contract. Replace ambient
63
+ delays with explicit synchronization. Make failures reach the test runner. Make filtered commands
64
+ prove that they selected the intended test.
65
+ - **Validation:** Run the focused test with a controlled failure, timeout, and cancellation when
66
+ these paths apply. Confirm deterministic completion and a nonzero applicable-test count.
67
+ - **Routing owner:** Use `realign` for test-lifecycle repair. Use `systematic-debugging` for a
68
+ reproduced product defect.
69
+ - **Applicable principles:** [P022](../../_support/docs/principles/README.md#p022),
70
+ [P027](../../_support/docs/principles/README.md#p027),
71
+ [P028](../../_support/docs/principles/README.md#p028),
72
+ [P064](../../_support/docs/principles/README.md#p064), and
73
+ [P065](../../_support/docs/principles/README.md#p065).
74
+ - **Sources:** [Athena behavior-first testing](../../_support/docs/review/behavior-first-testing.md),
75
+ the [AISlop 0.16.0 rules reference](https://github.com/scanaislop/aislop/blob/v0.16.0/docs/rules.md),
76
+ and [Unit Testing Asynchronous Code](https://learn.microsoft.com/en-us/archive/msdn-magazine/2014/november/async-programming-unit-testing-asynchronous-code).
77
+
78
+ ## Weakened validation gates
79
+
80
+ - **Signal:** A change skips, deletes, disables, or marks an applicable test as an expected failure.
81
+ It lowers a threshold, adds a silent continuation, excludes an applicable path, or suppresses a
82
+ diagnostic without an approved exception.
83
+ - **Required evidence:** Bind the gate definition, repository policy, current result, change history,
84
+ and affected requirement. Show that the change reduces applicable coverage or changes a failure
85
+ into success. Distinguish a pre-existing failure from a new regression.
86
+ - **Impact:** Continuous integration (CI) can accept a defect or a policy violation. A passing badge
87
+ can give false confidence.
88
+ - **Legitimate counterexample:** Evidence proves that a test or check is obsolete, inapplicable, or
89
+ replaced with equal or stronger coverage. An authoritative process records a narrow exception with
90
+ an owner and an end condition.
91
+ - **Smallest safe correction:** Correct the product or gate cause. Restore the applicable check. If
92
+ the contract changed, replace the old check with a behavior test that traces to the new contract.
93
+ - **Validation:** Run the focused check and all required repository gates. Record the command,
94
+ revision, environment, exit status, and unedited output.
95
+ - **Routing owner:** Use `realign` for validation-architecture repair. Use `simplify` only after
96
+ evidence proves that a gate artifact is obsolete. Require qualified review when the gate protects
97
+ security or availability.
98
+ - **Applicable principles:** [P063](../../_support/docs/principles/README.md#p063),
99
+ [P064](../../_support/docs/principles/README.md#p064),
100
+ [P065](../../_support/docs/principles/README.md#p065),
101
+ [P067](../../_support/docs/principles/README.md#p067),
102
+ [P068](../../_support/docs/principles/README.md#p068),
103
+ [P069](../../_support/docs/principles/README.md#p069), and
104
+ [P070](../../_support/docs/principles/README.md#p070).
105
+ - **Sources:** [GitHub guidance for review of AI-generated code](https://docs.github.com/en/copilot/tutorials/review-ai-generated-code).
106
+
107
+ ## Fictional APIs, dependencies, and missed reuse
108
+
109
+ - **Signal:** Code imports an undeclared or unresolved package. It calls a symbol that the bound
110
+ dependency version does not provide. It adds a package or wrapper although the repository,
111
+ language, framework, or standard library already owns the capability.
112
+ - **Required evidence:** Inspect manifests, locks, generated sources, package resolution, the exact
113
+ dependency version, authoritative API documentation, current repository mechanisms, and runtime
114
+ consumers. Confirm that dynamic loading or generation does not supply the symbol.
115
+ - **Impact:** Builds or runtime paths can fail. A new package can add maintenance, license, security,
116
+ and supply-chain work. Duplicate mechanisms can cause architecture drift.
117
+ - **Legitimate counterexample:** The import is an intentional optional peer, plug-in, generated
118
+ surface, platform branch, or vendored capability with a documented loading and validation contract.
119
+ - **Smallest safe correction:** Use the existing narrow mechanism when it meets the requirement.
120
+ Correct the API call to the bound version. Add a dependency only when a current requirement and its
121
+ supply-chain evidence make that addition necessary.
122
+ - **Validation:** Resolve and build from the bound lockfile in an authorized isolated environment.
123
+ Exercise the reachable behavior. Verify that no stale import, symbol, or wrapper remains.
124
+ - **Routing owner:** Use `simplify` for an unused dependency or a safely removable duplicate. Use `realign`
125
+ for dependency-direction, ownership, or interface repair. Use `systematic-debugging` for a
126
+ reproduced behavior defect.
127
+ - **Applicable principles:** [P012](../../_support/docs/principles/README.md#p012),
128
+ [P015](../../_support/docs/principles/README.md#p015),
129
+ [P057](../../_support/docs/principles/README.md#p057), and
130
+ [P074](../../_support/docs/principles/README.md#p074).
131
+ - **Sources:** [GitHub guidance for review of AI-generated code](https://docs.github.com/en/copilot/tutorials/review-ai-generated-code)
132
+ and [We Have a Package for You!](https://www.usenix.org/conference/usenixsecurity25/presentation/spracklen).
133
+
134
+ ## Dependency trust and provenance
135
+
136
+ - **Signal:** A change adds or updates a dependency, uses a mutable source reference, leaves a lock
137
+ mismatch, trusts a package name as identity, enables an install-time script, or adds permissions
138
+ and transitive dependencies without a stated need.
139
+ - **Required evidence:** Bind the package identity, source, version, lock entry, checksum or signature,
140
+ provenance, license, maintainer status, advisories, lifecycle scripts, permissions, transitive
141
+ graph, and the current requirement. Inspect repository dependency policy.
142
+ - **Impact:** The change can execute untrusted code, introduce a vulnerable or deceptive package,
143
+ expand privileges, or create an unmaintained build input.
144
+ - **Legitimate counterexample:** Repository policy already approves the exact pinned artifact. The
145
+ dependency is necessary, its provenance is verified, its authority is bounded, and no existing
146
+ mechanism meets the requirement.
147
+ - **Smallest safe correction:** Remove or replace an unnecessary dependency. Otherwise, pin and lock
148
+ the approved artifact. Keep provenance and integrity evidence. Disable unnecessary lifecycle
149
+ behavior and permissions. Do not install a package under `realign` authority alone.
150
+ - **Validation:** Use repository-approved software composition analysis and lock verification. In an
151
+ authorized isolated environment, reproduce installation and required behavior from the lock.
152
+ - **Routing owner:** Use `simplify` for proven removal. Use `realign` for dependency-boundary repair. Stop for
153
+ explicit authority when the correction needs an installation, license decision, credential, or
154
+ external write.
155
+ - **Applicable principles:** [P048](../../_support/docs/principles/README.md#p048),
156
+ [P050](../../_support/docs/principles/README.md#p050),
157
+ [P055](../../_support/docs/principles/README.md#p055),
158
+ [P057](../../_support/docs/principles/README.md#p057),
159
+ [P061](../../_support/docs/principles/README.md#p061), and
160
+ [P062](../../_support/docs/principles/README.md#p062).
161
+ - **Sources:** [GitHub guidance for review of AI-generated code](https://docs.github.com/en/copilot/tutorials/review-ai-generated-code)
162
+ and [We Have a Package for You!](https://www.usenix.org/conference/usenixsecurity25/presentation/spracklen).
163
+
164
+ ## Trust boundaries, authorization, and secrets
165
+
166
+ - **Signal:** Code removes or bypasses authorization. It accepts untrusted data without boundary
167
+ validation. It fails open when security state is unknown. Untrusted input reaches an evaluation,
168
+ command, query, markup, or deserialization sink. A credential or sensitive value appears in code,
169
+ a fixture, a prompt, a log, or an artifact.
170
+ - **Required evidence:** Trace the untrusted source to the protected operation or sink. Bind the
171
+ authorization policy, trust boundary, data classification, validation and encoding rules, failure
172
+ state, and credential owner. Do not print or copy a suspected secret.
173
+ - **Impact:** The defect can disclose data, grant an unauthorized capability, execute injected input,
174
+ or expose a credential.
175
+ - **Legitimate counterexample:** The value is a documented non-secret test token that cannot grant a
176
+ capability. A typed and validated value reaches a context-safe API. An authoritative boundary
177
+ performs complete mediation.
178
+ - **Smallest safe correction:** Restore authorization at the authoritative boundary. Parse, validate,
179
+ constrain, and safely encode untrusted data. Use parameterized APIs. Remove a secret from source and
180
+ history only through an authorized security procedure. Rotate or revoke an exposed credential.
181
+ - **Validation:** Add or run behavior tests for denied access, invalid input, failure state, and safe
182
+ encoding. Run repository-approved secret and security checks. Do not put secret material in the
183
+ validation receipt.
184
+ - **Routing owner:** Use `realign` with a qualified security reviewer. Treat a possible live secret or a
185
+ material authorization bypass as a stop condition. Deleting a secret from one file is not complete
186
+ remediation because it does not revoke the credential or remove history.
187
+ - **Applicable principles:** [P035](../../_support/docs/principles/README.md#p035),
188
+ [P048](../../_support/docs/principles/README.md#p048),
189
+ [P049](../../_support/docs/principles/README.md#p049),
190
+ [P050](../../_support/docs/principles/README.md#p050),
191
+ [P051](../../_support/docs/principles/README.md#p051),
192
+ [P053](../../_support/docs/principles/README.md#p053),
193
+ [P056](../../_support/docs/principles/README.md#p056), and
194
+ [P069](../../_support/docs/principles/README.md#p069).
195
+ - **Sources:** [AISlop 0.16.0 security rules](https://github.com/scanaislop/aislop/blob/v0.16.0/docs/rules.md#security)
196
+ and the [OWASP Secrets Management Cheat Sheet](https://cheatsheetseries.owasp.org/cheatsheets/Secrets_Management_Cheat_Sheet.html).
197
+
198
+ ## Performance changes without evidence
199
+
200
+ - **Signal:** A change adds a cache, concurrency, batching, pooling, manual memory control, or a more
201
+ complex algorithm without a measured constraint. A claim uses only a complexity warning, intuition,
202
+ or a benchmark result that is not bound to the reviewed revision.
203
+ - **Required evidence:** Identify the product constraint and representative workload. Bind the
204
+ baseline and candidate revisions, environment, benchmark command, samples, variance, resource
205
+ limits, and correctness checks. Separate latency, throughput, memory, and cost claims.
206
+ - **Impact:** Speculative optimization can add state, races, invalidation defects, and maintenance
207
+ work without a useful result.
208
+ - **Legitimate counterexample:** A current requirement or verified resource bound requires the design.
209
+ Evidence shows the constraint, and the repository already uses the selected mechanism.
210
+ - **Smallest safe correction:** Remove speculative complexity when it has no current requirement.
211
+ Otherwise, measure first and make the smallest change that satisfies the measured constraint.
212
+ - **Validation:** Reproduce the baseline and candidate measurements in the same controlled
213
+ environment. Run behavior, failure, concurrency, and resource-limit tests that the change affects.
214
+ - **Routing owner:** Use `realign` for an evidenced structural correction. Use `simplify` to remove
215
+ speculative machinery. Use `retain` when evidence does not support a change.
216
+ - **Applicable principles:** [P065](../../_support/docs/principles/README.md#p065),
217
+ [P072](../../_support/docs/principles/README.md#p072),
218
+ [P073](../../_support/docs/principles/README.md#p073), and
219
+ [P080](../../_support/docs/principles/README.md#p080).
220
+ - **Sources:** [Athena evidence-integrity policy](../../_support/docs/policies/evidence-integrity.md) and
221
+ [Brendan Gregg's performance-analysis methodology](https://www.brendangregg.com/methodology.html).
222
+
223
+ ## Comments, documentation, and excessive churn
224
+
225
+ - **Signal:** A comment only narrates mechanics, refers to an agent or implementation phase, or
226
+ repeats a symbol name. Documentation claims behavior that the product does not have. A change
227
+ includes unrelated formatting, renames, compatibility residue, TODO stubs, or broad rewrites.
228
+ - **Required evidence:** Compare the prose with code, contracts, public behavior, history, generation
229
+ policy, and the requested scope. Identify the maintenance or review effect. Do not use comment
230
+ length or changed-line count alone.
231
+ - **Impact:** Misleading prose can hide an invariant or false behavior claim. Unrelated churn can
232
+ conceal a defect, create conflicts, and make ownership history difficult to inspect.
233
+ - **Legitimate counterexample:** A comment records rationale, a non-obvious invariant, a security
234
+ constraint, compatibility evidence, or a required generation notice. A mechanical rewrite is a
235
+ separately authorized migration with reproducible validation.
236
+ - **Smallest safe correction:** Make code show its mechanics. Keep necessary rationale. Correct
237
+ behavior claims. Remove obsolete prose and unrelated residue only after consumer and history
238
+ evidence makes deletion safe.
239
+ - **Validation:** Run documentation, link, example, formatting, and behavior checks that the changed
240
+ surface activates. Inspect the final diff for unrelated paths and stale identifiers.
241
+ - **Routing owner:** Use `simplify` for safe deletion, consolidation, or churn removal. Use `realign` only
242
+ when prose or churn conceals an architecture, invariant, or contract defect. Otherwise, use
243
+ `retain`.
244
+ - **Applicable principles:** [P010](../../_support/docs/principles/README.md#p010),
245
+ [P014](../../_support/docs/principles/README.md#p014),
246
+ [P066](../../_support/docs/principles/README.md#p066),
247
+ [P070](../../_support/docs/principles/README.md#p070),
248
+ [P086](../../_support/docs/principles/README.md#p086),
249
+ [P087](../../_support/docs/principles/README.md#p087),
250
+ [P088](../../_support/docs/principles/README.md#p088), and
251
+ [P090](../../_support/docs/principles/README.md#p090).
252
+ - **Sources:** [AISlop 0.16.0 rules](https://github.com/scanaislop/aislop/blob/v0.16.0/docs/rules.md),
253
+ [SlopCodeBench](https://arxiv.org/abs/2603.24755), and a
254
+ [practitioner discussion](https://news.ycombinator.com/item?id=45535937).
255
+
256
+ ## Catalog boundary
257
+
258
+ Do not create a finding because a repository contains mocks, comments, dependencies, asynchronous
259
+ code, or optimization. Do not remove a security check as simplification. Do not add a dependency to
260
+ repair an unsupported scanner diagnostic. Route an observed defect through the workflow that owns
261
+ behavior repair. Route a safe subtraction through `simplify`.