Skip to content

feat(sdlc): worklist build EdgeGraph cutover (Phase 7 #7) - #135

Merged
PolyphonyRequiem merged 1 commit into
mainfrom
sdlc/p7-worklist-build-retrofit
May 7, 2026
Merged

feat(sdlc): worklist build EdgeGraph cutover (Phase 7 #7)#135
PolyphonyRequiem merged 1 commit into
mainfrom
sdlc/p7-worklist-build-retrofit

Conversation

@PolyphonyRequiem

Copy link
Copy Markdown
Owner

Phase 7 #7worklist build EdgeGraph cutover

Replace the BFS-by-depth wave logic in polyphony worklist build with the
EdgeGraph.ToWaves() + ExecutionModeInjector composition, so worklist
generation goes through the same wave-derivation engine as edges check
and the apex driver. Hard cutover — no opt-in flag, no backcompat shim.

This unblocks apex-driver.yaml (the next worklist consumer) being able
to trust a single source of truth for wave shape across the SDLC.

Behavior changes (wire shape)

WorklistResult gains three required fields, present on every envelope
including errors:

  • items_walked (int) — count of items in the subtree the verb walked.
  • has_conflicts (bool) — true iff EdgeGraph surfaced any conflicts
    (cycles, unknown items, etc). Always present, even on error envelopes,
    so workflow consumers don't need to first distinguish error-vs-conflict.
  • conflicts (array of EdgesCheckConflict) — same wire shape as the
    edges check verb (kind, description, contributing_edges).
    Empty array when no conflicts.

When has_conflicts: true, waves is [] (empty) — the consumer is
expected to surface the conflicts instead of acting on a partial wave plan.

waves[].wave_index was already the field name — no rename was needed
(the design doc's call to "rename depthwave_index" was based on a
misread of the existing model). WorklistWave and WorklistItem shapes
are unchanged.

Behavior changes (semantics)

  • Wave derivation now uses EdgeGraph.ToWaves() instead of BFS-by-depth.
    For the canonical Epic→Issue→Task definitional plan tree the wave
    topology coincides with BFS depth (children-unblock cross-item edges
    gate each child on parent's children_seeded), so existing depth-shape
    tests still hold logically. The new path additionally honors execution
    mode (sequential injects sibling chain edges, parallel does not)
    and plan_then_implement cross-item gating where applicable.
  • Missing root: the old verb tolerated a missing root and emitted
    plan_status: unknown while still walking. The new verb errors with
    error_code: root_not_found because EdgeGraph composition needs the
    type from process config to derive the per-item requirement set. This
    is a deliberate semantic change consistent with the rest of the SDLC
    surface area (edges check behaves the same way).
  • New error codes: root_not_found, type_unknown, derivation_failed,
    cache_error, graph_invalid. All emitted with exit 0 and a populated
    EmptyResult() envelope (items_walked: 0, waves: [],
    has_conflicts: false, conflicts: []) per the established
    Polyphony JSON contract.

What's NOT in this PR

  • No --depth flag. The current worklist build signature does not
    expose --depth (the brief mentioned it both as "preserve" and "do not
    confuse with the JSON field" — best read of the surface area is that
    the flag never landed). Verb signature is preserved exactly:
    (rootId, manifestPath, json, ct). If a depth cap is wanted later it
    can be added cleanly on top of the new composition.
  • No apex-driver.yaml changes. That's the next consumer to retrofit
    in a follow-up PR; this PR just lights up the worklist surface.
  • No documentation backcompat notes. Per "hard cutover" guidance.

Verification

  • dotnet build src/Polyphony/Polyphony.csproj — clean (0 warnings, 0 errors).
  • dotnet test tests/Polyphony.Tests/Polyphony.Tests.csproj2707 / 2707 pass.
  • New tests in WorklistCommandsBuildTests:
    • Build_EmptyTree_OneWaveOneItemNoConflicts
    • Build_WithExecutionMode_Parallel_DefaultBehavior
    • Build_WithPlanThenImplementItem_TwoPhaseGating
    • Build_EnvelopeShapeLockIn_AllExpectedSnakeCaseKeys
    • Build_EnvelopeShapeLockIn_HasConflictsAlwaysPresentEvenOnError
    • Build_WithCycle_EnvelopeShape_ContractLockIn (model contract; e2e
      cycle coverage stays at EdgeGraphTests per the edges check
      precedent — verb-built input maps can't cycle by construction)
    • RootMissingFromTwig_EmitsRootNotFoundError
    • UnknownType_EmitsTypeUnknownError
  • New tests in JsonOutputContractTests:
    • WorklistBuild_SnakeCaseFieldNames_PresentInRawJson
    • WorklistBuild_DeserializationRoundTrip_FieldsMapped
    • WorklistBuild_NotFound_ReturnsErrorEnvelope_WithSuccessExitCode
  • Pre-existing manifest discovery and human-render tests preserved.
  • Pre-existing RootMissingFromTwig_EmitsUnknownStatusButStillWalks
    test replaced by the RootNotFoundError variant per the semantic
    change above.

Verified-by

🤖 Verified by Copilot CLI

Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com

Replace BFS-by-depth wave logic in 'polyphony worklist build' with the EdgeGraph.ToWaves + ExecutionModeInjector composition, so worklist generation goes through the same wave-derivation engine as 'edges check' and the apex driver. Hard cutover, no opt-in flag.

WorklistResult gains required fields items_walked, has_conflicts, conflicts (reusing EdgesCheckConflict shape). Always present, including on error envelopes. waves is empty when has_conflicts is true. Verb signature unchanged.

Missing root now errors with root_not_found instead of emitting plan_status: unknown and walking — required by EdgeGraph composition needing the type from process config. Consistent with 'edges check'.

Tests: 2707/2707 pass.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@PolyphonyRequiem
PolyphonyRequiem merged commit d00d2e4 into main May 7, 2026
1 check passed
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