Skip to content

[Tech Debt]: workload_details.started_at and completed_at columns are declared but never written #64

Description

@mrhillsman

Category

Code quality / code smell

Description

internal/audit/schema.go declares two timestamp columns on workload_details:

CREATE TABLE IF NOT EXISTS workload_details (
    ...
    started_at       TEXT,
    completed_at     TEXT
);

docs/audit-schema.md marks both as "Reserved — currently unset." The Auditor interface and its SQLiteAuditor implementation never write to these columns. They are dead schema.

Severity

Low — cosmetic or minor inconvenience

Affected Files

  • internal/audit/schema.go — column declarations
  • internal/audit/audit.goRecordWorkload, UpdateWorkloadStatus, CompleteExecution
  • cmd/virtwork/main.go — orchestration calls that record per-workload progress
  • docs/audit-schema.md — descriptions to update either way

Proposed Fix

Pick one:

Option A — populate them. Stamp started_at when RecordWorkload is called (right before VM creation begins for that workload), and completed_at from UpdateWorkloadStatus when transitioning to created / failed. Useful if anyone ever queries per-workload duration.

Option B — drop them. If nobody plans to query workload-level start/end timestamps separately from audit_log.started_at / VM-level timestamps, remove the columns from schemaSQL. The audit schema doc already calls them out; one less surface to maintain.

Either option is a small, contained PR; the choice is editorial.

Area

Audit system

Architecture Layer

Layer 4 - Orchestration (cmd, cleanup)

Additional Context

See also the related issues for audit_log.cluster_context and audit_log.cleanup_mode, which have the same "declared but never written" pattern.

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