// The phone's source sweeps once in SourceGuardTests.swift (CottonUITests),// ported to vitest so they run on Linux in seconds: each reads Swift (and one// Rust folder) as text and asserts no forbidden call is written. The describe// blocks keep the Swift suites' names, so a comment in Sources that names// `WholeBodySweepTests` or `NoBearerSweepTests` still finds its guard here.//// Design P16 is explicit that these are PORTED rather than retired: "the defect// looks like a JavaScript problem and is not". `Data(contentsOf:)` over a// 464 MB file is the same jetsam kill with the same silence as `arrayBuffer()`// was — no exception, no crash report, a white screen. All of them sweep the// DIRECTORY, never a file list: "a two-file list is green on the day a third// file starts buffering".import { readFileSync } from"node:fs";import { basename, join } from"node:path";import { describe, expect, it } from"vitest";import { appSources, escapeRegExp, matches, repoRoot, trimSpaces, walk, withoutComments } from"./helpers/swift-source-sweep";describe("SourceSweep.withoutComments (the TypeScript twin)", () => {// RULE: The port strips comments exactly as SourceSweep.swift does, so a guard reads the CODE and a rule written in prose beside it cannot fail it. it("strips comments and leaves the code", () => {const stripped = withoutComments('// #FFFFFF in a comment\nlet kept = 1 /* #000000 */\nlet text = "a // b"\n'); expect(stripped).not.toContain("#FFFFFF"); expect(stripped).not.toContain("#000000"); expect(stripped).toContain("let kept = 1"); expect(stripped, "a slash inside a string literal is not a comment").toContain("a // b"); expect(withoutComments('"a \\" b" // c'), "an escape and the character it escapes are dropped, as the Swift did").toBe('"a b" '); });});// ── A big body is a FILE, never bytes ─────────────────────────────────────────describe("WholeBodySweepTests", () => {/** Swift's four spellings of the hazard `arrayBuffer()` was on the phone. */const buffering = [String.raw`Data\(contentsOf:`, String.raw`\.data\(for:`, String.raw`contentsOfFile:`, String.raw`String\(contentsOf:`];/** An entry must carry a sentence saying why THAT body is bounded — not "it's only a config file", but why it cannot grow. */const allowedToBuffer: Record<string, string> = {"CottonUI/Boot/UnlockAskSheet.swift":"the unlock card's UI seed (UnlockCardSeed, only under the -unlock-card-seed launch argument): reads the bundle's own unlock-card-seed.json, the core's cards for invented requests, about 17 KB fixed at build","CottonUI/Story/StoryDeskSeed.swift":"Story Dev's walk seed: reads the bundle's own story-desk-seed.json, a made-up screenplay of a few kilobytes fixed at build, in the Dev build only","CottonUI/Story/Ink/InkSeed.swift":"Story Ink's dev seed: reads the bundle's own story-ink-seed.json or story-ink-crowd.json, a made-up screenplay of a few kilobytes fixed at build, in the Dev build only","CottonUI/Chat/ChatWarmSeed.swift":"Chat Dev's look seed: reads the bundle's own chat-warm.json, the core's answers over invented people fixed at build, in the Dev build only","CottonUI/Days/DaysRoot.swift":"Cotton Days' dev look seed: reads the bundle's own days-dev-seed.json and days-crowd.json, made-up days of a few kilobytes fixed at build, in the Dev build only","CottonUI/Notes/NotesFileViewer.swift":"Words' reader of a note's file draws a web page or a Markdown file from its words, so it reads one whole, and only one of at most `wordsReadMost` (8 MB): a bigger one is said unreadable and Share hands it on as a file","CottonUI/Notes/NotesLookSeed.swift":"Cotton Notes Dev's look seed: reads the bundle's own notes-dev-seed.json and notes-crowd.json, made-up notes of a few kilobytes fixed at build, in the Dev build only","CottonUI/VaultApp/VaultDevOpen.swift":"Vault Dev's seed: reads the bundle's own vault-dev-seed.json, three invented logins fixed at build, in the Dev build only","CottonUI/Definitions/FixtureDefinitions.swift":"reads the app bundle's own table definitions and synthetic records, a few kilobytes each that ship with the build","CottonUI/Screens/Legal/BundledLicence.swift":"reads a licence text that ships in the app bundle, a few kilobytes fixed at build and never a person's","CottonKit/FlavourManifest.swift":"reads the bundle's own flavour.json, a manifest of a few hundred bytes fixed at build and never a person's","CottonPaper/Resources.swift":"left-out-pictures.json, the bundled list of imageset names a flavour's build left out of its catalogue (ios-flavour-pictures.py writes it): a few kilobytes of names at most, never a body.","CottonPaper/Theme/ShippedThemes.swift":"reads the bundle's own themes.json, the build's theme rows fixed at build and never a person's","CottonPaper/Theme/FlavourLook.swift":"reads the bundle's own Looks/<flavour>.json, one theme row of a few kilobytes fixed at build and never a person's","CottonUI/VaultApp/VaultModel.swift":"reads the password CSV the person picked in Cotton Vault's Bring passwords in, one line per saved login (kilobytes even for thousands), handed whole to the core's password.importCsv, which takes the text","CottonUI/Deck/Shell/DeckDoors.swift":"reads the Apple Passwords CSV the person picked, one line per saved login (kilobytes even for thousands), handed whole to the core's password.importCsv, which takes the text","CottonKit/PageFetch.swift":"reads one web page the person pasted or shared, its HTML whole because the core reads its article (tens to a few hundred kilobytes), or the one picture that page names, kept as a picture","CottonKit/Music/LookupFetch.swift":"reads one lookup answer for an album's Find details: a MusicBrainz or iTunes search answer of a few kilobytes, or the iTunes cover at 600 px, a JPEG of a hundred-odd kilobytes","CottonFaces/Shared/FixturePictures.swift":"reads the faces' own invented photographs that ship in the app bundle, a few hundred kilobytes each fixed at build and never a person's","CottonUI/Capture/VoiceModel.swift":"reads the voice model's two stamps it wrote itself, a version number and a time of a few bytes each; the model is never read as bytes","CottonKit/ShareIntake.swift":"reads a shared Goodreads export or OPML list whole for the object's import only after its size is checked against `goodreadsCeiling` (32 MB) or `opmlCeiling` (8 MB); past them it refuses `tooLarge` and reads nothing","CottonMailbox/ShareClassification.swift":"reads the bundle's own flavour.json, a manifest of a few hundred bytes fixed at build and never a person's","CottonUI/Story/StoryFountainOpen.swift":"reads one Fountain or plain-text screenplay the person opened in Story, handed whole to the core's story.fountain.read, which takes the text; only after its size is checked against `ceiling` (8 MB, a feature script is a few hundred kilobytes): past it the file is refused unread","CottonUI/VaultApp/VaultBreachFetch.swift":"reads one breach range (Cotton Vault's Check for breaches): the range service's answer for one five-character SHA-1 prefix, a few hundred lines of hash suffixes and counts (padded to about 1,000), tens of kilobytes at most","CottonSpecimens/SpecimenLetterboard.swift":"reads Loom's own bundled kit folder (`cinemas`): its manifest and the PNGs it names, fixed at build and never a person's", };// RULE: No Swift source reads a whole body into memory (Data(contentsOf:), .data(for:), contentsOfFile:, String(contentsOf:)) unless its file is allow-listed with the sentence saying why that body is bounded. it("no source reads a whole body into memory", () => {const sources = appSources(); expect(sources.length, "the sweep read no files").toBeGreaterThan(0);const offenders: string[] = [];for (const { name, text } of sources) {if (allowedToBuffer[name] !== undefined) continue;const code = withoutComments(text);for (const pattern of buffering) {if (matches(pattern, code).length > 0) offenders.push(`${name} (${pattern})`); } } expect( offenders,"these read a whole body into memory. A big body is a FILE, never bytes: stream it to disk. If the body really is bounded, add it to `allowedToBuffer` with the sentence saying why.", ).toEqual([]); }); it("the pattern would actually match", () => { expect(matches(String.raw`Data\(contentsOf:`, "let bytes = try Data(contentsOf: url)")).not.toEqual([]); });});// ── No bearer, ever ───────────────────────────────────────────────────────────describe("NoBearerSweepTests", () => {/** A server admits a DEVICE, not a session: an `Authorization` header anywhere on this path is a bearer coming back. */const bearerSpellings = [String.raw`"Authorization"`, String.raw`forHTTPHeaderField:\s*"Authorization"`, String.raw`\["Authorization":`];/** The two spellings of "this Swift opens a connection of its own". */const requestSpellings = ["URLSession", "URLRequest"];/** THE ONE STATED EXCEPTION FOR THE OBJECT'S MEDIA (coordinator, 5 Nov 2026). */const signedStream ="Signed media.stream URLs minted by the core, downloaded as given, never built or re-signed in Swift: a capability the object signed, carrying no credential of this app's; the download (a background URLSession, or one fetch into the cache) is an OS facility only Swift can drive.";/** * THE ONE STATED EXCEPTION FOR A CALL'S ROOM (13 Nov 2026). * A call's socket is the room's, not the device's: the core asks the object * for the call (signed, in Rust), the object mints a room credential for this * one call (`ccr_<room>_<secret>`), and the core hands it on inside the * `open_socket` effect alone, with the socket's whole address. Swift opens * that WebSocket (URLSession's is the only one an iPhone app can hold through * CallKit's audio session in the background) and carries that credential in * the header, never the URL; it is no credential of this app's, opens no * database, and dies with the room. */const roomSocket ="The call room's WebSocket (Cotton Calling): the address and the per-call room credential the core hands in an open_socket effect, opened as given with the credential as the Bearer the room checks (apps/business/src/open.ts, src/calling/room.ts). No device credential, no database: the room's capability for one call.";/** * THE ONE STATED EXCEPTION FOR A CHAT SOCKET (13 Nov 2026). * The phone's chat socket on its own object is opened with a ticket, not the * device's credential: the core asks the object for one on its door (signed, * in Rust), the object mints it for one socket (`cts_<database>_<secret>`, * kept by its hash, spent by opening, dead after a minute), and the core * hands it with the socket's address in `chat.socket`'s answer. Swift opens * that WebSocket (URLSession's is the only one an iPhone app holds) with the * ticket as the Bearer in the header, never the URL. */const chatSocket ="The chat socket's WebSocket (Cotton Messages): the address and the one-socket ticket the core hands in chat.socket's answer, opened as given with the ticket as the Bearer the object checks (apps/business/src/chat/chat.ts). No device credential: the object's capability for one socket, spent by opening it.";const allowedBearer: Record<string, string> = {"CottonCalls/WebSocketCallSocket.swift": roomSocket,"CottonChat/WebSocketChatSocket.swift": chatSocket, };/** One file's exemption — SCOPED TO THE CALL, never to the file. AN ENTRY MUST NAME A HOST THAT IS NOT A COTTON SERVER, or a capability the object minted for this one use (signedStream, roomSocket). */const allowedToRequest: Record<string, { allows: string[]; reason: string }> = {"CottonUI/Music/MusicPlayback.swift": { allows: ["URLSession"], reason: signedStream },"CottonUI/Reader/BookKeeper.swift": { allows: ["URLSession", "URLRequest"], reason: signedStream },"CottonUI/Viewer/FilmKeeper.swift": { allows: ["URLSession"], reason: signedStream },"CottonUI/Viewer/FilmFrames.swift": { allows: ["URLSession"], reason: `${signedStream} Here, one GET of the film's master, to choose the rung a frame is read from: the address shell.player's stream hands on, which is that signed URL or the phone's own door on 127.0.0.1 for a sealed film.`, },"CottonUI/Viewer/PodcastPlayback.swift": { allows: ["URLSession"], reason: signedStream },"CottonUI/Notifications/CottonAppDelegate.swift": { allows: ["URLSession"], reason: `${signedStream} Here, the system's background-session events handed back to those downloads.`, },"CottonCalls/WebSocketCallSocket.swift": { allows: ["URLSession", "URLRequest"], reason: roomSocket },"CottonChat/WebSocketChatSocket.swift": { allows: ["URLSession", "URLRequest"], reason: chatSocket },"CottonVoice/VoiceModelStore.swift": { allows: ["URLSession"], reason:"Cotton Voice's model files: a background URLSession downloads the public speech-model files from Cotton's own model bucket, each at the url and sha256 the core's voice.plan hands on (the catalogue's, never a Cotton server's API), with no bearer, no cookie and no device credential; each file is checked against its sha256 before it is kept. This file knows no address.", },"CottonUI/VaultApp/VaultBreachFetch.swift": { allows: ["URLSession", "URLRequest"], reason:"Cotton Vault's breach check (SHAPES vault.breach): somebody else's range service (api.pwnedpasswords.com, the addresses the core hands in fetch_ranges, cotton_core::keys::health::RANGE_URL), GET with the core's Add-Padding header and no credential. Only five SHA-1 characters per password leave the phone, and only when the person taps Check; never a Cotton server.", },"CottonUI/Chat/ChatLinkFetch.swift": { allows: ["URLSession", "URLRequest"], reason:"Comms' link previews (FEEDBACK-4 B4, chat CONTRACT.md \"Link previews\"): the page and picture of a link the person writes, fetched by their own phone so the server never sees it, at the address the core's composer.preview offers. An ephemeral session with no cookies, no cache and no credentials (every challenge but the server's trust refused), the page's first 256 KB and its picture's 2 MB within 6 s, and no address on the phone's own network, the first hop and every redirect checked (ChatLinkAddress.swift). Never a Cotton server; no credential of this app's. Chat Dev's seed registers its invented pages' server (ChatWarmLinkServer) on this session alone.", },"CottonKit/Music/LookupFetch.swift": { allows: ["URLSession", "URLRequest"], reason:"An album's Find details (Cotton Music, AlbumLookup) asks somebody else's lookup services from the phone: MusicBrainz (musicbrainz.org, under an identified User-Agent, one request a second) and the iTunes Search API (itunes.apple.com) and the artwork address it answers, which refuses the object's network. Each address is AlbumLookup's, handed in; this file knows none, never addresses a Cotton server and carries no credential of this app's: a GET with the service's own headers, nothing more.", }, };// RULE: The phone sends NO bearer: the device signature is the whole credential, so no Swift source sets an Authorization header. it("no Swift source sends an Authorization header", () => {const sources = appSources(); expect(sources.length, "the sweep read no files").toBeGreaterThan(0);const offenders: string[] = [];for (const { name, text } of sources) {if (allowedBearer[name]?.trim()) continue;const code = withoutComments(text);for (const pattern of bearerSpellings) if (matches(pattern, code).length > 0) offenders.push(`${name} (${pattern})`); } expect( offenders,"these set an Authorization header. The phone sends NO bearer: the device signature is the whole credential. Only the provider-key path (4k) may carry one, and it is not this app's.", ).toEqual([]); });// RULE: Every request exception says whose server it reaches, names only the calls it covers, still exists, and its file writes no address of its own. it("every request exception names somebody else's server", () => {const sources = appSources();for (const [name, exception] ofObject.entries(allowedToRequest)) { expect(exception.reason.trim(), `${name} is allowed to build a request with no reason written`).not.toBe(""); expect(exception.allows.length, `${name} is allow-listed for nothing in particular — name the call`).toBeGreaterThan(0);for (const spelling of exception.allows) { expect(requestSpellings, `${name} is allow-listed for \`${spelling}\`, which this sweep does not look for`).toContain(spelling); }const file = sources.find((source) => source.name === name); expect(file, `${name} is allow-listed and no longer exists — delete the entry`).toBeDefined();if (!file) continue;// An exempt file may hand an address on; it may not KNOW one.const code = withoutComments(file.text);for (const pattern of [String.raw`https?://`, String.raw`cottondb\.com`, "localhost", String.raw`127\.0\.0\.1`]) { expect( matches(pattern, code),`${name} is allowed to build a request and writes an address of its own (${pattern}). A literal here means this file decides whose server answers, which is the one thing the rule forbids.`, ).toEqual([]); } } });// RULE: The app makes no request to the household itself — every household byte goes through the core's one transport (architect, 13 Oct 2026); URLSession/URLRequest is allowed only for somebody else's server, each exception naming it. it("no Swift source opens an HTTP connection to a Cotton server", () => {const offenders: string[] = [];for (const { name, text } of appSources()) {const exempt = allowedToRequest[name]?.allows ?? [];const code = withoutComments(text);for (const pattern of requestSpellings) {if (!exempt.includes(pattern) && matches(pattern, code).length > 0) offenders.push(`${name} (${pattern})`); } } expect( offenders,"these build an HTTP request in Swift. Every byte to a Cotton server goes through Rust's signed transport — a Swift request carries no device signature and would be refused, or worse, admitted. If it genuinely addresses somebody ELSE'S server, add it to `allowedToRequest` with the sentence saying whose — and list only the spelling that sentence justifies.", ).toEqual([]); });// RULE: The only package that opens a connection is sentry-cocoa: project.yml declares and links exactly Cotton, Loom and sentry-cocoa, pinned exactly to Package.swift's version, imported only by an app target and linked by no target of the package. it("the only package that opens a connection is sentry-cocoa on the app target", () => {// Read BY PATH: `apps/cotton/project.yml` (the phone's project spec) — grep it repo-wide before moving it.const spec = readFileSync(join(repoRoot, "apps/cotton/project.yml"), "utf8"); expect(spec.length, "project.yml is empty — did the phone project move?").toBeGreaterThan(0);const code = spec .split("\n") .filter((line) => line.length > 0 && !trimSpaces(line).startsWith("#")) .join("\n");// The package list: the block between `packages:` and the next top-level key, WHATEVER that key is.const lines = code.split("\n");const start = lines.indexOf("packages:"); expect(start, "project.yml has no top-level `packages:` block").toBeGreaterThanOrEqual(0);let end = lines.findIndex((line, index) => index > start && line.length > 0 && !/\s/.test(line[0]));if (end < 0) end = lines.length;const packages = lines.slice(start + 1, end).join("\n");const declared = matches(String.raw`^ ([A-Za-z][\w-]*):`, packages, "m").map((m) => m.replace(/^[ :]+|[ :]+$/g, "")); expect( [...declared].sort(),`project.yml declares packages ${declared}. The app depends on the two local packages and on sentry-cocoa, and on nothing else: a third package is a connection this app may open that nobody wrote a sentence for.`, ).toEqual(["Cotton", "Loom", "sentry-cocoa"]); expect(packages).toContain("url: https://github.com/getsentry/sentry-cocoa");// Every target, a flavour's clones included, links only what `packages:` declares.const linked = newSet(matches(String.raw`^\s*- package:\s*([\w-]+)`, code, "m").map((m) => trimSpaces(m.split(":").pop() ?? ""))); expect([...linked].sort(), `project.yml targets link ${[...linked].sort()}; only Cotton, Loom and sentry-cocoa`).toEqual(["Cotton","Loom","sentry-cocoa", ]);// Pinned EXACTLY, and to the version the package manifest declares it at.const manifest = readFileSync(join(repoRoot, "apps/cotton/Package.swift"), "utf8"); expect(manifest.length, "apps/cotton/Package.swift is empty — did the package move?").toBeGreaterThan(0);const version = (line: string | undefined): string | undefined => (line === undefined ? undefined : matches(/[0-9]+\.[0-9]+\.[0-9]+/, line)[0]);const manifestPin = version(matches(String.raw`sentry-cocoa",\s*exact:\s*"([0-9.]+)"`, manifest)[0]);const phonePin = version(matches(String.raw`exactVersion:\s*"?([0-9.]+)"?`, packages)[0]); expect(manifestPin, "Package.swift no longer pins sentry-cocoa with `exact:`").toBeDefined(); expect(phonePin, "project.yml no longer pins sentry-cocoa with `exactVersion:`").toBeDefined(); expect(phonePin, "project.yml and Package.swift pin different sentry-cocoa versions").toBe(manifestPin);// Reached from the APP TARGET only.const importers = appSources() .filter((source) => withoutComments(source.text).includes("import Sentry")) .map((source) => source.name); expect(importers.length, "nothing imports Sentry — did reporting move?").toBeGreaterThan(0);for (const name of importers) expect(name.startsWith("App/"), `${name} imports Sentry; only an app target does, never a library`).toBe(true);// No target of the package links it.const targets = withoutComments(manifest) .split(".target(") .flatMap((part) => part.split(".testTarget(")) .slice(1); expect( targets.filter((target) => target.includes('.product(name: "Sentry"')).length,"a target in apps/cotton/Package.swift links Sentry; only the app target, through project.yml, does", ).toBe(0); });// RULE: The Rust transport sends no Authorization header either, and its `*_tests.rs` twin still asserts the header is absent. it("the Rust transport sends none either", () => {// Read BY PATH. `crates/cotton-client/src/transport/` is the RUST CLIENT lane's; grep this path repo-wide before moving it.const transport = join(repoRoot, "crates/cotton-client/src/transport");const files: Array<[string, string]> = [];const twins: Array<[string, string]> = [];for (const path of walk(transport, "rs")) {const text = readFileSync(path, "utf8");// A `*_tests.rs` names the header ON PURPOSE — to assert it is absent. (basename(path).endsWith("_tests.rs") ? twins : files).push([basename(path), text]); } expect( files.length,`could not read ${transport} — did it move? That path is the RUST CLIENT lane's; grep it repo-wide before changing this guard.`, ).toBeGreaterThan(0);for (const [name, text] of files) {for (const pattern of ["AUTHORIZATION", '"authorization"']) { expect(matches(pattern, text), `${name} names an Authorization header; the phone sends no bearer`).toEqual([]); } } expect( twins.some(([, text]) => text.toLowerCase().includes("authorization")),`no \`*_tests.rs\` under ${transport} mentions an Authorization header any more. This guard skips those files because they assert the header is ABSENT — if the Rust twin has gone, the skip is a hole.`, ).toBe(true); });});// ── One copy of the relay-name rule, and it is not here ───────────────────────describe("RelayNameSweepTests", () => {// RULE: Swift reaches the relay-name rule only through `cotton_call`: no Swift source names the relay domain or restates `NAME_PATTERN` — there is deliberately no third copy. it("no Swift source holds a copy of the relay-name rule", () => {const sources = appSources(); expect(sources.length, "the sweep read no files").toBeGreaterThan(0);for (const { name, text } of sources) {const code = withoutComments(text); expect(matches(String.raw`relay\.cottondb\.com`, code), `${name} names the relay domain; the address rules are below the boundary`).toEqual([]); expect(matches(String.raw`a-z0-9\]\{1,30\}`, code), `${name} restates the relay-name pattern; there is no third copy`).toEqual([]); } });});// ── One toast host, above the router ──────────────────────────────────────────describe("ToastHostSweepTests", () => {// RULE: No screen mints a `ToastCenter` of its own: a receipt is often spoken on the way out of a screen, and a centre owned by that screen dies with it. it("no screen owns a toast centre", () => {const sources = appSources(); expect(sources.length, "the sweep read no files").toBeGreaterThan(0);let swept = 0;const offenders: string[] = [];for (const { name, text } of sources) {if (!name.includes("/Screens/")) continue; swept += 1;if (matches(String.raw`ToastCenter\(`, withoutComments(text)).length > 0) offenders.push(name); } expect( offenders,"these build their own ToastCenter. A screen speaks into the host above the router — `@Environment(ToastCenter.self)` — because a receipt shown on the way out of a screen dies with it.", ).toEqual([]); expect(swept, "the sweep found no screens, so it proved nothing").toBeGreaterThan(0); });});// ── A model on the wire is a model something re-reads ─────────────────────────describe("InvalidationWiringSweepTests", () => {/** Exemptions carry a sentence and are checked to still be earned. */const exempt: Record<string, string> = {HomeModel: "fed by `RootView`'s one subscribe fan-out through `receive(_:)`, never pushed", };const conformance = String.raw`class (\w+)[^{\n]*\bRereadable\b`;// RULE: Every model that conforms to `Rereadable` is wired: a `Hosted` arm builds it, or a `.rereading` sits beside it, or its screen watches `sync?.revision` — a model nothing re-reads is a screen that never refreshes on a fold. it("every Rereadable model is on the wire", () => {const sources = appSources(); expect(sources.length, "the sweep read no files").toBeGreaterThan(0);const stripped = sources.map((source) => withoutComments(source.text));const models = newSet<string>();for (const code of stripped) {for (const line of matches(conformance, code)) {const name = line.split(" ").filter(Boolean)[1]; models.add(/^[\p{L}\p{N}_]*/u.exec(name)?.[0] ?? ""); } } expect(models.size, "the sweep found no conforming models").toBeGreaterThan(0);for (const name ofObject.keys(exempt)) expect(models.has(name), `${name} is exempt but no longer conforms — drop the row`).toBe(true);const unwired: string[] = [];for (const model of [...models].sort()) {if (exempt[model] !== undefined) continue;const word = newRegExp(String.raw`\b${escapeRegExp(model)}\b`);const wired = stripped.some((code) => {if (!word.test(code)) returnfalse;const byHost = matches(String.raw`Hosted\(\{[^}]*\b` + model + String.raw`\(`, code).length > 0;const byModifier = matches(String.raw`\.rereading \{`, code).length > 0;const inline = matches(String.raw`sync\?\.revision`, code).length > 0;return byHost || byModifier || inline; });if (!wired) unwired.push(model); } expect( unwired,`${unwired.join(", ")} conform to \`Rereadable\` and nothing re-reads them: no \`Hosted\` arm builds them, no \`.rereading\` sits beside them, and no screen watches \`sync?.revision\` for them.`, ).toEqual([]); });});