docs: add session log for the five-round audit
Record the fresh-context audit of the Nous Portal provider as the first entry in docs/devlog/ (rounds 1-5, the fixes in 00d50e1..04fa08f, decisions, gotchas, open items) with its INDEX.md, and add the Session Logs pointer window to the root AGENTS.md. DOX pass: docs/AGENTS.md now owns docs/devlog/ (one log per unit of work, INDEX.md is the source of truth, logs are append-only) and its verification line covers the filename convention; tests/AGENTS.md documents the drive() harness changes from rounds 4 and 5 (a deferred refresh to simulate overlapping handlers, a Nous model for setModel assertions, provider-level fetchModels via the registered provider).
This commit is contained in:
1 parent
04fa08f0b7
commit
a1735049b7
5 files changed
+138
-4
No files matched your search
+1
-1
@@ -15,7 +15,7 @@ Offline unit tests for `index.ts`. They pin the pure logic that has real branchi
|
||||
- `index.test.mjs` loads `index.ts` through jiti, the same TS loader pi uses, because the host packages are not installed in `node_modules`.
|
||||
- Host imports are aliased to `stubs/pi-ai.mjs`. Alias keys are matched longest-prefix first: `@earendil-works/pi-ai/compat` must be listed before `@earendil-works/pi-ai`, or the bare key swallows the subpath and resolution fails.
|
||||
- `stubs/pi-ai.mjs` exports only what `index.ts` imports: `envApiKeyAuth`, `createProvider`, `openAICompletionsApi`, `getAgentDir` (plus `agentDir` so tests can find the flag file). `getAgentDir` is called inside the default export, so it is reached only by tests that drive the commands; it returns a private `mkdtemp` dir per run, shared through `globalThis` because jiti loads the stub as a separate instance from a native import. It is a type-less stub; correctness of those functions is pi's concern and is verified live, not here.
|
||||
- Exported functions under test: `toModel`, `toCredential`, `tokenRequest`, `fetchModels`, `tierOf`, `withoutTierHeader`, and the default export via the `drive()` harness. Anything else is not unit-tested (notably the device-code poll loop inside `login`, which would need timer control and extraction).
|
||||
- Exported functions under test: `toModel`, `toCredential`, `tokenRequest`, `fetchModels`, `tierOf`, `withoutTierHeader`, and the default export via the `drive()` harness. `drive(flag)` returns `run(name, model, available, refresh)` — pass a deferred promise as `refresh` to simulate overlapping command invocations, and a Nous `model` when the `setModel` half of a contract is under test — plus the registered `provider`, which is how the provider-level `fetchModels` last-good retention is reached. Anything else is not unit-tested (notably the device-code poll loop inside `login`, which would need timer control and extraction).
|
||||
- Network calls are replaced with `t.mock.method(globalThis, "fetch", …)` from `node:test`, which restores itself when the test ends. Do not hand-roll a `globalThis.fetch` swap.
|
||||
- `fetchModels` reads a key only from the `credential` argument. Env resolution of `$NOUS_API_KEY` is `envApiKeyAuth`'s job upstream. The one test that touches `process.env` sets it deliberately, to pin that `fetchModels` ignores it; it restores the previous value in `t.after`.
|
||||
|
||||
|
||||
Reference in new issue
Block a user