feat(sdlc): worklist build EdgeGraph cutover (Phase 7 #7) - #135
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Phase 7 #7 —
worklist buildEdgeGraph cutoverReplace the BFS-by-depth wave logic in
polyphony worklist buildwith theEdgeGraph.ToWaves()+ExecutionModeInjectorcomposition, so worklistgeneration goes through the same wave-derivation engine as
edges checkand the apex driver. Hard cutover — no opt-in flag, no backcompat shim.
This unblocks
apex-driver.yaml(the next worklist consumer) being ableto trust a single source of truth for wave shape across the SDLC.
Behavior changes (wire shape)
WorklistResultgains three required fields, present on every envelopeincluding errors:
items_walked(int) — count of items in the subtree the verb walked.has_conflicts(bool) —trueiffEdgeGraphsurfaced 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 ofEdgesCheckConflict) — same wire shape as theedges checkverb (kind,description,contributing_edges).Empty array when no conflicts.
When
has_conflicts: true,wavesis[](empty) — the consumer isexpected to surface the conflicts instead of acting on a partial wave plan.
waves[].wave_indexwas already the field name — no rename was needed(the design doc's call to "rename
depth→wave_index" was based on amisread of the existing model).
WorklistWaveandWorklistItemshapesare unchanged.
Behavior changes (semantics)
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-shapetests still hold logically. The new path additionally honors execution
mode (
sequentialinjects sibling chain edges,paralleldoes not)and plan_then_implement cross-item gating where applicable.
plan_status: unknownwhile still walking. The new verb errors witherror_code: root_not_foundbecause EdgeGraph composition needs thetype 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 checkbehaves the same way).root_not_found,type_unknown,derivation_failed,cache_error,graph_invalid. All emitted with exit 0 and a populatedEmptyResult()envelope (items_walked: 0,waves: [],has_conflicts: false,conflicts: []) per the establishedPolyphony JSON contract.
What's NOT in this PR
--depthflag. The currentworklist buildsignature does notexpose
--depth(the brief mentioned it both as "preserve" and "do notconfuse 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 itcan be added cleanly on top of the new composition.
apex-driver.yamlchanges. That's the next consumer to retrofitin a follow-up PR; this PR just lights up the worklist surface.
Verification
dotnet build src/Polyphony/Polyphony.csproj— clean (0 warnings, 0 errors).dotnet test tests/Polyphony.Tests/Polyphony.Tests.csproj— 2707 / 2707 pass.WorklistCommandsBuildTests:Build_EmptyTree_OneWaveOneItemNoConflictsBuild_WithExecutionMode_Parallel_DefaultBehaviorBuild_WithPlanThenImplementItem_TwoPhaseGatingBuild_EnvelopeShapeLockIn_AllExpectedSnakeCaseKeysBuild_EnvelopeShapeLockIn_HasConflictsAlwaysPresentEvenOnErrorBuild_WithCycle_EnvelopeShape_ContractLockIn(model contract; e2ecycle coverage stays at
EdgeGraphTestsper theedges checkprecedent — verb-built input maps can't cycle by construction)
RootMissingFromTwig_EmitsRootNotFoundErrorUnknownType_EmitsTypeUnknownErrorJsonOutputContractTests:WorklistBuild_SnakeCaseFieldNames_PresentInRawJsonWorklistBuild_DeserializationRoundTrip_FieldsMappedWorklistBuild_NotFound_ReturnsErrorEnvelope_WithSuccessExitCodeRootMissingFromTwig_EmitsUnknownStatusButStillWalkstest replaced by the
RootNotFoundErrorvariant per the semanticchange above.
Verified-by
🤖 Verified by Copilot CLI
Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com