Skip to content
Myr

Integrate W5 group A: the dev world opens burrow's migrate as its family, reads the session cookie, and lists when each project last landed

Before adoption: this commit came in with the history the project adopted, so no landing records it.

W5 group 1 integration (issues 502, 503, 504, 505, 506, 507, 508, 512, 513, 514 merged above with --no-ff, in the index's order). These are the cross-issue fixes the merges needed; verify is green. - 506 x 502: a migrate ask's opening now counts its callers red first (`callersTwice`) and splits itself, so the dev seed died with NotRedFirst and every dev-world test failed by a transport error. The dev Checker now prints, for a count lane, what the examples state its command prints (`printedBy` in src/dev/examples.ts: burrow's `count-callers.ts` output on its first commit, computed from the example's own files: one caller in each of the six packages). burrow's decider opens only the parent, and the platform opens the family: six children and a delete child waiting on them (502's leftover: "open only the parent"). - 513 x 502: the development `#backend` now does what the production one does with the session cookie, `withCredential(request, credentialFrom(request))`, so the cookie `/auth/dev` sets reaches the dev world. client.test.ts's browsers now carry the session cookie (not an Authorization header the web would strip), and a new whoami case signs in through `/auth/dev`'s cookie; both fail by assertion without the line. - 514 x 502: the dev front page folds the project list as D1's `projects` table now does: `landedAt` from each Landed event, posture from a PostureChanged ledger entry (`open` until then), and entries take their project's posture. New dev-backend case: datekit is listed with its landing's time and burrow with none (red by assertion first). Credits stay `creditsFor` over each project, the rule D1's credits table is fed by. - 505: with 502's code in, a plant of `#backend` -> src/dev/backend.ts in production fails both the `devBackend` case and the dev-modules case by assertion; the test's comment that said the case could not fail yet now says so. - 513's suggestion: `min-w-0` on the header's session container (features/shared/layout.tsx), the root of the phone-width overflow it capped. - Tests: dev-backend and client cases that seed whole worlds get a 30 s limit (as packages/project's whole-story test does): the first, cold seed took 4.6 s of vitest's 5 s default while turbo ran every package's tests at once, about 0.6 s alone. - turbo.json (resolved in the 507 and 508 merges): @repo/rules#test and @repo/checks#test take the union of both branches' example inputs, with 507's exclusion of examples' `.env*` files kept on both; @repo/web#test and #typecheck keep commands.json. - PROVENANCE.md: folded 508's port row (burrow's copy of no-module-level-mutable-state), the idea rows of 501, 505 and 512, and 511's rows (a Fonts table; the shadcn components under Ports, with shadcn's MIT text copied from the package into LICENSES/shadcn-ui.MIT.txt). - Budgets: platform entry 1,609,285 of 1,665,000; web JavaScript 2,306,063 of 2,500,000 (504 suggested minifying the SSR build if it nears the limit).

authored by oscabriel · committed by oscabriel · parent 08b0ff8 · Browse files · 11 files+261 added−81 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

11 files+261 added−81 removed

  • tests:+82 added−14 removed
  • other:+179 added−67 removed

11 files+261 added−81 removed

modified:apps/web/src/dev/backend.ts+7 added-3 removed
modified:apps/web/src/dev/checker.ts+14 added-3 removed
modified:apps/web/src/dev/examples.ts+40 added-35 removed
22 unmodified lines
23import { Command, SymbolName } from "@repo/protocol/domain/common";24import type { AskKind } from "@repo/protocol/domain/kind";25import { PolicyInput } from "@repo/protocol/domain/policy";26import { AskId, Handle, ProjectName, RepoPath } from "@repo/protocol/ids";27import { Array, Predicate, Schema } from "effect";27import { Array, Number, Predicate, Schema } from "effect";2829import type { Files } from "./git.ts";3031const dir = Brand.configDir;
447 unmodified lines
479);480481const PARENT = "drop-legacy-fetch";482483/** One step of the migrate family: moving one package off `legacyFetch`. */484const child = (pkg: string): StatedAsk => ({485 askedBy: burrowPeople.decider,486 blockedBy: [],487 brief: {488 want: `@burrow/${pkg} calls http.get wherever it called legacyFetch.`,489 },490 check: migrateCheck,491 file: `${dir}/asks/${PARENT}-${pkg}.ask.ts`,492 id: `${PARENT}-${pkg}`,493 kind: "migrate",494 parent: PARENT,495 territory: { module: `@burrow/${pkg}`, paths: [`packages/${pkg}/**`] },496});497498const CHILDREN = ["auth", "billing"];499483/**484 * The one ask burrow's decider opens: the migrate. Its callers sit in all485 * six packages, so the platform opens it as a family (issue 506): a child486 * per package and a delete child waiting on the six, their files written487 * beside the parent's in the same landing.488 */489const burrowAsks: readonly StatedAsk[] = [490 {491 askedBy: burrowPeople.decider,492 blockedBy: [],
8 unmodified lines
501 module: ".",502 paths: Array.map(PACKAGES, (pkg) => `packages/${pkg}/**`),503 },504 },516 ...CHILDREN.map(child),517 {518 askedBy: burrowPeople.decider,519 blockedBy: CHILDREN.map((pkg) => `${PARENT}-${pkg}`),520 brief: { want: "Delete legacyFetch: nothing calls it any more." },521 check: encodeCheck(522 CheckSpec.cases.SymbolAbsent.make({523 count: Command.make(COUNT),524 symbol: SymbolName.make("legacyFetch"),525 })526 ),527 file: `${dir}/asks/${PARENT}-delete.ask.ts`,528 id: `${PARENT}-delete`,529 kind: "migrate",530 parent: PARENT,531 territory: { module: "@burrow/kit", paths: ["packages/kit/**"] },532 },505];506507const packageFiles = (pkg: string): readonly (readonly [string, string])[] => [508 [
129 unmodified lines
638 ),639 files: monorepo,640 project: ProjectName.make("burrow"),641} as const;642643/** How many times `text` calls `symbol`, as burrow's `scripts/count-callers.ts` counts. */644const callsIn = (text: string, symbol: string) =>645 text.split(`${symbol}(`).length - 1;646647/** What burrow's count command prints on its first commit: each package's calls of `legacyFetch`. */648const burrowCallers = () => {649 const byModule = Object.fromEntries(650 PACKAGES.map((pkg) => [651 `@burrow/${pkg}`,652 Number.sumAll(653 [...monorepo].flatMap(([path, text]) =>654 path.startsWith(`packages/${pkg}/src/`)655 ? [callsIn(text, "legacyFetch")]656 : []657 )658 ),659 ])660 );661662 return JSON.stringify({663 byModule,664 total: Number.sumAll(Object.values(byModule)),665 });666};667668/**669 * What each count command of the examples prints, by the command: the dev670 * Checker runs none, so a count lane prints this wherever it runs.671 */672export const printedBy: ReadonlyMap<string, string> = new Map([673 [COUNT, burrowCallers()],674]);
modified:apps/web/src/dev/front-page.ts+79 added-24 removed
4 unmodified lines
5 * projection (`projection.ts`). An ask opened goes on the page and one closed comes off; a6 * claim marks it claimed until it lapses or is released. An entry is what7 * the anonymous viewer sees: takeable when no live claim holds it, nothing8 * it waits on is still on the page, and it is held for nobody; newest first.9 * Every posture reads `open`, as D1's does until W6. A person's credits are10 * each project's own count, joined (`creditsFor`).9 * A project is listed from its first event, `open` until a `PostureChanged`10 * ledger entry moves it, with when it last landed (W5 514's `projects`11 * table). A person's credits are each project's own count, joined12 * (`creditsFor`): the rule D1's `credits` table is fed by, read at the source.13 */14import { FrontPage } from "@repo/project/front-page";15import type { FrontPageFilter } from "@repo/project/front-page";16import type { ProjectedEvent } from "@repo/project/projection";
3 unmodified lines
20import type {21 FrontPageEntry,22 ProjectListing,23} from "@repo/protocol/domain/front-page";24import { LedgerEntry } from "@repo/protocol/domain/visibility";25import type { ProjectName } from "@repo/protocol/ids";26import type { Posture } from "@repo/protocol/posture";27import { Array, DateTime, Effect, Layer, Order } from "effect";2829import { DevProjected } from "./projection.ts";30
4 unmodified lines
35 readonly openedAt: DateTime.Utc;36 readonly project: ProjectName;37}3839/** A project as D1's `projects` row holds it, but for its open asks, which the page counts. */40interface Listed {41 readonly landedAt?: DateTime.Utc;42 readonly posture: Posture;43}4445const keyOf = (project: ProjectName, ask: string) => `${project}/${ask}`;4647/** Every project's events in its own order. */48const inOrder = Order.mapInput(
48 unmodified lines
97 Released: ({ ask }) => withClaims(rows, keyOf(project, ask), -1),98 Warned: () => rows,99 });100101/** The project list after one project's event, as D1's statements change it. */102const listedStep = (103 listed: ReadonlyMap<ProjectName, Listed>,104 { event, project }: ProjectedEvent105): ReadonlyMap<ProjectName, Listed> => {106 const was: Listed = listed.get(project) ?? { posture: "open" };107108 if (ProjectEvent.guards.Landed(event)) {109 return new Map(listed).set(project, {110 ...was,111 landedAt: event.landing.landedAt,112 });113 }114115 if (116 ProjectEvent.guards.LedgerAppended(event) &&117 LedgerEntry.guards.PostureChanged(event.entry)118 ) {119 return new Map(listed).set(project, { ...was, posture: event.entry.to });120 }121122 return new Map(listed).set(project, was);123};124125const empty: ReadonlyMap<string, Row> = new Map();12693/** The page's rows after `events`, and every project they came from. */94const fold = (events: readonly ProjectedEvent[]) => ({95 projects: Array.sort(96 Array.dedupe(events.map(({ project }) => project)),97 Order.String98 ),99 rows: [...Array.reduce(Array.sort(events, inOrder), empty, step).values()],100});127const unlisted: ReadonlyMap<ProjectName, Listed> = new Map();128129/** The page's rows after `events`, and every project they came from, by name. */130const fold = (events: readonly ProjectedEvent[]) => {131 const ordered = Array.sort(events, inOrder);132133 return {134 listed: Array.reduce(ordered, unlisted, listedStep),135 projects: Array.sort(136 Array.dedupe(events.map(({ project }) => project)),137 Order.String138 ),139 rows: [...Array.reduce(ordered, empty, step).values()],140 };141};142143type Folded = ReturnType<typeof fold>;144145/** A project's posture as the list holds it: `open` until a ledger entry moves it. */146const postureOf = (folded: Folded, project: ProjectName): Posture =>147 folded.listed.get(project)?.posture ?? "open";148149/** One project as `listProjects` answers it. */150const listingOf =151 (folded: Folded) =>152 (project: ProjectName): ProjectListing => {153 const listing = {154 openAsks: folded.rows.filter((row) => row.project === project).length,155 posture: postureOf(folded, project),156 project,157 };158159 const landedAt = folded.listed.get(project)?.landedAt;160161 return landedAt === undefined ? listing : { ...listing, landedAt };162 };163164/** Newest first, then by project and ask, as D1's query orders them. */165const newestFirst = Order.combineAll([166 Order.flip(Order.mapInput(DateTime.Order, ({ openedAt }: Row) => openedAt)),167 Order.mapInput(Order.String, ({ project }: Row) => project),
1 unmodified line
169]);170171/** A row as the anonymous viewer sees it. */172const entryOf =111 (rows: readonly Row[]) =>173 (folded: Folded) =>174 (row: Row): FrontPageEntry => {175 const onPage = (ask: string) =>114 rows.some(176 folded.rows.some(177 (other) => other.project === row.project && other.ask.ask === ask178 );179180 const blockedBy = row.ask.blockedBy.filter(onPage);181 const claimed = row.claims > 0;182183 return {184 ask: { ...row.ask, blockedBy, claimed },123 posture: "open",185 posture: postureOf(folded, row.project),186 project: row.project,187 takeable:188 !claimed && blockedBy.length === 0 && row.ask.reserve === undefined,189 };
24 unmodified lines
214 Effect.provideService(Projects, projects)215 )216 ),217 entries: (filter) =>156 Effect.map(page, ({ rows }) =>157 Array.sort(rows.filter(matches(filter)), newestFirst).map(158 entryOf(rows)218 Effect.map(page, (folded) =>219 Array.sort(folded.rows.filter(matches(filter)), newestFirst).map(220 entryOf(folded)221 )222 ),223 projects: () =>162 Effect.map(page, (folded) =>163 folded.projects.map((project): ProjectListing => ({164 openAsks: folded.rows.filter((row) => row.project === project)165 .length,166 posture: "open",167 project,168 }))169 ),224 Effect.map(page, (folded) => folded.projects.map(listingOf(folded))),225 });226 })227);
modified:apps/web/src/dev/seed.ts+1 added-1 removed
278 unmodified lines
279280 return api;281});282283/** burrow: the migrate family opened, its delete step waiting on the other two. */283/** burrow: the migrate ask opened as its family, six children and a delete child waiting on them. */284const seedBurrow = Effect.flatMap(285 started(burrow.project, burrowPeople.decider, burrow.files, 15),286 (api) => opened(api, burrowPeople.decider, burrow.asks, 17)287);
48 unmodified lines
modified:apps/web/src/features/shared/layout.tsx+1 added-1 removed
modified:apps/web/test/client.test.ts+42 added-8 removed
1 unmodified line
2 * The web's contracts as its atoms read them, with `#backend` under the3 * `development` condition: the same `ContractsClient` group, the same4 * reactivity keys and the same `/rpc` path, answered by the dev world in5 * process instead of a platform. Each registry stands for one browser: its6 * client's requests carry that browser's HTTP `Authorization`, or none.6 * client's requests carry that browser's session cookie, or none, which7 * the backend turns into the bearer the dev world reads (issue 513).8 * Every test reads the one world the module's `backend` seeds, in order;9 * only the last changes it.10 */11import { describe, expect, it } from "@effect/vitest";
10 unmodified lines
2223import { backend } from "#backend";2425import { keys } from "../src/client/keys.ts";26import { serverClientOver } from "../src/server/client.ts";27import { SESSION_COOKIE, whoamiHandler } from "../src/server/session.ts";28import { ContractsClient, webContracts } from "../src/surfaces.ts";2930const WEB_URL = "http://localhost:3000";31
4 unmodified lines
3637/**38 * `ContractsClient` as one browser runs it: its HTTP protocol posts to the39 * web's `/rpc`, which hands the request to `backend` in process, with37 * `token` as the request's bearer when there is one.40 * `token` in the session cookie when there is one.41 */42const browser = (token?: string) =>43 Layer.effect(44 ContractsClient,
3 unmodified lines
48 RpcClient.layerProtocolHttp({49 transformClient: HttpClient.mapRequest((request) =>50 token === undefined51 ? request49 : HttpClientRequest.bearerToken(request, token)52 : HttpClientRequest.setHeader(53 request,54 "cookie",55 `${SESSION_COOKIE}=${token}`56 )57 ),58 url: `${WEB_URL}/rpc`,59 })60 ),
28 unmodified lines
89 {},90 { reactivityKeys: keys.today() }91);9293/**94 * The first test waits for the module's world to be seeded, cold, while95 * turbo runs every package's tests at once (near vitest's 5 s default).96 */97const seededWorld = { timeout: 30_000 };9886describe("the dev world, through the web's atoms", () => {99describe("the dev world, through the web's atoms", seededWorld, () => {100 it.live(101 "lists every open ask of both projects on the front page, the newcomers' one untakeable",102 () =>103 Effect.gen(function* () {
19 unmodified lines
123 `${project}/${ask.ask} ${takeable}`124 )125 .toSorted()126 ).toStrictEqual([114 "burrow/drop-legacy-fetch true",115 "burrow/drop-legacy-fetch-auth true",116 "burrow/drop-legacy-fetch-billing true",117 "burrow/drop-legacy-fetch-delete false",127 "burrow/drop-legacy-fetch false",128 "burrow/drop-legacy-fetch-burrow-auth true",129 "burrow/drop-legacy-fetch-burrow-billing true",130 "burrow/drop-legacy-fetch-burrow-catalog true",131 "burrow/drop-legacy-fetch-burrow-kit true",132 "burrow/drop-legacy-fetch-burrow-notify true",133 "burrow/drop-legacy-fetch-burrow-search true",134 "datekit/add-months-clamp true",135 "datekit/format-ordinal false",136 "datekit/parse-iso-week false",137 ]);
61 unmodified lines
199 expect(Schema.is(Unauthenticated)(refused)).toBeTruthy();200 })201 );202203 it.live(204 "signs a browser in as the person whose dev token its session cookie holds, as /auth/dev sets it",205 () =>206 Effect.gen(function* () {207 const response = yield* Effect.promise(() =>208 whoamiHandler((request) => serverClientOver(backend)(env, request))({209 request: new Request(`${WEB_URL}/auth/whoami`, {210 headers: { cookie: `${SESSION_COOKIE}=${DECIDER}` },211 }),212 })213 );214215 expect(216 JSON.parse(yield* Effect.promise(() => response.text()))217 ).toStrictEqual({ handle: "ines-v" });218 })219 );220221 it.live("shows the decider their Today, with the seed's decisions", () =>222 Effect.gen(function* () {223 const today = yield* settled(registryAs(DECIDER), todayAtom);224
82 unmodified lines
modified:apps/web/test/dev-backend.test.ts+37 added-2 removed
141 unmodified lines
142 return { landing, sampled };143 })144);145146/** The project list beside datekit's landed answer, as anyone reads them. */147const listedWithLanding = inFreshWorld((as) =>148 Effect.gen(function* () {149 const anyone = yield* clientOf(as());150 const ines = yield* clientOf(as(decider));151 const { projects } = yield* anyone.listProjects({});152 const { unattended } = yield* ines.today({});153154 return { landedAt: unattended.map(({ landedAt }) => landedAt), projects };155 })156);157158/**159 * Each test seeds whole worlds, the first one cold, while turbo runs every160 * package's tests at once: about 0.5 s alone, near vitest's 5 s default161 * under that load once burrow's migrate opens as a family of eight asks.162 */163const seededWorlds = { timeout: 30_000 };164146describe("the dev seed", () => {165describe("the dev seed", seededWorlds, () => {166 it.live("gives two fresh worlds equal front pages and project lists", () =>167 Effect.gen(function* () {168 const first = yield* pages;169 const second = yield* pages;170152 expect(first.entries).toHaveLength(7);171 expect(first.entries).toHaveLength(10);172 expect(first.projects.map(({ project }) => project)).toStrictEqual(173 PROJECTS174 );175 expect(Equal.equals(first, second)).toBeTruthy();
15 unmodified lines
191 }192 })193 );194195 it.live(196 "lists each project with when it last landed, as D1's project list does",197 () =>198 Effect.gen(function* () {199 const { landedAt, projects } = yield* listedWithLanding;200201 expect(202 projects.map(({ landedAt: at, project }) => [project, at])203 ).toStrictEqual([204 ["burrow", undefined],205 ["datekit", landedAt[0]],206 ]);207 expect(landedAt).toHaveLength(1);208 })209 );210211 it.live("lands bram's answer to datekit with its credit trailers", () =>212 Effect.gen(function* () {213 const { landing, sampled } = yield* landedAnswer;214
9 unmodified lines
modified:apps/web/test/production-bundle.test.ts+3 added-4 removed
250 unmodified lines
251 ).toStrictEqual([]);252 })253 );254255 // While `src/dev/backend.ts` only re-exports the server backend, a build256 // that resolved `#backend` to it would name no module of its own in the257 // maps, so `devBackend` bites once issue 502 gives the dev world code;258 // the forward to PLATFORM bites now.255 // A build that resolves `#backend` to `src/dev/backend.ts` fails here256 // (`devBackend`) and in the next case (the dev world's modules): checked257 // by a plant at W5's integration, once 502 gave the dev world its code.258 it.effect("resolves #backend to the forward to PLATFORM", () =>259 Effect.gen(function* () {260 const output = yield* Built;261
37 unmodified lines
added:LICENSES/shadcn-ui.MIT.txt+21 added
1MIT License23Copyright (c) 2023 shadcn45Permission is hereby granted, free of charge, to any person obtaining a copy6of this software and associated documentation files (the "Software"), to deal7in the Software without restriction, including without limitation the rights8to use, copy, modify, merge, publish, distribute, sublicense, and/or sell9copies of the Software, and to permit persons to whom the Software is10furnished to do so, subject to the following conditions:1112The above copyright notice and this permission notice shall be included in all13copies or substantial portions of the Software.1415THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR16IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,17FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE18AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER19LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,20OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE21SOFTWARE.
modified:PROVENANCE.md+16 added
9 unmodified lines
10| `packages/protocol/src/cli.ts` | [joelhooks/rat-stack](https://github.com/joelhooks/rat-stack) `packages/capability/src/to-command.ts` l.14–247 at `fba26d8` | MIT, `LICENSES/rat-stack.MIT.txt` | Projects an `Rpc` whose payload is a struct (or an empty record), not a capability, and calls it through an `RpcClient`, named and given positionals by the `Cli` annotation; `toCommands` projects a whole group by its `Surfaces` annotation. `--json` is always offered; `--yes` is restored from our own `NeedsApproval` (without it the command fails with `ApprovalNeeded` before any call); `--dry-run` is offered unless `ReadOnly` (it prints the encoded payload and calls nothing). The command prints through a `CommandOutput` port, never the console: a refusal (or the refusals a success carries, such as a refused receipt) goes to it once and the command fails with `Reported`. Defaults may fill required fields left out (the repo's project). String flags check their value with the field's schema, so the parser refuses a malformed value by its flag. The description comes from the `Description` annotation. Dropped: the reserved-field guards and the `as never` casts. |11| `packages/protocol/src/mcp.ts` | [joelhooks/rat-stack](https://github.com/joelhooks/rat-stack) `packages/capability/src/to-toolkit.ts` l.18–146 at `fba26d8` | MIT, `LICENSES/rat-stack.MIT.txt` | Projects an `RpcGroup`'s Rpcs, not capabilities: the payload, success and error schemas become the tool's. Handlers call each Rpc through an `RpcClient`, passing the payload alone. The description comes from the `Description` annotation. Hint annotations restored from our own `ReadOnly`, `Idempotent` and `Destructive` annotations, with `OpenWorld` false; a `NeedsApproval` contract's description gains "Asks a person first." Added `listTools`, the tools as `tools/list` shows them, and `toJsonSchema`, which derives a schema the way `McpServer` does (top-level `$ref` inlined, definitions under `$defs`). Dropped: the empty-input dynamic tool, upstream's approval flow and the file-wide diagnostics escape. |12| `tools/oxlint/fence/rules/debt-ledger.ts` | [joelhooks/rat-stack](https://github.com/joelhooks/rat-stack) `scripts/oxlint-plugin-debt-ledger.ts` at `fba26d8` | MIT, `LICENSES/rat-stack.MIT.txt` | Five kinds, one per `debt.baseline.json` key: the TypeScript kind is split by directive into `@ts-expect-error`, `@ts-ignore` and `@ts-nocheck`. A named export, registered in the `fence` plugin rather than its own, and run only through `oxlint.debt.config.ts`. `eslint-disable` directives count as `oxlint-disable`, since oxlint honours them. A directive counts only where a comment's line starts, as oxlint, eslint and tsc read it, except `@effect-diagnostics`, which the Effect language service reads anywhere. Every report sits at the file's first offset, where no disable comment can hide it, and carries its line (and column) in the message. An empty reason (`-- ` with nothing after) leaves the directive text without the ` --`. The JSON message `{directive, kind, reason?}` and the reason after ` -- ` are upstream's. |13| `tools/oxlint/fence/rules/no-module-level-mutable-state.ts` | [joelhooks/rat-stack](https://github.com/joelhooks/rat-stack) `scripts/oxlint-plugin-patterns.ts` l.28–43 and l.621–677 at `fba26d8` | MIT, `LICENSES/rat-stack.MIT.txt` | Only this rule is ported from that file. A named export in the `fence` plugin. `workspacePath` reads the path string alone: it strips oxlint's `cwd`, then finds the whole `(apps\|packages)/<name>/src/` shape anywhere, so a fixture tree counts and folders above the checkout don't; no `node:path` import and no `nodeBuiltinImport` escape. `workspacePath` is exported, for `no-effect-sleep-in-project`. The `.svelte` exclusion is dropped, and `declare let`/`declare var` is skipped. The scope check, `isModuleScopedVar`, the `moduleState` message and the description are upstream's. See `tools/oxlint/fence/UPSTREAM.md`. |14| `examples/burrow/tools/oxlint/burrow/rules/no-module-level-mutable-state.ts` | [joelhooks/rat-stack](https://github.com/joelhooks/rat-stack) `scripts/oxlint-plugin-patterns.ts` l.28–43 and l.621–677 at `fba26d8`, copied from `tools/oxlint/fence/rules/no-module-level-mutable-state.ts` | MIT, `examples/burrow/tools/oxlint/burrow/LICENSE-rat-stack.txt` (a copy of `LICENSES/rat-stack.MIT.txt`, so the example carries its own notice) | A copy of the fence's port, for the fictional example `burrow`. Its header points at burrow's own licence copy and `UPSTREAM.md`. It is registered in burrow's `burrow` plugin and set to `warn` by burrow's config. Everything else is as in the fence's row. See `examples/burrow/tools/oxlint/burrow/UPSTREAM.md`. |15| `tools/oxlint/fence/rules/no-manual-effect-runtime-in-tests.ts` | [joelhooks/rat-stack](https://github.com/joelhooks/rat-stack) `scripts/oxlint-plugin-effect-tests.ts` at `fba26d8`, adapted there from [pingdotgg/t3code](https://github.com/pingdotgg/t3code) `oxlint-plugin-t3code/rules/no-manual-effect-runtime-in-tests.ts` (Rat Stack names no commit; licence copied at `05d4042`) | MIT, `LICENSES/rat-stack.MIT.txt` and `LICENSES/t3code.MIT.txt` | A named export in the `fence` plugin. `manualRunnerName` (a string nobody read) became the boolean `isManualRunner`. The test-file pattern, the twelve `Effect.run*` methods plus `ManagedRuntime.make`, the `manualRunner` message and the description are Rat Stack's. t3code's later `maxOccurrences` ceiling and `Option` unwrapping are not ported. See `tools/oxlint/fence/UPSTREAM.md`. |16| `scripts/hooks/lib/policy.ts`, `scripts/hooks/vcs-policy.ts`, `.claude/settings.json`, `.cursor/hooks.json`, `.pi/extensions/vcs-policy/index.ts` | [joelhooks/rat-stack](https://github.com/joelhooks/rat-stack) `scripts/vcs-command-policy.js`, `scripts/hooks/block-git-no-verify.mjs`, `.claude/settings.json`, `.cursor/hooks.json` and `.pi/extensions/git-interceptor/index.ts` at `fba26d8` | MIT, `LICENSES/rat-stack.MIT.txt` | The regex became argv parsing: a shell reader (`scripts/hooks/lib/shell.ts`: simple commands, quotes, `$'…'`, substitutions, heredocs, redirects) and an option parser (`scripts/hooks/lib/argv.ts`), both new, so flag text inside a quoted `-m` is a message. Five rules instead of one: hook bypasses (`--no-verify` and its prefixes, `commit -n` and bundles, `-c core.hooksPath`, `--config-env`, aliases, `git config core.hooksPath`, `LEFTHOOK=0`, `HUSKY=0`, `lefthook uninstall`), `git push`, deletes (wrangler; cf without `--dry-run`, read the way yargs reads it), cf's project commands (also through cf's second bin name, `cloudflare`), and reads of the closed env files (a recursive `grep` or `rg -uu` included). Each refusal carries its rule and a reason sentence. Deny-only: the `GIT_EDITOR=:` rewrite is dropped. The adapter decodes its input with Effect Schema, runs under `BunRuntime.runMain`, writes through `Stdio`, denies Claude Code by exit 2 and fails closed on input it cannot read (upstream exits 0). The Cursor hook has no `matcher`, so every shell command is judged; the pi extension blocks through a local structural type instead of importing pi. Beyond the shell: `.claude/settings.json` denies Claude Code's Read tool the closed env files, and the pi extension blocks pi's `read`, `edit` and `grep` of them (`isClosedEnvPath`). |17| `scripts/vendor-agent-sources.sh` | [joelhooks/rat-stack](https://github.com/joelhooks/rat-stack) `scripts/vendor-agent-sources.sh` at `fba26d8` | MIT, `LICENSES/rat-stack.MIT.txt` | Two sources (Effect, workers-sdk) in place of six, in a flat `.agent_sources/<repo>` layout in place of `github.com/<owner>/<repo>`. The pins come from the root catalog's `effect` and `apps/platform`'s `wrangler`, refused unless each is one exact version. Every tag is checked with `git ls-remote --exit-code` before its clone, with no fallback. The clone's own package version must equal the pin. The metadata is written last and marks a finished clone; a pin that moved re-clones without `--refresh`. |18| `packages/rules/src/rules-evaluator/bun-prelude.ts` (the `next` generator, about 8 lines) | mulberry32, Tommy Ettinger's 32-bit seeded generator, written from the published algorithm | Public domain; no licence text to keep | Seeded from the evaluation's `seed` fact (or 0 for a rule call), and installed as `Math.random`, `crypto.getRandomValues` and `crypto.randomUUID` inside the config sandbox, so rule code sees the same numbers for the same facts (principle 8). |19| `packages/rules/src/prelude.ts` (`installFrozenGlobals`' `generator.next`, about 8 lines) | mulberry32, Tommy Ettinger's 32-bit seeded generator, written from the published algorithm | Public domain; no licence text to keep | The Dynamic Worker prelude's `Math.random`, `crypto.getRandomValues` and `crypto.randomUUID`, number for number the same as `bun-prelude.ts`'s, so the `/worker` and `/bun` rules adapters give one bundle the same policy (principle 8). The generator is reset before each job, so a warm worker gives the numbers a cold one would. |20| `tsconfig.base.json` (compiler options and the Effect diagnostics map) | [joelhooks/rat-stack](https://github.com/joelhooks/rat-stack) `tsconfig.base.json` at `fba26d8` | MIT, `LICENSES/rat-stack.MIT.txt` | `importFromBarrel` dropped (unknown to `@effect/tsgo` 0.48.1); `types` emptied, so each package opts into its host's types; `@effect/platform-bun` added to `namespaceImportPackages`; `outdatedApi`, `unstableApiUsage` and `experimentalApiUsage` raised to `error`; `allowedUnstableApis` emptied and granted per path through `overrides`. |21| `apps/web/src/components/ui/*.tsx` | shadcn/ui's `base-lyra` registry, generated by the `shadcn` 4.21.2 CLI | MIT, `LICENSES/shadcn-ui.MIT.txt` (from the `shadcn` package's `LICENSE.md`) | Formatted by oxfmt; otherwise as generated. |2223## Ideas, no code2425| Idea | From | Where it lives |
4 unmodified lines
30| A merged command catalog (`commands.json`) | cf's command catalog | `scripts/lib/gen.ts` |31| Skills as numbered playbooks: each step ends on a done-when, then a gate step and a Report list | Rat Stack's `skills/add-a-capability` and `skills/add-a-store` at `fba26d8` | `.agents/skills/{add-operation,add-refusal,add-check-kind,add-port}/SKILL.md` |32| A Workers rate-limit binding behind one Effect service: `limit({ key })` through `tryPromise`, with a failing binding as a defect | Rat Stack's `apps/mischief/src/rate-limits.ts` at `fba26d8` | `apps/platform/src/adapters/rate-limits.ts` (`WorkerRateLimits`) |33| A Worker Loader binding typed structurally, and a stub disposed quietly after each request | Rat Stack's `apps/mischief/src/sandbox-worker-loader.ts` at `fba26d8` (the idea only; no lines copied) | `packages/rules/src/rules-evaluator/worker.ts` (`LoaderBinding`) |34| A `#backend` package-imports condition: `development` serves the platform in process, the default forwards over the service binding | Rat Stack's `apps/web/package.json` (`imports`), `apps/web/src/dev/backend.ts` and `apps/web/src/server/backend.ts` at `fba26d8` | `apps/web/package.json`, `apps/web/src/{dev,server}/backend.ts` |35| The web's `/rpc` route as a function of its backend, and an `AtomRpc.Service` over the contracts with the HTTP protocol at `/rpc` | Rat Stack's `apps/web/src/server/rpc.ts` and `apps/web/src/client/docs.ts` at `fba26d8` | `apps/web/src/server/rpc.ts`, `apps/web/src/surfaces.ts` |36| A production-bundle test: build the web for production with source maps, then refuse any dev module (by the maps' `sources`) or dev string in the output | Rat Stack's `apps/web/test/production-bundle.test.ts` at `fba26d8` | `apps/web/test/production-bundle.test.ts` (Effect, one shared build, plus the manifest, routes and `#backend` checks) |37| `/.well-known/mcp.json` as an MCP server card (`protocolVersion`, `transport.endpoint`/`type`, `capabilities`), and the agent-skills index with path-absolute `/.well-known/agent-skills/<name>/SKILL.md` URLs | Rat Stack's `apps/mischief/src/content.ts` (`mcpServerCard`, `agentSkillsIndex`, `agentSkillPath`) at `fba26d8` | `apps/web/src/features/agents/llms.ts` (`mcpCard`), `apps/platform/src/well-known.ts` |38| An ask as Markdown on its own URL by `Accept` or at `.md`, with `Vary: Accept` and a `Link` alternate header, and no user-agent lists | Rat Stack's `apps/mischief/src/app.ts` l.84–124 (`acceptsHtml`) at `fba26d8` | `apps/web/src/features/ask/markdown.ts`, `apps/web/src/routes/$project/asks/{$ask,{$ask}[.]md}.ts(x)` |3940## Fonts4142Fonts are not code; each ships unchanged under its own licence.4344| Our file | Origin | Licence | Our changes |45| --- | --- | --- | --- |46| `apps/web/src/assets/fonts/public-sans-latin{,-ext}.woff2` | [Public Sans](https://github.com/uswds/public-sans) (USWDS/GSA, a modified Libre Franklin), as Google Fonts serves it (v21, variable weight 100–900) | SIL OFL 1.1 + CC0 for GSA's changes, `LICENSES/public-sans.OFL-1.1.txt` | None; the latin and latin-ext subsets only. |47| `apps/web/src/assets/fonts/jetbrains-mono-latin{,-ext}.woff2` | [JetBrains Mono](https://github.com/JetBrains/JetBrainsMono), as Google Fonts serves it (v24, variable weight 100–800) | SIL OFL 1.1, `LICENSES/jetbrains-mono.OFL-1.1.txt` | None; the latin and latin-ext subsets only. |