mirror of
https://github.com/Canner/WrenAI.git
synced 2026-10-16 15:07:41 +08:00
test(genbi): give the cache-key case a timeout, and name the generator prerequisite
The cache-key case runs three sequential compiles, each spawning subprocesses, and does not fit vitest's 5s default: it timed out on one full-suite run and passed in isolation at 732ms. It is the single test carrying the guarantee that a changed generator misses the cache, so a timeout there reads as a cache regression rather than a scheduling artifact — the most misleading way for this change to fail. The docs owed two things the implementation now assumes. RUNNING.md never named the generator as a prerequisite, so following it to boot the BFF hit a loud failure with no prior instruction. And the generator's identity is memoized per path for the process lifetime, so a running BFF does not notice a rebuild at the same path — worth stating where the rebuild is documented, since unlike the pinned Warble package this binary is expected to be rebuilt during development.
This commit is contained in:
@@ -88,6 +88,13 @@ Both are committed so a profile compiles standalone for CI and dev, pinned to th
|
||||
`examples/v5-jaffle`. At run time the host regenerates the document against the user's real project
|
||||
and rewrites `project:` (see `composeUserProfile`); nothing at run time reads the committed copies.
|
||||
|
||||
The generator's content hash is memoized per resolved path for the lifetime of the process, so a
|
||||
**running** BFF does not notice a generator rebuilt at the same path: the cache key does not move
|
||||
and a bundle compiled from the previous projection keeps being served. Restart the BFF after
|
||||
rebuilding the generator. This inherits from `warbleIdentity`, but bites harder here — Warble
|
||||
arrives pinned from npm, whereas this generator is an in-repo Rust build that is expected to be
|
||||
rebuilt during development.
|
||||
|
||||
Regenerate them, from the repository root, in this order — the golden is compiled *from* the
|
||||
document, so a stale document silently produces a stale golden:
|
||||
|
||||
|
||||
@@ -22,6 +22,13 @@ Beyond the prerequisites in [README.md](./README.md#prerequisites):
|
||||
local and gateway runtimes are not accepted. Claude is by far the better
|
||||
exercised of the two — see [Codex status](#codex-status).
|
||||
- The Wren CLI on `PATH`:
|
||||
- **The `wren-context-loader` generator, built from this repo.** Binding a user's project
|
||||
compiles a prepared-context document first, and the generator is a Rust binary rather than an
|
||||
npm dependency, so `pnpm install` does not supply it. Build it once with
|
||||
`cargo build --release --manifest-path core/wren-context-loader/Cargo.toml`, or point
|
||||
`WREN_HARNESS_CONTEXT_LOADER_BIN` at an existing build. Without either, the first user-project
|
||||
bind fails loudly — by design, since a silent fallback would leave no way to tell which path
|
||||
produced an IR.
|
||||
|
||||
```bash
|
||||
uv tool install wrenai
|
||||
|
||||
@@ -164,5 +164,5 @@ describe("compile cache key vs a generator change (project held constant)", () =
|
||||
expect(keyA?.profileHash).toBe(keyB?.profileHash);
|
||||
expect(keyA?.warbleIdentity).toBe(keyB?.warbleIdentity);
|
||||
expect(keyA?.hubDir).toBe(keyB?.hubDir);
|
||||
});
|
||||
}, 30_000);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user