Skip to content

fix(backups): reject unknown consumer identities before maintenance - #427

Merged
RentnerKev merged 1 commit into
mainfrom
rentner/fix-backup-quiescence-426
Nov 12, 2026
Merged

RentnerKev merged 1 commit into
mainfrom
rentner/fix-backup-quiescence-426

Conversation

@RentnerKev

@RentnerKev RentnerKev commented Nov 12, 2026 •

Copy link
Copy Markdown
Member

Summary

Backup and restore maintenance previously treated an unreadable, empty or malformed process identity as a non-consumer. Require fresh, complete identity evidence before export or consumer restart; an identity that remains unknown after three bounded reads now fails closed.

Preserve the owned Valkey and verified retained-Caddy exceptions, restore-only web preservation, mixed-UID rejection and exited/disappeared-process handling. No new process or Rust service is introduced.

Related issue

Refs #426, item 1 only. Worker telemetry and PostgreSQL efficiency are handled separately, so this PR does not close the parent issue.

Type of change

  • Bug fix

Testing

  • New identity regression fails against the original supervisor with “empty identity was accepted as a non-consumer” and passes with the fix.
  • Isolated Linux/Bun 1.4.4: 12/12 backup-supervisor, fault-supervisor and maintenance-subprocess tests passed.
  • Real Linux process fixtures passed, including the owned Valkey exception and a detached surviving UID-10001 consumer.
  • Shell syntax and diff whitespace checks passed.
  • Independent source review found no actionable issue.

Fixtures also cover transient/finally unreadable identities, missing/malformed UID fields, bounded fresh-read retries, process disappearance, zombie/exited states, mixed credentials, restore preservation and exact retained-Caddy verification.

Commands already executed (replace with the isolated checkout's absolute path):

docker run --rm --network none --mount 'type=bind,source=<worktree>,target=/workspace,readonly' --tmpfs /workspace/tmp --workdir /workspace --entrypoint bun oven/bun:1.4.4 --no-env-file test web/src/tests/tooling/docker/production/backup-supervisor.test.ts web/src/tests/tooling/docker/production/fault-supervisor.test.ts web/src/tests/tooling/scripts/backup/maintenance-process.test.ts
docker run --rm --network none --mount 'type=bind,source=<worktree>,target=/workspace,readonly' --workdir /workspace --entrypoint bash oven/bun:1.4.4 -c 'bash -n docker/production/backups/supervisor.sh docker/production/tests/backups.sh && bash docker/production/tests/backups.sh --linux-processes'
git diff --check

The first command uses a container-private tmpfs for test scratch files. Before the supervisor fix, running the new shell fixture against the original source exited 1 at the empty-identity regression; the corrected source passes.

Checklist

  • Relevant behavior and failure cases tested.
  • Existing ownership, maintenance and restore contracts preserved.
  • No secrets, production data, documentation files or screenshots added.
  • Related parent issue linked.

Breaking changes

Maintenance now stops explicitly when it cannot prove a surviving process safe, rather than proceeding with an unknown identity.

@coderabbitai

coderabbitai Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The backup maintenance process scan now retries process status reads, validates UID evidence, and blocks when a surviving process identity remains unknown. Tests cover identity outcomes, retry behavior, exceptions, and retained Caddy ownership checks.

Changes: Backup consumer identity checks

Layer / File(s) Summary
Read and classify process identity
docker/production/backups/supervisor.sh, docker/production/tests/backups.sh
The identity check retries status reads up to three times, validates all four UID fields, and distinguishes consumer, safe or vanished, and unknown identities. Tests cover malformed or unavailable status data, fresh retry evidence, preserve-web, and exited processes.
Apply identity checks in consumer scan
docker/production/backups/supervisor.sh, docker/production/tests/backups.sh
The scan fails if a surviving process identity is unknown. Tests cover that failure and verify the retained Caddy ownership check against the maintenance operation.

Estimated code review effort: 2 (Simple) | ~15 minutes

Change: Bug fix

Possibly related issues

Merge Risk: Minimal · up to 0b140

Backup maintenance now stops when it cannot prove a surviving process is safe, instead of skipping it. No merge-blocking issue was identified.

Security architecture risk: Minimal · up to 0b140

The change strengthens maintenance admission without granting additional authority. Persistent identity uncertainty now stops maintenance, while the existing ownership checks and shutdown paths remain in place. No material security risk introduced or worsened by this PR was identified.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The relevant failure scope is the production supervisor’s visible process namespace and managed services. Persistent identity uncertainty can stop those services rather than permit export or restart under uncertain quiescence; the changed gate grants no additional execution authority.

Security Findings and Attack Paths

  • inferred — The comparison closes the permissive identity-read-failure path at this checkpoint: a surviving process with persistently unreadable or malformed identity no longer passes as a non-consumer. No introduced or worsened attack path was identified in the inspected gate and lifecycle paths.

Trust Boundaries and Controls

  • observed — The retained-Caddy exception is bound to a root-controlled receipt, maintenance UUID, exact PID, and recorded process start ticks. Its identity helper also checks all credentials and the expected executable, with start-tick reads before and after inspection. Removing the unreadable-status skip makes this verifier load-bearing even when the scan cannot read Caddy’s status.

Resilience and Maintainability Implications

  • observed — Retries are bounded to three reads with at most two 0.1-second delays per uncertain entry. Waiting alone never admits the process: a fresh safe classification or disappearance is required, otherwise maintenance terminates through the established failure path.
Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: the backup maintenance now rejects consumer process identities it cannot prove, instead of treating them as non-consumers. It follows the conventional commit format an…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description check Passed The description follows the repository template. It states the problem and fix in the Summary, links Refs #426 with a clear scope note, marks Bug fix, and gives concrete testing commands and results. …
Full details: Title check

Explanation

The title names the main change: the backup maintenance now rejects consumer process identities it cannot prove, instead of treating them as non-consumers. It follows the conventional commit format and is specific enough for a reviewer scanning history. The summary and objectives both describe the same fail-closed behavior.

Full details: Description check

Explanation

The description follows the repository template. It states the problem and fix in the Summary, links Refs #426 with a clear scope note, marks Bug fix, and gives concrete testing commands and results. The Checklist and Breaking changes sections are filled in. Minor gaps: the Related issue uses "Refs" rather than "Fixes"/"Closes", which the author explains as partial scope, and the Checklist's "Existing tests pass" and "I updated documentation where necessary" items are not explicitly ticked. The content is still substantively complete.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 8ac0e3c and 0b1409f.

Files selected for processing: 2

  • docker/production/backups/supervisor.sh
  • docker/production/tests/backups.sh

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

@RentnerKev
RentnerKev merged commit 4294bf8 into main Nov 12, 2026
68 checks passed
@RentnerKev
RentnerKev deleted the rentner/fix-backup-quiescence-426 branch November 12, 2026 18:35
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