Skip to content

🏭 Add reconciled GitHub projection effects #700

Description

@minkimcello

Parent: #633

Architecture ancestry: PR #630

Planning base: 0479b3b1e6a3de08fb7d9de515a3efde80e7fe91; implementation base is the exact accepted C0 feedback commit recorded before handoff

Stack position: F3; parallel with F1, F4, F5, and F6; consumed by L7–L10

Readiness: blocked only until C0's accepted feedback SHA is recorded and present; no effect ownership, natural-key, reconciliation, credential, or projection-authority choice is delegated

Purpose and observable outcome

Authored XMD can write idempotent human-readable issue/PR handoffs, project the accepted stage to Project V2, make a PR ready, and close an issue or PR while interruption reconciliation guarantees that GitHub state never becomes lifecycle authority.

Authoritative behavior

  • Each comment, Project status, ready, PR-close, and issue-close operation is a distinct provider-neutral durable external effect with a stable natural key and observe/adopt/perform/refuse reconciliation.
  • Comment body/title are presentation, not identity. Project status, PR state, and issue state are projections of an accepted journal outcome.
  • Proven absence alone authorizes one performance; compatible completed state is adopted; conflict, ambiguity, incomplete pagination, and unavailability never authorize mutation.
  • GitHub App installation tokens stay inside the selected provider closure. Durable requests/results contain bounded normalized identities and URLs, not credentials, endpoints, raw GraphQL/REST payloads, cursors, or provider diagnostics.
  • Target-ref publication is not part of these projection effects.

Current state

packages/workflow/src/composition/pull-request-api.ts supports read and upsert; <PullRequest.Reviews>, <PullRequest.Comments>, and <PullRequest.Checks> read complete evidence. <Issue> reads/upserts issues through its own provider boundary. There is no comment write, Project V2 adapter, ready effect, or explicit close effect. Existing git_host_effect and issue_effect reconciliation, selection authentication, crash tests, and provider-private attachments are the patterns to extend rather than bypass.

Affected modules and public contracts

  • Add the exact public components/effect kinds frozen by C0 to packages/workflow/src/composition/**, installation, public entrypoints, and construct inventory.
  • Extend provider-neutral Git-host or Issue APIs according to ownership: issue comment/closure stays with the Issue provider when it does not require a Git repository; PR comment/readiness/closure and Project V2 use their named GitHub-capable provider boundaries.
  • Add Deno GitHub adapters under packages/workflow/src/deno/composition/**; route authentication through F2's installation-token provider when composed, with test providers supplying equivalent private closures.
  • Reuse the shared Git-host reconciliation state machine where its ownership is valid; do not combine unrelated mutations into one effect.
  • Add explicit provider, durability, crash, pagination, and public-entrypoint tests.

Ordered implementation plan

  1. Implement closed requests, natural keys, normalized observations/results, parsers, and public components for issue comments and PR comments.
  2. Implement Project V2 item/status observation and update with exact organization/project/item/field/option identities and complete pagination.
  3. Implement separate PR-ready, PR-close-unmerged, and issue-close-with-reason effects.
  4. Add GitHub adapters that authenticate before opening credential-bearing operations and retain no raw provider data.
  5. Add observe/adopt/perform/refuse reconciliation and crash injection at every multi-call boundary.
  6. Export/install the components and update the specifications and construct inventory in the same feedback commit.

Failure, cancellation, teardown, and replay

An unsupported provider, incomplete observation, ambiguous match, changed natural key, incompatible state, Project ahead of journal, unauthorized target, provider protocol failure, or malformed retained record refuses/fails according to the existing effect boundary before another mutation. Cancellation tears down the provider call and publishes no invented completion. If GitHub changed before interruption, resume observes and adopts only the compatible result. Completed replay contacts no provider.

Frozen evidence matrix

  • Each effect performs once from proven absence and replays/adopts one compatible remote result without duplication.
  • Kill after each remote sub-call and before local publication; resume converges or refuses without repeating a non-idempotent mutation.
  • Same-stage comments use distinct stable identities while body edits cannot steal another effect.
  • Project-behind reconciles forward; Project-ahead cannot manufacture an accepted transition.
  • Incomplete pagination, ambiguity, unavailable fields, and incompatible pre-state never become “absent.”
  • Ready is one explicit effect; PR and issue closure are separate effects with their exact reasons.
  • Credentials/raw payloads/cursors/endpoints never enter durable data, public values, logs, or errors.
  • Existing Push, PR upsert/read, and Issue read/upsert behavior remains unchanged.

Focused feedback evidence

Add explicit files such as packages/workflow/tests/issue-comment-durability.test.ts, packages/workflow/tests/pull-request-comment-durability.test.ts, packages/workflow/tests/project-status-github.test.ts, and packages/workflow/tests/github-projection-crash.test.ts. Run those exact files plus the existing pull-request*.test.ts, issue-*.test.ts, and deno task test --changed. Commit when the frozen evidence passes and report the exact SHA and commands.

Delivery verification

Run deno task lint, deno task check, and deno task check:jsr because public workflow surfaces move. CI owns full runtime suites unless provider test infrastructure changes shared setup.

Exclusions

No lifecycle selection, webhook/form ingress, target merge/ref update, Git process shell, raw gh/curl production call, PAT, ambient GITHUB_TOKEN, or implicit multi-effect <PullRequest> controller.

Risks and recovery

The main risk is assigning an effect to the wrong provider boundary or letting a projection become authority. A structural correction returns to C0/F3 before lifecycle stories consume it. Ordinary GitHub API version changes stay inside the adapter if normalized contracts remain unchanged.

Handoff

Record the exact C0 base, implement and specify only these projection effects, freeze the evidence, and return the exact F3 feedback SHA. The foundation integration branch merges it after F1 and before F4–F6/F2 in the declared order.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions