Repository navigation
Description
Follow-up to #841. #841 cut owned package source from 45,056 to 24,521 lines by adopting Better Auth, the MCP SDK and Ajv. Since then owned source grew to about 29.8k lines through the declarative store features and the hardening in #902 and #927–#1034. This audit asks, for every owned component, whether an existing package should own it instead. Four read-only audits ran against origin/main on 2026-09-30. Line counts are physical wc -l, and package facts come from npm view on that date. Host-lease code is excluded because it is being removed ("one server per database", in progress).
Verdict
The remaining owned code is mostly URLCode's contract: the declarative vocabulary, bounded parsers with exact refusals, request-smuggling and encoding guards, and sandbox isolation. Swapping in libraries would save about 2% (roughly 200 of 9,000 runtime lines, 150 of 7,560 tooling lines, and almost nothing in the store). Several obvious candidates would silently weaken guarantees:
- Hono and the WHATWG
Requestnormalize../%2e/\and merge repeated headers, which defeats RIM-INPUT-001 and the header-count refusals. - Kysely is async-only, which weakens the synchronous
BEGIN IMMEDIATEtransactions. - helmet, pino, http-cache-semantics and rate-limiter-flexible conflict with documented behaviour, or would not run in the Worker target.
Real reductions come from redesigns, tool swaps and scope cuts.
Ranked options
| # | Change | Est. lines | Kind | What is lost |
|---|---|---|---|---|
| 1 | One serving process per database (in progress) | large | cut | several servers sharing one database |
| 2 | Write audit rows in the store's own transaction; remove the audit outbox, drain, peek/ack and backoff; merge the two SQLite backup modules | 500–700 | redesign | separate audit file and retention, and the generic audit producer API for third-party extensions |
| 3 | release-please (SHA-pinned) in place of release-bump.ts and the prepare step; dorny/paths-filter v4 (SHA-pinned) in place of most of ci-plan.ts, keeping fail-closed if: guards |
~700 incl. tests | package | custom lane logic; adds third-party action supply-chain risk |
| 4 | remark-validate-links for local links and fragments; about 80 lines stay for the pinned blob/v<version> rules |
~200 | package (dev) | none |
| 5 | Cut urlcode import/export (provider formats) |
~235 + tests | cut | migrating from Netlify, Cloudflare or Vercel config |
| 6 | Cut urlcode-store ownerless-* |
~60 + ~100 tests | cut | switching a populated shared collection to owned |
| 7 | Cut urlcode benchmark |
~50 + flags | cut | the p95 CI gate |
| 8 | Cut verify --online and the tarball reader |
~35 | cut | re-hashing the published tarball (lockfile hashes remain) |
| 9 | tough-cookie for the fixture cookie jar, after confirming it is Worker-safe | ~75 | package | none if parity holds |
| 10 | ipaddr.js for CIDR matching in client-address.ts, with parity tests; keep egress.ts isPublicAddress owned |
~50 | package | none if parity holds |
| 11 | Internal dedup: readBody in server.ts and vercel.ts; the reserved-header set in security.ts and http-policy.ts |
~40 | dedup | none |
| 12 | McpServer high-level API in packages/mcp | 60–120 | package | risk of leaking error messages and changed error semantics; not recommended |
Rejected, with reasons in the audit reports:
- store: Kysely, Drizzle, umzug, PocketBase, idempotency and etag libraries;
- CLI: commander, citty and yargs; Hurl (binary postinstall) and newman;
- runtime: Hono and @hono/node-server as the core; find-my-way/rou3, helmet, pino, prom-client, http-cache-semantics, negotiator, piscina (sandbox isolation must stay exact), the Better Auth admin and organization plugins, @better-auth/cli, size-limit and changesets.
Record in docs/FRAMEWORK.md "Ownership" that these were evaluated, so the question is not reopened each time.
Activity
jimhoyd commentedon Sep 30, 2026
Additional compatibility gaps from a source/doc review of main df0cfd5; keep these in this existing audit rather than opening a new umbrella:
These are remaining limits/design decisions, not a claim of new runtime security regressions. Direct npm compatibility, Hono hosting and alternate-principal integration already work. The just-merged #1042/#1043 address body-format compatibility and bounded dependency-review evidence; they do not claim complete installed-code attestation or a generic database backend.
revert(core): drop the ipaddr.js swap by owner decision (#1041)
jimhoyd commentedon Sep 30, 2026
Maintainer follow-up asks whether the contract is solid and how PostgreSQL projects will work. Current main df0cfd5 supports normal PostgreSQL libraries in trusted Node application code, but the bundled auth/store/audit persistence is SQLite-specific; there is no connection-string switch for declarative store parity.
Recommended next portability proof, before freezing storage contracts: run the same owner-private records + reviewer transition + retry/idempotency scenario against real PostgreSQL, including concurrent connections, rollback and audit evidence. Keep identity/HTTP/schema contracts intact and database credentials/pools in operator configuration. Use existing upstream PostgreSQL support for Better Auth (it accepts pg.Pool); separate a bring-your-own auth-instance integration from the local SQLite initializer/CLI. Specify ownership of pool startup/shutdown, migrations and isolated test databases. Tests must never fall back to live application databases when isolation is unavailable.
Distinguish native application-owned PostgreSQL/ORM use (already an ordinary trusted-code path) from promising URLCode store declarations on PostgreSQL (not implemented). Retain application vocabulary only where a backend can enforce its semantics; declare/refuse unsupported behavior rather than emulate SQLite internals or force every database through a raw CRUD facade. Do not promise cross-provider atomicity just because auth and app data share a PostgreSQL server.
Also qualify the audit's rejection of Kysely: an asynchronous API does not by itself weaken transaction atomicity. The actual obstacle is integrating an asynchronous driver with today's synchronous store API and re-establishing the required isolation/locking/retry contract. PostgreSQL's default READ COMMITTED is not automatically equivalent to the current SQLite BEGIN IMMEDIATE behavior. A query builder alone does not solve that difference; evaluate with behavioral tests, not synchronous-versus-asynchronous syntax alone.
Sources: https://better-auth.com/docs/adapters/postgresql and https://www.postgresql.org/docs/current/transaction-iso.html . This is proposed follow-up scope, not a PostgreSQL support claim or authorization for a broad implementation in this comment.
refactor(core): share the node:http body reader and reserved header s…
refactor(cli): remove import/export, benchmark and verify --online (#…
jimhoyd commentedon Sep 30, 2026
The maintainer clarified that storage belongs to the project owner; PostgreSQL was an example, not the next required backend. Dedicated scope is now #1052: native storage tools, optional integrations for declared behavior, and explicit supported guarantees. This supersedes the earlier PostgreSQL-first recommendation in this discussion. #837 remains on hold.
jimhoyd commentedon Sep 30, 2026
Maintainer clarification: owner choice applies to ALL extensions and integrations, not only storage. #1052 has been broadened into the consistent architecture requirement: optional bundled defaults, native upstream APIs, focused integrations only where URLCode semantics require them, independent packages, and explicit behavioral guarantees. SQLite/PostgreSQL/auth/framework examples are not a mandated shortlist. This does not resume #837 or require rebuilding retired extensions.
feat(store): the audit log is the store's own, with a tap in core; na…
refactor(sqlite): one shared operator write-lock poll for store and a…
build: built-in changed-files step replaces ci-plan.ts; actions allow…
docs(framework): record the #1041 reuse-audit result and the packages…
jimhoyd commentedon Oct 1, 2026
Follow-up bespoke-functionality audit on 2026-10-01, pinned to main 96543b7. This is fresh source/reproduction evidence, not a request to repeat the rejected library swaps in this issue.
Physical source lines (comments/blanks included): core 23,955; auth 641; store 4,120; MCP 607; total 29,323. Separately, scripts contains 6,769 .ts/.js/.mjs lines. These are ownership/maintenance counts, not executable complexity, dead-code estimates or a deletion target.
Current main already has the audit-package removal, shared incoming-body reader and operator lock helper, generated middleware copies, shared skill sections and shared fixture execution core. Do not reopen those completed cuts.
New actionable findings:
Remaining ownership decisions for the existing #1098 application-workflow evaluation:
No source or test deletion was made. Distinct packed-consumer, platform, sandbox and provider proofs are not redundant merely because they repeat application shapes. The identified reductions are narrow consolidation/correctness work and evidence-led scope choices, not a supported claim that thousands of lines can safely be deleted today.