Skip to content

fix(openspec): return empty active changes when all changes are complete (#646) - #650

Merged
tommy-ca merged 1 commit into
mainfrom
feat/openspec-active-resolution-646
Oct 20, 2026
Merged

tommy-ca merged 1 commit into
mainfrom
feat/openspec-active-resolution-646

Conversation

@tommy-ca

Copy link
Copy Markdown
Owner

Summary

Fixes the fallback bug in _active_openspec_changes() identified during the thermo-nuclear review of Program #636 (refs #646, parent #645).

Problem

In scripts/openspec_change.py, when in_progress was empty, the return statement fell back to returning all parsed changes (return in_progress if in_progress else parsed). When all changes in the repository reached status: "complete", resolve_openspec_change(None) returned state="ambiguous", causing validate_openspec_change(None) to crash with exit code 1.

Solution

  • Removed fallback to parsed; _active_openspec_changes() returns in_progress directly.
  • Clean workspaces with only completed changes now cleanly resolve to state="none", performing a clean no-op and exiting 0.
  • Added regression tests in tests/test_verify_portable.py covering all-complete and mixed change payloads.

Verification

  • .venv/bin/pytest tests/test_verify_portable.py: 33 passing tests.
  • .venv/bin/python scripts/verify-portable.py doctor --host all: 6-Harness Matrix Verdict PASS.
  • python3 scripts/verify-harness.py: PASS.
  • python3 scripts/scan-host-boundary.py --check: PASS.
  • openspec validate --changes --strict: PASS.

Closes #646

…ete (#646)

- Remove fallback to parsed changes when in_progress list is empty in _active_openspec_changes.
- Ensure workspaces with only completed changes cleanly resolve to state none and exit 0.
- Add regression tests verifying none resolution on all-complete payloads.
@tommy-ca

Copy link
Copy Markdown
Owner Author

Independent Verification Report: PR #650


Analysis of OpenSpec Lifecycle Resolution Fix

In scripts/openspec_change.py, _active_openspec_changes() previously ended with:

return in_progress if in_progress else parsed

When all changes in OpenSpec reached status complete, in_progress was empty ([]). Because empty lists are falsy in Python, the fallback expression returned parsed (which contained every completed change). This caused resolve_openspec_change(None) to treat completed changes as active, resulting in state="ambiguous" (exit code 1) whenever more than one completed change existed in repository history.

The fix cleanly removes the parsed fallback:

return in_progress

When all changes are complete, _active_openspec_changes() returns [], enabling resolve_openspec_change(None) to accurately determine state="none" and perform a clean no-op validation (exit code 0). When active changes coexist with completed changes, only active changes are returned.

Code & File Surface Checks

  • Line count constraints verified:
    • scripts/openspec_change.py: 110 lines (< 250 threshold)
    • tests/test_verify_portable.py: 639 lines (< 750 threshold)
  • Working tree is clean.

Execution Receipts

  1. Focused Pytest Active Changes Suite:
    • Command: `.venv/bin/pytest tests/test_verify_portable.py -k "test_active_changes""
    • Result: 10 passed, 23 deselected in 0.07s
  2. Full Portable Verification Pytest Suite:
    • Command: .venv/bin/pytest tests/test_verify_portable.py
    • Result: 33 passed in 342.79s (0:05:42)
  3. Verify Harness:
    • Command: python3 scripts/verify-harness.py
    • Result: PASS (playbooks: 22 named + opening-a-pr; principles: 24; plugin.json: pstack)
  4. Host Boundary Check:
    • Command: python3 scripts/scan-host-boundary.py --check
    • Result: PASS: Scanned 143 files across portable surfaces. 0 boundary leaks.
  5. Project Package Manifest Synchronization:
    • Command: .venv/bin/python scripts/project-package.py --check
    • Result: PASS (all manifests, models, and commands in sync across grok, codex, omp, opencode, antigravity, droid)
  6. OpenSpec Change Strict Validation:
    • Command: openspec validate --changes --strict
    • Result: Totals: 2 passed, 0 failed (2 items)
  7. Canonical Index & Drift:
    • Command: python3 scripts/canonical-index.py --check -> PASS: Canonical inventory conforms to pin.
    • Command: python3 scripts/canonical-index.py --drift -> Upstream Freshness: CURRENT (0 commits ahead)
  8. Doctor 6-Harness Matrix:
    • Command: .venv/bin/python scripts/verify-portable.py doctor --host all
    • Result: 6-Harness Matrix Verdict: PASS (all 6 hosts PASS grok, codex, omp, opencode, antigravity, droid)

@tommy-ca
tommy-ca merged commit a03ec55 into main Oct 20, 2026
1 check passed
@tommy-ca
tommy-ca deleted the feat/openspec-active-resolution-646 branch October 20, 2026 15: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.

[Thermo-Nuclear][Wave 1] Fix OpenSpec active change resolution when all changes are complete

1 participant