Skip to content

[Tech Debt]: audit_log.cluster_context column is declared but never populated #65

Description

@mrhillsman

Category

Code quality / code smell

Description

audit_log.cluster_context exists in internal/audit/schema.go and is documented in docs/audit-schema.md as "Reserved — currently unused." The audit code path never reads the kubeconfig context name or writes it into this column. It is dead schema.

Severity

Low — cosmetic or minor inconvenience

Affected Files

  • internal/audit/schema.go — column declaration
  • internal/audit/audit.goStartExecution (would be the natural place to write it)
  • internal/cluster/cluster.go — would need to surface the active context if Option A is chosen
  • docs/audit-schema.md — description

Proposed Fix

Pick one:

Option A — populate it. Derive the context name from clientcmd when cluster.Connect loads a kubeconfig with multiple contexts, and pass it to Auditor.StartExecution via the Config struct (or a new field). Helpful for operators running against multiple clusters from one workstation.

Option B — drop it. If multi-context awareness isn't on the roadmap, remove the column from schemaSQL.

Area

Audit system

Architecture Layer

Layer 4 - Orchestration (cmd, cleanup)

Additional Context

Related: audit_log.cleanup_mode and workload_details.started_at / completed_at are also reserved-but-unused.

Metadata

Metadata

Assignees

No one assigned

    Labels

    size/SDenotes a PR that changes 10-29 lines, ignoring generated files.tech-debtTechnical debt, code quality, or maintenance concerntriage/acceptedIndicates an issue or PR is ready to be actively worked on.

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions