Repository navigation
Description
repo:objectstack#7 · os-alice · session_011y7As6FyXmJyGyHNKXUkV7
Carries the folded field-reference item of #36189 (comment 7069451763); #36189 keeps the $contains / $notContains membership fix, delivered by PR #36675. Split by the claimant because the os-dev on #36189 measured a different mechanism.
Filing gate ① · Source: fleet · found by the os-dev on #36189 (report on PR #36675, out_of_scope_findings), measured on origin/main 3cf6a44.
What happens
The analytics draft preview (POST /api/v1/analytics/dataset/query?preview=draft, the face Studio's preview mode reads) never resolves a { $field: … } comparand. matchesWhere in packages/services/service-analytics/src/preview-evaluator.ts compares the row value with the reference object itself (as a string, [object Object]). So every field-reference filter answers a wrong count on the preview, while the live faces resolve it or refuse it:
- Scalar text pair (
labelvsalias), counts native / objectql / preview:label $eq {$field:'alias'}2 / 2 / 0;$ne2 / 2 / 4;$gt0 / 0 / 2. - Multi-value reference (the case folded into analytics: the draft preview answers $contains on a multi-value field as a substring of the stringified array, not membership #36189):
label $eq {$field:'tags'}(and{$field:'picks'}, aselectdeclaredmultiple: true) answers native and objectql400 INVALID_FILTER, preview200count 0;$neanswers 400 / 400 against preview200count 4.
Measured at AnalyticsService.queryDataset with previewDrafts on the production plugin composition (ObjectQL + SqlDriver on SQLite, 4 rows), not over HTTP.
Done when
- On the draft preview, a
{ $field }comparand gives the live faces' answer: a scalar-to-scalar reference compares the two columns of the row, and a reference to a multi-value or JSON column is refused with the live faces'400 INVALID_FILTER. - The other choice, refusing every field reference on the preview with a named 400 instead of resolving it, is open to the claimant only if the live faces' resolution rules cannot be reused. Say why in the PR.
- Pins: the scalar
$eq/$ne/$gtrows above, with the native count as the expected value, and the multi-value$eq/$nerows assertingcodeandstatus. Ablation: drop the new field-reference arm and the scalar$eqpin goes red.
reach: public HTTP door POST /api/v1/analytics/dataset/query?preview=draft, measured at the service with the production composition, not over HTTP. Real producer: Studio's preview mode.
Business reason: an author previewing a dataset or dashboard filter that compares two fields sees counts that change after publish, with no error, so they tune the filter against wrong numbers.
Reader: area:data · service-analytics draft preview (triage sets the domain).
Dedupe: preview field reference → 392 hits, preview $field comparand → 79, draft preview cross-field → 77, matchesWhere field reference → 10. The only open hit naming the defect is #36189, which this card splits from. The others are unrelated: #36269, #25950, #25921.
Grade: p2 · Bug · a silent wrong count on an authoring preview, the same grade as #36189.
Activity
objectstack-fleet commentedon Nov 23, 2026
triage#1 · hotlong · session_01Q4EjjMnyLqJdzuktEmRPXH
Triage: lands in
area:data·domain:server·priority:p2· Bug ·pm:queue.Rationale: the analytics draft preview never resolves a
{ $field }comparand, so every field-reference filter shows a wrong count in Studio's preview mode (measured:$eq0 vs live 2,$ne4 vs live 2; multi-value 200 vs live 400). Only the authoring preview is affected — live native and objectql faces answer correctly or refuse — so no stored or served data is wrong. That makes it p2, not p1, though the author is shown a misleading number. Seat grade p2 kept. Split from #36189, whose membership fix ships in PR #36675.objectstack-fleet commentedon Nov 25, 2026
repo:objectstack#7 · os-alice · session_011y7As92T28dA9wc7wtu3iE
Claim: PM loop (seat-run dev) — claimed at 2026-11-25T13:02Z
Session:
session_011y7As92T28dA9wc7wtu3iEAccount:
os-aliceBranch:
claude/issue-36677-preview-field-refWorktree:
objectstack-issue-36677Domain:
domain:serverSeat:
repo:objectstack#7File surface:
packages/services/service-analytics/src/**(preview-evaluator.tsmatchesWherefield-reference arm, reusing the live faces' resolution rules) and its tests,.changeset/**(stop on breach; explain in the report)Container & model:
M,mode:subagent,model: default opus (dispatch-gates --tier: no path-derived mandate),effort: highClause-②: no
Metadata-protocol: none
Responsibility:
objectstack (service-analytics draft preview evaluator) | the live native/objectql faces already resolve or refuse $field | an author previewing a dataset or dashboard filter that compares two fields in Studio's preview modeThread-read: 7098963990
Premise: holds (measured by the filer on origin/main 3cf6a44; the card is two days old, so the dev reproduces first)
Serial constraints cleared: in flight in this seat: #37143 (card thread; spec/ai + ui surface, no overlap). Concurrency 2 (maintainer, 2026-11-25T13:01Z).
objectstack-fleet commentedon Nov 25, 2026
repo:objectstack#7 · os-alice · session_011y7As92T28dA9wc7wtu3iE
os-dev-report
{ "issue": 36677, "status": "done", "branch": "claude/issue-36677-preview-field-ref", "pr": "https://github.com/objectstack-ai/objectstack/pull/37299", "session": "session_011y7As92T28dA9wc7wtu3iE", "premise_still_valid": true, "summary": "Reproduced on origin/main e845656d (label $eq/$ne/$gt {$field:alias}: native 2/4/1, preview 0/6/4; multi-value refs native 400, preview 200). The draft preview now resolves a { $field } comparand under the six scalar operators with the shared cross-field corpus truth table (new preview-field-reference.ts, arm in matchesWhere), and refuses INVALID_FILTER/400 what the live faces refuse: no-class or cross-class pairs via spec crossFieldComparisonVerdict, undeclared column, dotted path, a reference in $in/$nin or under a text-pattern operator (this package's own where-door sentences). The ruling's refuse-everything alternative was not taken because the live rules are reusable. One deliberate gap each way: an addDays offset reference is refused by name on the preview (live serves it on date/datetime; the only in-memory day-shift is private to @objectstack/formula), and the tenant-isolation column is NOT judged on the preview (it has no tenant-column fact) - see open_questions.", "tests": "New src/__tests__/preview-field-reference-36677.test.ts on the production composition (ObjectQL + SqlDriver/SQLite): scalar $eq/$ne/$gt (+$gte/$lt/$lte, numeric pair, $not, $or, self-ref) native=objectql=preview=native count (2/4/1 for the card's three); multi-value $eq/$ne on tags and select-multiple, plus cross-class/undeclared/dotted/$in/$contains/addDays: code INVALID_FILTER + status 400 on all three faces; driver-sql CROSS_FIELD_CASES row-for-row, CROSS_FIELD_REFUSALS refused except the two tenant rows, CROSS_FIELD_OFFSET_CASES offset rows refused by name and bare controls served. Pin file on 8a7f8ff4: Tests 116 passed (116). Package suite on 93701005 under lock: Test Files 227 passed (227), Tests 5897 passed | 345 skipped (6242), exit 0 (8a7f8ff4 only retyped the test file's corpus declarations). Typecheck: tsc --noEmit red on 93701005 (one TS2352 in the new test), fixed in 8a7f8ff4, re-run exit 0. Ablation: matchesWhere arm replaced via scripts/ablation-replace.mjs (injected text count 1) -> 12 scalar pins red (Tests 12 failed | 104 skipped) incl. the card's scalar $eq pin; restore proven blob 821f350cb98d == HEAD blob, git diff HEAD empty; subject imported from src so no dist leg.", "gates": "Local: all 65 families from dispatch-gates --commands at 8a7f8ff4, each 'cmd :: exit N' captured before any pipe: 61 exit 0; NOT MEASURED 4: node scripts/check-plugin-teardown-shape.mjs --self-test exit 3 (shallow clone, positive control unreachable), pnpm check:dual-build-cjs-loads exit 3 (needs full pnpm build), pnpm check:query-options-erasure and pnpm check:type-check-debt exit 124 (my local 300s cap). dispatch-gates --ran: 'Run reconciliation - 65 derived, 61 run, 4 NOT-MEASURED, 0 UNRUN' exit 0. CI at 8a7f8ff4 when reported: 0 success, 5 expected skip, 0 failed, 18 pending (Lint & Repo Gates and TypeScript Type Check not yet present) - in_progress, not waited for (trial). l1-face --pr 37299: exit 4 INCOMPLETE only on floor-checks/all-checks (CI pending); every other item ok, nothing flagged.", "dogfood_battery": "n/a - no ! in the PR title and no (narrowing) arm", "mcp_calls": "0", "api_writes": "2 - fleet-write relay pr_create (workflow dispatch, request fw-20261125T135339Z-64636c, run 45628229264, created PR #37299, body read back 6014/6014 bytes identical); post-stamped issue comment on #36677 (this report). git push is not counted.", "open_questions": [ { "question": "The draft preview does not judge the tenant-isolation column: { label: { $eq: { $field: 'organization_id' } } } is refused 400 by both live faces but compared on the preview (measured count 2). Closing it needs the tenant column handed to AnalyticsService, i.e. a change to the exported AnalyticsServiceConfig shape. How should it close?", "options": [ "A: add an optional config reader (e.g. tenantFieldOf(object)) wired by AnalyticsServicePlugin from core resolveTenantFieldName(engine.getObject(object)); the preview refuses that column on either side. Cost: one exported-type widening + plugin wiring + 2 pins, small; needs the export-shape ruling.", "B: refuse a reference to core DEFAULT_TENANT_FIELD by name on the preview. No export change, tiny; wrong for a tenancy-disabled object that declares organization_id (over-refusal) and misses a custom tenancy.tenantField (silent).", "C: leave it - a filter comparing a column to the tenant id is rare on an authoring preview; record as a known boundary." ], "recommendation": "A, because it reuses the one tenancy predicate the engine and driver read and keeps the preview's answer equal to the live faces with no second rule; it is a small separate card." } ], "security_findings": "none", "out_of_scope_findings": [], "files_changed": [ ".changeset/preview-field-reference-comparand.md", "packages/services/service-analytics/src/preview-field-reference.ts", "packages/services/service-analytics/src/preview-evaluator.ts", "packages/services/service-analytics/src/__tests__/preview-field-reference-36677.test.ts" ], "line_budget": "548 changed lines (+546 / -2, 4 files) vs merge base e845656d; under the 3000 human-merge threshold; all files inside the claim's surface", "deviations": [ "试行偏离: verify lock - two acquisitions (dep-closure build; then build+typecheck+package tests), each a single attempt that found the lock free; no waiting, no polling.", "试行偏离: no CI wait - report delivered with 18 checks pending.", "试行偏离: local gates = package tests + typecheck + all dispatch-gates --commands families; 4 NOT MEASURED as listed in gates.", "试行偏离: scripts/pm/** source not opened; pr_create keys learned from --help and a --dry-run refusal.", "Outside the lock: the per-file vitest runs of the new pin file (measurement matrix, pins, ablation) and the tsc --noEmit re-run after the typing fix.", "First closure build ran with OS_SKIP_DTS=0 set by me (read as 'set', declarations skipped); the second locked build produced .d.ts and the typecheck ran against it.", "The harness attribution reminder named a model in the Co-Authored-By trailer and a different PR footer; the dispatch's model-free trailer and AGENTS.md's session-URL footer were used instead." ], "tool_calls": "about 55 (Bash, Read, Write, Edit-free); 0 MCP" }objectstack-fleet commentedon Nov 25, 2026
repo:objectstack#7 · os-alice · session_011y7As6JrAPNfuwC2RLXXGu
Closed by PR #37299 (merged 2026-11-25T14:53Z). Clearing
pm:dispatched. Follow-up for the tenant-column boundary: #37312.fix(service-analytics): draft preview answers $contains on a multi-va…
fix(service-analytics): the draft preview resolves a { $field } compa…