|
1 | 1 | # SPDX-License-Identifier: PMPL-1.0-or-later |
2 | | -# Copyright (c) {{CURRENT_YEAR}} {{AUTHOR}} ({{OWNER}}) <{{AUTHOR_EMAIL}}> |
| 2 | +# Copyright (c) 2026 Jonathan D.A. Jewell (hyperpolymath) <j.d.a.jewell@open.ac.uk> |
3 | 3 | # |
4 | | -# K9 Validator: Methodology Guard |
5 | | -# Checks that agent work respects methodology constraints declared in |
6 | | -# agent_instructions/methodology.a2ml. |
7 | | -# |
8 | | -# Usage: k9 validate methodology-guard |
| 4 | +# K9 Validator: Patch Bridge Methodology Guard |
| 5 | +# Ensures that CVE classification, lockfile parsing, reachability analysis, and registry lookups align |
| 6 | +# with the methodology ergonomics declared in agent_instructions/methodology.a2ml. |
9 | 7 |
|
10 | 8 | let methodology_guard = { |
11 | | - name = "methodology-guard", |
| 9 | + name = "patch-bridge-methodology-guard", |
12 | 10 | version = "1.0.0", |
13 | | - description = "Validates that agent work respects declared methodology constraints", |
| 11 | + description = "Validates that the bridge modules remain present, coverage metadata is fresh, and template placeholders are removed.", |
14 | 12 |
|
15 | 13 | checks = { |
16 | 14 | divergent_invariant_language = { |
17 | | - description = "No files in languages violating the divergent language invariant", |
| 15 | + description = "No files introduce a disallowed language variant in the proof directories.", |
18 | 16 | severity = "error", |
19 | | - # When methodology.divergent-invariants.language-invariant is set, |
20 | | - # check that no new files introduce a different language for that purpose. |
21 | | - # Example: if language-invariant = "idris2", reject new .lean or .v files |
22 | | - # in the proof directories. |
23 | 17 | check_type = "file-extension-guard", |
24 | 18 | scope = "src/", |
25 | 19 | }, |
26 | 20 |
|
27 | 21 | believe_me_ceiling = { |
28 | | - description = "believe_me count must not exceed declared ceiling", |
| 22 | + description = "believe_me occurrences do not exceed the declared ceiling (0 by default).", |
29 | 23 | severity = "error", |
30 | 24 | pattern = "believe_me", |
31 | 25 | ceiling_key = "methodology.divergent-invariants.believe-me-ceiling", |
32 | 26 | default_ceiling = 0, |
33 | 27 | }, |
34 | 28 |
|
35 | 29 | assert_total_ceiling = { |
36 | | - description = "assert_total count must not exceed declared ceiling", |
| 30 | + description = "assert_total usage stays within the declared ceiling (0 by default).", |
37 | 31 | severity = "error", |
38 | 32 | pattern = "assert_total", |
39 | 33 | ceiling_key = "methodology.divergent-invariants.assert-total-ceiling", |
40 | 34 | default_ceiling = 0, |
41 | 35 | }, |
42 | 36 |
|
43 | 37 | state_not_template = { |
44 | | - description = "STATE.a2ml must not contain template placeholders", |
| 38 | + description = "STATE.a2ml must not contain template placeholders.", |
45 | 39 | severity = "warning", |
46 | 40 | file = ".machine_readable/6a2/STATE.a2ml", |
47 | 41 | reject_patterns = ["{{PLACEHOLDER}}", "{{PROJECT}}", "rsr-template-repo"], |
48 | 42 | }, |
49 | 43 |
|
50 | 44 | coverage_updated = { |
51 | | - description = "coverage.a2ml should be updated within 30 days", |
| 45 | + description = "coverage.a2ml should be refreshed within the last 30 days.", |
52 | 46 | severity = "info", |
53 | 47 | file = ".machine_readable/agent_instructions/coverage.a2ml", |
54 | 48 | staleness_days = 30, |
55 | 49 | }, |
| 50 | + |
| 51 | + classify_module = { |
| 52 | + description = "CVE classification belongs to src/bridge/classify.rs.", |
| 53 | + severity = "error", |
| 54 | + check_type = "file-exists", |
| 55 | + file = "src/bridge/classify.rs", |
| 56 | + }, |
| 57 | + |
| 58 | + lockfile_module = { |
| 59 | + description = "Lockfile parsing logic is still present.", |
| 60 | + severity = "error", |
| 61 | + check_type = "file-exists", |
| 62 | + file = "src/bridge/lockfile.rs", |
| 63 | + }, |
| 64 | + |
| 65 | + reachability_module = { |
| 66 | + description = "Reachability analysis module remains versioned.", |
| 67 | + severity = "warning", |
| 68 | + check_type = "file-exists", |
| 69 | + file = "src/bridge/reachability.rs", |
| 70 | + }, |
| 71 | + |
| 72 | + registry_module = { |
| 73 | + description = "Registry lookup helper is tracked.", |
| 74 | + severity = "warning", |
| 75 | + check_type = "file-exists", |
| 76 | + file = "src/bridge/registry.rs", |
| 77 | + }, |
| 78 | + |
| 79 | + interface_test = { |
| 80 | + description = "The Zig FFI integration test supports the adoption gate.", |
| 81 | + severity = "warning", |
| 82 | + check_type = "file-exists", |
| 83 | + file = "src/interface/ffi/test/integration_test.zig", |
| 84 | + }, |
| 85 | + |
| 86 | + no_template_files = { |
| 87 | + description = "Remove any rsr-template placeholders.", |
| 88 | + severity = "error", |
| 89 | + check_type = "file-pattern-guard", |
| 90 | + scope = ".", |
| 91 | + reject_patterns = ["{{PROJECT}}", "{{OWNER}}", "{{AUTHOR}}"], |
| 92 | + }, |
| 93 | + |
| 94 | + no_placeholder_fuzz = { |
| 95 | + description = "Placeholder fuzz harnesses should not exist.", |
| 96 | + severity = "warning", |
| 97 | + check_type = "file-not-exists", |
| 98 | + file = "tests/fuzz/placeholder.txt", |
| 99 | + }, |
56 | 100 | }, |
57 | 101 | } |
58 | 102 | in methodology_guard |
0 commit comments