Delete a job removed from the manifest if it never ran

Open
#245 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
48/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
django, python
Domain
backend, databases

Research direction

Start by tracing sync behavior for jobs removed from .secondshift.yaml and how Run.job uses PROTECT. Then inspect the job relationships named in the issue—tasks, grants, triggers, capability requests—and their deletion behavior. Confirm that jobs without runs can be deleted without dangling records, jobs with runs retain removed_at, and resolve whether old approvals should expire when a job returns.

Written by the indexing model from the issue text.

Description

enhancement

Follows #242.

When a job leaves .secondshift.yaml, sync marks it with removed_at instead of deleting it. That keeps history that matters: runs, reports, deliveries and the record of who approved its access. Run.job is PROTECT, so a job with runs can't be deleted anyway.

A job that never ran has no history to keep. Its row is only clutter, for example a job that was added and renamed before it ever ran.

Proposal

  • In sync, delete a job that drops out of the manifest when it has no runs. Its triggers and capability requests go with it through the existing cascades.
  • Jobs with runs keep the removed_at mark as today.
  • Check what else points at a job (tasks, grants, triggers) and confirm that deleting it leaves nothing dangling.

Open question

A job added back keeps its old approvals. Sync already drops approvals for capabilities the job no longer asks for, so it never gains access it wasn't approved for. Decide whether approvals should also expire after the job has been gone a long time, so access gets reviewed again.

🤖 Generated with Claude Code

Dominant language
Python
Stars
1
Forks
1
Avg merge
1h 9m
Merged PRs (30d)
322

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from piotrekno1/second-shift

All issues in piotrekno1/second-shift

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.