Repository navigation
fix(lint)!: refuse a list-view chart bound to a dataset over another object - #26842
Conversation
…bject A list view's chart plots the rows of its dataset's base object; the list's object and filter never reach the dataset query. A chart under one object's list bound to a dataset over another object plotted that other object's records and saved 200. validateListViewFieldRefs now reports it as list-view-chart-dataset-foreign-object (error) at chart.dataset, on every list-view shape the rule walks, so the publish door refuses it and os validate / os build fail. A dataset that reaches the list's object only through an include relationship is refused too: include adds columns, not rows. Claude-Session: https://claude.ai/code/session_01WGufzhALodSKE3ejCJ1EXk Co-Authored-By: Claude <noreply@anthropic.com>
…fused Claude-Session: https://claude.ai/code/session_01WGufzhALodSKE3ejCJ1EXk Co-Authored-By: Claude <noreply@anthropic.com>
…n object Claude-Session: https://claude.ai/code/session_01WGufzhALodSKE3ejCJ1EXk Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WGufzhALodSKE3ejCJ1EXk Co-Authored-By: Claude <noreply@anthropic.com>
📓 Docs Drift Check4 anchor(s) derived from 1 changed package(s); no hand-written page names any of them. What this run could not see
Coarse fallback — 4 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 becfa4ac2a42ebe7ad961235cd40ebe1ca8c318f && git checkout becfa4ac2a42ebe7ad961235cd40ebe1ca8c318f
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 8eef9a8db402b6d46b15cc2375f8acddbb0d7b7e 3adedc914cebee085f7774754c3182a39d38dc34 && git checkout -B drift-repro 8eef9a8db402b6d46b15cc2375f8acddbb0d7b7e && git merge --no-ff 3adedc914cebee085f7774754c3182a39d38dc34
node scripts/docs-audit/affected-docs.mjs --json 8eef9a8db402b6d46b15cc2375f8acddbb0d7b7e |
Contract reviewServed-tier: Read-only review of card #26719 (body, triage 6446947560, claim 6448354345, os-dev-report 6450182672, claim amendment 6450303047), PR #26842 (body, file list, net diff of the six files against ① Derived judgmentsAccept-set changes the diff implies, each judged:
② Semver level
③ Boundary flags
PR body against the diff. One sentence is stale. Under "What changes", the line Should-fix (not blocking). The runtime door is pinned at Implemented-by: VERDICT: PASS |
… with an own-object control Claude-Session: https://claude.ai/code/session_01WGufzhALodSKE3ejCJ1EXk Co-Authored-By: Claude <noreply@anthropic.com>
席位核对 · ACCEPT ·
|
Requested by Yibo Wang · project thread
Fixes #26719
Clause-②: no (narrowing)
Metadata-protocol: narrowed
Skills-docs: updated here —
content/docs/data-modeling/analytics.mdxgains the rule and its remedy; noskills/**file teaches list-view chart bindings, so no skill changes.维护者速读
os validate/os build也报错;草稿保存不拦,与其他作者期规则一致。packages/lint/src/validate-list-view-field-refs.ts(checkChartDataset与新增文档段)、packages/lint/src/validate-list-view-field-refs.test.ts末尾的[#26719]段、.changeset/26719-list-view-chart-foreign-dataset.md。pnpm --filter @objectstack/lint exec vitest run src/validate-list-view-field-refs.test.ts -t 26719,应见 16 条全绿(拒绝、同对象对照、关系可达也拒绝、四种视图形态、运行时保存门)。What changes
A list view's
chartbinds an ADR-0021 dataset, and the chart draws the rows of that dataset's baseobject: the list handsqueryDatasetthe dataset name, dimensions and measures and nothing else, so neither the list's object nor its filter reaches the query. A chart under one object's list bound to a dataset over another object plotted the other object's records under the first object's name, and saved and published200.list-view-chart-dataset-foreign-object(error) invalidateListViewFieldRefs, the list-view lint family that already judges columns and the A list view bound to an object outside the writing package's dependency closure skips the field-reference check: unknowncolumnsfields are accepted (200 active, draft → publish) where the same body is refused 422list-view-field-unknown#24563 closure binding. One finding per list view, atchart.dataset;wherenames the view, the message names the dataset and both objects, the fix line names the remedy.validateChartBindings. The claim and the issue namepackages/spec, but the list-view lint family lives inpackages/lint(the spec holds no business logic).validateListViewFieldRefsalready resolves the list view's bound object on every shape the save door carries (a view item record, a flattened list overlay, a container'slist/listViews, an object's built-inlistViews, with a list view's owndata.objectwinning) and already runs at theviewandobjectdoors.validateChartBindingsruns at theflowandreportdoors only, and does not walk the view-item or flattened shapes, so landing the check there would not have reached the door the QA measured.includelists to-one relationships FROM the dataset's base object, so a dataset overcrm_opportunitythat includesaccountstill counts and sums opportunities: the relation adds columns to group by, never a second row set. Nothing maps the list's object onto the dataset either (that mapping was refused as option B of ruling 5825582592). Equality of the two object names is the one test that says the chart plots the rows the list lists. Pinned both ways (anowner-including task dataset is refused under the person list and admitted under the task list).chart-dataset-unknown), a dataset with noobject, a list view whose binding does not resolve (list-view-object-outside-closure/list-view-object-unknown/ skip 1). The dataset's own package is not judged: when its object is the view's own, that object is already inside the written package's closure.os explain list-view-chart-dataset-foreign-objectcarries the reasoning;LIST_VIEW_CHART_DATASET_FOREIGN_OBJECTis exported from@objectstack/lint;content/docs/data-modeling/analytics.mdxstates the rule.@objectstack/lintminor, BREAKING accept-set narrowing, ADR-0087not-required (no-migration-prescription); the body states the remedy and carries no FROM → TO rewrite, since that disposition refuses a prescription.Why
Studio QA S5 (studio-qa-2026-10-27): authors got a chart of unrelated data under an object's list without any warning.
Tests
[#26719]block at the end ofpackages/lint/src/validate-list-view-field-refs.test.ts, 16 cases: the refusal (rule,error, pathviews[0].list.chart.dataset,wherenames the view, message names the dataset and both objects, one-line fix ≤ 200 chars); the same-object control (silent); the relation case both ways; the four other list-view shapes (objects[].listViews,views[].listViews, a flattened overlay, a ViewItem record) each at its own path; a list view's owndata.objectwinning over its container's; silence where another verdict owns the case (unknown dataset, dataset with noobject, unresolved binding); an object with no readable field map still judged;validateandbuildboth fail; at the runtime save door (runRuntimeAuthoringRules, typeview, under a package closure) a view item bound to another package's object's dataset is refused and the same view on its own object's dataset is admitted;os explaincarries the relationship answer.pnpm --filter @objectstack/lint teston the merged tree (merge commit3ccc765c; the later commits touch only the changeset and one docs page): Test Files 168/168, Tests 7446/7446.pnpm --filter @objectstack/lint typecheckexit 0 (same lock,VERDICT command-exit 0).scripts/ablation-replace.mjs, anchor hit 1 → 0, blobeeb9791a→d078fc8e): removing thecheckChartDataset(...)call turns 11 of the block's cases red; the 5 controls stay green, as expected. Restored: anchor back to 1,git diff HEADempty.Acceptance notes
packages/spec; the list-view lint family it names (cf. A list view bound to an object outside the writing package's dependency closure skips the field-reference check: unknowncolumnsfields are accepted (200 active, draft → publish) where the same body is refused 422list-view-field-unknown#24563) lives inpackages/lint, and the change is there.packages/specis untouched.?mode=draftPUT still answers 200, and its promotion (POST /api/v1/meta/view/NAME/publish) now answers 422.c8583f80, showcase boot, a non-buildermember): a dataset overchartgap_item(member has no read) → memberPOST /api/v1/analytics/dataset/query403 PERMISSION_DENIED("reading chartgap_item is not permitted"), the same with an inline dataset body; a dataset overshowcase_contact(memberGET /data403) → dataset query 403; a dataset overshowcase_inquiry(member reads 0 of 3 rows byGET /data) → datasetrow_count0 for the member, 3 for admin. Object-level admission and the row scope both hold at the dataset door.validateChartBindingsruns at theflowandreportdoors only and does not walk the view-item or flattened list shapes, so atPUT /api/v1/meta/viewa chart list view whose dataset resolves to nothing, or whosevaluesnames no measure of its dataset, publishes200(measured onc8583f80:no_such_datasetandghost_measure, both as a view item and as a container'slistViews). Crossing that member ontoviewis its own refusal widening with its own corpus measurement.examples/**,apps/**,packages/platform-objects,packages/pluginsandpackages/servicesdeclare two chart list views (showcasetask.view.ts→showcase_task_metricsovershowcase_task,project.view.ts→showcase_project_metricsovershowcase_project); both are their own object's. Nothing to fix.packages/rest/src/meta-view-chart-binding.test.tsbindslead_metrics, which its harness does not register, so the rule is silent there.Verification
pnpm dev -- --fresh, packagecom.qa.chartgapwith objectchartgap_item): a chart list view bound toshowcase_task_metrics(overshowcase_task) → publish422 INVALID_METADATAwithlist-view-chart-dataset-foreign-objectatviews[0].config.chart.dataset(view item) andviews[0].listViews.lv_foreign2_publish.chart.dataset(container); draft200; the draft's promotion422. Bound tochartgap_item_metrics(overchartgap_item) →200on every path, promotion200.c8583f80: the same four writes bound toshowcase_task_metricsall answered200.9634b5a3:dispatch-gates --commands→ 87 families, 87 run, all exit 0 (check-adr-0087-registrationfirst exit 1 on a FROM/TO label in the changeset, fixed in9634b5a3, re-run exit 0);dispatch-gates --ran→ 87 derived, 87 run, 0 NOT-MEASURED, 0 UNRUN.9634b5a3,pnpm --filter @objectstack/dogfood testunder the verify lock (VERDICT command-exit 0, 16m43s): Test Files 314 passed, 3 skipped (317); Tests 2609 passed, 20 skipped (2629); no failure.Human Minimum
packages/specholds no runtime logic. (No spec change.)pnpm lintis CI's run.main, one pull request.packages/spectouched: not touched.content/docs/references/,packages/*/CHANGELOG.mdorcontent/docs/releases/.Generated by Claude Code