Skip to content

test(ci): selftest, alert and tidy tests and the audit pipeline template (P7-AUTO-20) - #547

Merged
acamarata merged 1 commit into
land/p7f-pluginsfrom
gaps/p7-auto-20
Oct 30, 2026
Merged

acamarata merged 1 commit into
land/p7f-pluginsfrom
gaps/p7-auto-20

Conversation

@acamarata

Copy link
Copy Markdown
Contributor

#543 carries the P7-AUTO-20 code (doctor --selftest [--alert], runs prune --tidy) without any test, and without the audit template. This PR adds both. Stacked on #543 (base land/p7f-plugins).

  • internal/selftest/selftest_test.go
    • TestSelftestChecksFlip: a healthy host passes all nine checks. Planting a stuck claim, a leaked job root, infra failures, a stale watcher, low disk or a missing required tool flips only the matching check to fail. An unreadable fact warns.
    • TestSelftestAlertOncePerDay: a failing set is sent once per UTC day. One more failing check makes a new message. A clean report sends nothing. The next day sends again. A set no sink took is retried.
    • TestTidyReportOnlyByDefault: without --apply, nothing is removed and the report lists the exact items.
    • TestTidyApplyReachesTarget: apply removes exactly the planned items and reaches the target. An unreachable target says why.
  • templates/audit-pipeline.yml: a schedule-only pipeline (so it runs in the background band) for govulncheck, pnpm audit and go test -race, merged into .nself/ci.yaml.
  • internal/selftest/audit_template_test.go, TestAuditTemplateValid: the template passes config.Parse (the pipeline-config schema). As a drill, a watcher pass on a not-ready host never calls the idle tick that starts it. A ready idle host starts one pipeline.

Verification (local, scoped)

  • go test -mod=vendor -count=1 -v -run '<the five names>' ./internal/selftest/: all PASS.
  • go vet ./internal/selftest/, go test ./architecture/... and gofmt are clean.

Not covered here

cmd/doctor_selftest_test.go and cmd/runs_tidy_test.go (store-backed CLI tests) are still absent. The acceptance behaviour is proven at the package level above.

Ticket: P7-AUTO-20

…ate (P7-AUTO-20)

Planted stuck claim, leaked job root, infra failures and others each flip
only their own check; the alert goes out once per failing set per UTC day
and retries a set no sink took; tidy is report-only without --apply and
applies exactly the planned items. templates/audit-pipeline.yml is a
schedule-only pipeline (background band) for govulncheck, pnpm audit and
go test -race; a watcher drill shows a not-ready host never starts it.
@acamarata
acamarata merged commit a9a1b8d into land/p7f-plugins Oct 30, 2026
16 of 19 checks passed
@acamarata

Copy link
Copy Markdown
Contributor Author

Folded into #543 (land/p7f-plugins) to land in one CI run.

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