GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub: pull request reads and writes by rawphp · Pull Request #19893 · pingdotgg/t3code

Conversation

@rawphp

@rawphp rawphp commented Oct 15, 2026

Copy link
Copy Markdown

Closes #14

Contract

  • done: tracker/github.ts gains pullRequest, markPrReady, markPrDraft, commentOnPr, compare and checks, each with the argv softfac's github.rs uses; branchTip already landed with Add native context menu to delete threads #12. softfac's test cases for these calls are ported to github.test.ts and pass.
  • out: wiring these into a gate or daemon; PR feedback, approval and ready-by queries; Linear.
  • risk: none
  • test: vp test run apps/server/src/factory/tracker/github.test.ts → pass (119)

Acceptance criteria

  • View a pull request (repo, head repo and ref, base, draft, state, merged, head sha) — pullRequest reads the real shape with the exact call, pullRequest from a fork and into another base says so, a pullRequest that does not exist is null
  • Mark it ready and back to draft — markPrReady runs gh pr ready, markPrDraft runs gh pr ready --undo, the already-ready / already-draft / closed-or-merged cases
  • Comment — commentOnPr appends the marker
  • Read a branch tip sha — already on main from Add native context menu to delete threads #12 (branchTip tests)
  • Compare two shas — compare asks for the status of the two refs with the exact call, compare reads each status GitHub gives
  • List check runs for a sha — checks reads the check runs of the commit with the exact call and the ranking, paging, skipped and link cases
  • softfac's src/github.rs cases for these calls are ported and pass — 38 cases ported one to one; one argv note below

One deliberate divergence from softfac: a ref refused before any gh call (a .. in compare, a sha that is not a full id in checks) is GitHubInvalidArgument, as the already-landed branchTip and fileAt do, where softfac reports a parse error. The argv and every answer are otherwise the same.

Gate

  • vp test run apps/server/src/factory → exit 0 (19 files, 504 tests)
  • vp run --filter t3 typecheck → exit 0

Run on 44cd981e3. Logs in the run's .factory/gate-1.log and gate-2.log.

Models

  • maker: claude-fable-5-1 (this session; no models block in .dw/config.yml, Tom's roster applied)
  • checker: claude-opus-5-5

Review

  • cycles: 1
  • fixed: correctness-1 — markPrDraft only read the pull request after a non-zero exit; softfac does it on every error, so a timed out, rate limited or oversized undo on a closed PR is now done too (32b4a1851, 249fae93e).
  • reliability: approve, no findings.
  • testing (mutation pass on 249fae93e): 12 of 12 named mutants killed, none unreached; nit testing-1 taken as 44cd981e3.
  • leftovers: none

Lessons

  • Run the repo's lint on the touched files even when the gate does not. Symptom: tests and typecheck were green, and a lint rule the repo enforces (prefer-catch-tags) only showed up because the maker ran vp lint on the two files by hand. Cause: the gate lists tests and typecheck only. Default: after the first green, lint the contract files with the repo's own lint command before Check, so reviewers and CI see the tip that passes it.
  • An issue's /tmp instruction for a reference clone yields to § Scratch. Symptom: the issue said to clone the reference repo into /tmp/softfac-ref. Default: clone it under <worktree>/.factory/ instead and give reviewers that path; the worktree's removal then takes the clone with it.

Commits

  • 9b690bb63 test(factory): port softfac's pull request, compare and check-run cases — Make slice (red: 38 failing, file did not typecheck)
  • 9a1137638 feat(factory): pull request reads and writes through gh — Make slice (green)
  • 32b4a1851 test(factory): markPrDraft reads the PR state after any failure — Check cycle 1 (red: 1 failing)
  • 249fae93e fix(factory): markPrDraft reads the PR state after any failure — Check cycle 1 (green)
  • 44cd981e3 test(factory): a check's conclusion and link come from the deciding run — Check nit (already green)

Files

  • apps/server/src/factory/tracker/github.ts — the six calls, their schemas and types
  • apps/server/src/factory/tracker/github.test.ts — softfac's cases ported to @effect/vitest

No new seam: both files are under the factory's own directory.

Worktree note: the factory's worktree was cut at e4bcce9f6, behind origin/main after #12 and #39 merged; it was fast-forwarded to 952129a80 before any write. Labels: all seven factory:* labels already existed; none created.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
rawphp and others added 30 commits October 15, 2026 19:44
@rawphp
chore: factory block for softfac
55f49ea
@tomkaczocha
Merge pull request #29 from original-solutions/factory/dw-config
e4bcce9
chore: factory block for softfac
@rawphp
test: factory layer logs factory started
7abf1e1
Red: ./index.ts does not exist yet, so the import fails.

Issue: #1
@rawphp
feat(server): wire an empty FactoryLayer through server.ts
f5af01a
Green: factory started is logged once.

Issue: #1
@rawphp
test: check-seams.sh passes allowed changes and names unlisted ones
595cc20
Red: factory/scripts/check-seams.sh does not exist yet, so both cases fail.

Issue: #1
@rawphp
feat(factory): add UPSTREAM, SEAMS and check-seams.sh
f07d8e2
Green: both check-seams cases pass.

Issue: #1
@rawphp
test(factory): boundary test for factory imports
95afcec
No red phase: the tree already complies, so the real-tree test passes on
arrival. The synthetic cases show each rule catching a violation.

Issue: #1
@rawphp
docs(factory): design copy and README
611af0d
Issue: #1
@rawphp
test(factory): import vitest helpers from vite-plus/test
cc1c0ac
Typecheck could not resolve the bare vitest module; the repo imports it via vite-plus/test.

Issue: #1
@rawphp
test(factory): rename into an allowed path is named, seam assertions …
cbcf91a
…order-free

Red: "names an upstream file renamed into an allowed path" fails because
check-seams.sh lets git rename detection hide the deleted upstream path.
The fail case now changes server.ts itself, and the boundary real-tree
test asserts server.ts imports ./factory/index.ts; both already pass.

Issue: #1
@rawphp
fix(factory): check-seams.sh diffs without rename detection
0aadcf1
A git mv of an upstream file into an allowed path listed only the new
path, so the deleted upstream file passed the seam check. --no-renames
lists both sides.

Issue: #1
@rawphp
fix(factory): close boundary and seam-check gaps from review
71ba6b4
- boundary.test.ts flags factory code outside factory/t3/ that imports the
  server's workspace packages (@t3tools/*, effect-acp, ...), read from
  apps/server/package.json.
- check-seams.sh captures the diff before the loop, so a failed git diff
  fails the script instead of passing with nothing checked.
- README and the script header say the check covers committed HEAD only.
- check-seams tests cover apps/web/src/factory/ and a failing diff.
- Node built-ins imported as NodeFS/NodePath/... per namespace-node-imports.
@tomkaczocha
Merge pull request #30 from original-solutions/t3/t3code-factory-issue-1
f1dba9a
Factory skeleton: an empty FactoryLayer wired in through one seam
@rawphp
test(factory): check.sh runs the gate steps in order and stops at the…
4a84519
… first failure

Issue: #2
@rawphp
feat(factory): check.sh runs seams, factory tests and typechecks in o…
5efa406
…ne gate

Issue: #2
@rawphp
ci(factory): factory-ci workflow runs check.sh on pull requests and p…
aef688a
…ushes to main

Issue: #2
@rawphp
docs(factory): gate and CI run factory/scripts/check.sh
bf609da
Issue: #2
@rawphp
test(factory): check.sh test names its logs with a counter, not Math.…
30845a3
…random

Issue: #2
@rawphp
test(factory): check.sh test runs from a subdirectory and names calls…
c97ed4f
… plainly

Review nits: the cd to the repo root was never exercised, and the expected
calls rebuilt the constants they came from. No red phase: both behaviors
already held.

Issue: #2
@rawphp
test: install, rollback and build version scripts
212cf43
Red on purpose: install.sh, rollback.sh and build.sh do not exist yet.

Issue: #3
@rawphp
feat(factory): build, install and rollback scripts for the darwin-arm…
10a3b70
…64 binary

Issue: #3
@rawphp
test(factory): pin run() env allowlist, process-group kill and output…
8b45673
… tail

Red: apps/server/src/factory/process.ts does not exist yet.

Issue: #8
@rawphp
feat(factory): run commands with a cleared env, a time limit and an o…
5a1d95e
…utput tail

Issue: #8
@rawphp
fix(factory): process tests read time through Effect's Clock
b60ba30
Issue: #8
@rawphp
docs(factory): answer open question 2, process.ts uses node:child_pro…
f49f63b
…cess

Issue: #8
@rawphp
test(factory): ledger run id, issue key, next attempt and timestamp t…
afde3af
…ests

Ports the run id, next_attempt, format_ts and parse_ts tests from softfac's
ledger.rs, plus the issue key parse and refuse cases from issue_key.rs.

Red: runId.test.ts and time.test.ts fail because runId.ts, time.ts and
errors.ts (LedgerError, used by testSupport.ts) do not exist yet.

Issue: #9
@rawphp
feat(factory): ledger run ids, issue keys and timestamps
b7e3a11
Ports softfac's RunId, IssueKey, next_attempt, format_ts and parse_ts to
plain TypeScript, and LedgerError with the Rust Display messages.

- Run ids are lowercase owner/name plus a canonical issue (up to u64 max) and
  attempt (up to u32 max); file names that are not exactly what this code
  writes are not run ids.
- Lowercasing is ASCII-only so a Kelvin sign cannot fold into a legal name.
- validateRunId also checks the issue and attempt, since they end up in the
  file name too.

Issue: #9
@rawphp
test(factory): ledger write, read, finish and crash-rule tests
208f2f9
Ports the run ledger tests from softfac's ledger.rs: one exact line for every
one of the 30 event types, create/open semantics (create-new, newline repair
of a torn last line, symlinks and directories refused), the read rules (torn
last line, blank lines, invalid lines counted, unknown events and odd data
kept as written, causes kept as written), finish (total_ms and gate_attempts
computed by the writer), the failed-write rules through an injected AppendIo,
file and directory modes, and the directory-sync failure that removes the new
file. The feedback read file and the list/summary readers are not ported.

Red: ledger.test.ts fails because events.ts, appendFile.ts, read.ts and
ledger.ts do not exist yet.

Issue: #9
@rawphp
test(factory): sessions and paths adapter cases
f2e3f81
Ports softfac's find_project and status cases from src/t3.rs, adds launch
and thread cases, and a contract test over the real orchestration layers
with the Claude replay transcript. Red: paths.ts and sessions.ts do not
exist yet, so none of the three files compile.

Issue: #5
@rawphp
test(factory): a TERM-trapping grandchild gets its grace before SIGKILL
ed64725
Red: the wrapper sh dies on SIGTERM and the group is SIGKILLed at once,
so the grandchild's marker never reaches the tail.

Issue: #8
tomkaczocha and others added 25 commits October 15, 2026 22:02
@tomkaczocha
Merge pull request #35 from original-solutions/t3/factory-issue-9
fca723a
Ledger: write and read run files in softfac's JSONL format
@rawphp
test(factory): separate stderr and truncation flag for FactoryProcess
0362d86
Fails until implemented: RunInput.separateStderr, RunResult.stderrTail and
RunResult.truncated do not exist yet, so stderr is still merged into tail and
the new fields are undefined.

Issue: #12
@tomkaczocha
Merge pull request #32 from original-solutions/t3/factory-issue-10
cb35ead
Domain: lifecycle states and the session's result line
@rawphp
feat(factory): separate stderr and truncation flag for FactoryProcess
2646c2d
RunInput.separateStderr keeps stderr out of the output tail so a command
whose stdout is JSON (gh) is not polluted. RunResult gains stderrTail and
truncated so a cut-off answer can be an error instead of a silent truncation.
Merged mode is unchanged.

Issue: #12
@rawphp
fix(factory): build.sh refuses a tree with uncommitted changes
0dbf91c
A version named after the commit could not tell builds of one commit apart when
the tree held edits or untracked files, and installing a second such build
deleted the first. build.sh now refuses to build when `git status --porcelain`
lists anything, naming the first ten paths, so the version always names exactly
what was built. The `.dirty` suffix is gone.

.worktrees/ joins .gitignore (a new seam in factory/SEAMS) so the main checkout,
which holds local worktrees, counts as clean.
@rawphp
test(factory): second launch fails on a missing ref, not an exhausted…
874956d
… transcript

The no-replay check launched thread B against the one-turn replay
transcript and swallowed the harness's exhaustion defect at teardown.
B now starts from a ref the repo does not have, so its run fails while
preparing the worktree, before any provider turn, and nothing is caught.

Issue: #7
@rawphp
Merge remote-tracking branch 'origin/main' into t3/c78b74ad
23156bb
@rawphp
test(factory): port softfac's gh tracker cases
64180c8
Ports the issue, label, comment, status-comment, file and error cases of
softfac's github.rs against a fake FactoryProcess. Fails until
tracker/github.ts exists: the module does not resolve yet.

Issue: #12
@rawphp
feat(factory): gh tracker over FactoryProcess
6ce1de0
makeGitHub reads and writes issues, labels, comments, branch tips and files
through the gh CLI, ported from softfac's github.rs. Every call goes through
FactoryProcess with GH_CONFIG_DIR set, a 60 s limit and separate stderr.
Errors are typed (spawn, failed, timed out, output too large, parse, rate
limited) and a cut-off answer is an error, never a truncation.

Issue: #12
@rawphp
Merge remote-tracking branch 'origin/main' into t3/factory-issue-12
c9ce5c1
@tomkaczocha
Merge pull request #34 from original-solutions/t3/factory-issue-3
aeb0727
Build, install and roll back a darwin-arm64 fork binary on this Mac
@rawphp
test(factory): events contract counts one id per status change of the…
938fa21
… run

The arrival check accepted any id whose thread already read completed, so
an early emission processed late could stand in for the completion. The
test now collects the run's status changes from the sink and takes exactly
that many ids, the last within 10 s of the terminal event.

Doc comments say that a fresh stream wakes once for a thread already in
flight, and that a failed stream is run again with the gap left to the
next pass.

Issue: #7
@rawphp
test(factory): github tracker speaks the lifecycle State, refuses NUL…
3fd0495
… args

The tests now use domain/lifecycle.ts State instead of github.ts's own
label table: listIssues and setState take a State, issue() returns
`state: State | null` plus `closed`, ensureLabels returns the created
States, and a test pins the seven exact `gh label create` calls.
A NUL byte in a gh argument must fail as GitHubSpawnError without
running gh and without leaking the argument into the message.

Fails until the code follows: 18 tests fail (listIssues/setState build
argv from the bare state name, issue() still returns factoryLabel and
the raw OPEN/CLOSED state, ensureLabels returns label names, the NUL
body reaches the runner).

Issue: #12
@rawphp
fix(factory): github tracker uses the lifecycle State and refuses NUL…
353be93
… args

github.ts kept its own copy of the label table. It now imports State,
STATES, stateLabel, stateFromLabel, stateColor and stateDescription from
domain/lifecycle.ts: listIssues and setState take a State, issue()
returns `state: State | null` and `closed`, ensureLabels returns the
States it created.

gh() now refuses an argument holding a NUL byte before running gh, so
Node's spawn error cannot quote a hidden comment body into logs.

Issue: #12
@rawphp
Merge remote-tracking branch 'origin/main' into t3/c78b74ad
5b21304
@rawphp
test(factory): fileAt refuses an oversize file whose content is whole
4d396f5
The existing oversize case was also shorter than its stated size, so the
length check caught it and the size cap itself went untested. This case
matches content and size, so only the cap can refuse it.

Issue: #12
@rawphp
fix(factory): gh tracker types the secondary rate limit, a missing gh…
893c887
… and refused arguments

- A secondary rate limit or an HTTP 429 is GitHubRateLimited, not GitHubFailed.
- The wrapper shell's exit 127 or 126 (gh not found or not executable) is
  GitHubSpawnError, as its doc says.
- branchTip and fileAt refuse a bad branch, path or sha with a new
  GitHubInvalidArgument instead of a Parse error that blamed gh's output.
- Timeout and too-large messages put the command in backticks like the rest.
- RunResult.tail's doc says it is stdout alone with separateStderr.
- Tests: separateStderr waits for stderr written after stdout closed, a timeout
  is not held by a process keeping stderr open, and fileAt's encoding check is
  reached by a small non-base64 file.
@rawphp
fix(factory): run status changes include a new run's first status
4c3a434
A run is written with its first status in run.created, which the stream
never read, so a follow-up's queued run did not wake the factory. Read the
unfiltered live tail and keep run.created and run.updated, since two typed
streams merged would not keep one run's events in sequence order. Build
each update from the five fields it needs instead of the whole payload.

The contract testkit takes shared names and one wait for a run's statuses
up to its terminal one, from run.created on, used by both contract tests.
@tomkaczocha
Merge pull request #41 from original-solutions/t3/factory-issue-12
ed9fdb8
GitHub: issue reads and writes through the gh CLI
@tomkaczocha
Merge pull request #39 from original-solutions/t3/c78b74ad
952129a
Adapter: tell the factory when a thread's run changes status
@rawphp
test(factory): port softfac's pull request, compare and check-run cases
9b690bb
Red: github.ts has no pullRequest, markPrReady, markPrDraft, commentOnPr,
compare or checks yet, so the 38 new cases fail and the file does not
typecheck.

Issue: #14
@rawphp
feat(factory): pull request reads and writes through gh
9a11376
tracker/github.ts gains pullRequest, markPrReady, markPrDraft, commentOnPr,
compare and checks, each with the argv softfac's github.rs uses. branchTip
landed with #12. A ref refused before the call (a `..` in compare, a sha
that is not a full id in checks) is a GitHubInvalidArgument, as branchTip
and fileAt already do, where softfac reports it as a parse error.

Issue: #14
@rawphp
test(factory): markPrDraft reads the PR state after any failure
32b4a18
Red: markPrDraft only reads the pull request after a non-zero exit, so a
timed out, rate limited or oversized undo on a closed PR is still an error.
softfac's mark_pr_draft falls back on every error.

Issue: #14
@rawphp
fix(factory): markPrDraft reads the PR state after any failure
249fae9
A timed out, rate limited or oversized `gh pr ready --undo` on a pull
request that is closed or merged by now is done, as in softfac; one that is
still open keeps the original error.

Issue: #14
@rawphp
test(factory): a check's conclusion and link come from the deciding run
44cd981
Already green: covers what the several-runs case only asserted by state.

Issue: #14
@rawphp

rawphp commented Oct 15, 2026

Copy link
Copy Markdown
Author

Opened against the wrong repository by mistake; this belongs on the original-solutions/t3code-factory fork. Sorry for the noise.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@rawphp rawphp closed this Oct 15, 2026
@github-actions github-actions Bot added vouch:unvouched Author is not yet trusted in the VOUCHED list. size:XXL 1,000+ changed lines (additions + deletions). labels Oct 15, 2026
@zainmitchell

zainmitchell commented Oct 26, 2026

Copy link
Copy Markdown

Factory catalog cross-reference — 2026-10-26. Prior-work history: this PR is cataloged for its work on GitHub PR reads and writes in the public original-solutions factory, acknowledged in our catalog. No code from that effort was copied into this derivative. This historical cross-reference requests no reopening and implies neither quality rejection nor an installation dependency.

Factory Ideas · Pinned fork source/guide · Source release. Version-pinned community experimental source preview; full lifecycle acceptance remains open. No upstream endorsement or current-PR-head test acceptance is claimed.

Prepared with GPT-6.1 Sol through Codex in T3 Code.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

size:XXL 1,000+ changed lines (additions + deletions). vouch:unvouched Author is not yet trusted in the VOUCHED list.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@rawphp @zainmitchell @tomkaczocha
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.