You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Pi adapter ships a TypeScript runtime under .pi/skills/planning-with-files/extensions/planning-with-files/ (index.ts, runtime.ts, attestation.ts, plan.ts, constants.ts) but has no integration tests for the extension itself. Current Python tests under tests/test_pi_extension_*.py only verify that the package declares its capabilities; they do not exercise the runtime behavior. This was flagged as a v2.39.0 follow-up.
Goal
Add a small test suite that exercises the Pi extension's event handlers against a mocked @earendil-works/pi-coding-agent context. One test per declared event handler is enough to start.
Acceptance criteria
Tests live under .pi/skills/planning-with-files/extensions/planning-with-files/*.test.ts (or a sibling __tests__/ dir, your call).
One test per documented event handler: session_start, before_agent_start, tool_call, tool_result, agent_end, session_before_compact, session_shutdown, input. 8 tests minimum.
Tests use a mocked ctx (don't require a real Pi runtime). Pattern: stub ctx.fs.readFile, ctx.ui.notify, ctx.model.provider, ctx.model.id per test.
At least one test covers each mode: auto, parity, cache-safe, notify.
At least one test asserts that the SHA-256 attestation gate blocks injection on a mismatched hash.
Add a package.json test script (or use the bundled framework if one is already there). Document the run command in the PR description.
Hints
Read .pi/skills/planning-with-files/extensions/planning-with-files/runtime.ts to learn the event handler surface.
Read .pi/skills/planning-with-files/extensions/planning-with-files/attestation.ts for the attestation gate to test.
Either Bun or Vitest both work; pick what's simplest to wire up.
Don't test the real Pi runtime end-to-end (that requires @earendil-works/pi-coding-agent). Mock the context surface only.
Look at tests/test_pi_extension_capabilities.py for the contract — your TypeScript tests can mirror that shape.
What this gets you
A merged PR closes this issue, earns you a permanent entry in CONTRIBUTORS.md, and meaningfully hardens the Pi adapter going forward. Real attribution on a project used by thousands of developers.
Questions
Comment on this issue or tag @OthmanAdi (or @TomXPRIME who owns the Pi adapter).
The Pi adapter ships a TypeScript runtime under
.pi/skills/planning-with-files/extensions/planning-with-files/(index.ts,runtime.ts,attestation.ts,plan.ts,constants.ts) but has no integration tests for the extension itself. Current Python tests undertests/test_pi_extension_*.pyonly verify that the package declares its capabilities; they do not exercise the runtime behavior. This was flagged as a v2.39.0 follow-up.Goal
Add a small test suite that exercises the Pi extension's event handlers against a mocked
@earendil-works/pi-coding-agentcontext. One test per declared event handler is enough to start.Acceptance criteria
.pi/skills/planning-with-files/extensions/planning-with-files/*.test.ts(or a sibling__tests__/dir, your call).session_start,before_agent_start,tool_call,tool_result,agent_end,session_before_compact,session_shutdown,input. 8 tests minimum.ctx(don't require a real Pi runtime). Pattern: stubctx.fs.readFile,ctx.ui.notify,ctx.model.provider,ctx.model.idper test.auto,parity,cache-safe,notify.package.jsontest script (or use the bundled framework if one is already there). Document the run command in the PR description.Hints
.pi/skills/planning-with-files/extensions/planning-with-files/runtime.tsto learn the event handler surface..pi/skills/planning-with-files/extensions/planning-with-files/attestation.tsfor the attestation gate to test.@earendil-works/pi-coding-agent). Mock the context surface only.tests/test_pi_extension_capabilities.pyfor the contract — your TypeScript tests can mirror that shape.What this gets you
A merged PR closes this issue, earns you a permanent entry in
CONTRIBUTORS.md, and meaningfully hardens the Pi adapter going forward. Real attribution on a project used by thousands of developers.Questions
Comment on this issue or tag @OthmanAdi (or @TomXPRIME who owns the Pi adapter).