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 — fork seams: green from upstream on main; a PR's own list is format-ch… · scuttletoby/t3code@9d5eeba

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • .github
    • fork-seams.json
    • scripts
      • fork-seam-check.cjs
      • fork-seam-check.test.cjs
  • apps/server/src
    • mcp
      • OrchestratorMcpService.ts
    • orchestration-v2
      • EffectWorker.ts
      • runtimeLayer.test.ts
  • docs/fork
    • updates.md
  • packages/shared/src
    • cliRelease.test.ts
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎.github/fork-seams.json‎

Copy file name to clipboardExpand all lines: .github/fork-seams.json
+170-10Lines changed: 170 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,26 @@
9090
": { unit: tracked.unit, slice: ownedSlice };",
9191
"}),"
9292
]
93+
},
94+
"apps/server/src/cli/connect.ts": {
95+
"why": "A server held with `serve --hold-work` shares the live server's environment id, so `t3 connect --disconnect` refuses before the relay delete (cloud/holdWorkConnect.ts).",
96+
"added": [
97+
"import * as HoldWorkConnect from \"../cloud/holdWorkConnect.ts\";",
98+
"// Fork: a held copy shares the live server's environment id; refuse before the relay delete.",
99+
"yield* HoldWorkConnect.refuseCliUnlinkWhileHeld(",
100+
"(yield* ServerConfig.ServerConfig).serverRuntimeStatePath,",
101+
");"
102+
]
103+
},
104+
"apps/server/src/cloud/CloudLink.ts": {
105+
"why": "unlink's error type takes the hold-work refusal (cloud/holdWorkConnect.ts); the one upstream line is split so the fork's error sits on its own line.",
106+
"added": [
107+
"readonly unlink: () => Effect.Effect<",
108+
"EnvironmentCloudRelayConfigResult,",
109+
"// Fork: a server held with `serve --hold-work` refuses (cloud/holdWorkConnect.ts).",
110+
"CloudLinkInternalError | ManagedLimits.ManagedPolicyRefusedError",
111+
">;"
112+
]
93113
}
94114
},
95115
"//pending": "Upstream files whose fork lines predate counting every upstream file, each with its ceiling: the most fork lines it may hold against upstream (counted from upstream, as fork-follow runs the check). To move into fork files or pin as seams; lower a ceiling when lines move out and take a file off when none are left. A pull request may change them but not grow them.",
@@ -106,10 +126,10 @@
106126
"apps/server/src/cloud/selfUpdate.ts": 4,
107127
"apps/server/src/config.ts": 2,
108128
"apps/server/src/mcp/McpHttpServer.ts": 10,
109-
"apps/server/src/mcp/OrchestratorMcpService.ts": 41,
129+
"apps/server/src/mcp/OrchestratorMcpService.ts": 35,
110130
"apps/server/src/mcp/toolkits/environment/handlers.test.ts": 63,
111131
"apps/server/src/mcp/toolkits/project/handlers.test.ts": 48,
112-
"apps/server/src/orchestration-v2/EffectWorker.ts": 31,
132+
"apps/server/src/orchestration-v2/EffectWorker.ts": 28,
113133
"apps/server/src/orchestration-v2/ProjectionStore.ts": 7,
114134
"apps/server/src/orchestration-v2/ProviderRuntimeRecoveryService.test.ts": 435,
115135
"apps/server/src/orchestration-v2/ProviderRuntimeRecoveryService.ts": 152,
@@ -132,17 +152,18 @@
132152
"apps/server/src/serverRuntimeState.ts": 4,
133153
"apps/server/src/terminal/Manager.ts": 2,
134154
"apps/server/vite.config.ts": 2,
155+
"apps/web/src/cloud/linkEnvironment.test.ts": 34,
135156
"apps/web/src/components/ChatMarkdown.permissions.browser.test.tsx": 277,
136-
"apps/web/src/components/ChatMarkdown.tsx": 71,
157+
"apps/web/src/components/ChatMarkdown.tsx": 63,
137158
"apps/web/src/components/chat/MarkdownFileLink.logic.ts": 74,
138159
"apps/web/src/components/chat/MarkdownFileLink.tsx": 148,
139160
"apps/web/src/components/media/mediaContent.ts": 8,
140161
"apps/web/src/components/settings/IntervalSecondsField.tsx": 4,
141-
"apps/web/src/components/settings/SettingsPanels.tsx": 2,
142-
"apps/web/src/components/settings/scopedSettings.test.ts": 57,
143-
"apps/web/src/components/settings/scopedSettings.ts": 5,
162+
"apps/web/src/components/settings/SettingsPanels.tsx": 4,
163+
"apps/web/src/components/settings/scopedSettings.test.ts": 153,
164+
"apps/web/src/components/settings/scopedSettings.ts": 9,
144165
"apps/web/src/components/settings/settingsSearch.ts": 25,
145-
"apps/web/src/components/settings/useScopedSettings.ts": 14,
166+
"apps/web/src/components/settings/useScopedSettings.ts": 27,
146167
"apps/web/src/index.css": 2,
147168
"apps/web/src/markdown-links.test.ts": 1,
148169
"apps/web/src/markdownFileHostPath.ts": 1,
@@ -157,8 +178,8 @@
157178
"packages/provider-core/src/server/managedProvider.test.ts": 39,
158179
"packages/provider-core/src/server/managedProvider.ts": 8,
159180
"packages/provider-core/src/server/snapshot.ts": 2,
160-
"packages/shared/package.json": 28,
161-
"packages/shared/src/cliRelease.test.ts": 43,
181+
"packages/shared/package.json": 32,
182+
"packages/shared/src/cliRelease.test.ts": 38,
162183
"packages/shared/src/cliRelease.ts": 11,
163184
"packages/shared/src/usageLimits.ts": 12,
164185
"vite.config.ts": 2
@@ -206,5 +227,144 @@
206227
"packages/shared/src/waitFor*",
207228
"scripts/lib/release-repository.ts",
208229
"scripts/release-repository.test.ts"
209-
]
230+
],
231+
"//lost": "Seam and pending files that lost upstream lines, counted from upstream (as fork-follow runs the check): \"lines\", the upstream lines not kept in order and indentation; \"gone\", those whose text is gone. Held exactly, like a ceiling; an unlisted file counts 0. Lower a count when a line comes back, and keep each one small: a line counted here may move unseen.",
232+
"lost": {
233+
"packages/shared/src/serverSettings.ts": {
234+
"lines": 1,
235+
"gone": 1
236+
},
237+
"apps/server/src/serverSettings.ts": {
238+
"lines": 10,
239+
"gone": 8
240+
},
241+
"apps/server/src/cloud/CloudLink.ts": {
242+
"lines": 1,
243+
"gone": 1
244+
},
245+
"apps/desktop/src/electron/ElectronShell.ts": {
246+
"lines": 1,
247+
"gone": 1
248+
},
249+
"apps/server/src/background/BackgroundPolicy.ts": {
250+
"lines": 1,
251+
"gone": 1
252+
},
253+
"apps/server/src/cli/server.ts": {
254+
"lines": 4,
255+
"gone": 4
256+
},
257+
"apps/server/src/mcp/McpHttpServer.ts": {
258+
"lines": 1,
259+
"gone": 1
260+
},
261+
"apps/server/src/mcp/OrchestratorMcpService.ts": {
262+
"lines": 4,
263+
"gone": 4
264+
},
265+
"apps/server/src/orchestration-v2/EffectWorker.ts": {
266+
"lines": 2,
267+
"gone": 1
268+
},
269+
"apps/server/src/orchestration-v2/ProjectionStore.ts": {
270+
"lines": 1,
271+
"gone": 1
272+
},
273+
"apps/server/src/orchestration-v2/ProviderRuntimeRecoveryService.test.ts": {
274+
"lines": 1,
275+
"gone": 1
276+
},
277+
"apps/server/src/orchestration-v2/ProviderRuntimeRecoveryService.ts": {
278+
"lines": 5,
279+
"gone": 5
280+
},
281+
"apps/server/src/orchestration-v2/ThreadLaunchService.ts": {
282+
"lines": 7,
283+
"gone": 3
284+
},
285+
"apps/server/src/orchestration-v2/ThreadManagementService.ts": {
286+
"lines": 1,
287+
"gone": 1
288+
},
289+
"apps/server/src/processRunner.ts": {
290+
"lines": 2,
291+
"gone": 2
292+
},
293+
"apps/server/src/scheduling/DueHint.ts": {
294+
"lines": 1,
295+
"gone": 1
296+
},
297+
"apps/server/src/server.ts": {
298+
"lines": 6,
299+
"gone": 6
300+
},
301+
"apps/server/src/serverRuntimeStartup.ts": {
302+
"lines": 6,
303+
"gone": 2
304+
},
305+
"apps/server/src/serverRuntimeState.ts": {
306+
"lines": 1,
307+
"gone": 1
308+
},
309+
"apps/server/src/terminal/Manager.ts": {
310+
"lines": 1,
311+
"gone": 1
312+
},
313+
"apps/web/src/components/ChatMarkdown.permissions.browser.test.tsx": {
314+
"lines": 9,
315+
"gone": 9
316+
},
317+
"apps/web/src/components/ChatMarkdown.tsx": {
318+
"lines": 2,
319+
"gone": 1
320+
},
321+
"apps/web/src/components/chat/MarkdownFileLink.logic.ts": {
322+
"lines": 22,
323+
"gone": 20
324+
},
325+
"apps/web/src/components/chat/MarkdownFileLink.tsx": {
326+
"lines": 32,
327+
"gone": 28
328+
},
329+
"apps/web/src/components/media/mediaContent.ts": {
330+
"lines": 1,
331+
"gone": 1
332+
},
333+
"apps/web/src/components/settings/IntervalSecondsField.tsx": {
334+
"lines": 1,
335+
"gone": 1
336+
},
337+
"apps/web/src/components/settings/scopedSettings.ts": {
338+
"lines": 3,
339+
"gone": 3
340+
},
341+
"apps/web/src/components/settings/useScopedSettings.ts": {
342+
"lines": 5,
343+
"gone": 5
344+
},
345+
"apps/web/src/remoteOpen.test.ts": {
346+
"lines": 2,
347+
"gone": 2
348+
},
349+
"apps/web/src/remoteOpen.ts": {
350+
"lines": 1,
351+
"gone": 1
352+
},
353+
"packages/contracts/src/editor.ts": {
354+
"lines": 5,
355+
"gone": 5
356+
},
357+
"packages/provider-core/src/server/managedProvider.ts": {
358+
"lines": 10,
359+
"gone": 8
360+
},
361+
"packages/shared/src/cliRelease.ts": {
362+
"lines": 1,
363+
"gone": 1
364+
},
365+
"packages/shared/src/usageLimits.ts": {
366+
"lines": 1,
367+
"gone": 1
368+
}
369+
}
210370
}
Collapse file

‎.github/scripts/fork-seam-check.cjs‎

Copy file name to clipboardExpand all lines: .github/scripts/fork-seam-check.cjs
+40-1Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,18 @@ function findHiddenUpstreamFiles(upstreamFiles, isForkFile, atHead) {
362362
);
363363
}
364364

365+
const KINDS = ["files", "pending", "forkFiles", "lost"];
366+
const SEAM_KEYS = ["why", "added"];
367+
368+
/** Refuses a key the check does not read (a misspelt block guards nothing); "//…" is a comment. */
369+
function refuseUnknownKeys(object, known, where) {
370+
for (const key of Object.keys(object)) {
371+
if (!key.startsWith("//") && !known.includes(key)) {
372+
throw new Error(`${CONFIG}: ${where}unknown key "${key}" (known: ${known.join(", ")})`);
373+
}
374+
}
375+
}
376+
365377
const isStringList = (value) =>
366378
Array.isArray(value) && value.every((item) => typeof item === "string" && item.trim() !== "");
367379

@@ -372,13 +384,15 @@ function parseConfig(text) {
372384
if (typeof files !== "object" || files === null || Array.isArray(files)) {
373385
throw new Error(`${CONFIG}: "files" must be an object`);
374386
}
387+
refuseUnknownKeys(config, KINDS, "");
375388
for (const [file, seam] of Object.entries(files)) {
376389
if (typeof seam?.why !== "string" || seam.why.trim() === "") {
377390
throw new Error(`${CONFIG}: ${file} needs a "why"`);
378391
}
379392
if (!Array.isArray(seam.added) || seam.added.some((line) => typeof line !== "string")) {
380393
throw new Error(`${CONFIG}: ${file}: "added" must be a list of lines`);
381394
}
395+
refuseUnknownKeys(seam, SEAM_KEYS, `${file}: `);
382396
}
383397
if (config.forkFiles !== undefined && !isStringList(config.forkFiles)) {
384398
throw new Error(`${CONFIG}: "forkFiles" must be a list of paths`);
@@ -431,6 +445,21 @@ function parseConfig(text) {
431445
return { files, pending, forkFiles: config.forkFiles ?? [], lost };
432446
}
433447

448+
/**
449+
* Why a pull request's own list cannot become main's (its format only: its rules are not in force
450+
* here), or undefined. Merged, a malformed list crashes every later run, the fix's run included.
451+
*/
452+
function ownListProblem(text) {
453+
const own = `this change's own ${CONFIG}`;
454+
if (text === undefined) return `${own}: this change deletes it.`;
455+
try {
456+
parseConfig(text);
457+
return undefined;
458+
} catch (error) {
459+
return `${own} is malformed: ${error instanceof Error ? error.message : error}`;
460+
}
461+
}
462+
434463
const hasConfig = (rev) => entryAt(rev, CONFIG)?.type === "blob";
435464

436465
/** Reads `<rev>:.github/fork-seams.json`; throws when that commit has none. */
@@ -525,14 +554,24 @@ function main(argv) {
525554
const from = parsed.configRef ? `--config-ref ${configRef}` : upstream ? "the head" : "the base";
526555
const notes = [...findListedGone(config, { atBase, atHead }), ...unlisted.notes, ...lost.notes];
527556
for (const note of notes) console.log(`Note: ${note}`);
528-
if (!upstream && textAt(head, CONFIG) !== textAt(mergeBase, CONFIG)) {
557+
const ownList = textAt(head, CONFIG);
558+
const editsList = !upstream && ownList !== textAt(mergeBase, CONFIG);
559+
const listProblem = editsList ? ownListProblem(ownList) : undefined;
560+
if (editsList) {
529561
console.log(
530562
`Note: this change edits ${CONFIG}; it is judged by the list in ${from}, not its own. ` +
531563
"A new seam or list entry takes effect once the owner merges it.",
532564
);
533565
}
534566
const counted = upstream ? "every upstream file" : "every upstream file it changes";
567+
if (listProblem !== undefined) {
568+
console.error(listProblem);
569+
console.error(
570+
`Fix the list in this change: merged, it is main's list, and a malformed one stops every later pull request and fork-follow run.`,
571+
);
572+
}
535573
if (reasons.length === 0 && ceilings.length === 0) {
574+
if (listProblem !== undefined) return 1;
536575
console.log(
537576
`Fork lines in upstream files: only the pinned seams (${counted}; list from ${from}).`,
538577
);
Collapse file

‎.github/scripts/fork-seam-check.test.cjs‎

Copy file name to clipboardExpand all lines: .github/scripts/fork-seam-check.test.cjs
+58Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,13 +345,27 @@ test("a malformed config throws instead of guarding nothing", () => {
345345
{ files: SEAM, lost: { "a.ts": { lines: 2, gone: 3 } } },
346346
{ files: SEAM, lost: { "a.ts": { lines: 2, gone: 1, why: "x" } } },
347347
{ files: SEAM, lost: { "b.ts": { lines: 1, gone: 0 } } },
348+
// Unknown kinds: a misspelt block or seam key would silently guard nothing.
349+
{ files: SEAM, lsot: {} },
350+
{ files: SEAM, Pending: { "p.ts": 1 } },
351+
{ files: { "a.ts": { ...SEAM["a.ts"], add: ["x"] } } },
348352
...["/abs", "../up", "**", "*", "!", "a/../b"].map((pattern) => ({
349353
files: {},
350354
forkFiles: [pattern],
351355
})),
352356
]) {
353357
assert.throws(() => parseConfig(JSON.stringify(bad)), JSON.stringify(bad));
354358
}
359+
// Keys that start with "//" are comments, at the top and in an entry.
360+
assert.doesNotThrow(() =>
361+
parseConfig(
362+
JSON.stringify({
363+
"//": "c",
364+
"//pending": "c",
365+
files: { "a.ts": { ...SEAM["a.ts"], "//": "c" } },
366+
}),
367+
),
368+
);
355369
assert.deepEqual(parseConfig(JSON.stringify({ files: SEAM })), {
356370
files: SEAM,
357371
pending: {},
@@ -503,6 +517,50 @@ test("a pull request that widens or drops its own list is judged by main's list"
503517
});
504518
});
505519

520+
// A pull request is judged by main's list, so its own list was never parsed before merge: a
521+
// malformed one (bad JSON, the old plain-number "lost", an unknown kind, or none) then made every
522+
// later pull request and fork-follow run crash (exit 3), the pull request that fixes it included.
523+
test("a pull request's own list is parsed for its format (never its rules) and refused when malformed", () => {
524+
withRepo(({ git, commit, run, fromUpstream }) => {
525+
const main = commit({ ...seams({ files: SEAM }), ...BASE }, "main");
526+
const heads = {
527+
'old plain-number "lost"': [
528+
seams({ files: SEAM, lost: { "a.ts": 3 } }),
529+
/"lost": a\.ts needs/,
530+
],
531+
"bad JSON": [{ [CONFIG]: '{"files": {' }, /JSON/],
532+
"an unknown kind": [seams({ files: SEAM, lsot: {} }), /unknown key "lsot"/],
533+
"no list": [{ [CONFIG]: null }, /this change deletes it/],
534+
};
535+
for (const [what, [files, message]] of Object.entries(heads)) {
536+
git("checkout", "-q", "-f", "-B", "pr", main);
537+
const pr = commit(files, what);
538+
for (const args of [
539+
[main, pr],
540+
["--config-ref", main, main, pr],
541+
]) {
542+
const result = run(...args);
543+
assert.equal(result.status, 1, `${what}: ${result.stdout}${result.stderr}`);
544+
assert.match(result.stderr, /this change's own \.github\/fork-seams\.json/, what);
545+
assert.match(result.stderr, message, what);
546+
assert.match(result.stderr, /Fix the list in this change/, what);
547+
assert.doesNotMatch(result.stderr, /a file of the fork's own/, what);
548+
}
549+
}
550+
// A well-formed list passes, whatever its rules (main's list judges the change).
551+
git("checkout", "-q", "-f", "-B", "pr", main);
552+
const wide = {
553+
files: { "a.ts": { why: "mine", added: ["anything: 1,"] } },
554+
pending: { "z.ts": 9 },
555+
};
556+
const fine = commit(seams(wide), "a wider list");
557+
assert.equal(run(main, fine).status, 0);
558+
// From upstream the head's list is the one in force: malformed, it is still a crash.
559+
const broken = commit(seams({ files: SEAM, lost: { "a.ts": 3 } }), "broken");
560+
assert.equal(fromUpstream(main, broken).status, 3);
561+
});
562+
});
563+
506564
// Every upstream file on the command line, from upstream (no list there: the series' own list judges it) and
507565
// from main with a list that predates "pending" and "forkFiles" (the first run after this change).
508566
test("every upstream file counts on the command line, from upstream and from main", () => {

0 commit comments

Comments
0 (0)
You are visitor 01402792 — 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.