fix(systems): audit the requester of an ordinary teardown recycle

Open
#3,589 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
1-2 days
Newbie friendliness
48/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
python
Domain
backend

Research direction

Read src/kdive/mcp/tools/lifecycle/systems/admin.py at the ordinary recycle paths around lines 541-556, then compare the authority path around lines 634 and 659-676. The issue leaves the audit behavior to an operator decision, so first resolve whether ordinary recycles should record the requester; if they should, add coverage with two distinct principals and confirm the recorded audit trail identifies the recycle requester.

Written by the indexing model from the issue text.

Description

area:mcp-api area:security effort:S priority:P3 risk:daytime-only status:ready type:bug

Problem

A failed ordinary (non-authority) {uid}:teardown job is recycled by a later systems.teardown call. The recycled job keeps the first enqueuer's authorizing principal (ADR-0447) and nothing records who asked for the recycle. #3544 / commit 03037508d added that audit row for the authority path only.

Evidence

  • src/kdive/mcp/tools/lifecycle/systems/admin.py:541-543: dedup_replay(conn, _teardown_dedup_key(uid), recycle=FAILED) recycles with no callback.
  • admin.py:549-556: the queue.enqueue(... recycle=FAILED) path likewise passes no on_recycle.
  • admin.py:634 and :659-676: the authority path passes on_recycle=partial(_audit_authority_recycle, ...), writing transition="teardown:recycled".

Expected

Operator decision first: record the requester for ordinary recycles too (consistent trail), or record that the ordinary path is deliberately unaudited.

Proposed approach

If approved, reuse the existing on_recycle callback at both ordinary sites, generalising _audit_authority_recycle (rename, no authority-specific fields), with a test using two distinct principals.

Provenance

Follow-up from campaign 4c2c8dc9e59d-7f9a87f5-2251-458a-bb30-04fbb2d4b05c. Source: #3544 scope exclusion.

Dominant language
Python
Stars
0
Forks
0
Avg merge
9h 13m
Merged PRs (30d)
197

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 randomparity/kdive

All issues in randomparity/kdive

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.