Skip to content

[audit] Dead code: delete unused alt-constructors/methods in pkg/scheduler + pkg/alerts #290

Closed

Description

@scttfrdmn

Filed from the 2026-07-11 spawn audit. Full report: docs/spawn-audit-2026-07-11.md. Assessment-only — no code changed yet.

Phase: Phase 0 — do now (dead code)

Evidence

  • pkg/scheduler/scheduler.go:55,277,330 — unused constructors/methods
  • pkg/alerts/alerts.go:98 NewClientWithEncryption, :110 NewClientWithTableNames, :174 GetAlert, :291 RecordAlertHistory — dead (verified no callers incl. lambda modules)

Recommendation
Delete the 7 unused constructors/CRUD methods.

User-facing / SemVer: No — internal. No bump.

Adversarially verified during the audit (62/62 findings survived verification; severities/scope adjusted where the first pass was wrong).

Activity

  1. added
    audit:2026-07
    on Jul 11, 2026
  2. scttfrdmn commented on Jul 11, 2026

    @scttfrdmn
    ContributorAuthor

    Scope correction during Phase 0 execution (PR #330): re-verified all 7 named funcs against the live tree. Only 2 had zero references anywhere:

    • alerts.NewClientWithEncryption — removed
    • scheduler.UpdateScheduleMetadata — removed

    The other 5 are live test infrastructure, not dead:

    • scheduler.NewClientWithTableName — the constructor for ~8 scheduler tests
    • scheduler.RecordExecution — seeds the test for the live GetExecutionHistory
    • alerts.NewClientWithTableNames — the constructor for the whole alerts_substrate_test.go
    • alerts.GetAlert / alerts.RecordAlertHistory — exercised by alerts_substrate_test.go

    The original finding over-counted because deadcode (run over the main module) can't see build-tagged/substrate test usage. Removing them would strip real coverage of live code, so they stay. Closing the removed portion via #330; leaving this issue open only if we later decide the substrate tests themselves should go (separate call).

  3. scttfrdmn commented on Jul 15, 2026

    @scttfrdmn
    ContributorAuthor

    Verified complete against current main (post-#326/#330).

    PR #330 already removed the only 2 symbols in the audit's list of 7 that had zero references anywhere:

    • alerts.NewClientWithEncryption
    • scheduler.UpdateScheduleMetadata

    Re-checked the remaining 5 across the whole spawn module + all lambda/* submodules + cmd/: they are live test-harness constructors/helpers, not dead code — deleting them would break unit/substrate tests for no benefit:

    Nothing left to delete. Closing as done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    audit:2026-07

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions