Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions decisions/PRACTICES.md
Original file line number Diff line number Diff line change
Expand Up @@ -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<ExtensionAPI, ...>` 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.

Expand Down
2 changes: 1 addition & 1 deletion extensions/dld-core/run-state.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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", () => {
Expand Down
Loading