Skip to content

Feat/issue 33 s1 finding hexads#80

Closed
hyperpolymath wants to merge 2 commits into
mainfrom
feat/issue-33-s1-finding-hexads
Closed

Feat/issue 33 s1 finding hexads#80
hyperpolymath wants to merge 2 commits into
mainfrom
feat/issue-33-s1-finding-hexads

Conversation

@hyperpolymath
Copy link
Copy Markdown
Owner

No description provided.

hyperpolymath and others added 2 commits May 26, 2026 12:30
Adds a per-WeakPoint hexad path to persist_assemblyline_report so a
batch scan can persist one hexad per finding in addition to the existing
aggregate hexad. Subject identity is `finding:<repo>:<file>:<line>:<category>`,
chosen for cross-run stability so the upcoming S2 (campaign register-pr)
and S3 (query) slices can join on it without diffing JSON.

New public surface:
- HexadSemantic gains an optional `finding: Option<FindingSemantic>`
  (additive, skip_serializing_if = none → existing consumers unaffected).
- FindingSemantic carries finding_id / repo / file / line / category /
  rule_id / rule_name / severity / description / first_seen_run /
  last_seen_run / framework. rule_id and rule_name reuse the canonical
  SARIF mapping (sarif.rs::rule_id / rule_name now pub(crate)).
- build_finding_hexads(report) -> Vec<PanicAttackHexad>.
- STORE_FINDING_HEXADS_ENV = "PANIC_ATTACK_STORE_FINDING_HEXADS" — when
  set non-empty AND StorageMode::VerisimDb is configured,
  persist_assemblyline_report writes one file per finding under
  `<dir>/hexads/findings/`.

Behaviour preserved:
- Default path unchanged (env var off → no per-finding writes).
- Aggregate hexad still emitted in every VerisimDb run.
- Suppressed WeakPoints are skipped, keeping the store aligned with
  fleet/CI counts.

S1 sets first_seen_run == last_seen_run; back-stamping from a prior
hexad is S2's job (per the issue), not S1's.

Tests: 7 new (id stability, category discrimination, count per WP,
suppression skip, canonical rule_id/name, file write + round-trip,
env-var default-off). Full suite: 215 lib + 13 + 16 + 6 + 12 + 3 + 7
+ 12 + 14 + 20 + 10 + 8 + 22 + 22 + 12 + 2 doc — all green. Clippy
clean with -D warnings.

Refs #33.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
… prerequisite)

Recon flagged that PANIC_ATTACK_STORE_FINDING_HEXADS=1 was dead without a
manifest configuring reports.storage-targets=verisimdb. The env check sat
inside the VerisimDb arm of persist_assemblyline_report, but storage_modes()
defaulted to [Filesystem] only — so the operational opt-in path was
unreachable without a fully-populated 0-AI-MANIFEST.a2ml.

Add resolve_storage_modes() that augments declared modes with VerisimDb when
the env var is truthy. Wire it at the single binding site in main.rs.

Smoke-verified end-to-end: assemblyline scan against a tiny multi-repo dir
now emits 5 per-finding hexads under hexads/findings/ from env var alone.

3 new tests + 1 existing finding_hexads_disabled_by_default test now share
a Mutex to serialize their env-var mutations under cargo's parallel runner.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@hyperpolymath hyperpolymath enabled auto-merge (squash) May 30, 2026 13:03
@hyperpolymath
Copy link
Copy Markdown
Owner Author

Closing — superseded. Same as #79: Issue #33's hexad storage shipped via #61 (feat(storage): persist kanren CrossLangInteraction as hexads). The per-finding hexad emission this PR implemented has been replaced.

auto-merge was automatically disabled May 30, 2026 16:57

Pull request was closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant