Conversation
…st stele-core **Dependabot.** #42 cleared the three stele-core advisories, including the Hono CORS ReDoS, which mattered here because that middleware is what guards /api/*. The last one was @babel/core, transitive via eslint-plugin-react-hooks — lint and build time only, never in bundle.html, hence LOW. Pinned with a pnpm override to ^7.29.7 rather than left open; the lockfile now resolves 7.29.7. **Version.** This was not an ambiguity, it was rot. v1.1.0 was tagged and released on 2026-06-06, package.json was bumped for it, and src/lib/version.ts was not — zero commits touched it between the two tags. Since STELE_VERSION is stamped into every narrative export as `steleVersion`, exports from the shipped 1.1.0 build claimed to be 1.0.0. package.json is authoritative because it is what the tag and release.yml publish against, so the constant is now injected from it by vite's `define` and cannot drift again. A test asserts the wiring holds, since a removed define would silently make it undefined rather than fail. **stele-core tests.** It had none — the reason it reached main with live type errors, and the reason the injectivity fix was only ever covered on the browser side. 39 cases over the chain encoding, the /api/* perimeter, the schema invariants, and the write-conflict classifier. No database needed: the chain is pure and the perimeter goes through Hono's request handler, so the suite runs in CI without a service container. node:test rather than vitest, deliberately. tsx is already a devDependency, so this adds zero packages to a security-sensitive service whose own review flagged install-time supply-chain risk. Mutation-tested rather than assumed: dropping the P2034 check fails 2, letting an empty API_SECRET fall open fails 1, reverting the chain to a delimiter join fails 1. The suite discriminates.
|
|
||
| import { describe, it } from "node:test"; | ||
| import assert from "node:assert/strict"; | ||
| import { isSerializationFailure } from "../src/routes/sessions.js"; |
There was a problem hiding this comment.
This import loads the sessions route, which initializes Prisma's generated client. That client is gitignored and neither installation nor the test script generates it, so a clean npm ci && npm test fails before the serialization tests run. This blocks clean-checkout verification until Prisma is generated separately; move the classifier into a dependency-free module or make generation part of the test setup.
Artifacts
Clean-install reproduction script
- The executed script copies only tracked and unignored package files into a temporary directory, removes generated output, and runs the clean-install test path; it captures the missing-client condition.
- The captured command output shows npm ci exit 0 followed by npm test exit 1 with ERR_MODULE_NOT_FOUND from lib/prisma.ts for generated/prisma/client.js; the claimed failure is reproducible.
Generated-client verification script
- The executed script repeats the isolated clean install, supplies a validation-only datasource URL for Prisma generation, and runs the identical test command; generation restores the module required by the new test import.
Generated-client passing output
- The captured output shows Prisma Client 7.9.1 generation, generated client presence, and npm test exit 0 with 39 passing tests; Prisma generation resolves the load failure.
Ran code and verified through T-Rex
Prompt To Fix With AI
This is a comment left during a code review.
Path: stele-core/test/serialization.test.ts
Line: 10
Comment:
**Clean test setup fails**
This import loads the sessions route, which initializes Prisma's generated client. That client is gitignored and neither installation nor the test script generates it, so a clean `npm ci && npm test` fails before the serialization tests run. This blocks clean-checkout verification until Prisma is generated separately; move the classifier into a dependency-free module or make generation part of the test setup.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.| function makeApp() { | ||
| const app = new Hono(); | ||
| app.use("/api/*", cors({ | ||
| origin: ["http://localhost:5173"], | ||
| allowMethods: ["GET", "POST", "PATCH", "OPTIONS"], | ||
| allowHeaders: ["Content-Type", "Authorization"], | ||
| })); | ||
| app.use("/api/*", requireBearer); | ||
| app.get("/api/thing", (c) => c.json({ ok: true })); | ||
| app.get("/health", (c) => c.json({ status: "ok" })); | ||
| return app; | ||
| } |
There was a problem hiding this comment.
makeApp() recreates a separate, reduced Hono stack instead of exercising the production createApp() wiring. When production CORS was placed after bearer authentication, these tests still passed while a real browser preflight returned a server error with no CORS headers, preventing authenticated browser clients from reaching the API. Test the production app directly, or share the complete perimeter setup.
Artifacts
Production wiring verification script
- The captured script temporarily moves production CORS after authentication, runs the isolated test and production endpoint probes, and restores the source file; it demonstrates the exact validation method.
Baseline production preflight output
- The baseline run shows 11 passing auth tests and a production OPTIONS request returning HTTP 204 No Content with the required CORS headers; production wiring works before mutation.
Production wiring divergence output
- The mutation run shows the duplicate auth tests still pass 11/11 while the production OPTIONS request returns HTTP 500 with no CORS headers; the test misses a browser-blocking production regression.
Ran code and verified through T-Rex
Prompt To Fix With AI
This is a comment left during a code review.
Path: stele-core/test/auth.test.ts
Line: 14-25
Comment:
**Production perimeter untested**
`makeApp()` recreates a separate, reduced Hono stack instead of exercising the production `createApp()` wiring. When production CORS was placed after bearer authentication, these tests still passed while a real browser preflight returned a server error with no CORS headers, preventing authenticated browser clients from reaching the API. Test the production app directly, or share the complete perimeter setup.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
Comments Outside DiffThese findings sit on lines the diff does not cover, so they could not be posted inline. Each one leaves this list once its file changes.
|
…st stele-core
Dependabot. #42 cleared the three stele-core advisories, including the Hono CORS ReDoS, which mattered here because that middleware is what guards /api/*. The last one was @babel/core, transitive via eslint-plugin-react-hooks — lint and build time only, never in bundle.html, hence LOW. Pinned with a pnpm override to ^7.29.7 rather than left open; the lockfile now resolves 7.29.7.
Version. This was not an ambiguity, it was rot. v1.1.0 was tagged and released on 2026-06-06, package.json was bumped for it, and src/lib/version.ts was not — zero commits touched it between the two tags. Since STELE_VERSION is stamped into every narrative export as
steleVersion, exports from the shipped 1.1.0 build claimed to be 1.0.0. package.json is authoritative because it is what the tag and release.yml publish against, so the constant is now injected from it by vite'sdefineand cannot drift again. A test asserts the wiring holds, since a removed define would silently make it undefined rather than fail.stele-core tests. It had none — the reason it reached main with live type errors, and the reason the injectivity fix was only ever covered on the browser side. 39 cases over the chain encoding, the /api/* perimeter, the schema invariants, and the write-conflict classifier. No database needed: the chain is pure and the perimeter goes through Hono's request handler, so the suite runs in CI without a service container.
node:test rather than vitest, deliberately. tsx is already a devDependency, so this adds zero packages to a security-sensitive service whose own review flagged install-time supply-chain risk.
Mutation-tested rather than assumed: dropping the P2034 check fails 2, letting an empty API_SECRET fall open fails 1, reverting the chain to a delimiter join fails 1. The suite discriminates.
What
Integrity
Test
npx tsc --noEmitpassesNot safe to merge until the clean-checkout test failure and production perimeter coverage gap are addressed.
Fix with agent prompt
Summary
This change adds stele-core coverage for serialization failures and bearer/CORS behavior, but it is not safe to merge yet. The new core test command fails from a clean checkout without generated Prisma output, and the CORS/authentication test can pass even when the production browser-access perimeter is broken.
Reviews (1) · Last reviewed commit: "fix: resolve remaining advisory, derive ..."