Skip to content

feat(plan): add polyphony plan write-plan verb (Phase 3 P7b foundation) - #83

Merged
PolyphonyRequiem merged 1 commit into
mainfrom
sdlc/plan-level-rewrite
May 6, 2026
Merged

feat(plan): add polyphony plan write-plan verb (Phase 3 P7b foundation)#83
PolyphonyRequiem merged 1 commit into
mainfrom
sdlc/plan-level-rewrite

Conversation

@PolyphonyRequiem

Copy link
Copy Markdown
Owner

Phase 3 — P7b foundation #1 of N

Pure file-IO verb that writes the architect's plan markdown to plans/plan-{item_id}.md. Stacks on PR #82 (P7a). Workflow rewrite (the original plan-level.yaml rewrite) is now split into multiple PRs per the rubber-duck critique below.

Scope (intentionally tight)

  • New verb: polyphony plan write-plan --item-id N --content-json '<json-encoded markdown>' [--plans-dir plans]
  • New result type PlanWritePlanResult (item_id, path, bytes_written, content_sha256, unchanged, error)
  • 11 new unit tests covering: input validation (3 error envelopes), happy path, sha256, idempotent rewrite, overwrite, nested-dir creation, empty content, Unicode round-trip
  • content_sha256 is included so the workflow can verify end-to-end integrity from architect output → committed PR artifact (one of the rubber-duck recommendations)

Why this verb (and not inline pwsh)

Rubber-duck pass on the broader P7b design (saved as files/p7b-rubber-duck-critique.md) flagged inline Set-Content of multi-line markdown as fragile (quoting, encoding, no integrity check). A small verb is testable, AOT-friendly, and gives us the SHA-256 hook for free.

What's NOT in this PR

The original P7 design (plan-level.yaml rewrite) is being split per the duck's recommendation:

  • P7b-i — deterministic plan-PR substrate (this PR + 3-4 follow-ups: plan commit-and-push, plan detect-state, fix to pr open-plan-pr to read manifest from origin/feature/{root}, then the actual workflow rewrite without LLM reviewer)
  • P7b-ii — advisory plan_reviewer agent (LLM posts comments only, per P7-pre identity decision)
  • P7b-iii — policy-controlled auto-merge (polyphony policy resolve gate before merge-plan-pr)

10 blocking issues from the rubber-duck pass are tracked in the critique file for the next planning round.

Testing

  • 1783/1783 tests passing locally (was 1772; +11)
  • Type-agnostic lint clean (all 4 surfaces)
  • AOT-friendly (PolyphonyJsonContext registered)

Branch name nit

Branch is named sdlc/plan-level-rewrite but this PR does not yet rewrite plan-level.yaml — that's the eventual P7b consumer flip after all the foundational verbs land. Branch will be reused for follow-up commits as the substrate stack grows; squash-merge here keeps one commit per PR per usual.

@PolyphonyRequiem
PolyphonyRequiem changed the base branch from sdlc/plan-derive-ancestor-chain to main May 6, 2026 16:18
@PolyphonyRequiem
PolyphonyRequiem force-pushed the sdlc/plan-level-rewrite branch from 487833e to 278e277 Compare May 6, 2026 16:18
Pure file-IO verb that writes the architect's plan markdown to
plans/plan-{item_id}.md. Designed to be called from plan-level.yaml
AFTER `branch ensure-plan` has switched to the plan branch (file
sequencing fixed by P7b rubber-duck pass — see session files).

The verb is intentionally narrow:
  - input: --item-id N --content-json '<JSON-encoded markdown>'
  - output JSON: {item_id, path, bytes_written, content_sha256, unchanged, error?}
  - no git ops, no manifest reads, no PR interaction

content_sha256 lets the workflow do an end-to-end integrity check
between architect output → committed PR artifact (one of the rubber-duck
recommendations to harden inline-string review).

Tests: 11 new in PlanCommandsWritePlanTests.cs (1772 -> 1783 total).
Type-agnostic lint clean. AOT-friendly (PolyphonyJsonContext registered).

Phase 3 P7b is being split per rubber-duck critique into:
  - P7b-i: deterministic plan-PR substrate (this PR + 3-4 follow-ups)
  - P7b-ii: advisory plan_reviewer agent
  - P7b-iii: policy-controlled auto-merge

Critique saved to session files (p7b-rubber-duck-critique.md) for the
next planning conversation.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@PolyphonyRequiem
PolyphonyRequiem force-pushed the sdlc/plan-level-rewrite branch from 278e277 to c339ce1 Compare May 6, 2026 17:25
@PolyphonyRequiem
PolyphonyRequiem merged commit 3562b62 into main May 6, 2026
1 check passed
@PolyphonyRequiem
PolyphonyRequiem deleted the sdlc/plan-level-rewrite branch May 6, 2026 18:09
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