docs: sync SKILL.md + llms-cli.txt to db(req) / adminDb() dual surface#104
Merged
Conversation
Mirrors the functions-sdk-caller-context change shipped in run402-private (layer run402-functions-runtime:10, v1.1.0 of the SDK). SKILL.md and cli/llms-cli.txt now describe db(req) as the default caller-context client (RLS applies) and adminDb() as the explicit BYPASSRLS opt-in routed through /admin/v1/rest/*. The legacy db.from() / db.sql() shape is flagged as a deprecation shim. openspec/specs/functions-db-docs/spec.md updated to require the dual-surface documentation shape. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Mirrors run402-private#51 (functions-sdk-caller-context). Layer
run402-functions-runtime:10+ SDK v1.1.0 are live in production; these public docs need to describe the shipped contract.Changes
SKILL.md (DB access inside functions)
db(req).from(table)(caller-context, RLS applies, routes/rest/v1/*) andadminDb().from(table)(BYPASSRLS, routes/admin/v1/rest/*).db.sqlrenamed toadminDb().sql(always BYPASSRLS — no caller-context SQL path).db(req); reach foradminDb()only when the function is the principal (audit logs, webhook handlers, cron cleanup).db.from(...)/db.sql(...)flagged as a one-release deprecation shim that warns on first use and routes throughadminDb().cli/llms-cli.txt (Functions section)
db(req)for user-scoped reads/writes andadminDb()for admin paths.adminDb().from()at build time.openspec/specs/functions-db-docs/spec.md
Why now
Gateway rejects
role=service_roleon/rest/v1/*as of PR #51. Any agent reading the old public docs would write a function that gets 403s in production. This PR closes that gap.Test plan
rg 'db\\.from|db\\.sql'in SKILL.md and cli/llms-cli.txt only matches the deprecation-shim calloutdb(req)andadminDb()with matching routes (/rest/v1/*and/admin/v1/rest/*)Follow-ups
db.from/db.sqlshim. Update these docs again to drop the deprecation callout at that time.🤖 Generated with Claude Code