Persist CommandLayer namespace claim requests in Neon/Postgres#282
Merged
Conversation
|
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.
Motivation
/api/claim/commandlayer-namespacefrom validation-only to real persistent claim request creation and lifecycle recording in a Postgres-compatible DB (Neon) so activation requests are stored and auditable.Description
lib/db.js, a small Neon-compatible DB helper that readsprocess.env.DATABASE_URL, throws a clear error when missing, lazily requires@neondatabase/serverless, and exports aqueryhelper for serverless use.api/claim/commandlayer-namespace.jsto retain all existing validation and, whenDATABASE_URLis configured, create a transactional persistence flow that inserts intoclaim_requests,claim_agents, andclaim_events, and returnsCLAIM_REQUEST_CREATEDwith a lifecycle payload; the handler returns503 STORAGE_UNAVAILABLEifDATABASE_URLis missing.db/migrations/001_claim_requests.sqlwhich createsclaim_requests,claim_agents, andclaim_eventstables plus indexes and enablespgcryptoas requested.public/claim.htmlto reflect the creation UX (show claim id, wallet, agent count) and to show a clear message when storage is unavailable, and add/adjust tests intests/api-claim-commandlayer-namespace.test.jscovering missingDATABASE_URL, pre-DB validation failures, successful mocked persistence, and attemptedclaim.createdevent insertion; also declare@neondatabase/serverlessinpackage.json.Testing
npm testwhich executed the repository tests and all tests passed (42tests passed).cd examples/webhook-auto-verify && npm install && npm run checkwhich completed successfully.npm run buildwhich failed because the repository does not define abuildscript (reported as a missing script).Codex Task