Capture selected GitHub issue passages as reviewed native Decisions

Merged
UN
1mo ago
+1071-3

Explicitly selected GitHub issue-comment passages can now become native Decisions after an agent reviews a bounded plan and approves its digest. Unselected prose writes nothing. Each Decision retains the exact quoted span, provider author, canonical comment URL and full-comment revision; quoted instructions remain inert JSON data.

pm github discussion capture --input selection.json and the typed captureGithubDiscussion SDK surface share strict boundary schemas, native create options, semantic SDK staging and target ownership checks. Apply re-reads source, schema, parent history and deterministic target immediately before each create. Native history guards detect parent ABA and deleted-target tombstones. Replay preserves existing/edited/foreign records and creates no second observation. Relationship and planning scopes are explicit, and configured status roles come from the SDK registry.

Closes pm-github-selected-discussion-decisions.

AcceptanceEvidence
Unmarked prose creates no decisionsEmpty selections plan zero creates; marked: false refuses before effects.
Editing a selected comment makes apply staleFull-comment revision binds body, attribution, URL and timestamp; edited quotes and edits outside the selected span invalidate approval.
Repeated approved capture adds no duplicate observationDeterministic IDs, SDK read-back/history comparisons, peer-create interleavings and tombstone preservation.
Source instructions remain inertExact JSON evidence round-trips through native SDK persistence and installed CLI read-back, including shell/HTML-like source text.

Validation:

  • node --test --test-concurrency=1 test/discussions.test.ts: 16/16 pass through the pinned pm test runner. Targeted c8 measures 100% statements, branches, functions and lines for both new modules. No coverage thresholds or source exclusions changed.
  • test/discussion-model.test.ts: 500 seeded random operation sequences compare SDK-read state with a second real SDK tracker. Includes older-input replays, CRLF/whitespace variants, all touched native fields, relationships, random ambient focus, JSON/TOON round trips and preview/apply agreement. State population is bounded to avoid quadratic staging-copy growth. Another 1,000 seeded extreme mutations fuzz input and output numeric domains.
  • Native fixtures run outside git with a PATH containing no git executable. Custom registries cover Unicode, slash-bearing and closed-looking active status names. Invalid source records fail individually; native create requirements and late I/O failures produce bounded remedies.
  • Behavioral revert: disabling only the new native create in a disposable source copy fails the marked-span SDK regression; restoring it passes 1/1. The package worktree was never mutated for the proof.
  • npm run typecheck, test typecheck, npm run lint, npm run docstring, npm run duplication, changelog checks and privacy pass. Privacy audited 7,680 Git objects on the final head. Dependency pins remain unchanged.
  • node test/discussion-packed-acceptance.ts: CLI 2026.10.28 passes all five modes: project-local, npm global, Bun global, npx and native Bun via bunx. Each creates one Decision, repeats unchanged and reads the exact quote through the installed host. Tested runtime archive SHA-256: 18829c1e76c6e76174f878febf864cabba590ad3189f1e1b569cd301a791a8fb. Repacking the final head reproduced those exact bytes (75 files).

Public-data measurement used the public tracker snapshot at base 4deec2a and five public comments on issue 143. The SDK certified 158 items. Across 24 sampled contexts: 24 plans, 24 identical replays, 24 empty-selection zero plans, maximum 905 JSON bytes / 829 TOON bytes, zero tracker writes and zero remote writes. Complete snapshot fingerprints remained identical, including runtime files. A literal read-only filesystem sample also preserved every byte and returned one bounded native refusal because the pinned SDK retains read-only modes in semantic staging.

Follow-up: pm-github-sdk-preview-readonly tracks that SDK staging limitation. Local strict health also reports a host/extension SDK version skew (2026.10.25/2026.10.28), while history and integrity checks pass; fresh CI supplies authoritative health evidence. No dependency bump or operational configuration change is included.

The remaining read-to-create window is optimistic: ordinary SDK/CLI writers and GitHub edits can race after the final read. commitWorkspaceTransaction does not exclude ordinary writers, and this feature makes no such isolation claim. Deterministic native creates prevent duplicate IDs. Independent rows use no frozen replay journal, destructive compensation or dependent observation append.

CI handoff at the original 30-minute wait cutoff (2026-10-29 08:57 UTC): final head 9ab4a85c97a03d163e15a84cc67606ec15330009 has 0/4 completed release-gate jobs; all four remain in progress in CI run 40844703097. Final-head CodeQL passed, and tracker health passed on both Node versions. Pending gates are not counted as approval.

The final commit adds pm tracking links only; implementation remains 3a893b6. On that prior implementation head, CI run 40842368383 has both Bun release gates passing: 1,589/1,589 tests each, zero failures, exact 100/100/100/100 coverage across 28 authored modules. Its Node 22 npm release gate also passed. These prior-head results are separate from final-head verification. The pm item contains the pending-run receipt and a live PR-checks link. No merge or release is requested.