Repository navigation
fix(aadi): log why the analysis limits are unavailable - #23
Merged
Merged
Conversation
Every LIMITS_UNAVAILABLE refusal was logged as a bare {"stage":"admit"}
(or not at all when the store or principal was missing), so an operator
could not tell a missing migration from a wrong password or a network
fault. The refusal now logs a safe diagnostic code: NO_STORE,
NO_PRINCIPAL, the Postgres SQLSTATE, or the Node network code. The error
message is never logged, since it can name the host or role.
The guard still fails closed: no analysis runs without a count.
docs/data.md maps each code to its fix and gives a read-only SQL check
for the tables the limits need.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ta9C9ipVdnjJbVts5P9wk
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Requested by Gaffercode · project thread
What changed
src/lib/aadi/limits.ts: everyLIMITS_UNAVAILABLErefusal now logs a safe diagnosticcode:NO_STORE,NO_PRINCIPAL, the Postgres SQLSTATE (e.g.42P01missing table,42501missing grant,28P01bad password) or the Node network code (ENOTFOUND,ECONNREFUSED,ETIMEDOUT). Same for theusageandsettlefailure logs. The error message is never logged, since it can name the host or role.docs/data.md: new section mapping each code to its fix, plus a read-only SQL check for the tables the limits need.tests/aadi-limits.test.ts: covers the new codes and that no message text leaks.Why
Beta users get "Pencatat batas pemakaian belum tersedia" on every analysis. The readiness probe reports
ready: true(it only checks thatSENTRAPEDIA_DATABASE_URLand the quota are set), so the store must be failing at query time. Before this change the log line was a bare{"stage":"admit"}and the cause was invisible. The most likely cause (unverified, no access to server logs or the production database) is that migration0003_analysis_limits.sql(and possibly 0004/0005) was never applied to the production Neon branch.The guard still fails closed: no analysis runs without a count. No behaviour change for users.
Verification
npx vitest run: 86 files, 826 passed, 23 skipped.npx tsc --noEmit: exit 0.npx eslinton the changed files: exit 0.npm run test:system: 70 passed, 0 failed.apps/sitetests and lint (untouched),test:aadi(Python engine, untouched), Postgres-backed tests (need a test database).Generated by Claude Code