Skip to content

Commit fa3b2ac

Browse files
committed
✨ Retain one REPL entry's pull requests and the evidence it read (#181, 5/6)
An authored REPL entry can now publish a branch, open or bring up to date its pull request, read the reviews, comments and checks the Git host holds for it, leave at a question and continue from acknowledged work. Delivery 5 of #181. A pull request is a statement about a branch a Git host already holds, and this entry never makes one exist. So the only thing that authorizes one is a completely validated saved Push request paired with its own acknowledged receipt and reached by this execution. An ordinary run proves that by scanning its own journal; an entry cannot, because its segment is reopened hours later beside other entries. A bare receipt, a local Commit or File result, a handler's synthetic `Git.push` answer, a failed Push and another entry's history authorize none. The last publication to a branch decides what is on it, in the order the journal acknowledged them — replay may revisit two concurrent children either way round, so arrival order would let a superseded head keep authorizing work — and a publication standing after the current position is not evidence, because a previous session getting further than this one does not authorize this one. Both external protocols settle through one `git_host_effect` type, and a failed envelope names no kind. The admission reader therefore classifies from the preceding unconsumed request in the same coroutine and that request's own expected worker name, rather than reading every refusal as a publication the way it could while publication was the only protocol there. Two readers that each passed over the other's failures would each see an orphan where the other saw a pair. The request is written down before the service is contacted, keeping the head, base, number, title, verbatim body and draft it asked for, so an interrupted upsert reconciles that exact question without rereading a checkout that has moved. Both ordinary middleware chains compose on a fresh call through invocation-local defaults: what a handler may decide is what to ask for, not what was answered. An answer that never delegated binds only the closed result contract and retains nothing; once the owned terminal has run its outcome binds or fails, so a rewritten return cannot bind another pull request and a swallowed delegated failure stays a failure. The three evidence reads need no Repository, working directory, managed root, Git session or native hold, so they are declared and installed for an entry that holds no checkout. Retention begins at the admitted-read seam and nowhere earlier: provider matching, the configured allowed list and target validation run on every execution, including the one that reopens a saved read. Removing the repository from that list refuses to continue while leaving the record in history — wrapping the public dispatch in a durable envelope instead would record questions the run was never permitted to ask. What is retained is the answer produced inside that seam, so a transformation before admission changes the recorded question while one after delegation reruns live over the saved snapshot. Each read installs its own scoped bridge permitting one admitted handoff, which is what makes nesting and concurrency work without coordination; the durable name omits the owner so a fork can inherit it, and ownership is checked explicitly from the record, including a failed read's description. Intentionally unchanged: Push's request format, dispatch and native fingerprint boundary; the Git-host worker, the GitHub pull-request provider and the admitted read adapter; Workflow's pull request, reads, forks and lifecycle; ordinary-run behavior; File, Dir, selection, local Git and Issue contracts; the CLI factory signature and owner bytes. No implicit Push, no second reconciliation state machine, no general publication API and no new operator setting. Known limitation: an unacknowledged pull request may already have changed the service, and the saved request is preserved for existing reconciliation to settle rather than retried; an unacknowledged read may simply run again. Evidence (F1–F6, all green on this tree): F1 9 suites/81 steps · F2 6/47 · F3 24/156 · F4 18/107 · F5 source 1/1, `deno task build` exit 0, compiled 1/1 · F6 Node 48/48 and Bun 48/48, `git diff --check` clean. `deno task lint` exits 0 and `deno task check` reports no errors. F6's Bun invocation needs the `--timeout=300000` the repository's own Bun runner always passes; the landed `repl-push-pty` row times out under a bare `bun test` for the same reason.
1 parent b786d94 commit fa3b2ac

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

‎packages/git/tests/retained-repository-pull-request-reads.test.ts‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,12 @@ import type {
4141
GitHubHttpRequest,
4242
GitHubHttpResponse,
4343
} from "../src/deno/composition/github.ts";
44-
import { PullRequestAPI } from "../src/composition/pull-request-api.ts";
44+
// From the subpath that publishes them rather than from the source modules:
45+
// these are public, and reaching one by relative path would bypass the export
46+
// map the partition test holds every consumer to.
47+
import { PullRequestAPI } from "@executablemd/git/api";
48+
import type { PullRequestReadResult } from "@executablemd/git/api";
4549
import { PullRequestOperations } from "../src/composition/pull-request-operations.ts";
46-
import type { PullRequestReadResult } from "../src/composition/pull-request-read-records.ts";
4750
import { parsePullRequestReadRequest } from "../src/composition/pull-request-read-records.ts";
4851
import { replRepositoryInstallation } from "../src/deno/retained-repository/provider.ts";
4952
import { admitReplRepositoryHistory } from "../src/retained-repository/admission.ts";

‎packages/git/tests/retained-repository-pull-request.test.ts‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,12 @@ import type {
5454
GitHubHttpRequest,
5555
GitHubHttpResponse,
5656
} from "../src/deno/composition/github.ts";
57-
import { PullRequestAPI } from "../src/composition/pull-request-api.ts";
57+
// From the subpath that publishes them rather than from the source modules:
58+
// these are public, and reaching one by relative path would bypass the export
59+
// map the partition test holds every consumer to.
60+
import { PullRequestAPI } from "@executablemd/git/api";
61+
import type { PullRequestResult } from "@executablemd/git/api";
5862
import { PullRequestOperations } from "../src/composition/pull-request-operations.ts";
59-
import type { PullRequestResult } from "../src/composition/pull-request-records.ts";
6063
import { replRepositoryInstallation } from "../src/deno/retained-repository/provider.ts";
6164
import { admitReplRepositoryHistory } from "../src/retained-repository/admission.ts";
6265
import { GIT_HOST_EFFECT } from "../src/git-host/effect-type.ts";

0 commit comments

Comments
 (0)