Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
0e06331
refactor(ports): split process-runner.ts into parts
V3RON Nov 15, 2026
6032151
refactor(drivers): split android testing.ts into test-* parts
V3RON Nov 15, 2026
763b957
refactor(agents): split spec-lint.mjs into parts
V3RON Nov 15, 2026
f96200c
refactor(core): split doctor.ts into parts
V3RON Nov 15, 2026
49ab97f
chore(agents): the comment lint excuses a block moved unchanged from …
V3RON Nov 15, 2026
28bf905
refactor(core): split config.ts into parts
V3RON Nov 15, 2026
dd79de1
refactor(contract): split operations.ts into parts
V3RON Nov 15, 2026
3d83603
refactor(http): split app.ts into parts
V3RON Nov 15, 2026
2389bfe
refactor(core): split registry.ts into parts
V3RON Nov 15, 2026
3c4a3a6
refactor(simlock-client): split client.ts into parts
V3RON Nov 15, 2026
870e117
test(core): the provision call-site scan names the android test-* parts
V3RON Nov 15, 2026
cb32248
refactor(drivers): move the iOS driver's runtime, data and passthroug…
V3RON Nov 15, 2026
d266743
refactor(leasing): split lease-acquisition-coordinator.ts into parts
V3RON Nov 15, 2026
71fe75e
refactor(leasing): keep the workflow's provision step private, as it …
V3RON Nov 15, 2026
f3740ad
refactor(daemon): split server.ts into parts
V3RON Nov 15, 2026
a163133
refactor(daemon): split dispatcher.ts into parts
V3RON Nov 15, 2026
7bd5a7d
refactor(gateway): split fleet-coordinator.ts into parts
V3RON Nov 15, 2026
0f44347
docs(manuals): point at the parts that now hold the operations, dispa…
V3RON Nov 15, 2026
ad42058
test(leasing): split create-leasing.test.ts by topic
V3RON Nov 15, 2026
6ed251f
test(gateway): split fleet-requests.test.ts by topic
V3RON Nov 15, 2026
56c585f
test(gateway): split worker-registry.test.ts by topic
V3RON Nov 15, 2026
4f1596b
test(gateway): split relay.test.ts by topic
V3RON Nov 15, 2026
3f4c821
test(gateway): split aggregate.test.ts by topic
V3RON Nov 15, 2026
182bc1d
test(ios): split index.test.ts by topic
V3RON Nov 15, 2026
2a24e5c
test(ios): split physical.test.ts by topic
V3RON Nov 15, 2026
f9511c7
chore(agents): the test lint excuses a test line or internal import a…
V3RON Nov 15, 2026
3139b65
test(gateway): split dispatcher.test.ts by topic
V3RON Nov 15, 2026
a81eff9
test(gateway): split fleet-routing.test.ts by topic
V3RON Nov 15, 2026
42757a4
test(core): split config.test.ts by topic
V3RON Nov 15, 2026
bb7808a
test(core): split doctor.test.ts by topic
V3RON Nov 15, 2026
ef89636
test(daemon): split dispatcher.test.ts by topic
V3RON Nov 15, 2026
96209f9
test(daemon): split server.test.ts by topic
V3RON Nov 15, 2026
e37c885
test(drivers): split index.test.ts by topic
V3RON Nov 15, 2026
ef2b09b
test(drivers): split index-lifecycle.test.ts by topic
V3RON Nov 15, 2026
0c7e3ea
test(drivers): split physical-handler.test.ts by topic
V3RON Nov 15, 2026
c3050bf
test(daemon): split dispatcher-leases.test.ts by topic
V3RON Nov 15, 2026
9a0be83
test(daemon): split relay-gateway.e2e.test.ts by topic
V3RON Nov 15, 2026
8971d22
test(leasing): split lease-acquisition-coordinator.test.ts by topic
V3RON Nov 15, 2026
6ba191a
test(leasing): split physical-device-watcher.test.ts by topic
V3RON Nov 15, 2026
259d164
test(leasing): split lease-end-participants.test.ts by topic
V3RON Nov 15, 2026
dfd16a8
test(gateway): split service.test.ts by topic
V3RON Nov 15, 2026
f6641b8
test(gateway): split fleet-coordinator.test.ts by topic
V3RON Nov 15, 2026
4eb2275
test(core): split component-installer.test.ts by topic
V3RON Nov 15, 2026
1f1c9d7
test(daemon): split main.test.ts by topic
V3RON Nov 15, 2026
3a77889
test(daemon): split optional-modules.test.ts by topic
V3RON Nov 15, 2026
74f28b6
test(agent-device): split edge.test.ts by topic
V3RON Nov 15, 2026
6d4b737
test(agent-device): split gateway-front.test.ts by topic
V3RON Nov 15, 2026
cef47ce
test(agent-device): split agent-device-supervisor.test.ts by topic
V3RON Nov 15, 2026
6960461
test(agent-device): split edge-request-rules.test.ts by topic
V3RON Nov 15, 2026
13b49fe
test(core): split policy.test.ts by topic
V3RON Nov 15, 2026
7df7598
test(core): split converger.test.ts by topic
V3RON Nov 15, 2026
0180255
test(core): split registry.test.ts by topic
V3RON Nov 15, 2026
e0be519
test(core): split quarantine-coordinator.test.ts by topic
V3RON Nov 15, 2026
79c0a72
test(core): split learned-kinds.test.ts by topic
V3RON Nov 15, 2026
bb161f2
test(http): split app-leases.test.ts by topic
V3RON Nov 15, 2026
902a450
test(http): split app.test.ts by topic
V3RON Nov 15, 2026
9df7067
test(contract): split operations.test.ts by topic
V3RON Nov 15, 2026
c54532b
test(contract): split schemas.test.ts by topic
V3RON Nov 15, 2026
473a5ba
test(drivers): split catalog.test.ts by topic
V3RON Nov 15, 2026
db4a5bb
test(drivers): split seeds.test.ts by topic
V3RON Nov 15, 2026
932c11d
refactor(drivers): split the iOS driver into a root over simctl, mark…
V3RON Nov 15, 2026
3ccccd0
test(core): the provision call-site scan allows the iOS driver handin…
V3RON Nov 15, 2026
3237cfe
test(core): the call-site scans name the test helpers the test splits…
V3RON Nov 15, 2026
823e7ba
test(drivers): split session.test.ts by topic
V3RON Nov 15, 2026
0ed2990
test(history): split usage.test.ts by topic
V3RON Nov 15, 2026
e2567a5
test(history): split history.test.ts by topic
V3RON Nov 15, 2026
34e022a
test(agents): split spec-lint.test.ts by topic
V3RON Nov 15, 2026
3aa59f0
test(simlock-client): split client.test.ts by topic
V3RON Nov 15, 2026
b4ae223
test(cli): split tunnel.test.ts by topic
V3RON Nov 15, 2026
210796a
test(mcp): split server.test.ts by topic
V3RON Nov 15, 2026
7cf04a8
test(mcp): split session.test.ts by topic
V3RON Nov 15, 2026
afbcb3d
test(tunnel): split worker.test.ts by topic
V3RON Nov 15, 2026
dc3b581
test(e2e): split physical-enrollment.test.ts by topic
V3RON Nov 15, 2026
b2e8e56
chore(fallow): the health overrides follow the setup helpers into the…
V3RON Nov 15, 2026
dbea685
test(cli): split index.test.ts by topic
V3RON Nov 15, 2026
0f1a8c3
chore(fallow): suppressions and exports follow the split code; the cl…
V3RON Nov 15, 2026
4562000
chore(fallow): core's index takes DownloadPolicy from the config type…
V3RON Nov 15, 2026
f1e5c2d
chore: record that the decomposition changes no public surface
V3RON Nov 15, 2026
a918717
chore(fallow): one canonical location per test helper name, and suppr…
V3RON Nov 15, 2026
dc10f6e
docs(manuals): name the moved parts by paths that resolve, within the…
V3RON Nov 15, 2026
73fc87c
fix(docs-surface): the config surface covers the parts config.ts was …
V3RON Nov 16, 2026
abc46bf
docs: pointers name the files the split moved code to, and edited com…
V3RON Nov 16, 2026
f5305a5
fix(docs-surface): the config surface covers config-alerts.ts too
V3RON Nov 16, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
35 changes: 32 additions & 3 deletions .agents/scripts/comments.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,34 @@ export function listComments({ base, head, all = false, files = null }) {
const kinds = SHELL.test(path) ? shellKinds(lines) : scriptKinds(lines);
blocks.push(...blocksIn(path, lines, kinds, added, all));
}
return blocks;
if (all) return blocks;
const removed = removedLines(base, head);
return blocks.filter((block) => !movedVerbatim(block, removed));
}

// why: a split moves code between files unchanged, so a block the diff adds whole while it
// removes the same lines elsewhere is not new; one removed line excuses one added line.
function movedVerbatim(block, removed) {
if (block.state !== "added") return false;
const wanted = new Map();
for (const { text } of block.lines.filter((l) => !DIRECTIVE.test(l.text.trim()))) {
wanted.set(text.trim(), (wanted.get(text.trim()) ?? 0) + 1);
}
if ([...wanted].some(([text, n]) => (removed.get(text) ?? 0) < n)) return false;
for (const [text, n] of wanted) removed.set(text, removed.get(text) - n);
return true;
}

function removedLines(base, head) {
const from = git("merge-base", base, head ?? "HEAD").trim();
const range = head === undefined ? [from] : [from, head];
const removed = new Map();
for (const line of git("diff", "-U0", "--no-color", ...range).split("\n")) {
if (!line.startsWith("-") || line.startsWith("--- ")) continue;
const text = line.slice(1).trim();
removed.set(text, (removed.get(text) ?? 0) + 1);
}
return removed;
}

export function changedFiles({ base, head, files = null }) {
Expand Down Expand Up @@ -81,12 +108,14 @@ function blocksIn(path, lines, kinds, added, all) {
function blockAt(path, lines, added, start, end, trailing) {
const block = lines.slice(start - 1, end);
if (block.every((l) => DIRECTIVE.test(l.trim()) || l.trim() === "")) return null;
const changed = block.filter((_, i) => added.has(start + i)).length;
// why: a tool directive added beside a comment edits nothing that comment says.
const said = block.map((l, i) => i).filter((i) => !DIRECTIVE.test(block[i].trim()));
const changed = said.filter((i) => added.has(start + i)).length;
return {
path,
start,
end,
state: changed === block.length ? "added" : changed > 0 ? "edited" : "unchanged",
state: changed === said.length ? "added" : changed > 0 ? "edited" : "unchanged",
trailing,
lines: block.map((l, i) => ({ n: start + i, text: l })),
next: trailing ? null : nextCode(lines, end),
Expand Down
12 changes: 10 additions & 2 deletions .agents/scripts/docs-surface-check.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
// one without the other prints the surfaces it changed and the exit code is 1. The surface is:
//
// cli src/cli/tree.ts, the command tree
// config src/core/config.ts, the config type, defaults and validator
// config src/core/config.ts and the parts it re-exports (config-types.ts, -defaults.ts,
// -validators.ts, -role-checks.ts, -helpers.ts, -alerts.ts): the config type, defaults
// and validator
// errors the ERROR_TABLE object in src/contract/errors.ts
// mcp each `registerTool(` name and definition object in src/mcp/server.ts, and the
// tool schemas in src/mcp/contracts.ts
Expand Down Expand Up @@ -50,7 +52,13 @@ const tools = (text) =>

const SURFACES = [
{ name: "cli", files: ["src/cli/tree.ts"], parts: whole },
{ name: "config", files: ["src/core/config.ts"], parts: whole },
{
name: "config",
files: ["", "-types", "-defaults", "-validators", "-role-checks", "-helpers", "-alerts"].map(
(part) => `src/core/config${part}.ts`,
),
parts: whole,
},
{
name: "errors",
files: ["src/contract/errors.ts"],
Expand Down
78 changes: 78 additions & 0 deletions .agents/scripts/spec-lint-patterns.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
import { dirname, join } from "node:path";
import { fileURLToPath } from "node:url";

export const ROOT = join(dirname(fileURLToPath(import.meta.url)), "..", "..");
export const TASK_H2 = ["Scope", "Technical spec", "Done when", "Out of scope", "Depends on"];
export const TASK_H3 = [
"Rows",
"Facts",
"Modules touched",
"Rules in play",
"Retired words",
"Tests",
];
// why: tasks and features written before the design tables keep their layout until they close.
export const OLD_TASK_H2 = [
"Scope",
"In short",
"Technical spec",
"Done when",
"Out of scope",
"Depends on",
];
export const OLD_TASK_H3 = [
"Facts",
"Modules touched",
"Surface and extension points",
"Contract and event changes",
"Other code on the same state",
"Failure modes",
"Rules in play",
"Retired words",
"Tests",
];
export const OPTIONAL = new Set(["Surface and extension points", "Retired words"]);
const BUSINESS_H2 = [
"Problem",
"Who it is for",
"Outcome",
"How it works for the user",
"Examples",
"What could go wrong",
"Words used",
"Non-goals",
"Completion conditions",
"Open questions",
"Decisions",
];
export const DESIGN = [
["Behaviours", "B"],
["Stored state", "S"],
["Interfaces", "I"],
["Existing code", "X"],
];
export const FEATURE_H2 = [...BUSINESS_H2, ...DESIGN.map(([name]) => name), "Tasks"];
export const OLD_FEATURE_H2 = [...BUSINESS_H2, "Shared values", "Behaviours", "Tasks"];
export const SCHEMA_STEP = /^([\w-]+) \+(\d+)$/;
export const REFACTOR_H2 = ["Why", "Target shape", "Out of bounds", "Done when"];
export const FAILURE_HEADER = ["Call", "Outcome", "What happens", "Limit, counted from"];
export const CANNOT_SPLIT =
/\b(cannot|can't|can not|does not|doesn't|won't) split\b|\bone task, not\b|\bkept? (it )?whole\b/i;
export const HARDWARE = /slow lane|real (simulator|emulator|device|iPhone|phone)|on a Mac with/i;
export const SLOW_TEST = /e2e\/slow-[\w-]+\.test\.ts/g;
const EXTENSIONS =
"ts|tsx|js|mjs|cjs|json|jsonc|md|mdx|yml|yaml|sh|swift|kt|kts|java|toml|txt|html|css|plist|py|xml|gradle";
export const PATH_LINE = new RegExp(
`^(v\\d[\\w.-]*:)?([\\w@./-]*[\\w@-]\\.(?:${EXTENSIONS})):(\\d+)(?:-(\\d+))?$`,
);
export const PLAIN_PATH_LINE = new RegExp(
`(?<![\\w/.@-])((?:[\\w@.-]+/)+[\\w@.-]+\\.(?:${EXTENSIONS})):(\\d+)(?:-(\\d+))?`,
"g",
);
export const DOC_PATH = /\.(md|mdx)\b/;
export const CODE_PATH = new RegExp(`\\.(?!md\\b|mdx\\b)(?:${EXTENSIONS})\\b`);
export const STOP = new Set(
"the a an and or of to in on at by for with from is are be it its as that this then than when one each no not into after before same their them they any all per but if so via while".split(
" ",
),
);
101 changes: 101 additions & 0 deletions .agents/scripts/spec-lint-text.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
import { prose, tables } from "./spec-body.mjs";
import { PATH_LINE, PLAIN_PATH_LINE, STOP } from "./spec-lint-patterns.mjs";

export function text(s) {
return s === undefined ? "" : prose(s.lines).join("\n").trim();
}

export function squash(s) {
return s.replace(/\s+/g, " ").trim();
}

export function lacksMermaid(s) {
return s !== undefined && !s.lines.some((l) => /^\s*```mermaid\s*$/.test(l));
}

function ref(path, from, to, tool = false) {
return { tool, path, from: +from, to: +(to ?? from) };
}

function backtickedRef(content, last) {
const full = PATH_LINE.exec(content);
if (full !== null) {
const tool = full[1] !== undefined;
return { found: ref(full[2], full[3], full[4], tool), last: tool ? null : full[2] };
}
const tail = /^:(\d+)(?:-(\d+))?$/.exec(content);
if (tail === null || last === null) return { found: null, last };
return { found: ref(last, tail[1], tail[2]), last };
}

function backtickedRefs(line) {
const refs = [];
let last = null;
for (const m of line.matchAll(/`([^`]+)`/g)) {
const next = backtickedRef(m[1], last);
last = next.last;
if (next.found !== null) refs.push(next.found);
}
return refs;
}

function plainRefs(line) {
return [...line.replace(/`[^`]*`/g, " ").matchAll(PLAIN_PATH_LINE)].map((m) =>
ref(m[1], m[2], m[3]),
);
}

export function pathRefs(lines) {
return prose(lines).flatMap((line) => [...backtickedRefs(line), ...plainRefs(line)]);
}

export function namedPaths(lines) {
return new Set(
[
...prose(lines)
.join("\n")
.matchAll(/`([\w@./-]+\/[\w@.-]+)(?::[\d-]+)?`/g),
].map((m) => m[1]),
);
}

export function taskNumbers(cell) {
return [...(cell ?? "").matchAll(/#(\d+)/g)].map((m) => Number(m[1]));
}

// why: Existing code says `none` under its Commit and Searches lines, so the word is looked for
// on a line of its own, never inside a sentence.
export function isNone(s) {
const lines = prose(s.lines).map((l) => l.replaceAll("`", "").trim());
return (
!tables(s.lines).some((t) => t.header[0] === "Id") && lines.some((l) => /^none\.?$/i.test(l))
);
}

export function bare(cell) {
return cell.replaceAll("`", "").trim();
}

export function words(s) {
return new Set(
s
.replace(/([a-z])([A-Z])/g, "$1 $2")
.toLowerCase()
.split(/[^a-z0-9]+/)
.filter((w) => w.length > 2 && !STOP.has(w))
.map((w) => w.replace(/(ing|ed|es|s)$/, "")),
);
}

function shared(a, b) {
return [...a].filter((w) => b.has(w)).length;
}

// why: a line may spell out the cases its row only names ("object rows of Examples"), so it
// passes when it holds most of the row's Behaviour words, or most of the shorter of the two.
export function overlap(line, row) {
const byBehaviour =
row.behaviour.size === 0 ? 0 : shared(row.behaviour, line) / row.behaviour.size;
const shorter = Math.min(line.size, row.words.size);
return Math.max(byBehaviour, shorter === 0 ? 0 : shared(line, row.words) / shorter);
}
Loading
Loading