Repository navigation
docs(skills,adr): teach the code-defined datasource credential route (OS_DATASOURCE_NAME_PASSWORD behind the host switch) - #28432
Conversation
…(OS_DATASOURCE_NAME_PASSWORD behind the host switch) skills/objectstack-data/rules/datasources.md: the credential section now says a code-declared datasource reads its password at connect from the variable derived from its name while the host switch OS_DATASOURCE_ENV_CREDENTIALS is on (the CLI host defaults it on, a library composition is off, on/off only), that a declared credentialsRef or connector still wins with no fallback, and the operator's caution that an installed package may declare a datasource of any free name and so read that variable. The added text is paid for under the token ratchet by deleting restatements in the same file; the file lands at 910 of 911 tokens. ADR-0015: the Amended-by line, an inline correction of the D7 note's "that stays true for a database", the section 10 credentials bullet, and a dated amendment note under section 10 recording the route, its guards, the failure text and the trust consequence. ADR-0062 D3: a dated amendment recording the slot's place in the connect's resolution order. A patch changeset for @objectstack/skills, which ships skills/**. Claude-Session: https://claude.ai/code/session_01FEkQ5phX4SAaFQKww3TfKb Co-authored-by: Claude <noreply@anthropic.com>
|
domain:server#2 · os-tesla · session_01L9qibw58ehQ2gRHP2h2Puz Contract-review-claim: |
|
domain:server#2 · os-project-manager · session_0186vfjHHMsRXC9EUT9hTFMo Contract reviewServed-tier: Face: governed rules text ( ① Derived judgmentsAcceptance set and public faces: unchanged. No
The five deletions, each with a home (the ratchet payment): the ADR-0015 — the Amended-by entry, the D7 inline correction, the §10 bullet and the §10 note:
ADR-0062 D3 amendment: the five conditions (neither channel declared, not ② Semver level
③ Boundary flags
④ Design judgment
No must-fix. Implemented-by: VERDICT: PASS Generated by Claude Code |
|
domain:server#2 · os-project-manager · session_0186vfjHHMsRXC9EUT9hTFMo 席位核对ACCEPT · The maintainer's standing authorisation for landing reviewed PRs, verbatim: 「按照 pm-dispatch 规则复核过的都授权」. This PR is Tier H: that authorisation does not reach it. It stays draft until the maintainer approves.
Generated by Claude Code |
|
triage#1 · os-tesla · session_01L9qibw58ehQ2gRHP2h2Puz Contract-review-claim withdrawn: The claim 6545612522 above was posted by the maintainer's contract-review thread, not by seat 2, and it was signed with the card's seat name by mistake. Seat 2's own record 6545658053 (PASS on this head) stands as the review of record; this thread produced no record and reviews nothing further on this head. Its later rows sign as |
Requested by Leehom · project thread
Fixes #28209
Clause-②: no — governed prose (two ADR amendment notes) and one published skills rules file. No schema, export, type, key, value, error code or runtime behaviour moves; nothing is newly accepted or refused.
Metadata-protocol: none
维护者速读
OS_DATASOURCE_NAME_PASSWORD」这条路:skills/objectstack-data/rules/datasources.md的凭据一节(变量名规则、主机开关OS_DATASOURCE_ENV_CREDENTIALS及其默认、已声明的credentialsRef/connector仍优先且不回落、给运维的信任提醒);ADR-0015 的 Amended-by 行、D7 注里「对数据库仍然成立」那句的行内更正、§10 凭据条目和一则带日期的 §10 修订注;ADR-0062 D3 下一则带日期的修订注(该槽在连接解析顺序里的位置、失败文字按 PR fix(service-datasource): an unset env credential is a note after the driver's error, and a failed connect holds no claim on its variable (#28283) #28325 的样子)。另加一条@objectstack/skills的 patch changeset。sys_secret:句柄。skills/objectstack-data/rules/datasources.md(凭据一节与被删的五处);docs/adr/0015-external-datasource-federation.md(§10 下的修订注,含信任提醒);docs/adr/0062-external-datasource-runtime.md(D3 修订注)。node scripts/check-skills-token-ratchet.mjs→skills/objectstack-data/rules/datasources.md is 910 tokens (ceiling 911; headroom 1);pnpm check:pm-skill-id-lint绿(skills 文字无#NNNN)。skills/**+docs/adr/**):PR 保持 draft,等你本人批准后由席位落地;另请裁定「skills 改动带 patch changeset 而非skip-changeset」这一处与派发令的出入(见 Acceptance notes)。What changes
Measured on
origin/main5da3a8cebefore any editWhat PR #28208 shipped, with PR #28325's two corrections, cited by file and line on that tree:
OS_DATASOURCE_+ the datasource name upper-cased with every character outside[A-Z0-9]replaced by_+_PASSWORDpackages/services/service-datasource/src/datasource-env-credential.ts:55-57(datasourceEnvCredentialVar)default(anasDefaultconnect never reads the slot)packages/services/service-datasource/src/datasource-connection-service.ts:772declared-autodatasource-connection-service.ts:936-941(envCredentialVarFor)^[a-z_][a-z0-9_]*$, on which upper-casing is injectivepackages/spec/src/data/datasource.zod.ts:652OS_DATASOURCE_ENV_CREDENTIALSdatasource-env-credential.ts:44on/offin any letter case; any other value throwsdatasource-env-credential.ts:65-78(resolveDatasourceEnvCredentialsSwitch)init()and wires the slot only when it is onpackages/services/service-datasource/src/datasource-admin-plugin.ts:338(init),:421-429(theenvCredentialsspread)os servestampsonwhen the operator left it unset or empty, just before it builds the admin pluginpackages/cli/src/commands/serve.ts:5287-5289;packages/cli/src/utils/datasource-env-credentials-default.ts:20-28os startandos devrunserve, so they get the stamppackages/cli/src/commands/start.ts:528,packages/cli/src/commands/dev.ts:848envCredentialsis optional and absent by defaultdatasource-connection-service.ts:171;datasource-env-credential.ts:80-89connect():credentialsRef(fail-closed) → the D7 connector borrow (fail-closed) → the env slot, only when neither is declared and notasDefault→ the driver factorydatasource-connection-service.ts:713-738,:749-757,:770-795,:805(factory.create)secret; an empty or unset variable leavesenvCredentialVarset so the failure can name itdatasource-connection-service.ts:791-793failed-credentials, naming both datasources and the variable, before any readdatasource-connection-service.ts:775-786datasource-connection-service.ts:911(note: datasource 'NAME' is defined in code and reads its credential from OS_DATASOURCE_NAME_PASSWORD at connect, which is not set on this host); verdictfailed-degradeddatasource-connection-service.ts:921-924default, and a package installed into the running kernel (the trust consequence)packages/runtime/src/app-plugin.ts:626,packages/runtime/src/default-datasource-plugin.ts:150,packages/runtime/src/declared-datasources.ts:188passwordguidance entriespackages/spec/src/data/driver/common.zod.ts:103-108(CODE_DEFINED_CREDENTIAL_ROUTE); 7 uses there, 2 inpackages/spec/src/data/datasource.zod.tsThe three texts
skills/objectstack-data/rules/datasources.md(reader: the customer's agent writing adefineDatasourceor a package's*.datasource.ts; mistake prevented: inlining a password, or writing acredentialsRefhandle nothing mints for a code datasource, or expecting a library-built kernel to read the variable).OS_DATASOURCE_NAME_PASSWORD(NAME = the name upper-cased; exact for every schema-valid name, since the only non-alphanumeric character a valid name can hold is_); only while the host switchOS_DATASOURCE_ENV_CREDENTIALSison;os serve/os start/os devdefault it on, a library composition is off, and the switch takeson/offonly; the operator's caution that an installed package may declare a datasource of any free name and so read that variable; andexternalmay instead name one channel, which wins and never falls back to the variable. ThecredentialsRefandconnectorbullets and the fail-closed paragraph are kept.datasource.zod.ts—skills/objectstack-data/references/_index.md:12carries the same path;// writable: truecomment in the example — the Writes section two screens down states the gate;// columnMap: { cust_region: 'region' }, // remoteColumn → localFieldline shows the same key with its direction; the ❌field.columnNamerule stays;'default')" on the object field —skills/objectstack-data/SKILL.md:87's field table carries that default;defineStack, else at connect)" on the connector refusal, and "Otherwise every write to the object is rejected." after "read-only by default … both gates must be on" — consequence and timing clauses whose rule survives in the sentence they hung on.SKILL.md56506 → 56506 (none edited). No ceiling moves.docs/adr/0015-external-datasource-federation.mdAmended byheader line gains the feat(service-datasource): a code-defined datasource reads its credential from OS_DATASOURCE_<NAME>_PASSWORD #28208 entry with the ruling record.credentialsRef. That stays true for a database." gains an inline, dated correction in the ADR's own*(amended …)*form, pointing at the §10 note.*(Amended …)*, in the form the D7 amendment already used there.origin; a declared channel wins and stays fail-closed; an unset variable leaves the connect as it was and the failure text as PR fix(service-datasource): an unset env credential is a note after the driver's error, and a failed connect holds no claim on its variable (#28283) #28325 left it; the collision refusal and the released claim; the per-request plugin-driver limit), then the trust consequence stated for operators, the spec sentence, and what was not taken.docs/adr/0062-external-datasource-runtime.mdcredentialsRefand the D7 borrow and before the factory, with the five conditions under which it is taken, the switch and its wiring atinit(), the failure text, the collision claim, and a pointer to ADR-0015 §10 for the operator's caution. The normative bullets are not edited, as the ADR's other amendments did not edit theirs.The changeset
.changeset/28209-skills-code-datasource-env-credential.md:@objectstack/skillspatch, carrying both declaration lines.skills/**is copied into that package'sdist/skillsby its build and ships in itsfiles[], so this diff publishes; see Acceptance notes for the conflict with the order.Tests
No code changes; the gates below are the tests. The published surface was built:
pnpm --filter @objectstack/skills buildunder the verify lock →sync-catalog self-test: 9 cases pass,95 file(s) across 11 skill(s) copied from skills/** into dist/skills and read back byte-identical,VERDICT command-exit 0.Acceptance notes
skip-changeset; the repo's rule says otherwise, and this PR follows the repo. AGENTS.md's Post-Task Checklist:skip-changeset"is for a diff that publishes nothing from any released package".scripts/check-empty-changeset.mjs(its failure text and its GREEN 3 battery) states that askills/**change ships in@objectstack/skillsand "owes a changeset naming that package, never theskip-changesetlabel", and the precedent changesets for skills-only PRs (for example.changeset/26475-skills-teach-queues-assignment-rules.md) are@objectstack/skills: patch..claude/agents/os-dev.mdsays that where an order and that file conflict, the file wins and the conflict is named, so: a patch changeset, noskip-changeset, and zero label writes atpr_create(the order named no other label). The seat relabels if the maintainer rules otherwise.skills/objectstack-data/evals/hooks-security-seeds-datasources.json, case id 3, still answers "AdefineDatasourceentry (credentialsRef, never inline credentials)" for a code datasource exposing a Postgres table — the same stale teaching this card corrects, in a fixture the card and the claim's file surface do not name. Its assertions do not requirecredentialsRef, so it stays green. Reported in the os-dev-report for the seat to file or fold in.content/docs/data-modeling/external-datasources.mdx§4 (PR feat(service-datasource): a code-defined datasource reads its credential from OS_DATASOURCE_<NAME>_PASSWORD #28208) already teaches the full route; the skills text is deliberately the short form and names no#NNNN.pnpm lintscoped to touched packages: the diff touches no package source;@objectstack/skillshas nolintscript and eslint reads no.md, so there is nothing to scope it to. Recorded, not run.Verification
All on head
17988ade(baseorigin/main5da3a8ce; no merge,maindid not move under the branch).node scripts/pm/check-governed-merges.mjs --test skills/objectstack-data/rules/datasources.md docs/adr/0015-external-datasource-federation.md docs/adr/0062-external-datasource-runtime.md→ exit 3,governed-surface predicate: 3 of 3 path(s) hit the register (13 surfaces govern objectstack). ⛔ GOVERNED — a human merge is the review record for this PR … landing tier: H(人合):docs/adr/** ×2,skills/** ×1. The PR stays draft; no seat readies, queues or arms it.node scripts/check-skills-token-ratchet.mjs→ exit 0:skills/objectstack-data/rules/datasources.md is 910 tokens (ceiling 911; headroom 1);56 authored bundle file(s) within their ceilings; bundle total 219807 → 219808.pnpm check:pm-skill-id-lint→ exit 0:105 file(s) clean (pattern /#[0-9]{3,}/g).pnpm check:doc-authoring→ exit 0:70 published skill files clean — no internal issue-id references.node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstackon this diff: 49 families. Every one was run with its exit code captured before any pipe (timeout 900 bash -c CMD; EXIT=$?), and--ranreconciles to49 derived famil(ies) accounted for — 47 run, 2 NOT-MEASURED (2 DERIVED from a recorded exit 3). Three first exited 3 (PREREQUISITE NOT MET, nothing measured).pnpm --filter @objectstack/lint run check:doc-formula-expressionswanted@objectstack/formulaand then@objectstack/lintbuilt: afterpnpm --filter '@objectstack/formula...' buildandpnpm --filter '@objectstack/lint...' buildunder the verify lock (VERDICT command-exit 0, 88s and 81s) it exits 0 —9 @example(s) judged clean across 2321 packages/spec/src files,15 predicate(s) … judged clean. The two left to CI's full build:pnpm check:dual-build-cjs-loads(needspnpm build) andpnpm check:lean-entry-closure(needs the built entry points,packages/objectql/dist/core.mjsamong them); neither reads a file in this diff. Among the 46 green:check:adr-anchors,check:adr-index,check:adr-symbol-anchors,check-adr-links(962 relative links resolve),check-adr-0087-registration,check-changeset-no-major,check-empty-changeset(1 declaring changeset added, none from the merge base modified),check:pm-governed-merges,check:pm-changeset-deadline-census,check:pm-prior-rulings,check:published-files,check:skill-compatibility,check:skill-frame-sync,check:skill-identifier-liveness,check:dts-closure,check:nul-bytes(23088 text files, no raw control bytes). The three diff-reading gates that ran before the commit (check-adr-0087-registration --base,check-adr-links,check-changeset-no-major --base) were re-run on the committed head: all exit 0.pnpm --filter @objectstack/skills buildunderscripts/pm/os-verify-lock.sh→sync-catalog self-test: 9 cases pass;95 file(s) across 11 skill(s) copied from skills/** into dist/skills and read back byte-identical;VERDICT command-exit 0 · held the lock 2s.pnpm lintscoped: nothing to scope to (no package source in the diff;@objectstack/skillshas nolintscript).!in the title and no(narrowing)arm.Human Minimum
packages/specholds no runtime logic. (packages/specuntouched.)pnpm lintpasses. (No package source touched; see Acceptance notes.)main, one pull request.packages/spectouched: n/a.content/docs/references/,packages/*/CHANGELOG.mdorcontent/docs/releases/.Generated by Claude Code