no-code-change-comment.json marker artifact module #304
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#304
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
Add the schema-validated
no-code-change-comment.jsonmarker artifact recording that the explanatory comment was successfully posted on the issue — written only after a successful post, checked before every post attempt (at-most-once, ADR-021 §6).Background
The no-code-change comment path needs a durable, crash-safe record that the comment was posted. This mirrors the existing idempotency pattern from ADR-018 (
mr-result.json) and the existing no-code-change artifact module (src/artifacts/services/noCodeChangeArtifact.ts+src/artifacts/helpers/validateNoCodeChange.ts): the marker is the single source of truth for "already commented" — absent → post, present → skip.Absence of the file is the normal pre-post state and must read as
undefined, not an error. A malformed file (e.g. a truncated write) is a real defect and must throw (ArtifactValidationError, same contract asreadNoCodeChangeSignal). This module is standalone — no pipeline wiring in this step.Implementation Details
Create
src/artifacts/helpers/validateNoCodeChangeComment.ts, mirroringvalidateNoCodeChange.ts:Same validation-result shape as the existing validator: rejects missing/empty/whitespace
issueKey, missing/empty/non-stringpostedAt, and non-object input.Create
src/artifacts/services/noCodeChangeCommentArtifact.ts, mirroringnoCodeChangeArtifact.ts:NO_CODE_CHANGE_COMMENT_FILENAME = 'no-code-change-comment.json'noCodeChangeCommentPath(runDir): stringwriteNoCodeChangeCommentSignal(runDir, artifact)— validate first, then write.readNoCodeChangeCommentSignal(runDir)— returnsundefinedwhen the file is absent; throwsArtifactValidationErrorwhen content is malformed.Export the filename constant, service functions, validator, and types from
src/artifacts/index.ts.Acceptance Criteria
validateNoCodeChangeCommentArtifactaccepts{ issueKey: 'ABC-123', postedAt: '<ISO-8601>' }and rejects missing/emptyissueKey, missing/emptypostedAt, and non-object input.undefined.ArtifactValidationError.NO_CODE_CHANGE_COMMENT_FILENAME === 'no-code-change-comment.json'andnoCodeChangeCommentPathplaces the file under the run dir.src/artifacts/index.ts; unit tests insrc/artifacts/helpers/validateNoCodeChangeComment.test.tsandsrc/artifacts/services/noCodeChangeCommentArtifact.test.tspass.Test Plan
npx vitest run src/artifacts/helpers/validateNoCodeChangeComment.test.ts src/artifacts/services/noCodeChangeCommentArtifact.test.tsnpm run lintclean.pi-loop opened and merged a pull request for this issue: #314