GeezerVison is showing github.com — Daily sync merges upstream's newest nightly tag through a pull request by rawphp · Pull Request #19873 · pingdotgg/t3code
Conversation
Closes #4
Contract
- done:
factory/scripts/sync.sh picks upstream's newest v*-nightly.* tag by version order and prints up to date (exit 0) when factory/UPSTREAM names it; otherwise merges it on sync/<tag> from origin/main with --no-ff, regenerates apps/web/src/routeTree.gen.ts when only that file conflicts, records <tag> <sha>, commits and runs check.sh. Green: push, open sync: <tag>, merge with a merge commit. Red: push, draft PR, issue Sync to <tag> fails checks (factory:proposed) with the failing step and its last 200 lines. Any other conflict: abort, push nothing, file or comment on Sync to <tag> conflicts, exit 1. factory-sync.yml runs it daily at 03:17 UTC and on dispatch.
- out: Linear; release build; deleting sync branches; disabling upstream workflows; a second run on a tag that already has a sync branch (its push fails non-fast-forward and the run goes red).
- risk: ci-automerge.
GITHUB_TOKEN lands a green sync on main with no human. vp i, the route generator and check.sh run upstream's code; the script drops GH_TOKEN from their environment and the checkout no longer persists the token, which is hygiene, not a boundary (same runner user).
- test:
vp test run apps/server/src/factory/sync.test.ts → pass (10 tests)
Known gap
GITHUB_TOKEN cannot push changes under .github/workflows/, and no permissions: key grants it. When a nightly touches upstream's workflows, the push fails, the script prints sync: push of sync/<tag> failed; <tag> is not synced and exits 1, and the run is red with no issue filed. The issue pins GITHUB_TOKEN, so this build does not swap tokens. The one-line fix, if wanted, is a fine-grained PAT or App token with the workflows permission as the step's GH_TOKEN; PRs opened with it would then trigger factory-ci, which is harmless.
gh auth setup-git with GH_TOKEN and persist-credentials: false is the documented pattern but was not exercised in CI from this run. The first workflow_dispatch run proves it.
Acceptance criteria
- Newest
v*-nightly.* by version order; up to date exit 0 when UPSTREAM names it — picks the newest nightly tag by version order and stops when UPSTREAM names it; live run against the real upstream printed newest nightly: v0.0.46-nightly.20261015.3145 then up to date
-
sync/<tag> from origin/main, merge --no-ff, UPSTREAM written, commit, check.sh — merges the newest tag, records it, runs the checks and merges the pull request (merge commit with two parents, UPSTREAM = <tag> <sha>)
- Route tree conflict regenerated with upstream's generator —
regenerates the route tree when only that file conflicts; factory/scripts/regenerate-routes.sh verified on the real tree: from a corrupted file it reproduces the committed routeTree.gen.ts byte for byte
- Other conflict: abort, push nothing, issue
Sync to <tag> conflicts listing paths, exit 1; comment when open — aborts on any other conflict..., aborts on a file the fork edited and the tag deleted, comments on the open conflicts issue instead of opening another
- Green: push, PR
sync: <tag>, merge commit — merges the newest tag... (gh pr merge <url> --merge)
- Red: push, draft PR, issue
Sync to <tag> fails checks labelled factory:proposed with failing step and last 200 lines — failing checks open a draft pull request and a factory:proposed issue with the failing step
-
factory-sync.yml: cron 17 3 * * * and workflow_dispatch, ubuntu-latest, contents: write, pull-requests: write, issues: write — verified .github/workflows/factory-sync.yml:4-11,21
- Test against a local fake upstream with three nightly tags —
sync.test.ts builds v0.0.9-nightly.20261013.1, v0.0.10-nightly.20261014.2950, v0.0.10-nightly.20261015.3145 plus a release tag v0.0.10 the pattern must skip
Decisions the issue left open
- The conflicts issue carries no label (the issue names
factory:proposed only for the fails-checks issue).
- Failing checks exit 1 after filing the issue, so both failure paths show a red run.
- Tags must match
^v[0-9]+\.[0-9]+\.[0-9]+-nightly\.[0-9]+\.[0-9]+$ before they reach git, gh or a branch name; an upstream rename of the nightly scheme fails loudly.
vp i runs after the merge so the generator and checks see the merged lockfile.
regenerate-routes.sh is its own script so a person resolving a seam conflict by hand runs the same generator.
Gate
vp test run apps/server/src/factory → exit 0 (5 files, 24 tests)
vp run --filter t3 typecheck → exit 0
- extra:
factory/scripts/check-seams.sh → exit 0
Models
- maker: this session, claude-fable-5-1 (
.dw/config.yml has no models block; the roster's sonnet maker was not used, the orchestrator made the change itself)
- checker: claude-opus-5-5 (host subagents)
Review
- cycles: 2, then a small final batch read by the orchestrator
- fixed: cycle 1 (correctness, reliability, security): a merge failing without unmerged paths fell through as a route tree conflict and committed the UPSTREAM bump alone; a refused push died without its own message;
GH_TOKEN reached vp i and check.sh and sat in .git/config; the tag reached a jq program unescaped; failing checks exited 0. Cycle 2 (correctness, testing with 12 mutants, 11 killed): the token comment overstated env -u as isolation; the surviving mutant (--diff-filter=M) gets a modify/delete conflict test; the gh stub re-implemented the title filter, so the exact match moved into the script and the stub prints raw rows.
- leftovers: none
Lessons
- A detached review copy of a pnpm workspace needs per-package links. Symptom: the testing reviewer's baseline run failed before any test ran. Cause: the brief linked only the root
node_modules; vitest also needs apps/<pkg>/node_modules and the shared packages' node_modules, and the relative path in the brief was one level short. Default: tell the reviewer to link whatever the baseline run asks for from the maker's install, run the suite green once, and only then mutate.
- A criterion that pins a mechanism a platform rule breaks is a receipt gap, not a guess or a stop. Symptom: the issue pinned
GITHUB_TOKEN, which cannot push workflow-file changes, and the sync merges a repo that changes its workflows weekly. Cause: the author did not know the limit. Default: verify the rule once (docs or one search), build as written, make that path fail with a message that names the branch and tag, and put the gap and its one-line fix at the top of the receipt.
- A stub that re-implements the filter the script passes to a CLI tests the stub. Symptom: the mutation review found the gh
--jq title match untested. Default: move the decision into the script (shell match on raw rows) and have the stub print rows, so the script's own logic is what the test exercises.
Commits
92ae186bc test(factory): sync.sh picks the newest nightly tag and merges it through a pull request — Make slice, red
dc320ebb7 feat(factory): daily sync merges upstream's newest nightly tag through a pull request — Make slice
d2ce21d50 docs(factory): describe the daily upstream sync — Make slice (docs, no red phase)
d9f006df6 test(factory): sync.sh keeps the token from upstream code and stops on a failed merge or push — Check cycle 1, red
11c6cfdcc fix(factory): sync.sh stops on a merge or push failure and keeps the token from upstream code — Check cycle 1
9b077e384 test(factory): sync.sh matches the conflicts issue title itself; modify/delete conflicts abort — Check cycle 2, red for the title match; the modify/delete test passed already
159886a61 fix(factory): sync.sh matches the conflicts issue title in shell, not in jq — Check cycle 2
Files
factory/scripts/sync.sh — the sync
factory/scripts/regenerate-routes.sh — runs the web app's TanStack generator standalone
.github/workflows/factory-sync.yml — daily 03:17 UTC and dispatch
apps/server/src/factory/sync.test.ts — fake upstream, fork and bare origin; gh, vp, check.sh stubbed
factory/README.md — sync section
Run notes
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
chore: factory block for softfac
Red: ./index.ts does not exist yet, so the import fails.
Issue: #1
Green: factory started is logged once.
Issue: #1
Red: factory/scripts/check-seams.sh does not exist yet, so both cases fail.
Issue: #1
Green: both check-seams cases pass.
Issue: #1
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
Typecheck could not resolve the bare vitest module; the repo imports it via vite-plus/test.
Issue: #1
…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
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
- 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.
Factory skeleton: an empty FactoryLayer wired in through one seam
… first failure
Issue: #2
… 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
One check script, run by a factory-ci workflow and by the factory gate
…ough a pull request
Red: factory/scripts/sync.sh does not exist yet, so every case fails on
reading it. Covers the tag choice by version order, the up-to-date exit,
a clean merge that records UPSTREAM and merges the pull request, a route
tree conflict that regenerates, another conflict that aborts and files or
comments on an issue, and failing checks that open a draft and an issue.
Issue: #4
…h a pull request
sync.sh picks the newest v*-nightly.* tag by version order, stops with
"up to date" when factory/UPSTREAM names it, and otherwise merges it on
sync/<tag> with --no-ff, regenerating the route tree with
regenerate-routes.sh when only that file conflicts. Any other conflict
aborts and files or comments on `Sync to <tag> conflicts`. Green checks
push, open `sync: <tag>` and merge it; red checks open it as a draft and
file `Sync to <tag> fails checks` with the failing step's last 200 lines.
factory-sync.yml runs it daily at 03:17 UTC and on dispatch.
The test's gh stub answers `issue list` by title so the comment-or-create
decision is covered; the conflicts body may mention the route tree in its
hint, so the test checks the list line only.
Issue: #4
…n a failed merge or push
Red: a merge that fails without a conflict falls through as a route tree
conflict, a refused push dies without saying why, a tag with a quote is
accepted, vp i and check.sh see GH_TOKEN, and failing checks exit 0.
Issue: #4
…token from upstream code
A merge that failed without unmerged paths was taken for a route tree
conflict and went on to commit the UPSTREAM bump alone; it now prints
git's output and exits 1. A refused push says which branch and tag. The
tag must match the nightly pattern before it reaches gh, git or jq.
vp i, the generator and check.sh run without GH_TOKEN; the workflow
stops persisting the checkout token and routes git push through gh's
credential helper instead. Failing checks exit 1 after filing the issue,
so the scheduled run is red on both failure paths.
Issue: #4
…fy/delete conflicts abort
Red: the gh stub now prints every open issue as number and title rows,
so the comment-or-create decision is the script's own match; a fuzzy
search hit listed first must not win. The modify/delete case passes
already and pins --diff-filter=U.
Issue: #4
… in jq
The tag no longer reaches a jq program, and the exact-title match is the
script's own, so a fuzzy search hit cannot receive the comment. The
token comments say what env -u does and does not do.
Issue: #4
|
Opened against the wrong repository by a fork default; this change belongs to the fork original-solutions/t3code-factory. Sorry for the noise.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Factory catalog cross-reference — 2026-10-26. Prior-work history: this PR is cataloged for its work on nightly-upstream synchronization through PRs 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.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Labels
size:XL
500-999 changed lines (additions + deletions).
vouch:unvouched
Author is not yet trusted in the VOUCHED list.
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.
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.
|