Skip to content

bug(wave-status): cross-repo issue refs in state.json issues dict get orchestrator repo slug instead of target repo #521

@bakeb7j0

Description

@bakeb7j0

Summary

When wave-status init persists a plan with cross-repo issue refs (e.g. Wave-Engineering/mcp-server-sdlc#362), the state.json issues dict keys get constructed as Wave-Engineering/<orchestrator-repo>#<number> instead of preserving the original ref. phases-waves.json retains correct refs; only state.json is wrong.

Implementation Steps

  1. Locate _issue_repo() function in wave-status source (wave_status/state.py, approximately line 500+). It currently returns _plan_default_repo(plan_data) for cross-repo issues when only per-issue repo is absent.
  2. Modify _issue_repo() to extract and return the repo component from the issue's existing ref field (e.g. parse Wave-Engineering/mcp-server-sdlc#362 to get Wave-Engineering/mcp-server-sdlc) when a per-issue repo override is not present but the issue already has a qualified ref in phases-waves.json.
  3. Update _compose_issue_key() call site at line ~596 in the extend_init() function to use the qualified repo extracted from the issue's ref field, preserving the original owner/repo#N shape verbatim.
  4. Document the schema change: state.json v3 now guarantees that qualified issue keys match the original phases-waves.json ref values (for issues with a resolvable repo).

Test Procedures

Unit Test: Add test_init_preserves_cross_repo_refs() to the wave-status test suite:

  • Construct a phases-waves.json with multiple phases and waves containing cross-repo issue refs: e.g. {"ref": "Wave-Engineering/mcp-server-sdlc#362", "number": 362}, {"ref": "Wave-Engineering/mcp-server-sdlc#367", "number": 367}.
  • Call wave-status init --force <plan.json> from a different orchestrator repo (e.g. claudecode-workflow).
  • Assert that state.json's issues dict keys match the original ref fields exactly: Wave-Engineering/mcp-server-sdlc#362, Wave-Engineering/mcp-server-sdlc#367, etc.
  • Verify no keys contain the orchestrator's repo slug (e.g. no Wave-Engineering/claudecode-workflow#362).

Manual Verification:

  • Create a test phases-waves.json with cross-repo refs (template provided in issue body).
  • Run wave-status init --force <test-plan.json> from cc-workflow project root.
  • Inspect .claude/status/state.jsonissues dict keys.
  • Confirm all qualified keys preserve the original owner/repo#N shape (not orchestrator-substituted).

Acceptance Criteria

  • state.json issues dict keys match ref fields from phases-waves.json verbatim
  • Regression test covering cross-repo plan init + state.json shape
  • Existing in-flight cc-workflow#499 plan's state.json manually patched post-fix-land

Not In Scope

  • Any change to phases-waves.json shape
  • Any change to how /nextwave reads state.json (consumer-side read is correct; producer-side write is wrong)

Dependencies

Metadata

rules-lawyer 📜 (cc-workflow)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions