Skip to content

🌱 refactor(cmd/hive): extract runEvalCycle's ioscan canary gate behind a seam (#7232) - #7316

Merged
clubanderson merged 1 commit into
v4from
scanner/fix-7232-advisory-canary-gate
Sep 17, 2026
Merged

clubanderson merged 1 commit into
v4from
scanner/fix-7232-advisory-canary-gate

Conversation

@kubestellar-hive

Copy link
Copy Markdown
Contributor

Refactor

Refs #7232 — one increment of its step 1 (runEvalCycle seams); deliberately non-closing: runEvalCycle's remaining collaborators and all of main() are still to extract, per the issue's own sequencing.

Claimed ground: src/cmd/hive/eval_cycle_seams.go (new gateAdvisoryFindings + advisoryIngestDeps), the advisory-findings ingestion block of runEvalCycle in src/cmd/hive/main.go (~L6434), and new test file src/cmd/hive/eval_cycle_advisory_gate_7232_test.go. Disjoint from hold PR #7312 (dashboard fleet-report files only).

What moved

runEvalCycle's ioscan canary gate — the decision that a leaked canary token in an advisory finding's report text is always recorded (audit entry + critical bead) and withholds the finding from persistence only under ioscan.fail_closed — was inline against the process-global canary registry, a live dashboard, and real bead stores, so none of it was reachable by tests. It now follows the exact split of the earlier #7232 kick-dispatch seam: decisions in gateAdvisoryFindings (eval_cycle_seams.go), effects injected at the call site in main.go, order preserved verbatim.

Behavior pinned (mutation-tested, 4/4 killed)

  • canaries disabled ⇒ nil scanner: every finding passes, no effect fires — configuration alone never blocks
  • fail-closed withholds only the leaking finding; clean batch-mates still persist, in order
  • fail-open records the leak (audit + bead) but keeps the finding — evidence without suppression
  • audit entry names canary.leak, the leak's agent, and the advisory-finding source exactly
  • scan text is title\ndetail\nfile\ntype\nseverity — dropping any field fails the test

Verification

  • go vet ./cmd/hive/ clean; go test ./cmd/hive/ -count=1 passes (44.3% → 44.6%, gateAdvisoryFindings at 100%)
  • Mutations killed: leak-always-blocks, dropped bead effect, dropped Detail from scan text, scan gated on failClosed

Filed by scanner agent (ACMM L5 — hold-gated mode). Hold-gated: human review required.

— hive: agent=scanner backend=copilot model=claude-fable-5 copilot=1.0.78

…d a seam (#7232)

Refs #7232 (one increment of step 1; runEvalCycle's remaining collaborators
and main() are still to extract).

runEvalCycle's advisory-findings ingestion embedded the ioscan canary gate —
the decision that a leaked canary token in a finding's report text is always
recorded (audit entry + critical bead) and withholds the finding from
persistence only under ioscan.fail_closed — inline against the process-global
canary registry, a live dashboard, and real bead stores, so none of it was
testable. Same split as the #7232 kick-dispatch seam: the decisions move to
gateAdvisoryFindings in eval_cycle_seams.go, the effects stay injected at the
call site.

Pinned behavior, each mutation-tested (4/4 killed):
- canaries disabled => nil scanner, everything passes, no effects fire
- fail-closed blocks ONLY the leaking finding; batch-mates still persist
- fail-open records the leak but keeps the finding
- audit entry names rule/agent/source exactly
- the scan text is title\ndetail\nfile\ntype\nseverity — dropping any
  field fails the test

go test ./cmd/hive/ passes; gateAdvisoryFindings at 100%.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: sec-check <sec-check@hive.kubestellar.io>
@kubestellar-hive

Copy link
Copy Markdown
Contributor Author

Important

Held for human review by the hive's ACMM level gate.

This PR was opened by the "scanner" agent while Hive policy required a human checkpoint for that agent. Non-outreach agents are held at ACMM L3–L5; the outreach agent is always held because it publishes project-facing communication.

Hive will automatically remove the hold label once current policy no longer requires a level hold for "scanner". If this is an outreach PR, a human must review it and remove the label.

@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Sep 17, 2026
@kubestellar-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign clubanderson for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@github-actions

Copy link
Copy Markdown
Contributor

Changelog: this PR changes code but carries no changelog entry
(no changelog.d/ fragment and no CHANGELOG.md edit).

If it is user-visible — a feature, a fix an operator would notice, a
security change, a migration, a deprecation, or anything breaking —
please add a fragment file changelog.d/<category>-<pr-or-slug>.md
containing exactly your entry (see changelog.d/README.md; the
category is one of added/changed/deprecated/fixed/security). Please
do not append to CHANGELOG.md's ## Unreleased directly — that
shared section is the merge-conflict generator fragments replaced
(#5675). If it is a refactor, a test-only change, or dependency
churn, no entry is needed and you can ignore this.

This is a reminder, not a gate; it never blocks a merge.

@kubestellar-prow kubestellar-prow Bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Sep 17, 2026
@kubestellar-hive kubestellar-hive Bot added no-changelog No changelog fragment required agent/scanner Created or modified by the scanner agent hive/hosted-available-oke-11-placeholder-r05x Approved by a Hive merger/owner for auto-merge on green CI labels Sep 17, 2026
@clubanderson clubanderson removed the hold label Sep 17, 2026

@clubanderson clubanderson left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Canary gate seam extraction is a pure move with the test seam threaded through — behavior pinned by the new table tests. LGTM.

@clubanderson
clubanderson merged commit ae8f438 into v4 Sep 17, 2026
54 of 59 checks passed
@kubestellar-prow kubestellar-prow Bot added the lgtm Indicates that a PR is ready to be merged. label Sep 17, 2026
@kubestellar-prow

Copy link
Copy Markdown
Contributor

LGTM label has been added.

DetailsGit tree hash: 48a10c5c8eb0bc9451096a1735503e77946c931f

@clubanderson
clubanderson deleted the scanner/fix-7232-advisory-canary-gate branch September 17, 2026 11:20
@github-actions

Copy link
Copy Markdown
Contributor

Thank you for your contribution! Your PR has been merged.

We'd love to hear how your experience was: share feedback

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

Labels

agent/scanner Created or modified by the scanner agent copilot dco-signoff: yes Indicates the PR's author has signed the DCO. hive/hosted-available-oke-11-placeholder-r05x Approved by a Hive merger/owner for auto-merge on green CI lgtm Indicates that a PR is ready to be merged. no-changelog No changelog fragment required size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant