@homericintelligence/athena-opencode 0.4.4 → 0.5.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/README.md +30 -17
- package/package.json +2 -2
- package/plugin.js +20 -5
- package/skills/TECHNICAL_ENGLISH.md +78 -0
- package/skills/_cli.py +26 -18
- package/skills/_support/docs/dependency-resolution.md +192 -0
- package/skills/_support/docs/policies/development.md +117 -0
- package/skills/_support/docs/policies/evidence-integrity.md +40 -0
- package/skills/_support/docs/principles/README.md +542 -0
- package/skills/_support/docs/principles/details/p001-kiss.md +114 -0
- package/skills/_support/docs/principles/details/p002-yagni.md +109 -0
- package/skills/_support/docs/principles/details/p003-dry.md +126 -0
- package/skills/_support/docs/principles/details/p004-solid.md +165 -0
- package/skills/_support/docs/principles/details/p005-modularity.md +123 -0
- package/skills/_support/docs/principles/details/p006-principle-of-least-astonishment.md +115 -0
- package/skills/_support/docs/principles/details/p007-subtraction-over-addition.md +113 -0
- package/skills/_support/docs/principles/details/p008-understand-before-subtracting.md +115 -0
- package/skills/_support/docs/principles/details/p009-general-mechanisms-over-special-cases.md +108 -0
- package/skills/_support/docs/principles/details/p010-scope-fidelity.md +117 -0
- package/skills/_support/docs/principles/details/p011-minimal-coherent-change.md +128 -0
- package/skills/_support/docs/principles/details/p012-evidence-before-modification.md +115 -0
- package/skills/_support/docs/principles/details/p013-avoid-hasty-abstractions.md +112 -0
- package/skills/_support/docs/principles/details/p014-preserve-unrequested-behavior.md +110 -0
- package/skills/_support/docs/principles/details/p015-architecture-conformance.md +124 -0
- package/skills/_support/docs/principles/details/p016-separation-of-concerns.md +125 -0
- package/skills/_support/docs/principles/details/p017-high-cohesion-low-coupling.md +130 -0
- package/skills/_support/docs/principles/details/p018-information-hiding.md +128 -0
- package/skills/_support/docs/principles/details/p019-explicit-contracts.md +134 -0
- package/skills/_support/docs/principles/details/p020-executable-architecture.md +130 -0
- package/skills/_support/docs/principles/details/p021-evolutionary-and-reversible-design.md +126 -0
- package/skills/_support/docs/principles/details/p022-test-behavior-not-implementation.md +129 -0
- package/skills/_support/docs/principles/details/p023-parameterized-table-driven-testing.md +129 -0
- package/skills/_support/docs/principles/details/p024-boundary-value-testing.md +128 -0
- package/skills/_support/docs/principles/details/p025-property-based-testing-for-invariants.md +133 -0
- package/skills/_support/docs/principles/details/p026-regression-before-repair.md +134 -0
- package/skills/_support/docs/principles/details/p027-deterministic-and-hermetic-tests.md +128 -0
- package/skills/_support/docs/principles/details/p028-test-failure-paths.md +133 -0
- package/skills/_support/docs/principles/details/p029-generalize-error-policy-preserve-specific-cause.md +131 -0
- package/skills/_support/docs/principles/details/p030-nearest-responsible-error-boundary.md +133 -0
- package/skills/_support/docs/principles/details/p031-propagate-rather-than-swallow.md +131 -0
- package/skills/_support/docs/principles/details/p032-handle-once-preserve-causality.md +137 -0
- package/skills/_support/docs/principles/details/p033-state-safe-failure-semantics.md +140 -0
- package/skills/_support/docs/principles/details/p034-fail-fast.md +132 -0
- package/skills/_support/docs/principles/details/p035-fail-secure-fail-closed.md +137 -0
- package/skills/_support/docs/principles/details/p036-graceful-degradation.md +137 -0
- package/skills/_support/docs/principles/details/p037-idempotency-before-retry.md +139 -0
- package/skills/_support/docs/principles/details/p038-bounded-retry.md +145 -0
- package/skills/_support/docs/principles/details/p039-bounded-waiting.md +151 -0
- package/skills/_support/docs/principles/details/p040-bounded-resources.md +138 -0
- package/skills/_support/docs/principles/details/p041-backpressure-and-load-shedding.md +141 -0
- package/skills/_support/docs/principles/details/p042-fault-isolation-bulkheads.md +140 -0
- package/skills/_support/docs/principles/details/p043-circuit-breakers.md +148 -0
- package/skills/_support/docs/principles/details/p044-atomicity-where-possible.md +141 -0
- package/skills/_support/docs/principles/details/p045-compensation-where-atomicity-is-impossible.md +163 -0
- package/skills/_support/docs/principles/details/p046-resumability.md +138 -0
- package/skills/_support/docs/principles/details/p047-observability-is-part-of-correctness.md +134 -0
- package/skills/_support/docs/principles/details/p048-secure-by-design.md +132 -0
- package/skills/_support/docs/principles/details/p049-secure-by-default.md +126 -0
- package/skills/_support/docs/principles/details/p050-least-privilege.md +123 -0
- package/skills/_support/docs/principles/details/p051-complete-mediation.md +124 -0
- package/skills/_support/docs/principles/details/p052-separation-of-duties.md +129 -0
- package/skills/_support/docs/principles/details/p053-validate-at-trust-boundaries.md +126 -0
- package/skills/_support/docs/principles/details/p054-defense-in-depth.md +135 -0
- package/skills/_support/docs/principles/details/p055-minimize-attack-surface.md +133 -0
- package/skills/_support/docs/principles/details/p056-secrets-stay-out-of-code-and-context.md +137 -0
- package/skills/_support/docs/principles/details/p057-supply-chain-integrity.md +135 -0
- package/skills/_support/docs/principles/details/p058-bounded-agent-authority.md +137 -0
- package/skills/_support/docs/principles/details/p059-data-is-not-instruction.md +130 -0
- package/skills/_support/docs/principles/details/p060-constrain-sub-agents.md +136 -0
- package/skills/_support/docs/principles/details/p061-separate-decision-from-high-impact-execution.md +131 -0
- package/skills/_support/docs/principles/details/p062-human-approval-for-irreversible-or-high-risk-actions.md +129 -0
- package/skills/_support/docs/principles/details/p063-requirement-to-code-traceability.md +116 -0
- package/skills/_support/docs/principles/details/p064-requirement-to-test-traceability.md +116 -0
- package/skills/_support/docs/principles/details/p065-verify-before-claiming-completion.md +129 -0
- package/skills/_support/docs/principles/details/p066-preserve-existing-work.md +114 -0
- package/skills/_support/docs/principles/details/p067-no-test-cheating.md +126 -0
- package/skills/_support/docs/principles/details/p068-no-validation-bypass.md +119 -0
- package/skills/_support/docs/principles/details/p069-independent-review-for-high-risk-changes.md +129 -0
- package/skills/_support/docs/principles/details/p070-code-health-must-not-regress.md +116 -0
- package/skills/_support/docs/principles/details/p071-consistency-over-personal-preference.md +117 -0
- package/skills/_support/docs/principles/details/p072-technical-evidence-over-preference.md +122 -0
- package/skills/_support/docs/principles/details/p073-optimize-only-with-evidence.md +123 -0
- package/skills/_support/docs/principles/details/p074-prefer-existing-mechanisms.md +121 -0
- package/skills/_support/docs/principles/details/p075-make-invalid-states-hard-to-represent.md +128 -0
- package/skills/_support/docs/principles/details/p076-parse-then-validate-then-operate.md +133 -0
- package/skills/_support/docs/principles/details/p077-separate-policy-from-mechanism.md +112 -0
- package/skills/_support/docs/principles/details/p078-single-source-of-truth.md +131 -0
- package/skills/_support/docs/principles/details/p079-explicit-ownership-and-lifetimes.md +124 -0
- package/skills/_support/docs/principles/details/p080-make-concurrency-deliberate.md +122 -0
- package/skills/_support/docs/principles/details/p081-forward-progress-with-safety.md +125 -0
- package/skills/_support/docs/principles/details/p082-design-for-cancellation.md +133 -0
- package/skills/_support/docs/principles/details/p083-irreversible-actions-last.md +124 -0
- package/skills/_support/docs/principles/details/p084-prefer-local-reasoning.md +131 -0
- package/skills/_support/docs/principles/details/p085-explicit-is-better-than-implicit.md +123 -0
- package/skills/_support/docs/principles/details/p086-readability-counts.md +113 -0
- package/skills/_support/docs/principles/details/p087-comments-explain-why-code-explains-what.md +120 -0
- package/skills/_support/docs/principles/details/p088-delete-dead-code.md +125 -0
- package/skills/_support/docs/principles/details/p089-delete-obsolete-configuration-and-dependencies.md +125 -0
- package/skills/_support/docs/principles/details/p090-prefer-negative-code.md +134 -0
- package/skills/_support/docs/principles/details/p091-test-driven-development.md +149 -0
- package/skills/_support/docs/review/README.md +59 -0
- package/skills/_support/docs/review/behavior-first-testing.md +73 -0
- package/skills/_support/docs/review/common.md +365 -0
- package/skills/_support/docs/review/design-docs.md +74 -0
- package/skills/_support/docs/review/issue-planning.md +220 -0
- package/skills/_support/docs/review/language-routing.md +141 -0
- package/skills/_support/docs/review/repository-scorecard.md +170 -0
- package/skills/advise/SKILL.md +102 -40
- package/skills/advise/scripts/list_retrievable_skills.py +3 -3
- package/skills/brainstorm/SKILL.md +167 -76
- package/skills/change-review/SKILL.md +99 -43
- package/skills/change-review/references/scope-resolution.md +70 -41
- package/skills/change-review/scripts/resolve_scope.py +119 -73
- package/skills/finalize-plan/SKILL.md +208 -100
- package/skills/git-worktrees/SKILL.md +108 -59
- package/skills/git-worktrees/scripts/prepare_worktree.py +16 -10
- package/skills/issue-review/SKILL.md +143 -47
- package/skills/learn/SKILL.md +284 -162
- package/skills/myrmidon-swarm/SKILL.md +136 -61
- package/skills/plan-issue/SKILL.md +129 -47
- package/skills/pr-review/SKILL.md +170 -71
- package/skills/pr-review/references/criteria.md +61 -14
- package/skills/pr-review/references/delivery.md +159 -80
- package/skills/pr-review/references/evidence.md +268 -139
- package/skills/pr-review/references/prevalidated.md +91 -48
- package/skills/pr-review/scripts/collect_evidence.py +211 -140
- package/skills/pr-review/scripts/diff_context.py +6 -4
- package/skills/pr-review/scripts/materialize_snapshot.py +112 -120
- package/skills/pr-review/scripts/pr_identity.py +27 -15
- package/skills/pr-review/scripts/resolve_pr.py +53 -31
- package/skills/repo-review/SKILL.md +209 -87
- package/skills/systematic-debugging/SKILL.md +195 -131
- package/skills/systematic-debugging/scripts/repository_evidence.py +9 -4
- package/skills/test-driven-development/SKILL.md +134 -53
- package/skills/tidy/SKILL.md +97 -33
- package/skills/tidy/scripts/run_tidy.py +3 -3
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
# P065 — Verify Before Claiming Completion
|
|
2
|
+
|
|
3
|
+
## Definition
|
|
4
|
+
|
|
5
|
+
Before a completion claim, examine the last change. Run the applicable checks that the repository
|
|
6
|
+
specifies. Report the command, revision, environment, result, and important verification gaps.
|
|
7
|
+
|
|
8
|
+
**Aliases:** evidence-backed completion, validation before a success claim.
|
|
9
|
+
|
|
10
|
+
## Provenance
|
|
11
|
+
|
|
12
|
+
**Classification:** Athena synthesis.
|
|
13
|
+
|
|
14
|
+
This rule uses established verification practice and evidence from software delivery. No verified
|
|
15
|
+
source owns this rule. Athena's evidence-integrity policy specifies accurate reports with recorded
|
|
16
|
+
commands, revisions, and environments.
|
|
17
|
+
|
|
18
|
+
## Decision rule
|
|
19
|
+
|
|
20
|
+
Do not report an expectation as a completion claim. Examine the delivered state. Use current,
|
|
21
|
+
risk-based evidence. Limit the claim to facts that the evidence proves.
|
|
22
|
+
|
|
23
|
+
## How to apply
|
|
24
|
+
|
|
25
|
+
- Review the last diff and all generated, staged, and untracked artifacts in scope.
|
|
26
|
+
- Run the necessary tests, build checks, type checks, lint checks, static checks, security checks,
|
|
27
|
+
and package checks.
|
|
28
|
+
- Use the last revision and applicable environment. Do not use stale results.
|
|
29
|
+
- Record commands, exit status, revision, environment, and important limitations.
|
|
30
|
+
- Report failures, skips, unavailable dependencies, and timeouts. Do not report a pass result
|
|
31
|
+
without evidence.
|
|
32
|
+
|
|
33
|
+
## Diagram
|
|
34
|
+
|
|
35
|
+
```mermaid
|
|
36
|
+
flowchart TD
|
|
37
|
+
A["Examine last change"] --> B["Select necessary checks for risk"]
|
|
38
|
+
B --> C["Run checks on last revision"]
|
|
39
|
+
C --> D{"Necessary evidence passes?"}
|
|
40
|
+
D -- "No" --> E["Report failure or evidence gap"]
|
|
41
|
+
D -- "Yes" --> F["Record command, revision, and environment"]
|
|
42
|
+
F --> G["Make evidence-bound completion claim"]
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Language examples
|
|
46
|
+
|
|
47
|
+
The two examples show completion only if the expected-check set is not empty and each check has a
|
|
48
|
+
current pass result.
|
|
49
|
+
|
|
50
|
+
```python
|
|
51
|
+
def completion_report(revision, expected, results):
|
|
52
|
+
current = {
|
|
53
|
+
name: check for name, check in results.items()
|
|
54
|
+
if check.revision == revision
|
|
55
|
+
}
|
|
56
|
+
missing = sorted(expected.difference(current))
|
|
57
|
+
failed = sorted(name for name in expected if name in current and not current[name].passed)
|
|
58
|
+
complete = bool(expected) and not missing and not failed
|
|
59
|
+
return Report(revision, complete, missing, failed)
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
```rust
|
|
63
|
+
fn completion_report(revision: &str, expected: &HashSet<String>,
|
|
64
|
+
results: &HashMap<String, Check>) -> Report {
|
|
65
|
+
let current = |name: &String| {
|
|
66
|
+
results.get(name).filter(|check| check.revision.as_str() == revision)
|
|
67
|
+
};
|
|
68
|
+
let missing = expected.iter().filter(|name| current(*name).is_none()).cloned().collect();
|
|
69
|
+
let failed = expected.iter()
|
|
70
|
+
.filter(|name| current(*name).is_some_and(|check| !check.passed))
|
|
71
|
+
.cloned().collect();
|
|
72
|
+
let complete = !expected.is_empty() && missing.is_empty() && failed.is_empty();
|
|
73
|
+
Report::new(revision, complete, missing, failed)
|
|
74
|
+
}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Boundaries and tensions
|
|
78
|
+
|
|
79
|
+
Use risk-based evidence. Documentation, configuration, and production changes use different
|
|
80
|
+
evidence. Checks that pass cannot prove requirements that the checks do not
|
|
81
|
+
exercise.
|
|
82
|
+
|
|
83
|
+
Cost does not supply evidence for an unverified claim. If a necessary check cannot run, report the
|
|
84
|
+
gap. Also report the command or environment that can give the missing evidence. Do not bypass the
|
|
85
|
+
gate.
|
|
86
|
+
[P068 No Validation Bypass](p068-no-validation-bypass.md) specifies this rule.
|
|
87
|
+
|
|
88
|
+
## Examples
|
|
89
|
+
|
|
90
|
+
**Positive:** An author examines the last diff and runs the necessary gate at the current commit.
|
|
91
|
+
The report identifies one unavailable platform test and does not claim that all tests pass.
|
|
92
|
+
|
|
93
|
+
**Misuse:** A developer changes code after a test passes. The developer cites that stale result
|
|
94
|
+
as proof for the new revision.
|
|
95
|
+
|
|
96
|
+
**Athena/agent workflow:** Before completion, an agent runs `just all` and reports the command
|
|
97
|
+
result.
|
|
98
|
+
If the full gate cannot complete, the agent identifies each narrower check.
|
|
99
|
+
|
|
100
|
+
## Related principles
|
|
101
|
+
|
|
102
|
+
- [P012 Evidence Before Modification](p012-evidence-before-modification.md)
|
|
103
|
+
- [P047 Observability Is Part of Correctness](p047-observability-is-part-of-correctness.md)
|
|
104
|
+
- [P064 Requirement-to-Test Traceability](p064-requirement-to-test-traceability.md)
|
|
105
|
+
- [P068 No Validation Bypass](p068-no-validation-bypass.md)
|
|
106
|
+
- [P072 Technical Evidence Over Preference](p072-technical-evidence-over-preference.md)
|
|
107
|
+
|
|
108
|
+
## References
|
|
109
|
+
|
|
110
|
+
### Source information
|
|
111
|
+
|
|
112
|
+
- [NIST IR 8397, Guidelines on Minimum Standards for Developer Verification of Software](https://doi.org/10.6028/NIST.IR.8397)
|
|
113
|
+
records a current consensus set of verification techniques. Athena does not identify it as the
|
|
114
|
+
initial source for this rule.
|
|
115
|
+
|
|
116
|
+
### Applicable information
|
|
117
|
+
|
|
118
|
+
- [NIST SSDF 1.1](https://csrc.nist.gov/pubs/sp/800/218/final) specifies review, analysis, and testing
|
|
119
|
+
practices for software verification before release.
|
|
120
|
+
- [Google Engineering Practices: What to look for in a code review](https://google.github.io/eng-practices/review/reviewer/looking-for.html)
|
|
121
|
+
states that reviewers must examine function, tests, design, and the full change context.
|
|
122
|
+
|
|
123
|
+
### More information
|
|
124
|
+
|
|
125
|
+
- [Athena evidence integrity policy](../../policies/evidence-integrity.md) specifies the
|
|
126
|
+
repository's contract for accurate completion-evidence reports with recorded commands, revisions,
|
|
127
|
+
and environments.
|
|
128
|
+
|
|
129
|
+
[Back to the engineering principles catalog](../README.md#p065)
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# P066 — Preserve Existing Work
|
|
2
|
+
|
|
3
|
+
## Definition
|
|
4
|
+
|
|
5
|
+
Do not revert, overwrite, reformat, regenerate, delete, or remove work from a different task.
|
|
6
|
+
Identify earlier modifications. Isolate task-owned edits from them. When you cannot keep the two
|
|
7
|
+
sets of work together, stop the task. Before you continue, isolate the task.
|
|
8
|
+
|
|
9
|
+
**Aliases:** worktree preservation, noninterference with earlier changes.
|
|
10
|
+
|
|
11
|
+
## Provenance
|
|
12
|
+
|
|
13
|
+
**Classification:** Athena synthesis.
|
|
14
|
+
|
|
15
|
+
No verified source specifies this rule. The rule uses version-control safety,
|
|
16
|
+
narrow-change practice, and collaborative ownership. The rule gives agents a clear contract for a
|
|
17
|
+
shared workspace.
|
|
18
|
+
|
|
19
|
+
## Decision rule
|
|
20
|
+
|
|
21
|
+
Before an edit or removal, identify if the path contains work from a different task. If you cannot
|
|
22
|
+
keep that work, do not discard or overwrite it without specified authority. Use safe isolation.
|
|
23
|
+
If safe isolation is not possible, tell the user that direction is necessary.
|
|
24
|
+
|
|
25
|
+
## How to apply
|
|
26
|
+
|
|
27
|
+
- Before an edit or cleanup, examine working-tree, index, branch, and worktree state.
|
|
28
|
+
- Attribute changes from the initial state, task scope, and current diff.
|
|
29
|
+
- Edit only specified paths. Stage only specified pathsets.
|
|
30
|
+
- When concurrent changes cannot be safe together, use an isolated branch or linked worktree.
|
|
31
|
+
- Report conflicts or ownership that is not clear. Do not use deletion to resolve them.
|
|
32
|
+
|
|
33
|
+
## Diagram
|
|
34
|
+
|
|
35
|
+
```mermaid
|
|
36
|
+
flowchart TD
|
|
37
|
+
A["Examine path and repository state"] --> B{"Is work from a different task in this path?"}
|
|
38
|
+
B -- "No" --> C["Edit specified task paths"]
|
|
39
|
+
B -- "Yes" --> D{"Are the two changes safe together?"}
|
|
40
|
+
D -- "Yes" --> C
|
|
41
|
+
D -- "No" --> E["Use isolated worktree or stop"]
|
|
42
|
+
C --> F["Review task-owned diff"]
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Language examples
|
|
46
|
+
|
|
47
|
+
The two examples change the task-owned field and keep all other fields.
|
|
48
|
+
|
|
49
|
+
```python
|
|
50
|
+
def update_owned_field(record, value):
|
|
51
|
+
result = record.copy()
|
|
52
|
+
result["owned"] = value
|
|
53
|
+
return result
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
```rust
|
|
57
|
+
fn update_owned_field(record: &Record, value: String) -> Record {
|
|
58
|
+
let mut result = record.clone();
|
|
59
|
+
result.owned = value;
|
|
60
|
+
result
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Boundaries and tensions
|
|
65
|
+
|
|
66
|
+
Preservation does not make earlier changes immutable. The user can specify a modification,
|
|
67
|
+
replacement, or removal. A scoped task can make careful edits to a modified file necessary. A
|
|
68
|
+
generated product artifact can also make coherent regeneration necessary.
|
|
69
|
+
|
|
70
|
+
The rule does not authorize data loss without a report or churn that is not part of the task. It
|
|
71
|
+
does not prevent authorized collaboration. Do not discard uncommitted work only to make the
|
|
72
|
+
repository clean.
|
|
73
|
+
|
|
74
|
+
## Examples
|
|
75
|
+
|
|
76
|
+
**Positive:** An agent finds edits from a different task in the primary checkout. The agent uses a
|
|
77
|
+
new linked worktree and stages only the feature paths.
|
|
78
|
+
|
|
79
|
+
**Misuse:** A formatter rewrites the full repository to simplify review of one patch. A reset also
|
|
80
|
+
removes modifications with ownership that is not known.
|
|
81
|
+
|
|
82
|
+
**Athena/agent workflow:** A delegated writer finds a second agent on the same skill. The writer
|
|
83
|
+
does not edit the overlapping skill file and reports the overlap to the coordinator.
|
|
84
|
+
|
|
85
|
+
## Related principles
|
|
86
|
+
|
|
87
|
+
- [P010 Scope Fidelity](p010-scope-fidelity.md)
|
|
88
|
+
- [P011 Minimal Coherent Change](p011-minimal-coherent-change.md)
|
|
89
|
+
- [P021 Evolutionary and Reversible Design](p021-evolutionary-and-reversible-design.md)
|
|
90
|
+
- [P083 Irreversible Actions Last](p083-irreversible-actions-last.md)
|
|
91
|
+
|
|
92
|
+
## References
|
|
93
|
+
|
|
94
|
+
### Source information
|
|
95
|
+
|
|
96
|
+
- [Git worktree documentation](https://git-scm.com/docs/git-worktree) gives information about linked
|
|
97
|
+
worktrees. Its example isolates a high-priority change from active work. It is not the initial
|
|
98
|
+
source for this full principle.
|
|
99
|
+
|
|
100
|
+
### Applicable information
|
|
101
|
+
|
|
102
|
+
- [Git status documentation](https://git-scm.com/docs/git-status) specifies inspection of staged,
|
|
103
|
+
unstaged, and untracked working-tree state before an action.
|
|
104
|
+
- [Google Engineering Practices: Small CLs](https://google.github.io/eng-practices/review/developer/small-cls.html)
|
|
105
|
+
recommends a different change for a refactor. It also recommends a narrow conceptual focus for
|
|
106
|
+
each change.
|
|
107
|
+
|
|
108
|
+
### More information
|
|
109
|
+
|
|
110
|
+
- [Git restore documentation](https://git-scm.com/docs/git-restore) states that restoration
|
|
111
|
+
can replace working-tree content or remove paths. This result makes earlier target resolution
|
|
112
|
+
necessary.
|
|
113
|
+
|
|
114
|
+
[Back to the engineering principles catalog](../README.md#p066)
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
# P067 — No Test Cheating
|
|
2
|
+
|
|
3
|
+
## Definition
|
|
4
|
+
|
|
5
|
+
When an implementation violates its intended contract, fix the implementation. Do not decrease
|
|
6
|
+
evidence quality.
|
|
7
|
+
|
|
8
|
+
Do not delete or skip a correct test. Do not change assertions to accept incorrect results. Do not
|
|
9
|
+
add mocks with a large scope. Do not report a failure as expected without contract evidence. Do not
|
|
10
|
+
change expected values only to make the test pass.
|
|
11
|
+
|
|
12
|
+
**Aliases:** preserve test integrity, no false success.
|
|
13
|
+
|
|
14
|
+
## Provenance
|
|
15
|
+
|
|
16
|
+
**Classification:** Athena synthesis.
|
|
17
|
+
|
|
18
|
+
This phrase is an Athena rule with no verified initial source. The rule formalizes a property of
|
|
19
|
+
tests that give applicable evidence. Such a test rejects defective behavior and agrees with the
|
|
20
|
+
accepted contract.
|
|
21
|
+
|
|
22
|
+
## Decision rule
|
|
23
|
+
|
|
24
|
+
When a test fails, identify if the implementation, test, environment, or requirement is incorrect.
|
|
25
|
+
Only when evidence proves an error in the test contract, setup, or assertion, change the test. An
|
|
26
|
+
accepted requirement change can also make a test change necessary. A delivery schedule problem does
|
|
27
|
+
not make the change necessary.
|
|
28
|
+
|
|
29
|
+
## How to apply
|
|
30
|
+
|
|
31
|
+
- Reproduce the failure. Make sure that the test observes the specified behavior.
|
|
32
|
+
- Compare the expectation with current requirements and public contracts.
|
|
33
|
+
- When the implementation is incorrect, fix product behavior. Keep the regression test.
|
|
34
|
+
- Repair intermittent setup failures, invalid fixtures, or stale expectations with recorded
|
|
35
|
+
evidence.
|
|
36
|
+
- Keep mocks narrow to exercise integration and failure behavior.
|
|
37
|
+
|
|
38
|
+
## Diagram
|
|
39
|
+
|
|
40
|
+
```mermaid
|
|
41
|
+
flowchart TD
|
|
42
|
+
A["Reproduce test failure"] --> B["Compare test with accepted contract"]
|
|
43
|
+
B --> C{"Implementation violates contract?"}
|
|
44
|
+
C -- "Yes" --> D["Fix implementation and keep test"]
|
|
45
|
+
C -- "No" --> E{"Is the test or requirement incorrect?"}
|
|
46
|
+
E -- "Yes" --> F["Correct test with evidence"]
|
|
47
|
+
E -- "No" --> G["Examine environment"]
|
|
48
|
+
D --> H["Run applicable test again"]
|
|
49
|
+
F --> H
|
|
50
|
+
G --> H
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Language examples
|
|
54
|
+
|
|
55
|
+
The two examples keep a specified denial contract for a guest request.
|
|
56
|
+
|
|
57
|
+
```python
|
|
58
|
+
def test_guest_cannot_delete():
|
|
59
|
+
request = DeleteRequest(role="guest")
|
|
60
|
+
response = delete_resource(request)
|
|
61
|
+
assert response.status == 403
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
```rust
|
|
65
|
+
#[test]
|
|
66
|
+
fn guest_cannot_delete() {
|
|
67
|
+
let request = DeleteRequest::new(Role::Guest);
|
|
68
|
+
let response = delete_resource(request);
|
|
69
|
+
assert_eq!(response.status, 403);
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Boundaries and tensions
|
|
74
|
+
|
|
75
|
+
Tests can contain defects and do not automatically specify the contract. An accepted contract change
|
|
76
|
+
can make a test change necessary. Repair obsolete or nondeterministic tests. Do not keep them only
|
|
77
|
+
to satisfy a process requirement.
|
|
78
|
+
|
|
79
|
+
Repository policy can authorize a narrow, documented skip for an unsupported environment. The skip
|
|
80
|
+
does not prove a pass result for the missing test. Use evidence from
|
|
81
|
+
[P072](p072-technical-evidence-over-preference.md) for the contract decision.
|
|
82
|
+
|
|
83
|
+
## Examples
|
|
84
|
+
|
|
85
|
+
**Positive:** A regression test shows a missing authorization check. The author fixes the
|
|
86
|
+
implementation and keeps the test. The test fails if the defect returns.
|
|
87
|
+
|
|
88
|
+
**Misuse:** An author changes a failed assertion from a specified denied status to one that accepts
|
|
89
|
+
all responses. No requirement makes the change necessary. The author does not correct the defect.
|
|
90
|
+
|
|
91
|
+
**Athena/agent workflow:** An agent examines a validator contract failure. The agent corrects the
|
|
92
|
+
validator or a fixture that evidence proves incorrect. The agent does not change prose or delete the
|
|
93
|
+
case only to pass
|
|
94
|
+
`just test`.
|
|
95
|
+
|
|
96
|
+
## Related principles
|
|
97
|
+
|
|
98
|
+
- [P022 Test Behavior, Not Implementation](p022-test-behavior-not-implementation.md)
|
|
99
|
+
- [P026 Regression Before Repair](p026-regression-before-repair.md)
|
|
100
|
+
- [P064 Requirement-to-Test Traceability](p064-requirement-to-test-traceability.md)
|
|
101
|
+
- [P068 No Validation Bypass](p068-no-validation-bypass.md)
|
|
102
|
+
- [P072 Technical Evidence Over Preference](p072-technical-evidence-over-preference.md)
|
|
103
|
+
|
|
104
|
+
## References
|
|
105
|
+
|
|
106
|
+
### Source information
|
|
107
|
+
|
|
108
|
+
- [Google Engineering Practices: What to look for in tests](https://google.github.io/eng-practices/review/reviewer/looking-for.html#tests)
|
|
109
|
+
states that tests must be correct and give applicable evidence. Tests must also fail when code is
|
|
110
|
+
defective. Athena does not claim this source as the initial source for its label.
|
|
111
|
+
|
|
112
|
+
### Applicable information
|
|
113
|
+
|
|
114
|
+
- [NIST SSDF 1.1](https://csrc.nist.gov/pubs/sp/800/218/final) lists code review, analysis, and
|
|
115
|
+
executable tests as software verification controls before release.
|
|
116
|
+
- [Google Engineering Practices: Tests in small CLs](https://google.github.io/eng-practices/review/developer/small-cls.html#keep-related-test-code-in-the-same-cl)
|
|
117
|
+
states that logic changes must have applicable tests. It also states that refactors must have test
|
|
118
|
+
coverage.
|
|
119
|
+
|
|
120
|
+
### More information
|
|
121
|
+
|
|
122
|
+
- [pytest documentation: How to use skip and xfail](https://docs.pytest.org/en/stable/how-to/skipping.html)
|
|
123
|
+
documents permitted uses and results for skipped or expected-failure tests. These markers report a
|
|
124
|
+
limitation, not a test pass.
|
|
125
|
+
|
|
126
|
+
[Back to the engineering principles catalog](../README.md#p067)
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
# P068 — No Validation Bypass
|
|
2
|
+
|
|
3
|
+
## Definition
|
|
4
|
+
|
|
5
|
+
When a validator finds a problem, do not disable or bypass the validator. Do not report an incorrect
|
|
6
|
+
validation result.
|
|
7
|
+
|
|
8
|
+
Validators include type checks, lint rules, compiler warnings, security controls, CI gates,
|
|
9
|
+
authorization checks, and runtime checks. Fix the cause. An exception must be narrow. Evidence must
|
|
10
|
+
show its necessity. The repository's authorized process must include it.
|
|
11
|
+
|
|
12
|
+
**Aliases:** no gate bypass, preserve validation integrity.
|
|
13
|
+
|
|
14
|
+
## Provenance
|
|
15
|
+
|
|
16
|
+
**Classification:** Athena synthesis.
|
|
17
|
+
|
|
18
|
+
No verified source specifies this rule. The rule uses secure-development verification,
|
|
19
|
+
defense in depth, and protected-branch practice. It gives contributors a clear constraint.
|
|
20
|
+
|
|
21
|
+
## Decision rule
|
|
22
|
+
|
|
23
|
+
When validation fails, use the result as evidence. Examine the cause. If evidence does not prove
|
|
24
|
+
that the control is incorrect, do not decrease control coverage or enforcement. When the repository
|
|
25
|
+
process authorizes a correction or exception, keep the intended protection.
|
|
26
|
+
|
|
27
|
+
## How to apply
|
|
28
|
+
|
|
29
|
+
- Reproduce the validation result. Identify the requirement that the control enforces.
|
|
30
|
+
- Correct the implementation, configuration, dependency, or test that violates that requirement.
|
|
31
|
+
- Use the standard ownership and review process to change a defective rule.
|
|
32
|
+
- Keep a necessary suppression local. Record its cause. Make its review and removal easy.
|
|
33
|
+
- If a check did not run or had a skip, report it. If no check ran, do not report a pass.
|
|
34
|
+
|
|
35
|
+
## Diagram
|
|
36
|
+
|
|
37
|
+
```mermaid
|
|
38
|
+
flowchart TD
|
|
39
|
+
A["Validation reports a defect"] --> B["Identify protected requirement"]
|
|
40
|
+
B --> C{"Implementation violates requirement?"}
|
|
41
|
+
C -- "Yes" --> D["Correct implementation or configuration"]
|
|
42
|
+
C -- "No" --> E{"Does evidence prove the control incorrect?"}
|
|
43
|
+
E -- "Yes" --> F["Use authorized control-change process"]
|
|
44
|
+
E -- "No" --> G["Keep gate and report failure"]
|
|
45
|
+
D --> H["Run full validation again"]
|
|
46
|
+
F --> H
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Language examples
|
|
50
|
+
|
|
51
|
+
The two examples stop publication when the validator reports an error.
|
|
52
|
+
|
|
53
|
+
```python
|
|
54
|
+
def publish(change):
|
|
55
|
+
errors = validate(change)
|
|
56
|
+
if errors:
|
|
57
|
+
raise ValidationError(errors)
|
|
58
|
+
repository.publish(change)
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
```rust
|
|
62
|
+
fn publish(change: &Change) -> Result<(), Error> {
|
|
63
|
+
validate(change)?;
|
|
64
|
+
repository::publish(change)?;
|
|
65
|
+
Ok(())
|
|
66
|
+
}
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Boundaries and tensions
|
|
70
|
+
|
|
71
|
+
Validation mechanisms can give false positives or conflict with a new accepted requirement. They
|
|
72
|
+
can also be unavailable. When the protection operates correctly and the change obeys repository
|
|
73
|
+
policy, a correction is not a bypass. Before use, the repository must specify an emergency path.
|
|
74
|
+
That path must keep necessary safeguards and record the exception. Administrative permission to
|
|
75
|
+
bypass a gate does not give authority to use the bypass.
|
|
76
|
+
|
|
77
|
+
## Examples
|
|
78
|
+
|
|
79
|
+
**Positive:** A linter finds a dangerous shell command. The author corrects the command and keeps
|
|
80
|
+
the rule active.
|
|
81
|
+
|
|
82
|
+
**Misuse:** A pull request adds a suppression with a large scope or disables a necessary check. The
|
|
83
|
+
author wants to complete the correction in less time.
|
|
84
|
+
|
|
85
|
+
**Athena/agent workflow:** When `just all` fails, the agent examines and reports the result. The
|
|
86
|
+
agent does not use `--no-verify` or edit expected output. It does not report a narrower command that
|
|
87
|
+
passed as the full gate.
|
|
88
|
+
|
|
89
|
+
## Related principles
|
|
90
|
+
|
|
91
|
+
- [P020 Executable Architecture](p020-executable-architecture.md)
|
|
92
|
+
- [P054 Defense in Depth](p054-defense-in-depth.md)
|
|
93
|
+
- [P065 Verify Before Claiming Completion](p065-verify-before-claiming-completion.md)
|
|
94
|
+
- [P067 No Test Cheating](p067-no-test-cheating.md)
|
|
95
|
+
- [P072 Technical Evidence Over Preference](p072-technical-evidence-over-preference.md)
|
|
96
|
+
|
|
97
|
+
## References
|
|
98
|
+
|
|
99
|
+
### Source information
|
|
100
|
+
|
|
101
|
+
- [NIST SP 800-218, Secure Software Development Framework 1.1](https://doi.org/10.6028/NIST.SP.800-218)
|
|
102
|
+
includes established secure review, analysis, and test practices. Athena does not claim it as the
|
|
103
|
+
initial source for this rule.
|
|
104
|
+
|
|
105
|
+
### Applicable information
|
|
106
|
+
|
|
107
|
+
- [GitHub: About protected branches](https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/managing-protected-branches/about-protected-branches)
|
|
108
|
+
documents enforceable review gates, status-check gates, and specified bypass controls.
|
|
109
|
+
- [NIST SSDF 1.1](https://csrc.nist.gov/pubs/sp/800/218/final) states that personnel must verify
|
|
110
|
+
human-readable and executable code. It also states that personnel must correct known
|
|
111
|
+
vulnerabilities before release.
|
|
112
|
+
|
|
113
|
+
### More information
|
|
114
|
+
|
|
115
|
+
- [OWASP Application Security Verification Standard](https://owasp.org/www-project-application-security-verification-standard/)
|
|
116
|
+
gives a maintained basis for security verification requirements. It does not authorize gate
|
|
117
|
+
removal without approval.
|
|
118
|
+
|
|
119
|
+
[Back to the engineering principles catalog](../README.md#p068)
|
package/skills/_support/docs/principles/details/p069-independent-review-for-high-risk-changes.md
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
# P069 — Independent Review for High-Risk Changes
|
|
2
|
+
|
|
3
|
+
## Definition
|
|
4
|
+
|
|
5
|
+
An independent reviewer must examine each security-critical or availability-critical change. The
|
|
6
|
+
review depth must match the risk. The reviewer must know the affected domain. The reviewer must
|
|
7
|
+
examine the specified change and evidence. Agreement with the author's result is not sufficient.
|
|
8
|
+
|
|
9
|
+
**Aliases:** independent technical review, qualified second review.
|
|
10
|
+
|
|
11
|
+
## Provenance
|
|
12
|
+
|
|
13
|
+
**Classification:** established principle.
|
|
14
|
+
|
|
15
|
+
Michael Fagan documented independent software inspection at IBM during the 1970s. Code-review and
|
|
16
|
+
secure-development guidance specify independent, domain-qualified assessment in proportion to risk.
|
|
17
|
+
|
|
18
|
+
## Decision rule
|
|
19
|
+
|
|
20
|
+
Before acceptance of a high-risk change, receive a review from a qualified reviewer who did not
|
|
21
|
+
author the change. The reviewer must examine assumptions. The reviewer must examine evidence. The
|
|
22
|
+
reviewer must report findings independently. Author agreement is not necessary.
|
|
23
|
+
|
|
24
|
+
## How to apply
|
|
25
|
+
|
|
26
|
+
- Classify risk from the changed trust boundaries, data, concurrency, migration, or operations.
|
|
27
|
+
- Select reviewers for specialized areas such as security, privacy, cryptography, concurrency,
|
|
28
|
+
infrastructure, or the applicable domain.
|
|
29
|
+
- Give the reviewer the requirements, specified revision, full diff, tests, and known limitations.
|
|
30
|
+
- Record the author and reviewer conclusions independently.
|
|
31
|
+
- Clearly record the resolution of material findings.
|
|
32
|
+
- When impact and uncertainty increase, increase review independence and depth.
|
|
33
|
+
|
|
34
|
+
## Diagram
|
|
35
|
+
|
|
36
|
+
```mermaid
|
|
37
|
+
flowchart TD
|
|
38
|
+
A["Classify change risk"] --> B{"High-risk change?"}
|
|
39
|
+
B -- "No" --> C["Use standard review path"]
|
|
40
|
+
B -- "Yes" --> D["Select qualified non-author reviewer"]
|
|
41
|
+
D --> E["Examine specified change and evidence"]
|
|
42
|
+
E --> F{"Material finding?"}
|
|
43
|
+
F -- "Yes" --> G["Resolve finding and revise change"]
|
|
44
|
+
G --> I["Examine specified revised change and evidence"]
|
|
45
|
+
I --> F
|
|
46
|
+
F -- "No" --> H["Record independent result"]
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Language examples
|
|
50
|
+
|
|
51
|
+
The two examples use one immutable digest of the same change, author independence, and domain
|
|
52
|
+
qualification before acceptance.
|
|
53
|
+
|
|
54
|
+
```python
|
|
55
|
+
def accept(change, review):
|
|
56
|
+
if review.change_digest != change.digest:
|
|
57
|
+
raise ValueError("review does not match change")
|
|
58
|
+
if review.author == change.author:
|
|
59
|
+
raise ValueError("reviewer is not independent")
|
|
60
|
+
if change.domain not in review.qualifications:
|
|
61
|
+
raise ValueError("reviewer is not qualified")
|
|
62
|
+
return review.approved
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
```rust
|
|
66
|
+
fn accept(change: &Change, review: &Review) -> Result<bool, Error> {
|
|
67
|
+
if review.change_digest != change.digest {
|
|
68
|
+
return Err(Error::StaleReview);
|
|
69
|
+
}
|
|
70
|
+
if review.author == change.author {
|
|
71
|
+
return Err(Error::SameAuthor);
|
|
72
|
+
}
|
|
73
|
+
if !review.qualifications.contains(&change.domain) {
|
|
74
|
+
return Err(Error::UnqualifiedReviewer);
|
|
75
|
+
}
|
|
76
|
+
Ok(review.approved)
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Boundaries and tensions
|
|
81
|
+
|
|
82
|
+
A human reviewer is not always necessary for independent review. A qualified agent or specialist
|
|
83
|
+
can do a new, bounded review. Repository policy can specify a human, Code Owner, regulated role, or
|
|
84
|
+
approval count.
|
|
85
|
+
Automated analysis can add evidence to a review but usually does not supply all contextual
|
|
86
|
+
judgment. A non-author agreement without analysis is not an independent review. Low-risk work does
|
|
87
|
+
not make a large review process necessary.
|
|
88
|
+
|
|
89
|
+
## Examples
|
|
90
|
+
|
|
91
|
+
**Positive:** A security specialist did not author an authorization change. The specialist reviews
|
|
92
|
+
the specified commit, threat boundary, negative tests, and release behavior before acceptance.
|
|
93
|
+
|
|
94
|
+
**Misuse:** A team member approves cryptographic code without an inspection or knowledge of the
|
|
95
|
+
primitive. The approval only satisfies a necessary count.
|
|
96
|
+
|
|
97
|
+
**Athena/agent workflow:** A coordinator assigns a high-risk diff to an independent review agent.
|
|
98
|
+
The task has specified criteria. The criteria do not tell the reviewer to agree with the author's
|
|
99
|
+
result.
|
|
100
|
+
The coordinator reports unresolved findings to the user.
|
|
101
|
+
|
|
102
|
+
## Related principles
|
|
103
|
+
|
|
104
|
+
- [P052 Separation of Duties](p052-separation-of-duties.md)
|
|
105
|
+
- [P054 Defense in Depth](p054-defense-in-depth.md)
|
|
106
|
+
- [P061 Separate Decision from High-Impact Execution](p061-separate-decision-from-high-impact-execution.md)
|
|
107
|
+
- [P065 Verify Before Claiming Completion](p065-verify-before-claiming-completion.md)
|
|
108
|
+
|
|
109
|
+
## References
|
|
110
|
+
|
|
111
|
+
### Source information
|
|
112
|
+
|
|
113
|
+
- [Fagan, "Design and Code Inspections to Reduce Errors in Program Development" (1976)](https://doi.org/10.1147/sj.153.0182)
|
|
114
|
+
is a primary account of structured software inspection with specified roles.
|
|
115
|
+
|
|
116
|
+
### Applicable information
|
|
117
|
+
|
|
118
|
+
- [Google Engineering Practices: What to look for in a code review](https://google.github.io/eng-practices/review/reviewer/looking-for.html)
|
|
119
|
+
states that authors must involve qualified reviewers for complex areas. Examples include security,
|
|
120
|
+
privacy, and concurrency.
|
|
121
|
+
- [NIST SSDF 1.1](https://csrc.nist.gov/pubs/sp/800/218/final) lists code review and analysis as
|
|
122
|
+
practices that identify vulnerabilities before release.
|
|
123
|
+
|
|
124
|
+
### More information
|
|
125
|
+
|
|
126
|
+
- [OWASP Secure Code Review Cheat Sheet](https://cheatsheetseries.owasp.org/cheatsheets/Secure_Code_Review_Cheat_Sheet.html)
|
|
127
|
+
gives information about risk-based manual review and context that automated tools can miss.
|
|
128
|
+
|
|
129
|
+
[Back to the engineering principles catalog](../README.md#p069)
|