Skip to content

feat: platform audit budget/compliance cross-refs + fix CR API group#10

Merged
stxkxs merged 1 commit into
mainfrom
platform-budget-compliance
May 30, 2026
Merged

feat: platform audit budget/compliance cross-refs + fix CR API group#10
stxkxs merged 1 commit into
mainfrom
platform-budget-compliance

Conversation

@stxkxs
Copy link
Copy Markdown
Member

@stxkxs stxkxs commented May 30, 2026

See the commit message for full detail. Final slice of the Platform-tenant auditor — and a bug fix for #8/#9.

⚠️ Bug fix

The Platform/Tenant CRs are in the platform.nanohype.dev group and BudgetPolicy in governance.nanohype.dev — not agents.stxkxs.io, which the merged auditor hardcoded in its GVR. On a real cluster platform audit would have listed zero Platforms. Fixed platformGVR (+ added tenant/budget GVRs); fixtures corrected so they actually exercise the shipping GVR.

Summary

  • Budget + compliance cross-refsspec.budget.name resolves to a BudgetPolicy (in the Platform's namespace); SOC2 platforms require killSwitchEnabled; the Platform's compliance is ≥ its owning (cluster-scoped) Tenant. New findings: BUDGET_POLICY_MISSING, KILL_SWITCH_DISABLED, COMPLIANCE_WEAKER_THAN_TENANT, TENANT_MISSING.
  • Reuses the dynamic client already in Audit; no AWS, no new dependency.
  • 10 platform tests (added budget-missing / kill-switch / compliance-weaker).

Verification

go build, go test ./..., go vet, golangci-lint v2.12.2 (uncapped) all pass.

This completes Phase 2 — the Platform auditor now covers the cluster, AWS IRSA, and budget/compliance sides of the contract.

…I group

Completes the Platform-tenant auditor with the budget + compliance
cross-resource checks, and corrects the custom-resource API group that
slices #8/#9 hardcoded wrong.

─── Bug fix (affects the already-merged auditor) ───

The Platform and Tenant CRs live in the platform.nanohype.dev API group
and BudgetPolicy in governance.nanohype.dev — NOT agents.stxkxs.io, which
the auditor's platformGVR hardcoded. Against a real cluster, `platform
audit` listed zero Platforms (the GVR matched nothing). Corrected
platformGVR and added the tenant + budget GVRs. The earlier unit tests
passed only because their fixtures used the same wrong group; the fixtures
now use the real groups, so they actually exercise the shipping GVR.

─── Budget + compliance cross-references ───

- internal/platform: auditBudgetCompliance runs for every Platform (spec
  consistency, independent of phase) and reports:
    - spec.budget.name empty or pointing at a BudgetPolicy that doesn't
      exist (BUDGET_POLICY_MISSING)
    - a SOC2 platform whose referenced BudgetPolicy has
      killSwitchEnabled=false (KILL_SWITCH_DISABLED)
    - a Platform less strict than its owning Tenant — Tenant requires
      soc2/hipaa but the Platform doesn't (COMPLIANCE_WEAKER_THAN_TENANT)
    - spec.tenant pointing at a Tenant CR that doesn't exist (TENANT_MISSING)
  BudgetPolicy is looked up in the Platform's namespace; the Tenant CR is
  cluster-scoped. Reuses the dynamic client already threaded through Audit.
- internal/cloud: the four new finding types; SARIF rules extended.

─── Tests ───

- audit_test.go: fixtures corrected to the real API groups and given a
  matching BudgetPolicy + Tenant; new cases cover budget-missing,
  kill-switch-disabled, and compliance-weaker-than-tenant (10 tests total).

No new dependency. Verification: go build ./..., go test ./..., go vet
./..., and golangci-lint v2.12.2 (uncapped) all pass.

This completes Phase 2: the Platform auditor now spans the cluster, AWS
IRSA, and budget/compliance sides of the eks-agent-platform contract.

Co-authored-by: stxkxsbot <275011021+stxkxsbot@users.noreply.github.com>
@stxkxs stxkxs merged commit fac9fb5 into main May 30, 2026
4 checks passed
@stxkxs stxkxs deleted the platform-budget-compliance branch May 30, 2026 04:47
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