mirror of
https://github.com/bitbaum/solon.git
synced 2026-12-04 05:57:03 +01:00
* Rate limit: limitkit decides, the windows live in Postgres The assistants' limiter was a per-process Map: every deploy gave everyone a fresh allowance and each instance counted on its own. The decision is now @bitbaum/limitkit's sliding window, and the windows are held in rate_limit_windows (migration 0035, additive), one transaction per decision, serialized per key. - Seven routes take their bucket from one table of numbers (unchanged). - Retry-After and the RateLimit headers come from the window, not a constant. - The address is the hop the proxy wrote (limitkit clientIp), not the first X-Forwarded-For entry, which the caller chooses. - Stored keys are keyed digests; no address or account id is held. - Without a database, or while it is unreachable, the same rule runs from memory and the store is retried after 30 seconds. Replaces #563, whose migration number collided with 0034_member_person_tag. Claude-Session: https://claude.ai/code/session_019MDtmup8GiNe1XJoj1caTC * Rate limit: refusals never reach the database; the limiter has its own pool Review of this change found that every check, refused or not, ran a transaction on the app's only pool and waited on the advisory lock while holding a connection: a flood from one address made unrelated queries wait seconds. And a database that hangs never fell back to memory. - A refusal is remembered per process until its window opens (other instances can only add hits, so it cannot open earlier), and writes nothing when it is decided by the database. - Decisions for one key run one at a time per process, so a burst from one caller takes one connection, not all of them. - The limiter has its own pool (3 connections, 1 s to get one), lock and statement timeouts, and a 1.5 s deadline per decision; past it, memory decides. The 30 s back-off is measured from the failure. - Memory shadows this process's allowed requests, so a fallback continues the count instead of starting a fresh one. - No session secret, no shared store: the keys would be plain digests of addresses. The digest input is domain-separated. - The sweep compares on the database's clock, the one that wrote touched_at. - The warning log carries an error code, never the query or its parameters. Measured on Postgres 16: 3000 concurrent requests from one refused caller allow none, and an unrelated query on another pool answers in 4 ms (it waited 2.5-6.8 s before). Claude-Session: https://claude.ai/code/session_019MDtmup8GiNe1XJoj1caTC --------- Co-authored-by: Claude <noreply@anthropic.com>
101 lines
3.2 KiB
JSON
101 lines
3.2 KiB
JSON
{
|
|
"blocks": {
|
|
"shell": {
|
|
"package": "@bitbaum/sitekit",
|
|
"status": "pending",
|
|
"bindings": [],
|
|
"gap": {
|
|
"owner": "fleet-remediation",
|
|
"reason": "Existing product header/footer still render locally. Migrate through shared slots in a separate UI wave; do not couple account recovery with a shell replacement.",
|
|
"replacementCondition": "Shared renderer/theme adopted and browser/domain fixtures pass in its own UI wave."
|
|
}
|
|
},
|
|
"identity": {
|
|
"package": "@bitbaum/accountkit",
|
|
"bindings": [
|
|
{
|
|
"file": "src/lib/auth/index.ts",
|
|
"symbols": ["createAuthRuntime", "createAuthMailer"]
|
|
},
|
|
{
|
|
"file": "src/components/auth/account-screens.tsx",
|
|
"symbols": ["SignInForm", "SignUpForm", "AccountPanel"]
|
|
}
|
|
]
|
|
},
|
|
"publishing": {
|
|
"package": "bip-kit",
|
|
"bindings": [
|
|
{
|
|
"file": "src/components/site/development-records.tsx",
|
|
"symbols": ["DevelopmentPage"]
|
|
},
|
|
{
|
|
"file": "src/app/[locale]/blog/[slug]/page.tsx",
|
|
"symbols": ["ArticleBody"]
|
|
}
|
|
]
|
|
},
|
|
"design": {
|
|
"package": "@bitbaum/design-tokens",
|
|
"status": "pending",
|
|
"bindings": [],
|
|
"gap": {
|
|
"owner": "fleet-remediation",
|
|
"reason": "Existing product CSS/Tailwind owns semantic tokens; shared token package is not installed or imported. Preserve the current appearance while mapping roles in the separate UI migration.",
|
|
"replacementCondition": "Shared renderer/theme adopted and browser/domain fixtures pass in its own UI wave."
|
|
}
|
|
},
|
|
"ai": {
|
|
"package": "@bitbaum/ai-kit",
|
|
"bindings": [
|
|
{
|
|
"file": "src/app/api/chat/route.ts",
|
|
"symbols": ["completeStream"]
|
|
},
|
|
{
|
|
"file": "src/app/api/law/ask/route.ts",
|
|
"symbols": ["complete", "completeStream"]
|
|
}
|
|
]
|
|
},
|
|
"chat": {
|
|
"package": "@bitbaum/chatkit",
|
|
"bindings": [
|
|
{
|
|
"file": "src/components/chat/governance-chat.tsx",
|
|
"symbols": ["ChatScreen", "Composer", "ChatThread"]
|
|
},
|
|
{
|
|
"file": "src/components/law/law-chat.tsx",
|
|
"symbols": ["ChatScreen", "Composer", "ChatThread"]
|
|
}
|
|
]
|
|
},
|
|
"limits": {
|
|
"package": "@bitbaum/limitkit",
|
|
"bindings": [
|
|
{
|
|
"file": "src/lib/chat/rate-limit.ts",
|
|
"symbols": ["slidingWindow", "MemoryStore", "clientIp", "toHeaders"]
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"migration": {
|
|
"scope": "This wave completes the account mail/recovery binding. Pending blocks are known missing adoption, not exceptions or successful composition. The strict composition audit must continue to report them until migrated.",
|
|
"mail": {
|
|
"package": "@bitbaum/mail-kit",
|
|
"via": "@bitbaum/accountkit/auth/mail",
|
|
"binding": "src/lib/auth/index.ts",
|
|
"verification": "Real adapter is intercepted only for synthetic local browser tests; production delivery remains unverified."
|
|
}
|
|
},
|
|
"experience": {
|
|
"ceiling": {}
|
|
},
|
|
"productOwned": {
|
|
"domain": "Governance, legal sources, evidence and law-specific prompts remain Solon domain behavior."
|
|
}
|
|
}
|