diff --git a/decisions/PRACTICES.md b/decisions/PRACTICES.md index e3ece71..6af5987 100644 --- a/decisions/PRACTICES.md +++ b/decisions/PRACTICES.md @@ -13,9 +13,9 @@ The repository has two test layers with a runner each. They cover different code ### Pi extension (bun) -- Tests run with `bun test` and live beside the code they cover, as `*.test.ts` in `extensions/dld-run/`. Pi loads only `index.ts` from an extension directory, so colocated tests are never loaded as extensions. +- Tests run with `bun test` and live beside the code they cover, as `*.test.ts` in `extensions/pi-dld-run/`. Pi loads only `index.ts` from an extension directory, so colocated tests are never loaded as extensions. - The extension is typechecked with `npx tsc --noEmit`, which requires `npm install` for the pi type definitions. Typecheck is part of the definition of done, not an optional extra — it is the only mechanism that catches a drift between our assumptions and the real pi API. -- Tests exercise the extension through the fake in `extensions/dld-run/testing/fake-pi.ts`, never a live harness. +- Tests exercise the extension through the fake in `extensions/pi-dld-run/testing/fake-pi.ts`, never a live harness. - The fake's surface is declared with `Pick` and assigned without type assertions, so the compiler rejects a fake that no longer matches pi. Do not reach for `as` to silence a mismatch — it converts a compile error into a runtime `TypeError`. Where a partial object genuinely cannot be typed (a context object standing in for a large interface), confine the assertion and comment why. - Prefer dependency injection over module-level side effects, so failure branches are reachable from tests. A check that can only read the real filesystem can only ever be tested in the happy case. diff --git a/extensions/dld-core/run-state.test.ts b/extensions/dld-core/run-state.test.ts index c10d4ec..55b7b33 100644 --- a/extensions/dld-core/run-state.test.ts +++ b/extensions/dld-core/run-state.test.ts @@ -9,7 +9,7 @@ import { readRunFrom, type RunState, } from "./run-state.ts"; -import { createFakePi } from "../dld-run/testing/fake-pi.ts"; +import { createFakePi } from "../pi-dld-run/testing/fake-pi.ts"; let workspace: string; diff --git a/extensions/dld-run/doctor.test.ts b/extensions/pi-dld-run/doctor.test.ts similarity index 100% rename from extensions/dld-run/doctor.test.ts rename to extensions/pi-dld-run/doctor.test.ts diff --git a/extensions/dld-run/doctor.ts b/extensions/pi-dld-run/doctor.ts similarity index 100% rename from extensions/dld-run/doctor.ts rename to extensions/pi-dld-run/doctor.ts diff --git a/extensions/dld-run/index.ts b/extensions/pi-dld-run/index.ts similarity index 100% rename from extensions/dld-run/index.ts rename to extensions/pi-dld-run/index.ts diff --git a/extensions/dld-run/loop.test.ts b/extensions/pi-dld-run/loop.test.ts similarity index 100% rename from extensions/dld-run/loop.test.ts rename to extensions/pi-dld-run/loop.test.ts diff --git a/extensions/dld-run/loop.ts b/extensions/pi-dld-run/loop.ts similarity index 100% rename from extensions/dld-run/loop.ts rename to extensions/pi-dld-run/loop.ts diff --git a/extensions/dld-run/package.test.ts b/extensions/pi-dld-run/package.test.ts similarity index 95% rename from extensions/dld-run/package.test.ts rename to extensions/pi-dld-run/package.test.ts index 7c57db7..7888a1a 100644 --- a/extensions/dld-run/package.test.ts +++ b/extensions/pi-dld-run/package.test.ts @@ -34,7 +34,7 @@ describe("pi package manifest", () => { test("the extension entry point is where pi looks for it", () => { // Pi loads only index.ts from an extension subdirectory, which is what // keeps colocated *.test.ts files from being loaded as extensions. - expect(existsSync(join(packageRoot(), "extensions", "dld-run", "index.ts"))).toBe(true); + expect(existsSync(join(packageRoot(), "extensions", "pi-dld-run", "index.ts"))).toBe(true); }); test("pi runtime packages are optional peers, never bundled", () => { diff --git a/extensions/dld-run/surfaces.test.ts b/extensions/pi-dld-run/surfaces.test.ts similarity index 100% rename from extensions/dld-run/surfaces.test.ts rename to extensions/pi-dld-run/surfaces.test.ts diff --git a/extensions/dld-run/testing/fake-pi.test.ts b/extensions/pi-dld-run/testing/fake-pi.test.ts similarity index 100% rename from extensions/dld-run/testing/fake-pi.test.ts rename to extensions/pi-dld-run/testing/fake-pi.test.ts diff --git a/extensions/dld-run/testing/fake-pi.ts b/extensions/pi-dld-run/testing/fake-pi.ts similarity index 100% rename from extensions/dld-run/testing/fake-pi.ts rename to extensions/pi-dld-run/testing/fake-pi.ts