Skip to content

Filter placeholders on date / datetime / time columns step around the temporal-comparand door and compare as text (wrong rows, no 400) #35394

Closed
1 of 1 issue completed

Description

@objectstack-fleet

repo:objectstack#5 · os-bill · session_01Utp6CbSphdunq2aJq7ktuY

Filing gate: out-of-scope finding from the os-dev of #34938 (PR #35391), class a, filed by seat 5 (area ux-1) on the seat's word. ⛔ Not a claim. Pre-existing class on main, not introduced by #35391.

What happens

The temporal-comparand door refuses a non-temporal literal compared against a date / datetime / time column (INVALID_FILTER, 400). But isUninterpretableTemporalComparand in packages/core steps around every known placeholder as written (classifyFilterToken !== null), and after resolution judgeResolvedToken checks only date-macro kinds. So a context placeholder (and, once #35391 lands, a period-key placeholder) reaches the driver and is compared as text.

Measured with engine.find on SqlDriver (SQLite) and InMemoryDriver, both the same; not measured over HTTP:

  • {current_user_id} on a date column: $lt returns every row, $eq / $gte return no rows, all 200.
  • The same comparisons with the literal value: refused, INVALID_FILTER 400.
  • {current_week_start} with $gte: correct (a date macro is judged).

A list view, dashboard widget or RLS-adjacent filter that names a non-date placeholder on a temporal column silently returns wrong rows instead of an authoring error.

Expected

The step-around applies to date-macro placeholders only. Context and period-key placeholders on a temporal column are judged like the literal they resolve to (refused 400), or refused as written.

Done when

Pins for {current_user_id} (and {current_iso_week} if #35391 has merged) on date, datetime and time columns answer 400 on both drivers, {current_week_start} still resolves, and the door's ablation turns the pins red.

Dedupe words: temporal comparand placeholder step-around, isUninterpretableTemporalComparand, judgeResolvedToken, context token date column, period-key.

Sub-issues

Sub-issues

1 of 1 Issues completed
Loading 1 sub-issues

Activity

  1. added
    bug
    priority:p2
    pm:queue
    finding
    domain:server
    on Nov 19, 2026
  2. objectstack-fleet commented on Nov 19, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#5 · os-bill · session_01Utp6CajiB6BSQKWowy6YLB

    Claim: PM loop round 10 · area data-2 (seat 5 assignment 2026-11-19T11:41Z, confirmed 2026-11-19T11:42Z) · 2026-11-19T11:43Z
    Area: data-2
    Session: session_01Utp6CajiB6BSQKWowy6YLB
    Account: os-bill
    Branch: claude/issue-35394-context-placeholder-temporal-door
    Worktree: objectstack-issue-35394
    Domain: domain:server
    Seat: repo:objectstack#5
    File surface: packages/core/src/utils/temporal-comparand.ts (isUninterpretableTemporalComparand: the placeholder step-around keeps date macros only) and its test; packages/objectql/src/temporal-comparand-door.ts only if the context-token judgement must sit after resolution; pins in the existing door / driver test files (packages/objectql/src/*temporal*door*.test.ts, SqlDriver + InMemoryDriver); root .changeset/. Callers that read the predicate (import-coerce.ts, record-validator.ts, service-analytics/src/comparand-shape.ts) are measured, not edited, unless a pin shows one changes answer. ⛔ No packages/spec, no docs/adr/**. Stop on breach and report.
    Container & model: M, mode:subagent, model: default — no path-derived mandate, effort: high
    Clause-②: no (narrowing)
    Metadata-protocol: none
    Responsibility: @objectstack/core + objectql in objectstack: a context placeholder ({current_user_id} …) compared against a date / datetime / time column steps around the temporal-comparand door and is compared as text (wrong rows, 200) where the literal it resolves to is refused 400; no platform path covers it; every list view, dashboard widget or filter naming a context placeholder on a temporal column
    Thread-read: none
    Premise: holds — on origin/main the step-around in isUninterpretableTemporalComparand excludes only period-key (#34938, PR #35391 merged 11:39Z), and judgeResolvedToken judges date-macro only; the module note names this card as the open question for context tokens
    Serial constraints cleared: #35391 merged; no open PR in this area claims these files (the dev runs overlap-check before the first push)
    Pre-claim lane: domain:server (packages/core/src/utils/**, packages/objectql/src/**), area data-2 by seat assignment; not on data-1's lease row
    Pre-claim deps: #34938 / PR #35391 (merged)
    Prior rulings read: temporal comparand, placeholder step-around, context token, period key → #34938 module note ("whether they should be is #35394's question"); coordinator rulings ledger 0 hits; ADR none found (git grep -l "temporal.comparand" docs/adr → 0); none conflicts

  3. added
    pm:dispatched
    and removed
    pm:queue
    on Nov 19, 2026
  4. objectstack-fleet commented on Nov 19, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#5 · os-bill · session_01Utp6CajiB6BSQKWowy6YLB
    os-dev-report

    {
    "issue": 35394,
    "status": "done",
    "branch": "claude/issue-35394-context-placeholder-temporal-door",
    "pr": "#35508",
    "session": "session_01Utp6CajiB6BSQKWowy6YLB",
    "head": "dffff8dd18a983f6bc88ec612e0f2de1394aff91",
    "premise_still_valid": true,
    "summary": "isUninterpretableTemporalComparand (@objectstack/core) now judges a context placeholder ({current_user_id}, {current_org_id}) AS WRITTEN on date / datetime / time, so the engine's temporal-comparand door refuses it INVALID_FILTER / 400 before any read, as it refuses the literal id; before, it resolved to the id and compared as text ($lt every row, $eq / $gte none, 200) on SqlDriver and InMemoryDriver alike (measured before/after with a scratch probe over both real drivers). The step-around is now one row per classifyFilterToken kind (PLACEHOLDER_AT_THE_TEMPORAL_RULE, Record over the kind union, so a new spec kind is a compile error until decided): date-macro, unknown and record-context stay stepped around; period-key and context are judged as written. A1 partly falsified by measurement: 'date-macro only' would move {TODAY} / {record_id} on a temporal column from the resolver's FILTER_TOKEN_UNKNOWN / FILTER_TOKEN_UNRESOLVED to this door's INVALID_FILTER, against existing pins (engine-aggregate-having-temporal-door.test.ts unknown-placeholder test, engine-aggregate-positions.test.ts placed_on $gte {TODAY}); route switched per the card's intent, which names only context and period-key placeholders. No context token resolves to a temporal value (CONTEXT_TOKENS = current_user_id, current_org_id), so no post-resolution judgement was needed and temporal-comparand-door.ts is untouched. A2 holds: import-coerce guards with classifyFilterToken first; record-validator's date/datetime arm needs Date.parse-readable and its time arm needs classifyFilterToken === null, so no placeholder reaches the predicate; service-analytics resolves tokens (resolveQueryTokens) before resolveStrategy/canHandle, so comparand-shape only sees the resolved id; analytics suite green unchanged. Card assignee untouched; the PR is assigned os-bill via pr_create.",
    "files": [
    "packages/core/src/utils/temporal-comparand.ts",
    "packages/core/src/utils/temporal-comparand.test.ts",
    "packages/objectql/src/engine-temporal-comparand-door.test.ts",
    "packages/objectql/src/engine-aggregate-having-temporal-door.test.ts",
    ".changeset/35394-context-token-temporal-door.md"
    ],
    "tests": "Tree of dffff8d. pnpm --filter @objectstack/core test exit 0 (Test Files 153 passed (153), Tests 3649 passed (3649)); pnpm --filter @objectstack/core typecheck exit 0 (check:test-typecheck OK, 4 pinned signatures held); pnpm --filter @objectstack/objectql test exit 0 (Test Files 615 passed (615), Tests 13891 passed (13891)); pnpm --filter @objectstack/objectql typecheck exit 0 (check:test-typecheck OK, 233 errors / 64 signatures held, unchanged); pnpm --filter @objectstack/service-analytics test exit 0 (Test Files 218 passed (218), Tests 5606 passed | 345 skipped). Pre-fix red: the new door pin against the unbuilt core dist failed 'due_on $eq {current_user_id}: expected null not to be null'. Ablation on committed head dffff8d via scripts/ablation-replace.mjs: PLACEHOLDER_AT_THE_TEMPORAL_RULE context row -> an expression evaluating to 'stepped-around' (anchor 1->0, blob cf8b82d62c75->823b62a08fe4); core rebuilt; ablation-dist-preflight @objectstack/core: marker present in 2 built files. Mutated: objectql pins Tests 2 failed | 71 passed (73) (the two [#35394] tests, where and having); core pins Tests 1 failed | 29 passed (30) (the [#35394] refusal test). Restored: blob == HEAD cf8b82d62c75, git diff HEAD empty, git status clean; core rebuilt; preflight --absent: marker absent from all 20 built files; objectql 73/73, core 30/30. (A first identical ablation ran on aa57660 with the same red/green; the having pin then moved to its own describe in dffff8d, so it was repeated on the final head.) Real-driver probe (scratch, not committed): before, sql and memory: {current_user_id}/{current_org_id} on due_on/created_date/opens_at -> $eq 200 [], $lt 200 [a,b], $gte 200 []; literal usr_1 -> 400 INVALID_FILTER. After: all 400 INVALID_FILTER; {record_id} 400 FILTER_TOKEN_UNRESOLVED and {TODAY} 400 FILTER_TOKEN_UNKNOWN unchanged; controls due_on $gte {current_week_start} -> 200 [a], owner $eq {current_user_id} -> 200 [a] on both drivers.",
    "gates": "Local: node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack derived 65 families (tree aa57660 + the uncommitted having-pin move, byte-identical to dffff8d); all 65 run, exit codes captured per command before any pipe: 64 exit 0, pnpm check:dual-build-cjs-loads exit 3 PREREQUISITE NOT MET (no dist for 77 packages); re-run after the dogfood closure build: exit 0 ('124 published require entry point(s) across 72 package(s) load'). --ran reconciliation with ':: exit N' records: '65 derived famil(ies) accounted for - 64 run, 1 NOT-MEASURED (1 DERIVED from a recorded exit 3)' (that one since measured green as above). check-adr-0087-registration --base origin/main exit 0: '1 declared-breaking changeset(s), each carrying an ADR-0087 disposition' [BREAKING+bang+clause-2-narrowing] not-required (no-migration-prescription). overlap-check: 'VERDICT clean exit 0' (origin/main merges cleanly, 0 open PR heads share a file). No export renamed or removed, so check-platform-checklist not owed. CI on PR head dffff8d (read once, all 68 check-runs completed, none failed): Lint & Repo Gates success, TypeScript Type Check success, Test Core success (10/10 shards), Build Core success, Governed Surface Queue Guard success, Type Check UI success, Test UI success, Build & E2E UI success, Live E2E UI success, Dogfood Regression Gate success, Check Changeset success, PR-body guards success, Lint · PM dispatch-gates success; Lint UI skipped (path-scheduled). test:repo not run locally (diff touches no repo-project test); CI Test Core covers it.",
    "dogfood_battery": "dffff8dd1 · os-verify-lock: VERDICT command-exit 0 (pnpm --filter @objectstack/dogfood test after pnpm --filter '@objectstack/dogfood^...' build, no OS_TEST_SHARD, no path) · Test Files 482 passed | 3 skipped (485) · Tests 4092 passed | 68 skipped (4160) · no failures",
    "skills_docs": "Skills-docs: none — skills/objectstack-query/rules/filters.md ('Session tokens') teaches {current_user_id} / {current_org_id} as the signed-in user's and organization's ids on an id column (owner_id) and teaches no temporal use; the refusal on a date / datetime / time field is the one the literal id already took (line written into the PR body)",
    "mcp_calls": "0",
    "api_writes": "1 relay stroke (pr_create: POST /repos/objectstack-ai/objectstack/pulls draft + POST /repos//issues/35508/assignees os-bill; read-back identical, 14885 bytes) + 1 os-dev-report comment via post-stamped.mjs (POST /repos//issues/35394/comments); git push x3 (empty branch, aa57660, dffff8d) not REST",
    "deviations": [
    "A1 route switched (measured, see summary): unknown and record-context placeholders stay stepped around; only context joins period-key as judged-as-written.",
    "Real-driver pins: the card's done-when names SqlDriver and InMemoryDriver; objectql cannot import either driver and the REST SqlDriver pin file (packages/rest/src/data-temporal-write-real-day-iso.test.ts) is outside the claim's file surface, so the pins use the door test's recording driver (zero reads asserted) and the real-driver reading is a scratch before/after probe quoted in the PR body. No breach made.",
    "Maintainer brief section: os-dev.md's six-line form was used, not the dispatch's four-line form (os-dev.md wins on conflict).",
    "Attribution header: no HTML-comment attribution line was self-written (os-dev.md forbids dev-authored HTML comments; only a harness-written one is kept); the body opens with 'Fixes #35394' and ends with the session-URL footer block.",
    "Gate union derived on aa57660 plus the uncommitted having-pin relocation, then committed unchanged as dffff8d; not re-derived on the new head because the tree is byte-identical."
    ],
    "open_questions": [],
    "security_findings": "none",
    "out_of_scope_findings": [
    "carrier: none · noted, not filed — temporal-comparand-door.ts module note (Scope section) still says '{placeholder} strings are stepped around'; stale since the period-key change, outside this card's file surface; in PR Acceptance notes",
    "carrier: none · noted, not filed — the door's refusal for a context or period-key placeholder uses the junk-literal consequence sentence ('compare false for EVERY row') although $lt answered every row; pre-existing wording shared by the whole class; in PR Acceptance notes"
    ]
    }

  5. objectstack-fleet commented on Nov 19, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#5 · os-bill · session_01Utp6CajiB6BSQKWowy6YLB
    os-dev-report

    {
      "issue": 35394,
      "status": "done",
      "branch": "claude/issue-35394-context-placeholder-temporal-door",
      "pr": "https://github.com/objectstack-ai/objectstack/pull/35508",
      "session": "session_01Utp6CajiB6BSQKWowy6YLB",
      "premise_still_valid": true,
      "summary": "Round 2 (contract review S1, prose only). One commit cd3f820f8 on 4594e552c edits only .changeset/35394-context-token-temporal-door.md (+10/-2). Line 12: the aggregate verb now reads 'its where, each aggregation's filter and its having' (engine-delete-and-aggregate.ts:1143). Line 19 names the sessionless code move. Lines 21-25 name IObjectQLEngine.judgeFilter (with and without a session), lint's row-scope predicate rule (code and hint), and the analytics read-scope admission as an upgrade consequence only: refused at compile, READ_SCOPE_COMPILE_FAILED / 500, with a dashboard returning 500 until the clause is rewritten. Line 27 adds the row-level-security fix 'owner == current_user.id'. Every claim was measured before and after with an uncommitted probe on a real engine. The PR body was not touched; the PM mirrors the sentences into it. The PR is still a draft.",
      "tests": "Before/after probe at head 4594e552c, uncommitted and deleted afterwards. packages/objectql/src/zz-scratch-35394-probe.test.ts used a real ObjectQL with a recording driver plus @objectstack/lint validateRlsPredicateEnforceability with the engine's bound judgeFilter. packages/services/service-analytics/src/__tests__/zz-scratch-35394-probe.test.ts ran AnalyticsServicePlugin over a real ObjectQL and SqliteWasmDriver on the ObjectQL face, with the context userId u_me. AFTER (HEAD core), for due_on, created_date and opens_at x {current_user_id}, ${current_user_id} and {current_org_id}: judgeFilter $lt with a session gave {ok:false, INVALID_FILTER, 400}, and without a session also INVALID_FILTER/400. judgeFilter with operation aggregate gave INVALID_FILTER/400. find with no session gave INVALID_FILTER/400. aggregate with aggregations[].filter and a session gave INVALID_FILTER/400. Driver reads: 0. Lint for due_on (less-than) '{current_user_id}' and for created_date >= '{current_org_id}' gave rls-predicate-unenforceable 'RLS using (INVALID_FILTER / 400): ...' with the hint 'Rewrite the comparison the engine names: ...'. Analytics read scope closed_on $lt {current_user_id} gave READ_SCOPE_COMPILE_FAILED/500, and closed_at (datetime) $lt {current_user_id} gave READ_SCOPE_COMPILE_FAILED/500. Controls: subject $eq {current_user_id} on judgeFilter gave ok:true with a session and FILTER_TOKEN_UNRESOLVED without one, the lint finding on subject stayed FILTER_TOKEN_UNRESOLVED with the current_user-key hint, and the analytics scope owner $eq {current_user_id} was served. BEFORE: packages/core/src/utils/temporal-comparand.ts was replaced by its 921211960 blob (hash checked on disk), then core was rebuilt; ablation-dist-preflight @objectstack/core PLACEHOLDER_AT_THE_TEMPORAL_RULE --absent passed with the marker absent from all 20 built files. judgeFilter with a session gave ok:true and without one FILTER_TOKEN_UNRESOLVED/400. judgeFilter(aggregate) with a session gave ok:true. find with no session gave FILTER_TOKEN_UNRESOLVED/400. aggregations[].filter with a session gave ok. Lint gave 'RLS using (FILTER_TOKEN_UNRESOLVED / 400)' with the 'Write the caller's value as a current_user key' hint. The analytics closed_on and closed_at {current_user_id} scopes were admitted (no refusal). The closed_on {current_org_id} scope was READ_SCOPE_COMPILE_FAILED in both legs, because the probe context carried no tenant and the resolver refused it, so it is not a moved reading. RESTORE: git checkout HEAD -- path, the hash cf8b82d62 equals the HEAD blob, git diff HEAD on the path was empty, and core was rebuilt. The preflight dist reading found the marker present in 3 built files. The preflight tree reading exited 3 only because the two untracked scratch probe files were still present. They were then deleted, and git status --porcelain was empty before the commit. The before-leg wrapper VERDICT was command-exit 7 for that tree reading alone. The after-leg VERDICT was command-exit 0, with 1/1 test in each probe file.",
      "gates": "Local, narrowed to the changeset-only diff (declared narrowing: the code hunks are unchanged from round 1, and CI ran the full derived union on this head). Each exit code was captured before any pipe, and every one was 0: check-adr-0087-registration --base origin/main (the no-migration-prescription exemption was read), check-adr-0087-registration --self-test (819 assertions), check-changeset-no-major --base origin/main, check-empty-changeset --base origin/main, check-empty-changeset --self-test, check-closing-keyword-parity, check-issue-citations, pnpm check:issue-citations, docs-audit check-affected-docs, check-drift-comment, pnpm check:changeset-gate-self-tests, pnpm check:nul-bytes (26084 files, no control bytes), check-comment-mask-corpus (22952 files, 0 disagree). dispatch-gates --commands --repo objectstack-ai/objectstack was derived at 4594e552c and warned STALE TREE, 7 commits behind origin/main; no base merge was taken, per the brief. --ran reconciliation was not run, because the derived list is the whole PR's union and CI owns it. CI on head cd3f820f8: 57 success, 11 skipped, 0 failure or in-progress. These include Check Changeset, Test Core 1-10/10, Lint & Repo Gates and every Lint shard, TypeScript Type Check, Type Check workspace/consumer/source/debt, and Type Check UI.",
      "dogfood_battery": "cd3f820f8 · os-verify-lock VERDICT command-exit 0 (held 39m58s) · pnpm --filter @objectstack/dogfood test · Test Files 482 passed | 3 skipped (485) · Tests 4092 passed | 68 skipped (4160) · no failures. The closure (dogfood^...) was built at 4594e552c, whose source is identical apart from the changeset, and @objectstack/core was rebuilt after the before-leg restore.",
      "mcp_calls": "0",
      "api_writes": "1 — POST repos/objectstack-ai/objectstack/issues/35394/comments (this os-dev-report, via post-stamped.mjs). The git push of cd3f820f8 is not a REST write.",
      "open_questions": [],
      "security_findings": "none",
      "out_of_scope_findings": ["carrier: none · noted, not filed: the review's N3 and N4 stale-prose nits still stand outside this diff (temporal-comparand-door.ts:93 and :741, engine-top-level.ts:954, import-coerce.ts:350-351, filter-number-comparand-declared-type.ts:181-182, validate-rls-predicate-enforceability.ts:205-208). They are seat-routed per the review and were untouched here (file fence)."]
    }

    Changeset sentences added (lines 19, 21-25, 27; line 12 amended) are quoted verbatim in the committed file at cd3f820.

  6. objectstack-fleet commented on Nov 19, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#5 · os-bill · session_01Utp6CajiB6BSQKWowy6YLB

    Closed-out · area data-2 · 2026-11-19T15:54Z

    reading value
    PR #35508 MERGED through the merge queue as 3cfa5bc8 (Fixes #35394; this card closed completed)
    contract record narrowing face, CONTRACT_REVIEW_TIER: 7011051316 PASS with S1, delta 7013373527 PASS (S1 closed); L1-a ACCEPT 7010600154; landed with security

    Delivered: a context placeholder (current user, current organisation) used as a filter value on a date, datetime or time field is refused, naming the field, as the id it resolves to already was. Before, it was compared as a date and silently returned wrong rows. Date placeholders such as start of this week are unchanged.
    Follow-ups: #35522 (review nits N3 / N4, p3; left for the data seat).
    State: pm:dispatched removed; card closed.

  7. removed
    pm:dispatched
    on Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:databugdomain:serverfindingpriority:p2

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions