Skip to content

Remove dead job/migration/schedule functions#13

Merged
wnstfy merged 3 commits into
developfrom
chore/dead-code-jobs-schedule
Jun 21, 2026
Merged

Remove dead job/migration/schedule functions#13
wnstfy merged 3 commits into
developfrom
chore/dead-code-jobs-schedule

Conversation

@wnstfy

@wnstfy wnstfy commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

Summary

Part of a grouped dead-code cleanup (3 PRs, split by area). This PR removes zero-caller functions across the multi-job, migration, and schedule modules.

Changes (3 atomic commits)

  • lib/jobs.sh — remove get_job_config_file, validate_job_config, get_default_job, is_multi_job
  • lib/migration.sh — remove rollback_migration, show_migration_status, is_multi_job_enabled (no CLI routes to rollback/status; auto-migration is one-way)
  • lib/schedule.sh — remove get_template_display, get_template_description, detect_template_name (keeps get_template_schedule and list_schedule_templates, which the schedule CLI uses)

244 lines removed.

Scope note

Strictly behaviour-preserving: only functions with zero callers anywhere in the codebase or tests. The suggest_alternative_times conflict-suggestion feature and the job reserved-name list are reachable (wired into check_schedule_conflicts/validate_job_name), so they are intentionally left for a separate behaviour-change review, not included here.

Testing

  • ./tests/run-tests.sh --syntax — 22 files pass
  • ./tests/run-tests.sh --unit — all unit tests pass
  • shellcheck -x -s bash -S warning backupd.sh lib/*.sh — clean

Targets develop. Hold for green CI + review before merge.

wnstfy added 3 commits June 21, 2026 14:15
get_job_config_file, validate_job_config, get_default_job and is_multi_job
have no callers anywhere in the codebase or tests. Callers build job paths
inline and validation/mode-detection are never invoked.
rollback_migration, show_migration_status and is_multi_job_enabled have no
callers: no CLI subcommand routes to rollback or status, and auto-migration
is one-way. Drops the now-orphaned "Migration Status" section header too.
get_template_display, get_template_description and detect_template_name have
no callers. get_template_schedule and list_schedule_templates (used by the
schedule CLI) are kept.
@greptile-apps

greptile-apps Bot commented Jun 21, 2026

Copy link
Copy Markdown

Greptile Summary

This PR removes 10 dead functions (244 lines) across lib/jobs.sh, lib/migration.sh, and lib/schedule.sh. All removed symbols were confirmed to have zero callers in the codebase and tests before deletion.

  • lib/jobs.sh — drops get_job_config_file, validate_job_config, get_default_job, and is_multi_job; no call sites exist anywhere.
  • lib/migration.sh — drops rollback_migration, show_migration_status, and is_multi_job_enabled; the migration path is intentionally one-way with no CLI routes to these.
  • lib/schedule.sh — drops get_template_display, get_template_description, and detect_template_name; retains get_template_schedule and list_schedule_templates which are actively used by lib/cli.sh; also corrects the file mode from 755 → 644 (library file, not a standalone executable).

Confidence Score: 4/5

All removed functions are genuinely unreachable — no callers exist anywhere in the codebase or tests. The schedule module correctly retains the two functions actively consumed by cli.sh.

The removals are well-scoped dead code with no functional impact. The only loose end is that CHANGELOG.md still lists three of the deleted functions as part of the BACKUPD-035 API surface, which could mislead someone treating the changelog as a reference.

CHANGELOG.md — line 139 names three now-deleted functions and should be updated to reflect the removal.

Important Files Changed

Filename Overview
lib/jobs.sh Removes four dead functions (get_job_config_file, validate_job_config, get_default_job, is_multi_job); confirmed zero callers across the codebase.
lib/migration.sh Removes three dead functions (rollback_migration, show_migration_status, is_multi_job_enabled); confirmed zero callers; auto-migration is intentionally one-way.
lib/schedule.sh Removes three dead helpers (get_template_display, get_template_description, detect_template_name) and corrects the file mode from executable (755) to non-executable (644); list_schedule_templates still outputs all four pipe-delimited fields consumed by cli.sh.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    subgraph jobs["lib/jobs.sh (removed)"]
        A[get_job_config_file]
        B[validate_job_config]
        C[get_default_job]
        D[is_multi_job]
    end

    subgraph migration["lib/migration.sh (removed)"]
        E[is_multi_job_enabled]
        F[rollback_migration]
        G[show_migration_status]
    end

    subgraph schedule["lib/schedule.sh (removed)"]
        H[get_template_display]
        I[get_template_description]
        J[detect_template_name]
    end

    subgraph kept["lib/schedule.sh (retained)"]
        K[get_template_schedule]
        L[list_schedule_templates]
    end

    CLI["lib/cli.sh"] --> K
    CLI --> L

    style jobs fill:#ffcccc,stroke:#cc0000
    style migration fill:#ffcccc,stroke:#cc0000
    style schedule fill:#ffcccc,stroke:#cc0000
    style kept fill:#ccffcc,stroke:#009900
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
    subgraph jobs["lib/jobs.sh (removed)"]
        A[get_job_config_file]
        B[validate_job_config]
        C[get_default_job]
        D[is_multi_job]
    end

    subgraph migration["lib/migration.sh (removed)"]
        E[is_multi_job_enabled]
        F[rollback_migration]
        G[show_migration_status]
    end

    subgraph schedule["lib/schedule.sh (removed)"]
        H[get_template_display]
        I[get_template_description]
        J[detect_template_name]
    end

    subgraph kept["lib/schedule.sh (retained)"]
        K[get_template_schedule]
        L[list_schedule_templates]
    end

    CLI["lib/cli.sh"] --> K
    CLI --> L

    style jobs fill:#ffcccc,stroke:#cc0000
    style migration fill:#ffcccc,stroke:#cc0000
    style schedule fill:#ffcccc,stroke:#cc0000
    style kept fill:#ccffcc,stroke:#009900
Loading

Reviews (1): Last reviewed commit: "Remove unused schedule-template accessor..." | Re-trigger Greptile

@wnstfy
wnstfy merged commit 53038c2 into develop Jun 21, 2026
4 checks passed
@wnstfy
wnstfy deleted the chore/dead-code-jobs-schedule branch June 21, 2026 12:57
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