Skip to content

[FIX] Planner Lifecycle Registry Category Immunity#3884

Merged
Trecek merged 3 commits into
developfrom
bug-planner-validator-does-not-exempt-archived-stubs-from-as/3845
Jun 7, 2026
Merged

[FIX] Planner Lifecycle Registry Category Immunity#3884
Trecek merged 3 commits into
developfrom
bug-planner-validator-does-not-exempt-archived-stubs-from-as/3845

Conversation

@Trecek

@Trecek Trecek commented Jun 7, 2026

Copy link
Copy Markdown
Collaborator

Summary

The planner lifecycle registry (lifecycle_registry.json) uses magic string keys with no authoritative type definition. When archived_stubs was added as a new lifecycle category (PR #3801), consumers (validator functions) and the registry read-modify-write loop (record_lifecycle_event) were never updated. The architectural solution introduces a LifecycleCategory StrEnum as the single source of truth with an import-time completeness assertion — the same pattern used successfully for IssueLabelState/LABEL_LIFECYCLE_REGISTRY in _type_constants_features.py. This makes it structurally impossible to add a lifecycle category without updating the consumer registry.

Requirements

REQ-FIX-1: Add archived_stubs exemption to assignment completeness check

Add an archived_stubs pair-extraction block to _check_assignment_completeness following the identical pattern used for absorbed (lines 184–191) and voided_wps (lines 192–199). Extract (phase_num, assign_num) pairs from lifecycle_registry["archived_stubs"] keys and add them to an exemption set checked before emitting the error. ~10 line change.

REQ-FIX-2: Add archived_stubs exemption to dep references check

Add archived_stubs WP IDs to the exemption set in _check_dep_references (validation.py:223). Currently only voided_wps keys are exempted. Archived stub WP IDs should also be treated as valid dangling references.

REQ-FIX-3: Add archived_stubs to lifecycle registry defaults and re-read whitelist

Three locations need updating in lifecycle.py:

  • record_lifecycle_event initial defaults (lines 21–26): add "archived_stubs": {}
  • record_lifecycle_event re-read reconstruction (lines 30–35): add "archived_stubs": loaded.get("archived_stubs", {})
  • load_lifecycle_registry defaults (lines 59–64): add "archived_stubs": {}

The re-read reconstruction at lines 30–35 is critical — without it, any subsequent lifecycle event write silently drops existing archived_stubs data.

REQ-FIX-4: Test coverage

Add tests verifying that:

  • Assignments whose only WPs appear in archived_stubs do not produce assignment_completeness errors
  • WP IDs in archived_stubs do not produce dep_references errors when referenced in depends_on
  • record_lifecycle_event preserves archived_stubs when writing other lifecycle events

Note: the existing test_validate_plan_ignores_archived_stubs (test_validation_core.py:252) is vacuous for assignment completeness — it creates no assignment result file for the archived WP's parent assignment, so the check never fires. New tests must include the assignment result file to exercise the actual code path.

REQ-FIX-5 (optional): Belt-and-suspenders — record to voided_assignments

When reconcile_wp_files() archives ALL WPs for an assignment, additionally record that assignment ID in voided_assignments. Note: this requires a non-trivial addition — reconcile_wp_files() currently has no assignment-level mapping and would need to consult wp_manifest.json or assignment result files to determine assignment membership. Consider implementing only if REQ-FIX-1 alone proves insufficient.

Closes #3845

Implementation Plan

Plan file: /home/talon/projects/autoskillit-runs/remediation-20260607-131055-562412/.autoskillit/temp/rectify/rectify_planner-lifecycle-category-immunity_2026-06-07_131500.md

🤖 Generated with Claude Code via AutoSkillit

Token Usage Summary

Step Model count uncached output cache_read peak_ctx turns cache_write time
rectify* opus[1m] 1 55 15.9k 1.2M 95.0k 41 100.9k 16m 46s
review_approach* opus[1m] 1 3.0k 5.0k 228.2k 52.1k 10 33.2k 5m 15s
dry_walkthrough* opus 1 43 10.0k 931.5k 86.2k 44 86.4k 6m 25s
audit_impl* opus[1m] 1 36 13.0k 416.3k 69.0k 19 48.2k 6m 22s
prepare_pr* MiniMax-M3 1 45.1k 3.5k 313.8k 50.2k 18 0 1m 17s
compose_pr* MiniMax-M3 1 43.2k 1.9k 290.7k 46.2k 14 0 1m 4s
review_pr* opus[1m] 3 99 89.3k 2.1M 94.9k 97 194.9k 23m 1s
Total 91.5k 138.7k 5.4M 95.0k 463.6k 1h 0m

* Step used a non-Anthropic provider; caching behavior may differ.

Model Usage Breakdown

Model steps uncached output cache_read cache_write time
opus[1m] 4 3.2k 123.3k 3.9M 377.2k 51m 26s
opus 1 43 10.0k 931.5k 86.4k 6m 25s
MiniMax-M3 2 88.2k 5.4k 604.5k 0 2m 21s

Trecek and others added 3 commits June 7, 2026 13:50
…ubs exemption

Introduce LifecycleCategory StrEnum and LIFECYCLE_CATEGORY_DEFAULTS in
planner/lifecycle.py with import-time completeness guard, so adding a
new lifecycle category cannot silently bypass consumer registries.

Refactor record_lifecycle_event and load_lifecycle_registry to derive
defaults from the enum — fixes the read-modify-write data-loss bug
where archived_stubs (written by reconcile_wp_files) was dropped on
the next record_lifecycle_event call.

Change record_lifecycle_event key type to LifecycleCategory; update
all call sites (manifests, merge, consolidation) and tests.

Add archived_stubs exemption to _check_assignment_completeness and
_check_dep_references, mirroring existing voided_wps logic.

Update SKILL.md defaults literal to include archived_stubs.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…changes

The lifecycle enum-gated registry commit shifted line numbers in
consolidation.py (+4) and manifests.py (+4), causing the JSON write
site allowlist ratchet test to fail.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

@Trecek Trecek left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

AutoSkillit review passed. No blocking issues found.

@Trecek Trecek added this pull request to the merge queue Jun 7, 2026
Merged via the queue into develop with commit b28b3ae Jun 7, 2026
3 checks passed
@Trecek Trecek deleted the bug-planner-validator-does-not-exempt-archived-stubs-from-as/3845 branch June 7, 2026 21:40
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