Skip to content

[quality] test: pin ioscan classifier audit trail, CI-failing kick list, and tokens Diagnostics - #6059

Merged
clubanderson merged 1 commit into
v4from
quality/test-scheduler-audit-tokens-diag
Sep 5, 2026
Merged

[quality] test: pin ioscan classifier audit trail, CI-failing kick list, and tokens Diagnostics#6059
clubanderson merged 1 commit into
v4from
quality/test-scheduler-audit-tokens-diag

Conversation

@kubestellar-hive

Copy link
Copy Markdown
Contributor

Test Improvement

Coverage analysis (go test ./pkg/... -short -coverprofile, total 94.7%) found three untested clusters. This PR adds 14 hermetic tests, no production code.

Files/functions claimed (for overlap comparison by future kicks):

  • src/pkg/scheduler/ioscan_classifier_audit_test.go (new) → recordClassifierResult, recordClassifierSkip in src/pkg/scheduler/ioscan_enforce.go (60% → 100%)
  • src/pkg/scheduler/ci_failing_list_test.go (new) → buildCIFailingList in src/pkg/scheduler/scheduler.go (58.3% → 100%)
  • src/pkg/tokens/diagnostics_test.go (new) → (*Collector).Diagnostics in src/pkg/tokens/collector.go (0% → 100%)

What the tests pin:

  • Every semantic-classifier decision (allow/redact) and every skipped evaluation (budget_exhausted, error) records an ioscan_classifier audit entry with rule/score/category/action — previously the emission paths were dead in tests, so a regression silently dropping classifier decisions from the audit trail would not have been caught.
  • buildCIFailingList renders (none) for missing/malformed/empty snapshots and one correctly formatted line per failing PR (number, repo, author, head SHA, title) — the kick template contract.
  • tokens.Diagnostics: zero value before scan, clean healthy scan, LiveCaptureEnabled toggle, LastScanError/LastBobScanError surfacing, and per-scan rebuild (stale bob error clears after a healthy scan).

Disjointness: verified against the open-PR snapshot — #6049 (pkg/hub health/verdict, pkg/agent start_failure, cmd/hive), #6046 (v5 forward-port; full 249-file list checked — no scheduler or tokens files), #6010 (pkg/hub wildcard TLS). No file overlap.

Validation

  • go test ./pkg/scheduler/ ./pkg/tokens/ -short -count=1 — ok, coverage 96.3%→97.1% (scheduler), 94.8%→95.7% (tokens)
  • go vet ./pkg/scheduler/ ./pkg/tokens/ — clean
  • (-race unavailable in this sandbox: no gcc for cgo; CI's v2-tests lane runs it)

Filed by quality agent (hold-gated mode). Human review required.

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

…st, and tokens Diagnostics

Covers three previously-untested paths found by coverage analysis:

- pkg/scheduler/ioscan_enforce.go recordClassifierResult /
  recordClassifierSkip (60% -> 100%): every semantic-classifier decision
  (allow/redact/block) and every skipped evaluation (budget_exhausted,
  error) must land in the audit log with the ioscan_classifier action and
  a detail carrying rule/score/category/action.
- pkg/scheduler/scheduler.go buildCIFailingList (58.3% -> 100%): missing
  snapshot file, malformed JSON, empty items, and per-PR line formatting
  (number, repo, author, head SHA, title).
- pkg/tokens/collector.go Diagnostics accessor (0% -> 100%): zero value
  before scan, clean healthy scan, LiveCaptureEnabled toggle, scan-error
  surfacing (LastScanError, LastBobScanError), and per-scan rebuild so a
  stale bob error clears after a healthy scan.

Test-only change; no production code touched.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: hivecommons-hive[bot] <hive-bot@hivecommons.dev>
@kubestellar-hive kubestellar-hive Bot added the hold label Sep 5, 2026
@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Sep 5, 2026
@github-actions

github-actions Bot commented Sep 5, 2026

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 5, 2026
@kubestellar-hive kubestellar-hive Bot added quality testing agent/quality Approved by a Hive merger/owner for auto-merge on green CI hive/hosted-available-oke-11-placeholder-r05x Approved by a Hive merger/owner for auto-merge on green CI labels Sep 5, 2026
@clubanderson clubanderson added no-changelog No changelog fragment required and removed hold labels Sep 5, 2026
@clubanderson

Copy link
Copy Markdown
Member

/lgtm
/approve

@kubestellar-prow kubestellar-prow Bot added the lgtm Indicates that a PR is ready to be merged. label Sep 5, 2026
@kubestellar-prow

Copy link
Copy Markdown
Contributor

LGTM label has been added.

DetailsGit tree hash: 2e69fa8150af1a0b81dd541f42b2d1e3297473f5

@kubestellar-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: clubanderson

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

The pull request process is described 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

@clubanderson
clubanderson merged commit a53c92c into v4 Sep 5, 2026
54 of 61 checks passed
@kubestellar-prow kubestellar-prow Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 5, 2026
@clubanderson
clubanderson deleted the quality/test-scheduler-audit-tokens-diag branch September 5, 2026 06:23
@github-actions

github-actions Bot commented Sep 5, 2026

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

clubanderson pushed a commit that referenced this pull request Sep 8, 2026
v5 removed the enforceIssueText wrapper (dead-code refactor); the v4 test
from #6059 still called it. Use the two-value form v5 keeps instead of
resurrecting the wrapper.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TmdVsn5zULh5KVpFkYrX59
Signed-off-by: Andrew Anderson <andan02@gmail.com>
kubestellar-hive Bot added a commit that referenced this pull request Sep 8, 2026
…st, and tokens Diagnostics (#6059)

Covers three previously-untested paths found by coverage analysis:

- pkg/scheduler/ioscan_enforce.go recordClassifierResult /
  recordClassifierSkip (60% -> 100%): every semantic-classifier decision
  (allow/redact/block) and every skipped evaluation (budget_exhausted,
  error) must land in the audit log with the ioscan_classifier action and
  a detail carrying rule/score/category/action.
- pkg/scheduler/scheduler.go buildCIFailingList (58.3% -> 100%): missing
  snapshot file, malformed JSON, empty items, and per-PR line formatting
  (number, repo, author, head SHA, title).
- pkg/tokens/collector.go Diagnostics accessor (0% -> 100%): zero value
  before scan, clean healthy scan, LiveCaptureEnabled toggle, scan-error
  surfacing (LastScanError, LastBobScanError), and per-scan rebuild so a
  stale bob error clears after a healthy scan.

Test-only change; no production code touched.

Signed-off-by: hivecommons-hive[bot] <hive-bot@hivecommons.dev>
Co-authored-by: hivecommons-hive[bot] <hive-bot@hivecommons.dev>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: sec-check <sec-check@hive.kubestellar.io>
kubestellar-hive Bot pushed a commit that referenced this pull request Sep 8, 2026
v5 removed the enforceIssueText wrapper (dead-code refactor); the v4 test
from #6059 still called it. Use the two-value form v5 keeps instead of
resurrecting the wrapper.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TmdVsn5zULh5KVpFkYrX59
Signed-off-by: Andrew Anderson <andan02@gmail.com>

Signed-off-by: sec-check <sec-check@hive.kubestellar.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent/quality Approved by a Hive merger/owner for auto-merge on green CI approved Indicates a PR has been approved by an approver from all required OWNERS files. 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 quality size/L Denotes a PR that changes 100-499 lines, ignoring generated files. testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant