auditor-lambda 0.7.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/README.md +0 -21
  2. package/dist/cli/auditStep.js +7 -1
  3. package/dist/cli.d.ts +0 -1
  4. package/dist/cli.js +0 -2
  5. package/dist/extractors/graph.js +12 -2
  6. package/dist/io/artifacts.d.ts +3 -1
  7. package/dist/io/artifacts.js +18 -2
  8. package/dist/orchestrator/advance.js +2 -1
  9. package/dist/orchestrator/artifactFreshness.js +12 -2
  10. package/dist/orchestrator/autoFixExecutor.d.ts +1 -1
  11. package/dist/orchestrator/autoFixExecutor.js +10 -0
  12. package/dist/orchestrator/executorResult.d.ts +12 -0
  13. package/dist/orchestrator/executorResult.js +1 -0
  14. package/dist/orchestrator/fileIntegrity.d.ts +1 -0
  15. package/dist/orchestrator/fileIntegrity.js +12 -3
  16. package/dist/orchestrator/graphEnrichmentExecutor.d.ts +1 -1
  17. package/dist/orchestrator/graphEnrichmentExecutor.js +3 -1
  18. package/dist/orchestrator/internalExecutors.d.ts +1 -18
  19. package/dist/orchestrator/internalExecutors.js +1 -158
  20. package/dist/orchestrator/reviewPacketGraph.d.ts +31 -0
  21. package/dist/orchestrator/reviewPacketGraph.js +691 -0
  22. package/dist/orchestrator/reviewPackets.d.ts +2 -15
  23. package/dist/orchestrator/reviewPackets.js +3 -685
  24. package/dist/orchestrator/runtimeCommand.d.ts +11 -0
  25. package/dist/orchestrator/runtimeCommand.js +79 -0
  26. package/dist/orchestrator/scope.js +1 -1
  27. package/dist/orchestrator/syntaxResolutionExecutor.d.ts +1 -1
  28. package/dist/orchestrator/synthesisExecutors.d.ts +12 -0
  29. package/dist/orchestrator/synthesisExecutors.js +90 -0
  30. package/docs/development.md +35 -139
  31. package/docs/history.md +26 -0
  32. package/docs/product.md +41 -108
  33. package/package.json +1 -1
  34. package/schemas/audit_findings.schema.json +3 -2
  35. package/schemas/dispatch_quota.schema.json +2 -0
  36. package/schemas/external_analyzer_results.schema.json +2 -2
  37. package/schemas/repo_manifest.schema.json +1 -1
  38. package/docs/handoff.md +0 -204
@@ -45,7 +45,8 @@
45
45
  "confidence",
46
46
  "lens",
47
47
  "summary",
48
- "affected_files"
48
+ "affected_files",
49
+ "evidence"
49
50
  ],
50
51
  "properties": {
51
52
  "id": { "type": "string" },
@@ -76,7 +77,7 @@
76
77
  },
77
78
  "impact": { "type": "string" },
78
79
  "likelihood": { "type": "string" },
79
- "evidence": { "type": "array", "items": { "type": "string" } },
80
+ "evidence": { "type": "array", "minItems": 1, "items": { "type": "string" } },
80
81
  "reproduction": { "type": "array", "items": { "type": "string" } },
81
82
  "systemic": { "type": "boolean" },
82
83
  "related_findings": { "type": "array", "items": { "type": "string" } },
@@ -101,6 +101,7 @@
101
101
  "quota_source_snapshot": {
102
102
  "type": ["object", "null"],
103
103
  "description": "Real-time usage snapshot from a QuotaSource, if available.",
104
+ "additionalProperties": false,
104
105
  "properties": {
105
106
  "remaining_pct": { "type": ["number", "null"] },
106
107
  "reset_at": { "type": ["string", "null"], "format": "date-time" },
@@ -113,6 +114,7 @@
113
114
  "backoff_state": {
114
115
  "type": ["object", "null"],
115
116
  "description": "Exponential backoff state for repeated rate-limit errors.",
117
+ "additionalProperties": false,
116
118
  "properties": {
117
119
  "consecutive_429_count": { "type": "integer", "minimum": 0 },
118
120
  "current_cooldown_ms": { "type": "integer", "minimum": 0 },
@@ -58,8 +58,8 @@
58
58
  "enum": ["critical", "high", "medium", "low", "info"]
59
59
  },
60
60
  "path": { "type": "string" },
61
- "line_start": { "type": "integer" },
62
- "line_end": { "type": "integer" },
61
+ "line_start": { "type": "integer", "minimum": 1 },
62
+ "line_end": { "type": "integer", "minimum": 1 },
63
63
  "summary": { "type": "string" },
64
64
  "rule": { "type": "string" },
65
65
  "raw": {}
@@ -15,7 +15,7 @@
15
15
  },
16
16
  "additionalProperties": false
17
17
  },
18
- "generated_at": { "type": "string" },
18
+ "generated_at": { "type": "string", "format": "date-time" },
19
19
  "files": {
20
20
  "type": "array",
21
21
  "items": {
package/docs/handoff.md DELETED
@@ -1,204 +0,0 @@
1
- # Handoff
2
-
3
- Current pickup note for the next implementation agent. Keep durable product
4
- direction in `docs/product.md`, engineering workflow in `docs/development.md`,
5
- contracts in `docs/contracts.md`, and operator steps in
6
- `docs/operator-guide.md`.
7
-
8
- ## Current State
9
-
10
- The docs refresh remains consolidated under `docs/`; do not restore old
11
- phase-specific docs unless asked. Checked-in `dist/` is expected to be rebuilt
12
- after TypeScript changes.
13
-
14
- Graph-informed packetization is in place and observable through
15
- `review_packets.json` and `audit_plan_metrics.json`: packet entrypoints,
16
- key edges, boundary files, quality, merge/boundary edge kinds, weak packet
17
- counts, gap counts, extension counts, and bounded samples are all emitted.
18
-
19
- Latest completed slice:
20
-
21
- - completed the remediator-lambda audit end-to-end after refreshing stale
22
- artifacts:
23
- - `run-to-completion` refreshed file disposition, auto-fix, structure,
24
- planning, runtime validation, and synthesis
25
- - resolved all additional runtime/selective-deepening handoffs; final
26
- `audit_tasks.json` had 81 tasks, all complete, 0 pending
27
- - fixed target-side Windows/runtime validation noise in remediator-lambda:
28
- `src/phases/plan.ts` no longer invokes `npx vitest`/`npx jest` in temp
29
- roots without `package.json`; `tests/phase-plan.test.ts` has a longer
30
- cleanup retry/hook timeout; `vitest.config.ts` excludes generated
31
- audit/provider directories from test discovery
32
- - `npm test` in `C:\Code\remediator-lambda` now passes: 5 test files,
33
- 51 tests
34
- - final synthesis promoted `C:\Code\remediator-lambda\audit-report.md`
35
- (47 findings, 16 work blocks), and `.audit-artifacts` was cleaned by
36
- completion
37
- - `node C:\Code\auditor-lambda\dist\index.js validate --root
38
- C:\Code\remediator-lambda --artifacts-dir
39
- C:\Code\remediator-lambda\.audit-artifacts` reports `issue_count: 0`
40
-
41
- Prior completed remediator slice:
42
-
43
- - completed the remediator-lambda final selective-deepening round:
44
- - created dispatch run `20260509T180000000Z_audit_tasks_completed_002`
45
- for the two remaining pending tasks
46
- - submitted packet
47
- `lens-steward-security:security-reliability:packet-1-cfa943527d`;
48
- accepted 2 result entries, `finding_count: 0`
49
- - `merge-and-ingest` accepted 2 result entries, rejected 0,
50
- `spurious_file_count: 0`, `finding_count: 0`
51
- - `audit_tasks.json` now has 73 tasks, all `complete`, 0 pending
52
- - `audit-code validate` on the remediator artifact bundle reports
53
- `issue_count: 0`
54
-
55
- Prior completed implementation slice:
56
-
57
- - fixed `merge-and-ingest` to treat unexpected files in `task-results/` as
58
- warnings rather than hard failures; subagents sometimes write a spurious
59
- packet-level result file alongside per-task `submit-packet` submissions —
60
- the unexpected file check now emits a stderr warning and increments
61
- `spurious_file_count` in the output JSON, but does not block ingestion when
62
- all backend-assigned result files are present and valid
63
- - added regression test: `merge-and-ingest proceeds despite unexpected files
64
- in task-results/`; test count: 199 passing
65
- - fixed Windows `EBUSY` test cleanup in `remediator-lambda/tests/phase-plan.test.ts`:
66
- `enumerateTestFiles` calls `spawnSync("npx vitest ...")` in the temp dir;
67
- on Windows the child process handle lingers briefly after return, causing
68
- `rm()` in `afterEach` to EBUSY; added `rmWithRetry` (5 attempts, 100ms×n
69
- backoff) used in both `beforeEach` and `afterEach`; remediator-lambda now
70
- passes all 153 tests cleanly
71
-
72
- Prior completed slice:
73
-
74
- - added `python-test-util-suite-link` edges: `.py` files co-located in a
75
- `utils/`, `helpers/`, or `support/` subdirectory within an `isTestPath`
76
- directory are chained as a suite (same bounded-suite pattern as existing
77
- TypeScript type / JSON schema / package-script suites); `conftest.py` is
78
- excluded from the predicate
79
- - confidence: `0.72`; direction: `undirected`
80
- - added 3 focused unit tests; rebuilt checked-in `dist/`
81
-
82
- Field evidence (Polar-CV-KAN):
83
-
84
- - canonical run: `.audit-artifacts/polar-python-util-suite-20260509`
85
- (7 packets, 1.000 cohesion, 2 weak packets)
86
- - `python-test-util-suite-link` produces 2 intra-unit edges within the
87
- `tests-utils` packet (`assertions.py → mocks.py`, `mocks.py → test_data.py`)
88
- - `tests-utils` packet: `internal_edge_count` 0 → 2; `cohesion_score` 0 → 1;
89
- `unexplained_file_count` 3 → 0; no longer a weak packet
90
- - Polar metrics: 7 packets, **1.000 cohesion** (up from 0.857), **2 weak
91
- packets** (down from 3)
92
- - 2 remaining weak packets are `unexplained_files` type; genuinely isolated
93
- files (`.auditorignore`, `experiments/domains/__init__.py`,
94
- `experiments/summarize_results.py`) cannot be linked without false positives
95
-
96
- Field evidence (remediator-lambda):
97
-
98
- - baseline: `.audit-artifacts/remediator-yaml-refs-20260508`
99
- - remediator metrics stable: 62 tasks, 3 packets, 1.000 cohesion, 0 weak
100
- packets; `python-test-util-suite-link` adds 0 edges (TypeScript repo, no
101
- `.py` files)
102
- - remediator full audit loop completed: `.audit-artifacts/` (in-progress run
103
- `20260509T153435008Z_audit_tasks_completed_006` + deepening run
104
- `20260509T155225210Z_audit_tasks_completed_001`); first round produced 42
105
- findings across 65 tasks; deepening round added 4 findings across 6 tasks
106
- - remediator deepening `merge-and-ingest` retry succeeded after the spurious
107
- file fix:
108
- - command used:
109
- `node C:\Code\auditor-lambda\dist\index.js merge-and-ingest --run-id 20260509T155225210Z_audit_tasks_completed_001 --root C:\Code\remediator-lambda --artifacts-dir C:\Code\remediator-lambda\.audit-artifacts`
110
- - accepted 6 result entries, rejected 0, `spurious_file_count: 1`,
111
- `finding_count: 4`
112
- - result ingestion progressed and added 2 selective deepening tasks
113
- - current remediator artifact state after retry: `audit_results_ingested`
114
- present, `audit_tasks_completed` satisfied, `requeue_tasks.json` empty,
115
- `audit_tasks.json` has 73 tasks with 0 pending after final selective
116
- deepening run `20260509T180000000Z_audit_tasks_completed_002`
117
- - final selective deepening verified the existing `src/types/workerSession.ts`
118
- security findings and upheld the reliability no-finding result for
119
- `src/types/sessionConfig.ts`, `src/types/workerResult.ts`, and
120
- `src/types/workerSession.ts`; it added 0 findings
121
- - current remediator packet metrics: 73 tasks, 3 packets, 1.000 cohesion,
122
- 1 weak packet with 1 unexplained file
123
- - final refreshed remediator audit completed with 81 tasks, all complete, and
124
- final `audit-report.md` at repo root. Runtime validation was confirmed after
125
- excluding generated audit/provider directories from Vitest discovery; the
126
- earlier `EBUSY` output was environmental noise from generated worktrees.
127
-
128
- ## Verification
129
-
130
- Completed:
131
-
132
- ```bash
133
- npm run build
134
- npm test # 199 passing
135
- node C:\Code\auditor-lambda\dist\index.js merge-and-ingest --run-id 20260509T180000000Z_audit_tasks_completed_002 --root C:\Code\remediator-lambda --artifacts-dir C:\Code\remediator-lambda\.audit-artifacts
136
- node C:\Code\auditor-lambda\dist\index.js validate --root C:\Code\remediator-lambda --artifacts-dir C:\Code\remediator-lambda\.audit-artifacts
137
- npm test # in C:\Code\remediator-lambda, 51 passing
138
- node C:\Code\auditor-lambda\dist\index.js run-to-completion --root C:\Code\remediator-lambda --artifacts-dir C:\Code\remediator-lambda\.audit-artifacts --max-runs 10
139
- node C:\Code\auditor-lambda\dist\index.js validate --root C:\Code\remediator-lambda --artifacts-dir C:\Code\remediator-lambda\.audit-artifacts
140
- ```
141
-
142
- ## Files Touched Recently
143
-
144
- - `src/cli.ts` — `cmdMergeAndIngest`: unexpected files → warning, not failure
145
- - `tests/audit-code-wrapper.test.mjs` — new regression test
146
- - `dist/` — rebuilt
147
- - `C:\Code\remediator-lambda\src\phases\plan.ts` — avoid test-runner
148
- enumeration in roots without `package.json`
149
- - `C:\Code\remediator-lambda\tests\phase-plan.test.ts` — sturdier
150
- `rmWithRetry` helper and longer hook timeout
151
- - `C:\Code\remediator-lambda\vitest.config.ts` — exclude generated
152
- audit/provider directories from test discovery
153
- - `C:\Code\remediator-lambda\audit-report.md` — final promoted report
154
- - `docs/handoff.md`
155
-
156
- ## Next Steps
157
-
158
- 1. The 2 remaining weak packets in Polar (`experiments-domains` with 5
159
- unexplained files, `tests-tiny-files` with 3 unexplained files) share the
160
- same genuinely isolated files (`.auditorignore`,
161
- `experiments/domains/__init__.py`, `experiments/summarize_results.py`).
162
- No extractor can address these without false positives; treat as floor.
163
- Only revisit if a future field trial on a different repo surfaces the same
164
- pattern in fixable form.
165
- 2. Remediator-lambda field trial is closed. Review the final
166
- `C:\Code\remediator-lambda\audit-report.md` only if you need product
167
- remediation planning; no audit-code backend work remains for that run.
168
- 3. Run the release/publish flow only when intentionally cutting a version.
169
-
170
- ## Cautions
171
-
172
- - `AuditTask` remains the deterministic coverage identity; `ReviewPacket`
173
- should not replace result ingestion contracts.
174
- - Weak graph edges, semantic affinity, and shared token frequency should remain
175
- context unless deterministic graph evidence corroborates them.
176
- - Boundary files are evidence hints. Worker prompts should continue to
177
- discourage broad reads outside the packet.
178
- - Keep suite links bounded and evidence-led; do not turn same-directory
179
- proximity into a broad packet merge rule.
180
- - `conftest-link` fires only when conftest.py is inside a `isTestPath`
181
- directory; root-level conftest.py is deliberately excluded to avoid O(n)
182
- fan-out to all Python files.
183
- - `yaml-path-reference-link` only matches string values ending in config
184
- extensions (`.yaml`, `.yml`, `.json`, `.toml`) that resolve to an existing
185
- file in the repo; absolute URLs and values without `/` are excluded.
186
- - `python-test-util-suite-link` predicate requires all four conditions: `.py`
187
- extension, NOT a conftest, parent dir name in `{utils, helpers, support}`,
188
- and the parent dir's normalized path passes `isTestPath`. Do not broaden the
189
- dir-name set without field evidence from a real repository.
190
- - `python-test-util-suite-link` edges appear as intra-unit edges (not counted
191
- in `merge_edge_kind_counts`) when all suite files belong to the same unit.
192
- This is correct — the edges still increment `internal_edge_count` and clear
193
- the weak-packet flag. Absence from merge counts does not mean the edges are
194
- inactive.
195
- - `merge-and-ingest` unexpected files now warn to stderr and increment
196
- `spurious_file_count` in the output JSON. They do not cause ingestion to
197
- fail. The check is still present to make spurious writes visible.
198
- - In this sandbox, running the wrapper from `C:\Code\auditor-lambda` with an
199
- absolute remediator root hit an `EPERM` while overwriting the existing
200
- remediator run `audit-results.json`; invoking the built CLI directly from
201
- `C:\Code\remediator-lambda` succeeded. Treat this as an execution-environment
202
- wrinkle unless it reproduces outside the sandbox.
203
- - Final remediator completion cleaned `.audit-artifacts`; use the promoted
204
- repo-root `audit-report.md` and `validate` output as the source of truth.