Maintenance pass: log retention, dependency refresh, typecheck + CI#18
Merged
Merged
Conversation
log_entries had no retention policy, only a manual per-profile clear route, so a long-running agent logs every LLM call/tool call/response forever (reported: 18GB db). Cap each profile to its most recent 20,000 entries, trimmed opportunistically every ~200 inserts. Closes #5
Was pinned to "latest" but locked at 0.55.1 (18 minor versions behind) β model picker was missing every Claude model newer than opus-4-6/sonnet-4-6. Pin to a real caret range instead of "latest" so upgrades are deliberate. Also adds @opentelemetry/api as an explicit dependency: pi-ai 0.73.1 pulls in the Mistral SDK, which has an optional peer import on it that bun's --compile bundler resolves statically regardless of the "optional" peerDependenciesMeta flag, breaking the production build without it.
The project had no @types/bun devDependency and no CI beyond the tag-triggered release build, so `tsc --noEmit` failed out of the box on a fresh clone (bun:sqlite/bun:test/ImportMeta.dir unresolved) and nothing caught type or build regressions on PRs. This bumping pi-ai just now silently broke `bun build --compile` (missing optional @opentelemetry/api peer dep) with no CI to catch it. - Add @types/bun so tsc resolves Bun's runtime APIs - Fix real type-safety gaps this uncovered: several `resp.json()` results flowing as unknown into typed code (http.ts, http_v2.ts, mcp.ts, schema.ts, routes/models.ts), a bogus type cast in agent-manager.ts's slimGameState, an untyped SQLite bindings spread in db.ts, and a nonexistent `comment` field on hono's SSEMessage (routes/logs.ts) that TS silently let through as an unused, no-op property - Add `typecheck`/`test` package.json scripts - Add .github/workflows/ci.yml: typecheck + test + build on every PR
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Admiral hadn't had a real maintenance pass in a while (last release published Feb 27; last two commits on main were April 22 and June 27). This does the quick, high-value cleanup identified from a fresh audit against the current gameserver API and admiral's own open issues:
log_entrieshad no retention policy, only a manual per-profile "clear log" route. A long-running agent logs every LLM call/tool call/response forever (reported: 18GB db in admiral.db grows very quickly to multiple GBsΒ #5). Caps each profile to its most recent 20,000 entries, trimmed opportunistically every ~200 inserts. Verified manually: 21,000 inserts β exactly the newest 20,000 rows remain.@mariozechner/pi-aito 0.73.1 β was pinned to"latest"but the lockfile had it stuck at 0.55.1 (18 minor versions behind), so the model picker was missing every Claude model newer than opus-4-6/sonnet-4-6. Pinned to a real caret range instead of"latest"so future bumps are deliberate. This pulled in the Mistral SDK, which has an optional@opentelemetry/apipeer import thatbun build --compileresolves statically regardless of the "optional" flag β added it as an explicit dependency so the production build doesn't break.@types/bun, fixtscerrors, add PR CI βtsc --noEmitfailed out of the box on a fresh clone (no@types/bun, sobun:sqlite/bun:test/ImportMeta.dirdidn't resolve), and there was no CI beyond the tag-triggered release build β nothing would have caught the@opentelemetry/apibuild break above before it hit a tagged release. Added@types/bun, fixed the several realunknown-typedresp.json()results it uncovered plus a couple of other latent typing bugs, addedtypecheck/testpackage.json scripts, and added.github/workflows/ci.ymlrunning typecheck + test + build on every PR.Also as part of this pass (already landed on
maindirectly, included here for context):view_storagev2 routing collision) as no-longer-reproducible β gameserver has since consolidated storage into a singlespacemolt_storagetool with atargetparam, so the old path collision this described no longer exists.Technical Approach
See commit messages for detail on each change; each commit is independently reviewable.
Test Plan
bun testβ 15/15 passingbun run typecheckβ clean (root + frontend)bun run buildβ production binary builds and the frontend bundles successfullyGenerated by Claude Code