Deterministic no-code-change comment-body builder (buildNoCodeChangeCommentBody) #303
Labels
No labels
batch
bug
chore
documentation
enhancement
pi-loop
ready
resume
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
david/pi-loop#303
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Create the single, deterministic, unit-testable function that produces the comment text pi-loop posts on the source issue when the implement agent declares no code is needed (the
no-code-change.jsonshort-circuit, ADR-021 §3). This is the first of three standalone modules — it is exported for the pipeline and tests, but not wired into the pipeline yet.Background
When the implement stage ends with a no-code verdict, pi-loop must post a comment on the source issue explaining why, without closing the issue. The comment body must be composed by plain code from the schema-validated
NoCodeChangeArtifact— no new LLM session anywhere on this path. The builder is provider-agnostic: the same body is used whether the issue came from Jira, GitHub, Forgejo, or GitLab, so it must not mention MRs/PRs or include any platform URL/noun.It mirrors the local
buildCommentBodyalready used insidesrc/writeback/services/runWriteback.ts(reuse the shape, don't reinvent it). ADR-021 (docs/adr/021-no-code-change-comment.md) is the design record; the frame is fixed pi-loop wording with three fields interpolated verbatim.The consumed artifact (
NoCodeChangeArtifact, already shipped with the existing no-code-change feature) carriestype— one of'database' | 'config' | 'docs' | 'other'— plusreasonandworkPerformedfree-text strings.Implementation Details
Create
src/writeback/helpers/buildNoCodeChangeCommentBody.ts:Render a fixed pi-loop frame interpolating
type,reason, andworkPerformedverbatim (plain string interpolation — the fields are plain strings, so there are no escaping surprises). Suggested shape (final wording free):Export the builder from
src/writeback/index.ts(the write-back barrel) so the pipeline and tests can import it.Do NOT wrap, truncate, or rephrase the field values — verbatim embedding is the contract (ADR-021 §3).
Do not wire anything into the pipeline in this step.
Acceptance Criteria
src/writeback/helpers/buildNoCodeChangeCommentBody.tsexists and exports the typed function with the signature above.database,config,docs,other) the returned body embedstype,reason, andworkPerformedbyte-for-byte as given.src/writeback/index.tsbarrel.src/writeback/helpers/buildNoCodeChangeCommentBody.test.tsand pass.Test Plan
npx vitest run src/writeback/helpers/buildNoCodeChangeCommentBody.test.ts— cover the type matrix (one artifact per type), verbatim field embedding, determinism (call twice, compare output), and absence of MR/URL tokens.npm run lintclean.pi-loop opened and merged a pull request for this issue: #313