Repository navigation
feat(spec,core): a scoped import lookup miss whose value exists under another parent answers reference_out_of_scope - #37567
Conversation
… another parent answers reference_out_of_scope
FieldErrorCode gains reference_out_of_scope, with its catalog sentence
import_reference_out_of_scope in all four platform locales. The importer
answers it for a scoped lookup cell whose value matches a record only
outside the row's scope, and the cell error carries the scoping columns as
`scope: [{ field, value }]` (ValidateDataIssueSchema), so a client keyed on
the code can name the column and its cell without parsing the message.
A value no record has keeps reference_not_found. A scoped read the
field-predicate guard refused is never probed, so it stays
reference_not_found too.
Claude-Session: https://claude.ai/code/session_01L6bhgWgMUXf5juNBhN6rLX
Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L6bhgWgMUXf5juNBhN6rLX Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 3 package(s): 12 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 5 release-owned page(s) also name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 187 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 1aab83e008917f501af2fcee095f67a62ce4f6b3 && git checkout 1aab83e008917f501af2fcee095f67a62ce4f6b3
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 6c290d3af7c52d019d1de1c09b6b0306f09700bb 80a79c7732c04fc57b067c26aa74bdabe5b34604 && git checkout -B drift-repro 6c290d3af7c52d019d1de1c09b6b0306f09700bb && git merge --no-ff 80a79c7732c04fc57b067c26aa74bdabe5b34604
node scripts/docs-audit/affected-docs.mjs --json 6c290d3af7c52d019d1de1c09b6b0306f09700bb
|
…key; spec minor Claude-Session: https://claude.ai/code/session_01L6bhgWgMUXf5juNBhN6rLX Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L6bhgWgMUXf5juNBhN6rLX Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#2 · os-sales · session_01L6bhgV6i8jfWwSXjpWJrjA Contract reviewServed-tier: ① Derived judgmentsRead: card #36794 (body, triage 7118224568, claim 7192981274, amendment 7194794693), the PR body and its 17-file list, the net diff against
② Semver level
③ Boundary flagsThe card's question: is moving the cross-parent case out of
Other flags.
④ Design judgment
No must-fix, no should-fix. Nits, each an accepted deviation or a follow-up; none moves the verdict:
Implemented-by: VERDICT: PASS |
|
repo:objectstack#2 · os-sales · session_01L6bhgV6i8jfWwSXjpWJrjA 席位核对 — ACCEPT · head 80a79c7 · card #36794 (PR-1 of 2) · area s2-data · 2026-11-26T15:11ZL1 checklist
Tier: S. Landing: ready + auto-merge by this stroke. |
⛔ merge queue 构建失败 — 先分诊,再决定要不要重排队列构建 45846812886 红了。队列跑的是全量套件(PR 侧 CI 只跑 affected 子集), 分类: 失败的 job(日志抽取,best effort):
跨 PR 相同签名(24h,按失败测试文件聚合):
历史信号:
分诊清单:
Generated by Claude Code · merge-queue-triage workflow (#4859) |
|
repo:objectstack#2 · os-sales · session_01L6bhgV6i8jfWwSXjpWJrjA 重投 · head 80a79c7 · 2026-11-26T15:45ZThe merge queue dropped this PR (CI_FAILURE) on merge-group run 45846812886. The only red job is
|
…ell was scoped by; a scope no read could filter by says so (objectstack-ai#37706) <!-- claude-projects-attribution: {"github_login":"os-sales"} --> _Requested by **Sales** · [project thread](https://claude.ai/code/project/chan_01D5bWFY3rFzgJcytD5gD4Uu?thread=cmsg_01D5bWFY3rFzgJcytD5gD4UuDqyPrPQvkURDXnUDgkyFWB)_ Fixes objectstack-ai#36794 (PR-2 of 2; PR-1 objectstack-ai#37567 landed the spec reason and the importer) Clause-②: yes (widening) Metadata-protocol: none ## 维护者速读 - 导入向导在预检和完成页上,对“查找值属于另一个父记录”的情况显示专门的提示,例如 `"Design review" was found, but not under Project "Gemini"`。提示会用标签说出限定它的列和本行填的值,11 种界面语言都已翻译。 - 补上契约审核提出的一个漏洞:如果 `dependsOn` 指向一个引擎无法筛选的字段(比如公式),限定查询一次都没跑成。这种情况以前会被误报成“在别的父记录下”,现在照旧报“找不到记录”,提示语改为说明无法在这个范围内查找,需要给 `dependsOn` 换一列。 - 只影响导入失败行的显示文字和一种配置错误时的错误码,成功导入不受影响,没有新增可写的元数据键。整张 PR 可以直接撤回。 - 无。 ## What changes - **Import Wizard** (`ui/packages/plugin-grid/src/ImportWizard.tsx`): `formatDryRunError` gains `case 'reference_out_of_scope'`, rendered from the cell error's structured `scope`. Each entry is named by the importing object's field label (its api-name when it has none) with the cell the row gave it, joined in the order the server sent them by the pack's own separator (`grid.import.scopeSeparator`: `、` in ja and zh, `، ` in ar; review N3). The Wizard keys on the code and `scope` only and never parses the server sentence; a cell error with no `scope` falls through to the server's own sentence (already in the caller's locale), the same path an unknown code takes. `scope` is carried onto `ImportResult.errors` by both the synchronous import mapping and `jobResultToImportResult`, so the completion screen renders the same text as the dry-run panel. New keys `grid.import.referenceOutOfScope`, `grid.import.scopeEntry` and `grid.import.scopeSeparator` are in the Wizard's default dictionary and in all 11 locales under `ui/packages/i18n/src/locales/`. - **Review nit 2, a scope no read could filter by** (`packages/core/src/utils/import-runner.ts`, `import-coerce.ts`): the resolver records whether any scoped candidate read ran to an answer, and whether a read was refused by the engine's filter seam for the scope: `isScopeFilterRefusal`, the declared `code: 'INVALID_FIELD'` naming a scope field in `fields`, read off the refusal like `isScopeFieldDenial`, never its message. Only when no read answered and such a refusal was seen (the `dependsOn` `param` names a target field the engine cannot filter by, such as a `formula`) does it return `RefMatch.scopeUnqueryable`. A lookup whose reads are all refused for any other reason (no read grant on the target, a driver fault) keeps the plain miss and the plain sentence (contract review S1, 7204641031). That cell keeps `reference_not_found`, with no unscoped probe and no `scope`, and gets its own catalog sentence `import_reference_scope_unqueryable`, whose remedy names the target field the `dependsOn` entry filters by ("point that dependsOn entry at a stored field", review N1) (`packages/spec/src/system/validation-message.ts`, all four platform locales). **Chosen: the runtime answer, no lint.** A lint refusing such a `dependsOn` would refuse metadata that publishes today, which is a narrowing that needs its own card. Before this PR that cell answered `reference_out_of_scope` once the unscoped probe found the value, which claimed a fact the import never checked. - **Review nit 1**: `ImportRowResultSchema.errors` describe (`packages/spec/src/api/export.zod.ts`) and the runner's `ImportRowResult.errors` jsdoc now say a `reference_out_of_scope` element carries `scope`. Regenerated `content/docs/references/api/export.mdx`. - **Review nit 4**: `content/docs/api/error-catalog.mdx` now says `scope` names the row's own scoping columns and the cells the row gave them, not the parent's columns. - `content/docs/data-modeling/import-mappings.mdx`, scoped-lookup section: a `dependsOn` `param` naming a formula cannot scope the lookup, and the cell answers `reference_not_found` with the could-not-look-up sentence; any other refusal keeps the plain sentence. - Changeset: `@objectstack/spec`, `@objectstack/core`, `@object-ui/plugin-grid` and `@object-ui/i18n` patch. `Metadata-protocol: none`: no key enters `packages/spec/authorable-surface/*.json`, because `check:generated` moved only the references page. The new catalog key is message vocabulary, the same class as PR-1's `import_reference_out_of_scope`, which its claim also read as `none`. `Clause-②: yes (widening)`: a new catalog key a deployment can override, and a wire answer that only becomes more precise for a case no released version answered `reference_out_of_scope` for. ## Tests - **Review nit 3, a real engine and the real field guard** (`packages/qa/dogfood/test/import-reference-out-of-scope.dogfood.test.ts`): a booted stack with the real `SecurityPlugin`, ObjectQL, SQL driver and the REST import door, plus a fixture member whose permission set hides `oos_task.project`. The guard is shown live first: the member's filter on that field gets 403, the admin's gets 200. The pins: - Admin, a task of another project: `reference_out_of_scope` with `scope: [{ field: 'project', value: 'Gemini' }]`. The in-scope row resolves and stores the id. A value nobody has: `reference_not_found` with no `scope`. - Member, the same rows: `reference_not_found`, plain sentence, no `scope`, including the row whose task really is under its own project. - A `dependsOn` whose `param` is a formula: `reference_not_found` with the `import_reference_scope_unqueryable` sentence. - None of these reads the guard's reason across a package as a string. Each answer comes from the real seam. - Ablation (dogfood): with the `isScopeFieldDenial` branch disabled, the member pin goes red. With the `scopeUnqueryable` assignment disabled, the formula pin goes red (2 failed / 2 passed). Restored: 4 passed. - `packages/core/src/utils/import-runner-reference-master-scope.test.ts`: a new pin in which every scoped read is refused `INVALID_FIELD` naming the scope field. It answers `reference_not_found` with the new sentence, no `scope`, and no unscoped probe. Two pins for S1: every read refused `PERMISSION_DENIED` naming no field, and every read refused `INVALID_FIELD` naming a field outside the scope; both answer the plain sentence. - `packages/spec/src/system/validation-message.test.ts`: every locale of `import_reference_scope_unqueryable` interpolates `{{value}}` and `{{scope}}` and names `dependsOn`; the English render. - `ui/packages/plugin-grid/src/importDryRun.test.ts`: the new case names the scope column by its label and the row's cell; a multi-column scope names every column (one without a label by api-name), joined by the pack's separator; it is never rendered as "no matching record"; with no `scope`, the server sentence is shown minus the api-name prefix. `importAsyncPath.test.ts`: `jobResultToImportResult` carries `scope` onto the error. <details><summary>Local readings (tree 8b99fd1, on main fbcfdfb; round 2 head f9dcf30: core master-scope 19 passed, spec validation-message 45 passed, dogfood out-of-scope 4 passed, ui i18n + plugin-grid 428 files / 4822 passed, plugin-grid type-check and core tsc green)</summary> - `pnpm --filter @objectstack/spec check:generated --fix`: 1 stale (`content/docs/references/**`, the `errors` describe), green after; nothing under `packages/spec/authorable-surface/` moved. - `typecheck` core and spec: green. `type-check` `@object-ui/plugin-grid` and `@object-ui/i18n` (deps built): green. `lint` plugin-grid: 0 errors. - `pnpm --dir ui exec vitest run packages/i18n/ packages/plugin-grid/`: two i18n census pins moved with the new keys and were updated in this PR (`de-quote-pairing-3876`, 133 → 135 paired spans; `untranslated-identity-4376`, `grid.import.scopeEntry` allowlisted as a format string). After that: i18n 111 files / 2028 passed; plugin-grid files green (the first run's only 3 failures were those two i18n pins). - spec `src/system/` + `src/data/mapping.test.ts`: 80 files / 2841 passed. core `src/utils/`: 51 files / 1356 passed. - dogfood `import-reference-out-of-scope` + `import-reference-exposure`: 2 files / 15 passed (core built from this tree). - `node scripts/pm/overlap-check.mjs`: VERDICT clean exit 0 (main, objectstack-ai#37676, objectstack-ai#37667, objectstack-ai#37422). </details> ## Acceptance notes - The unfilterable-scope cell keeps the `reference_not_found` code, so the Wizard shows its generic "No matching record" text there. The precise sentence reaches API callers in the cell error's `message`. That case is an authoring mistake that a Wizard user cannot fix, and a code of its own would be a new `FieldErrorCode` member, which needs its own contract review. Left as it is. ## Verification Read first: `formatDryRunError` in `ImportWizard.tsx` (`case 'reference_out_of_scope'`), the resolver's `lookup` in `import-runner.ts` (`asked`, `scopeUnqueryable`), and `referenceNotFound` in `import-coerce.ts`. Two-minute check: `pnpm --dir ui exec vitest run packages/plugin-grid/src/importDryRun.test.ts -t "reference_out_of_scope"` runs 4 tests, all green. --- _Generated by [Claude Code](https://claude.ai/code/session_01L6bhgWgMUXf5juNBhN6rLX)_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01L6bhgWgMUXf5juNBhN6rLX <!-- signed: repo:objectstack#2 · os-sales · session_01L6bhgWgMUXf5juNBhN6rLX --> --------- Co-authored-by: Claude <noreply@anthropic.com>
Requested by Sales · project thread
Part of #36794 (PR-1 of 2: the spec reason and the importer; the Import Wizard text follows in PR-2 on the same branch once this one lands)
Clause-②: yes (widening)
Metadata-protocol: added (
ValidateDataIssueSchema.scope, a new optional key on the import cell error; the newFieldErrorCodevalue is a wire code, no author-writable key)Skills-docs: follow-up #37590
维护者速读
What changes
FieldErrorCodegainsreference_out_of_scope(packages/spec/src/api/errors.zod.ts, ADR-0114 D2 closed catalog), besidereference_not_found. Ruled route A on the card.import_reference_out_of_scopein all four platform locales (packages/spec/src/system/validation-message.ts). The English text is byte-identical to the sentence the scoped refusal already shipped with (Contract: no record matches "CTR-0006" (Account = "Acme")), now with{{scope}}as a parameter, so a deployment can override it undervalidation.field.import_reference_out_of_scopeand the other three locales say it in their own word order.ValidateDataIssueSchemagains an optionalscope: [{ field, value }](packages/spec/src/api/protocol.zod.ts), present only on an import cell error whose code isreference_out_of_scope. This is the thread's route decision, agreed by the seat at claim time: the card asks the Wizard to name the scoping column and its cell while keying on the code and never parsing server prose, and the row result carried no structured column at all. Same{ field, value }naming the importer already uses for the columns; additive, optional, Clause-② widening. The contract review below judges it.packages/core/src/utils/import-coerce.ts,import-runner.ts): the fix(core): a scoped import lookup miss names the scoping column when the value exists outside the scope #36735 unscoped probe now answers the new reason with the new message key and thescopeentries; the runner copiesscopeonto the row'serrorselement. A value nobody has keepsreference_not_found.RefMatch.scopeDenied,isScopeFieldDenial). A caller who cannot read the scope field (a hiddenmaster_detailfield, or theparamadependsOnentry names) has the scoped lookup refused, so its miss says nothing about where the value lives. Before this PR the probe still ran and the fix(core): a scoped import lookup miss names the scoping column when the value exists outside the scope #36735 sentence named the scope; with a code that now claims "under another parent", that answer would be wrong for a record sitting under the row's own parent. It keepsreference_not_foundand the plain sentence, which is whatcontent/docs/data-modeling/import-mappings.mdxalready says for that caller. The guard is read off the error's declareddetails.reason === 'field_predicate_denied'(the reason all four field-predicate guards answer) naming a scope field, never its message.packages/runtime/src/dispatcher-error-vocabulary.ts: the new code'sforeign-vocabularyrow (ADR-0112 D6), same wording as its three siblings.content/docs/api/error-catalog.mdxfield-code table andcontent/docs/data-modeling/import-mappings.mdxscoped-lookup section. Regenerated:content/docs/references/api/{errors,export,protocol}.mdx,packages/spec/authorable-surface/api.json(api/ValidateDataIssue:scope), the strictness-ledger count forapi/(537 → 538, the new nested object).@objectstack/specminor,@objectstack/coreand@objectstack/runtimepatch.Metadata-protocol: added, not the claim'snone:Check Changesetreads the newapi/ValidateDataIssue:scoperow inpackages/spec/authorable-surface/api.jsonas a key entered, and a kind other thannonegrades the package that carries it at leastminor.Tests
packages/core/src/utils/import-runner-reference-master-scope.test.ts: the import: a lookup cell refused by the row's dependent scope says "no record matches", although the record exists under another parent #36159 describe now pinsreference_out_of_scopefor adependsOnscope and a master scope, by name and by pasted id, single and multi-value, witherrors[0].scopeas data; a value nobody has keepsreference_not_foundwith noscopekey; the two import: a lookup cell resolves a name across the whole target object, not within the row's own master reference, so a repeated detail name ("Advance 30%" on two contracts) fails the row with reference_ambiguous #33523 pins whose value lives under another master move to the new code; a new pin: a scope the field guard refuses answersreference_not_foundand no unscoped probe runs.packages/rest/src/import-integration.test.ts: a new top-level describe drives the realPOST /data/:object/importroute on a real engine and sqlite with a realdependsOndeclaration: one row resolves, one answersreference_out_of_scopewithscope: [{ field: 'project', value: 'Gemini' }], one answersreference_not_foundwith noscope.packages/spec/src/system/validation-message.test.ts: every locale interpolates{{value}}and{{scope}}; the English render is the shipped sentence; the zh-CN render.if (scopedMatch.scopeDenied) return refusal;commented out, the guard pin goes red (1 failed / 15 passed), restored green.Local readings (tree f4a201e + 2e8b0b9)
pnpm --filter @objectstack/spec test: Test Files 900 passed (900), Tests 28505 passed, 1 todo.vitest run src/utils/import-runner-reference-master-scope.test.ts(core): 16 passed.src/utils/import-coerce.test.ts: passed.vitest run src/import-integration.test.ts(rest): 62 passed.pnpm --filter @objectstack/spec check:generated: 2 stale before--fix(references docs, strictness ledger), both green after.typecheckspec, core, runtime: green; rest: one TS18048 in the new pin, fixed in 2e8b0b9,check:test-typecheckOK.node scripts/check-dispatcher-error-vocabulary.mjs: exit 0.node scripts/pm/overlap-check.mjs: VERDICT clean exit 0 (main, feat(spec)!: form is a metadata type of its own, and the form doors read a form over both types #37422, feat(security)!: View All and Modify All stop opening fields; viewAllFields is the one every-field bit #37371).dispatch-gates.mjs --commandsderived list (118 commands) is running; its reading goes on the PR when done.Acceptance notes
reason === 'reference_not_found'to mean "the lookup cell did not resolve" stops seeing the out-of-scope case under that value. The schema only widens (a new enum member, a new optional key), so this PR declaresClause-②: yes (widening); whether the move of that case is itself a narrowing for such a client is the L2's call.Skills-docs: follow-up owed):skills/objectstack-data/rules/relationships.md:117says another master's detail answersreference_not_found.skills/**is governed, and this PR'sClause-②: yeskeeps it off the low-risk arm, so the line here would make the whole PR Tier H; its follow-up card is skills: objectstack-data relationships rule says another master's detail isreference_not_foundon import; after PR #37567 it isreference_out_of_scope#37590.casefor, soformatDryRunErrorfalls through to the server's own sentence (already in the caller's locale, naming the scope) on both the dry-run panel and the completion screen. PR-2 gives the code its own Wizard key built fromscope.Verification
Read first:
packages/core/src/utils/import-coerce.tsreferenceNotFound(the new reason and the guard),packages/core/src/utils/import-runner.tsthe resolver'scatch(isScopeFieldDenial),packages/spec/src/api/protocol.zod.tsValidateDataIssueSchema.scope.Two-minute check:
pnpm --filter @objectstack/rest exec vitest run src/import-integration.test.ts -t "under another parent"— one test, green; row 2 answersreference_out_of_scopewith itsscope.Generated by Claude Code