Skip to content

fix(erasure): keep operator scratch that is not owner-only instead of planning it (#1468) - #2495

Merged
jinon86 merged 2 commits into
mainfrom
fix/1468-scratch-owner-only-retain
Oct 23, 2026
Merged

jinon86 merged 2 commits into
mainfrom
fix/1468-scratch-owner-only-retain

Conversation

@jinon86

@jinon86 jinon86 commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

What

Owner decision 2026-10-23 on #1468 (option 2): operator scratch that is not owner-only is kept, not planned for deletion.

ccc-erasure-apply.py refuses a whole run when any target is not owned by the effective uid or has a group/other bit (check_ancestors: owner-not-euid / group-other-bits-on-target). On the first node measured, 24 of 45 scratch files were 0644/0755, so every prune-expired run would be refused — and chmod 600 would refresh ctime and restart the 90-day clock.

  • scripts/ccc-erasure-planner.py: _owner_only() (same target test as apply) applied to the fallback_scope class only → retain (not owner-only). Rule order: live claims → key file → symlink → owner-only → scheduler guard → age.
  • Named retention classes (group a/b) unchanged.
  • Docs (docs/erasure-closeout.md rule order) + changelog fragment.

Verification

  • ccc_erasure_retention_test.py 45 OK (2 new: non-owner-only scratch at 0644/0755/0640 → retain for prune-expired and decommission while owner-only scratch → delete and passes apply.check_ancestors; rule does not touch a named class). The main new test fails with the rule disabled.
  • planner 57/0 · apply OK · handoff 16/0 · security audit 18/0 · ruff clean · canon-node-name-scan baseline.
  • Local read-only plan (one node): scratch = 24 retain (not owner-only) + 21 retain-until, 0 delete.

Still open

On that node 3 group-b crontab backups are also not owner-only, so a prune-expired run would still be refused there. Not changed here (retaining group b would defeat its purpose) — separate owner decision on #1468.

Refs #1468

🤖 Generated with Claude Code

… planning it (#1468)

Owner decision 2026-10-23 (option 2). ccc-erasure-apply.py refuses a whole
run when any target is not owned by the effective uid or has a group/other
permission bit; on the first node measured, 24 of 45 scratch files were
0644/0755, so every prune-expired run there would have been refused, and a
chmod would restart the 90-day clock (ctime).

The planner now applies the same owner-only test (`_owner_only`, mirroring
check_ancestors' target test) to the `state.operator_scratch` fallback and
plans such files as `retain (not owner-only)`. Rule order: live claims ->
key file -> symlink -> owner-only -> scheduler guard -> age. Named
retention classes are unchanged.

Tests: ccc_erasure_retention_test.py 45 OK (2 new; the main one fails with
the rule disabled), planner 57/0, apply OK, handoff 16/0, security audit
18/0, ruff clean, canon-node-name-scan baseline.

Refs #1468

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jinon86
jinon86 requested a review from seoseo-ai as a code owner October 23, 2026 08:27
…-independent

CI runners use umask 022, so `fresh-handover.md` was created 0644 and,
under the new owner-only rule, planned `retain (not owner-only)` instead of
`retain-until`, failing "scratch: unknown state file planned as operator
scratch (retain-until)" on validate-harness-shard (3). Locally (umask 077)
it passed. chmod 600 the fixture, and add an explicit 0644 case asserting
`retain (not owner-only)`.

ccc-erasure-planner.test.sh PASS=58 FAIL=0 under umask 022 and 077.

Refs #1468

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@seoseo-ai seoseo-ai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved after exact-head validation and fresh operator authorization using the relay-held seoseo-ai credential.

@jinon86
jinon86 added this pull request to the merge queue Oct 23, 2026
Merged via the queue into main with commit 8067d0f Oct 23, 2026
14 checks passed
@jinon86
jinon86 deleted the fix/1468-scratch-owner-only-retain branch October 23, 2026 09:36
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.

2 participants