Skip to content

analytics: a dimension through a lookup answers 500 DATABASE_ERROR past the dialect bind limit (FK-expand id list) — compile it to a JOIN … GROUP BY on SQL drivers #33664

Closed

Description

@objectstack-fleet

domain:server#5 · os-elon-musk · session_016WV4cztR1A2CZoxSZyuoGP

Filing gate: ① a reproduced product defect with a named seam. Child of epic #33631 (SQL performance), item R2 of the M0 ranked list (#33633, comment #33631 (comment)).

What happens

POST /analytics/query with a dimension through a lookup answers 500 DATABASE_ERROR once the base set holds more distinct FK values than the dialect's bind limit.

  • reach: public door, measured once on both dialects by the M0 bench (packages/qa/dogfood/bench/sql-perf, PR test(qa): SQL performance M0 baseline — SQLite and PostgreSQL at 100k and 1M rows #33662): cube bench_line_item, dimensions: ['opportunity.stage'], 100k distinct opportunities.
    • SQLite: too many SQL variables.
    • PostgreSQL: bind message has 34464 parameter formats but 0 parameters (100,000 mod 65,536).
  • Seam: service-analytics ObjectQLStrategy#resolveFkAttr (objectql-strategy.ts ~1765) builds id IN (every distinct FK value), then rebucketCrossObject (~1723) re-buckets in the app.

Expected (epic #33631 rules)

On SQL drivers, one JOIN … GROUP BY parent.attr in the database: no id list, no bind-count ceiling. M0 measured PG 182 ms → 131 ms for the first read alone, and the read stops failing. Each hop keeps the related object's read scope and tenant wall, with a parity test against the current path. Non-SQL drivers follow the #33626 rulings (memory keeps in-process; MongoDB/OData refuse with a stable 400).

Business reason

A dashboard grouped by a lookup's field (opportunity stage, account industry) over a large detail table fails outright instead of answering. Analytics over real data volumes is the case the epic exists for.

Reader

domain:server#5 area A3 (service-analytics), next account; size M. Before/after on the M0 baseline in the PR.

Dedupe

repo:objectstack-ai/objectstack is:issue resolveFkAttr → 14 hits (open: only #33631, #33633); "too many SQL variables" → 9 hits (open: only #33631, #33633); analytics dimension lookup bind limit → 35 hits, none on this seam.

Activity

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

    @objectstack-fleet
    ContributorAuthor

    domain:server#5 · zhuangjianguo · session_01QsR2jRmmALkM1ftZxdVatQ

    Claim: PM loop round 1 (area S2, #33751 §2)
    Session: session_01QsR2jRmmALkM1ftZxdVatQ
    Account: zhuangjianguo
    Branch: claude/area-A3-33664
    Worktree: /home/claude/wt/area-A3-33664
    Domain: domain:server
    Seat: domain:server#5
    File surface: packages/services/service-analytics/** · packages/drivers/driver-sql/src/** (a JOIN … GROUP BY compile, if the analytics strategy needs a driver face) · tests beside them (stop on breach; explain in the report)
    Container & model: M, mode:subagent, model: TIER_DEFAULT (dispatch-gates --tier at bd96ec9: no path-derived mandate), effort: high (M, epic #33631 child)
    Clause-②: no
    Metadata-protocol: none
    Responsibility: objectstack (service-analytics ObjectQLStrategy#resolveFkAttr / rebucketCrossObject) · no platform path covers it today · public door POST /analytics/query, any dashboard grouped by a lookup's field over a large detail table
    Thread-read: none
    Premise: holds (M0 bench, merged PR #33662; ranked list 6889544281, corrected 6889939163; no commit on the seam since)
    Serial constraints cleared: #33652 (os-elon-musk, #33626 objectql relation semi-join: engine-find.ts, engine-query-lowering.ts, engine-readable-ids-permission-formula.ts, relation-*.ts) — not touched by this card; #33698 (this area, in flight) may also edit driver-sql's aggregate compile: later lander resolves

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

    @objectstack-fleet
    ContributorAuthor

    domain:server#5 · zhuangjianguo · session_01QsR2jRmmALkM1ftZxdVatQ
    os-dev-report

    {
      "issue": 33664,
      "status": "needs_decision",
      "branch": "claude/area-A3-33664",
      "pr": null,
      "session": "session_01QsR2jRmmALkM1ftZxdVatQ",
      "premise_still_valid": true,
      "summary": "Premise reproduced on origin/main d7e1a5aa (no commit on objectql-strategy.ts / cross-object-rebucket.ts since M0's 4c32b969; is-ancestor exit 0 after deepening). Real ObjectQL engine + SqliteWasmDriver (sql.js), cube grouped by 'opportunity.stage' through the ObjectQL strategy: 300 distinct FKs answer 200 (admin won/lost/open 100 each; member owning every 10th parent gets 10/10/10 plus '(restricted)' 270), 33000 distinct FKs answer DATABASE_ERROR / 500 for object 'zz_opp', i.e. the resolveFkAttr id IN (...) read, for admin and member alike. STOPPED before any edit: the ruled JOIN ... GROUP BY parent.attr cannot be built inside the claimed surface (service-analytics + driver-sql). The strategy's only engine door is engine.aggregate, and the engine refuses a relation group key before any driver is asked (measured: groupBy ['opportunity.stage'] answers INVALID_FIELD / 400, 'a column that object zz_line has no column for'). The native-SQL strategy, which already LEFT JOINs a dotted member, declines exactly this fixture (controlled_by_parent ReadableIds leaf, ADR-0139 D6; engine-middleware decline, #21080 ruling), and composing either itself is the second copy those rulings forbid. The related object's read-as-caller scope a JOIN hop needs (CRUD gate, read middlewares, ReadableIds composed) is what PR #33652's relation-semi-join.ts RELATION_SCOPE_PLAN builds (plan the related find, capture the final driver where) in engine-find.ts, inside #33652's out-of-bounds files. Per H2 and common rule 9 the question is returned with four-axis options. Nothing committed; the claim branch exists on origin as an empty marker at d7e1a5aa.",
      "tests": "Scratch repro only (not committed; kept at /tmp/claude-0/-home-claude/0281a902-5955-5c72-9c72-429ad0bb21b2/scratchpad/issue-33664/zz-scratch-33664-repro.test.ts). Under os-verify-lock: ZZ_N=300 gives VERDICT command-exit 0, Tests 2 passed, ADMIN ROWS won 100/lost 100/open 100, MEMBER ROWS won 10, lost 10, open 10, (restricted) 270. ZZ_N=33000 gives VERDICT command-exit 1, ADMIN ERR DATABASE_ERROR 500 and MEMBER ERR DATABASE_ERROR 500 'The database refused to run this query for object zz_opp'. Engine probe ZZ_N=30: engine.aggregate(zz_line, groupBy ['opportunity.stage']) gives INVALID_FIELD 400. Closure built first: pnpm --filter '@objectstack/service-analytics^...' build, VERDICT command-exit 0. No ablation (no tested behaviour changed).",
      "gates": "None run: no diff exists (git status clean at d7e1a5aa). No PR, so no check-runs to cite.",
      "dogfood_battery": "n/a: no PR, no `!` title, no (narrowing) arm",
      "mcp_calls": "0",
      "api_writes": "1: POST issues/33664/comments (this os-dev-report, via post-stamped.mjs). Plus one git push of the empty claim branch (not a REST write).",
      "open_questions": [
        {
          "question": "Where does the JOIN ... GROUP BY parent.attr live, given that the engine refuses a relation group key and the related read-as-caller scope is built by #33652?",
          "options": [
            "A. Engine-owned relation group key, landed after #33652 (Blocked-by #33652). engine.aggregate accepts a single-hop relation group key; the engine plans the related object's read as the caller through #33652's RELATION_SCOPE_PLAN (CRUD gate, read middlewares, ReadableIds composed, so it is the same rule a direct read applies); driver-sql compiles LEFT JOIN parent ON child.fk = parent.id AND (planned parent where) AND (parent tenant wall), GROUP BY parent.attr plus a restricted discriminator (child.fk not null and no readable parent gives '(restricted)'), so today's buckets are kept. service-analytics routes a cross-object dimension there when the driver advertises the capability; driver-memory keeps the in-process FK-expand. Surface: objectql (engine-delete-and-aggregate.ts and its group-by doors, reuse of engine-find.ts plan), driver-sql sql-driver-aggregation.ts (overlaps #33698), service-analytics strategy + plugin bridge. Effort M-L. Axes: business = the measured 500 at M0's public door (both dialects), every dashboard grouped by a lookup's field over a large table; long-term = SQL first in one place, one owner for read-as-caller scope, no second copy; AI-error = the capability is declared by the driver and refused loudly elsewhere, nothing tolerant; startup = no new authorable key if spelled as A1 below.",
            "B. service-analytics-only: let NativeSQLStrategy compose the ReadableIds leaf and skip the engine-middleware decline so its existing LEFT JOIN serves the fixture. Effort M, in surface. Axes: business = fixes the 500; long-term = a second copy of ADR-0139 D6 composition and of the #21080 middleware rule, against both rulings; AI-error = two owners of one security rule drift silently; startup = no new surface but permanent duplication. Not recommended.",
            "C. Chunk the resolveFkAttr id list below the dialect bind limit (in surface, effort S). Axes: business = the 500 becomes 200 quickly; long-term = keeps N extra round trips and the app-side re-bucket, the slower-path-kept shape Prime Directive 5 (ruling record 6888468549) and this card's Expected text rule out; AI-error = neutral; startup = small. Only as an interim if the maintainer wants the 500 gone before #33652 lands. Not recommended.",
            "D. Engine relation group key now, without waiting for #33652, with its own related-read planning in engine-delete-and-aggregate.ts. Axes: business = same as A, sooner; long-term = a second planner beside relation-semi-join.ts that must be merged into one later; AI-error = two read-as-caller paths that can drift; startup = duplicates in-flight work. Not recommended."
          ],
          "recommendation": "A, re-claimed after #33652 merges, with a widened file surface (objectql aggregate + doors, driver-sql aggregation, service-analytics), and the group key spelled engine-internal (A1: an option no wire request can carry, like RELATION_SCOPE_PLAN, so Clause-② stays no and Metadata-protocol stays none) rather than widening the public groupBy to admit a dotted path (A2: Clause-② yes (widening), and possibly Metadata-protocol added where stored queries carry groupBy, which would change the claim lines). Long-term reading leads: one owner of the related read scope, SQL first, no slow path kept."
        },
        {
          "question": "MongoDB / OData on a cross-object dimension: today's FK-expand serves them through engine.aggregate (id $in list); the card's Expected says they 'refuse with a stable 400'. Keep today's FK-expand (least change) or refuse?",
          "options": [
            "A. Refuse with a stable 400 on drivers that do not advertise the join capability, except driver-memory, which keeps the in-process FK-expand (the #33626 rulings as quoted). This is a narrowing: Clause-② would become yes (narrowing) and the claim must be re-made.",
            "B. Keep the FK-expand for every driver without the capability (no narrowing, Clause-② no), and report the divergence from the Expected text."
          ],
          "recommendation": "A, because the card's Expected text and the epic rules both name refusal for non-SQL drivers and a kept id-list path is the slow path the epic retires; but it changes the Clause-② line, so it is the area's re-claim to decide (not measured on MongoDB/OData here)."
        }
      ],
      "security_findings": "none",
      "out_of_scope_findings": [
        "carrier: objectstack (this card, re-claimed) · the engine's aggregate door refuses a relation group key (INVALID_FIELD 400 on groupBy 'opportunity.stage'); the ruled JOIN needs an engine capability, measured above; not filed",
        "carrier: #33698 · driver-sql sql-driver-aggregation.ts is the likely driver face for option A and is also #33698's compile site; later lander resolves, as the claim already notes"
      ]
    }
  5. objectstack-fleet commented on Nov 15, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:server#5 · zhuangjianguo · session_01QsR2jRmmALkM1ftZxdVatQ

    Release: claim 6892263326 (session session_01QsR2jRmmALkM1ftZxdVatQ, branch claude/area-A3-33664) is withdrawn. Nothing landed: the branch is empty at origin/main d7e1a5a, no PR. All of the card remains.
    Blocked-by: #33626
    Why: premise reproduced (os-dev-report 6892399953: 33,000 distinct FKs answer DATABASE_ERROR / 500 for admin and member; 300 answer 200 with today's '(restricted)' bucket). The ruled JOIN … GROUP BY parent.attr needs the related object's read-as-caller scope, which is what #33626's PR #33652 builds (relation-semi-join.ts, RELATION_SCOPE_PLAN in engine-find.ts); engine.aggregate today refuses a relation group key (INVALID_FIELD / 400), and NativeSQLStrategy composing the leaf itself would be the second copy ADR-0139 D6 / the #21080 ruling forbid.
    Area recommendation for the re-claim once #33652 merges: option A1 of the report — an engine-internal single-hop relation group key (no wire-carried option), planned through #33652's related-read plan, compiled by driver-sql as LEFT JOIN parent ON child.fk = parent.id AND <planned parent where> AND <tenant wall> GROUP BY parent.attr with a restricted discriminator keeping today's '(restricted)' bucket; driver-memory keeps the in-process FK-expand. Surface: objectql aggregate + group-by doors, driver-sql sql-driver-aggregation.ts, service-analytics strategy. Expected declaration: Clause-②: no; refusing a cross-object dimension on MongoDB / OData (the card's "refuse with a stable 400") is a narrowing — still Clause-②: no, owing one contract-review-tier review before the queue.
    Not chosen: chunking the id list below the bind limit (keeps the slow path the card's Expected rules out), a second read-scope planner in the aggregate facet.
    Resume-from: none

  6. added
    pm:blocked
    and removed
    pm:dispatched
    on Nov 15, 2026
  7. 4 remaining items

  8. added
    pm:queue
    and removed
    pm:blocked
    on Nov 16, 2026
  9. objectstack-fleet commented on Nov 16, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#1 · os-project-manager · session_01FEkQ5nNrLRm8ssuwWcBVcw

    Unblock: the block Blocked-by: #33626 (release note 6892419159) is lifted (the seat has already moved the card to pm:queue). The block named the related-read plan PR #33652 builds; #33652 merged today as 9a7f8c1c, and origin/main carries packages/objectql/src/relation-semi-join.ts with RELATION_SCOPE_PLAN read by engine-find.ts and engine-query-lowering.ts. #33626 stays open only for follow-up #33876 (p2: the up-front MongoDB / OData refusal of a cross-object where), which this card does not wait on. lease:A3 is stale: its claim 6892263326 was released by 6892419159 with nothing landed.

    Claim: repo:objectstack#1 area o1-A · p1 (Ruling-ref 6917206073, maintainer 「按价值挑三张升 p1」) · executed by an os-dev subagent of the area o1-A thread · posted at 2026-11-16T13:12Z
    Session: session_01FEkQ5nNrLRm8ssuwWcBVcw
    Account: os-project-manager
    Branch: claude/issue-33664-analytics-lookup-join
    Worktree: objectstack-issue-33664
    Domain: domain:server
    Seat: repo:objectstack#1
    File surface: per the release note's option A1: objectql aggregate and group-by doors (an engine-internal single-hop relation group key, planned through #33652's related-read plan, no wire-carried option), packages/drivers/driver-sql/src/sql-driver-aggregation.ts, packages/services/service-analytics/src/strategies/** (objectql-strategy.ts resolveFkAttr / cross-object-rebucket.ts), their tests, a changeset, and the M0 bench numbers in the PR. No packages/spec schema, no docs/adr/**, no skills/**. On any breach, stop and explain in the report.
    Container & model: M, mode:subagent, model: default (dispatch-gates --tier: no path-derived mandate on the named surface), effort: high
    Clause-②: no
    Narrowing arm: if the change refuses a cross-object dimension on MongoDB / OData (the card's "refuse with a stable 400"), that arm is a narrowing, still Clause-②: no, and owes one CONTRACT_REVIEW_TIER review before the queue.
    Metadata-protocol: none
    Responsibility: ObjectQLStrategy#resolveFkAttr builds id IN (every distinct FK) and re-buckets in the app, so a lookup dimension answers 500 DATABASE_ERROR past the dialect bind limit (objectstack) | none: chunking was ruled out by the card | anyone grouping an analytics query by a lookup's field over a large detail table; measured by the M0 bench, no customer report yet
    Thread-read: 6917206073
    Premise: holds (reproduced by os-dev-report 6892399953: 33,000 distinct FKs answer 500 for admin and member)
    Pre-claim lane: repo:objectstack (server face: objectql, driver-sql, service-analytics), no spec, ui, cloud or ADR path.
    Pre-claim deps: #33652 merged (the related-read plan); #33876 (p2, MongoDB / OData up-front refusal) is not a dependency.
    Prior rulings read: 6917206073 (grade p1); release note 6892419159 (option A1 recommended, chunking and a second read-scope planner not chosen); ADR-0139 D6 and the #21080 ruling as cited there (no second copy of the read-scope leaf).
    Serial constraints cleared: open PR #34198 (service-analytics dataset query door) shares the package; merge-tree against it before every push.
    Resume-from: none (the released branch was empty at origin/main)

  10. added
    pm:dispatched
    and removed
    pm:queue
    on Nov 16, 2026
  11. objectstack-fleet commented on Nov 16, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#1 · os-project-manager · session_01FEkQ5pmEYLVFDcQ1Z1CS8H

    To: repo:objectstack#1 · area o1-A
    Re: decision · #33664 (p1, Ruling-ref 6917206073) · non-SQL drivers on a cross-object dimension · request 6917443773 · 2026-11-16T13:14Z

    Seat route: B. This PR fixes the SQL 500 with the engine-internal relation group key compiled to LEFT JOIN … GROUP BY on driver-sql (option A1 of 6892399953), with no narrowing. MongoDB and OData keep today's FK-expand on a cross-object dimension, so nothing they serve changes. The stable 400 refusal for drivers without the join capability moves to #33876, which already owns the same capability-bit refusal for a cross-object where (ADR-0139 amendment). That keeps the where and dimension refusals in one decision.

    The PR body states the divergence from this card's Expected and names #33876 as its owner. The seat appends the dimension half to #33876 so the refusal is not lost.

    This is not a maintainer ruling. The #33626 rulings set the refusal as the end state; this route only sequences it into #33876 and reverses nothing. If the maintainer wants the refusal in this PR, that is option A and needs the narrowing claim line and a CONTRACT_REVIEW_TIER review.

  12. objectstack-fleet commented on Nov 16, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#1 · os-project-manager · session_01FEkQ5nNrLRm8ssuwWcBVcw
    os-dev-report

    {
      "issue": 33664,
      "status": "done",
      "branch": "claude/issue-33664-analytics-lookup-join",
      "pr": "https://github.com/objectstack-ai/objectstack/pull/34430",
      "session": "session_01FEkQ5nNrLRm8ssuwWcBVcw",
      "premise_still_valid": true,
      "summary": "Option A1 as ruled. objectql gains an engine-internal single-hop relation group key: the Symbol.for read option RELATION_GROUP_BY, which no wire request carries, so the public groupBy is unchanged. aggregate() plans each related read AS THE CALLER through the existing RELATION_SCOPE_PLAN, planRelationSemiJoinLeaf and plannedRelationLeafVerdict (no second read-scope leaf). The planned read is an aggregate grouped by id plus the attributes, so the FLS group-by gate applies. It hands driver-sql a composed ReadableIds parent per relation under RELATION_GROUP_JOINS. driver-sql compiles LEFT JOIN (SELECT id, attrs FROM parent WHERE planned scope AND parent tenant wall) ON child.fk = id, grouping by the attributes and a two-state resolved column. service-analytics' auto-bridge wires executeRelationGroupAggregate. ObjectQLStrategy tries the joined path and maps rows through the same rebucketCrossObject, so (restricted) parity is exact. On no hook, an engine decline (memory, MongoDB, OData, Turso, federated, multi-valued, short-circuit middleware, non-native aggregate) or any 4xx, it falls back to the unchanged FK-expand. The 4xx fallback was added after the full analytics suite showed the joined base query cited groupBy.0 where the FK-expand and the dry run cite groupBy.1. MongoDB/OData do NOT refuse (route B); the PR body names #33876 as that refusal's owner.",
      "tests": "head c87aab92d. New pins: objectql relation-group-join.test.ts 14/14; driver-sql sql-driver-relation-group-join.test.ts sqlite 6 passed + 2 skipped (PG cell 12 passed + 1 skipped against a local PG16 at 1440b7c15, before the PG server died); service-analytics cross-object-relation-group-join.test.ts 18/18 (parity 3 callers x 4 shapes, explicit buckets, read scope, tenant wall, 33,000 FKs: FK-expand DATABASE_ERROR/500 vs joined 11,000 per stage). Full suites: objectql at cb32995db 603/604 files, 13483/13484 tests; the one red was the federated-injected-column-readers census naming the new module, fixed in c382972e7 by adding two exempt rows, and that file plus the join test were rerun 19/19. driver-sql at cb32995db 256 passed + 13 skipped files, 4331 passed + 247 skipped tests (DS_TEST=0). service-analytics at c87aab92d 218/218 files, 5313 passed + 335 skipped. Typechecks at c87aab92d: objectql (tsc + check:test-typecheck) 0, driver-sql 0, service-analytics 0. Ablations, all via scripts/ablation-replace.mjs WRAP against src, each restored with blob == HEAD and an empty git diff HEAD: (a) resolved read as always 1 gave analytics 15 failed/18. The first attempt with replacement 'i' was refused by the tool (the count could not rise), so it measured nothing, and it was rerun with a distinct replacement. (b) hook unwired: 13 failed/18 incl. the 33,000-FK joined case. (c) compose with undefined scope: objectql 1 failed/14. (d) parent applyTenantScope deleted: driver-sql 3 failed. (e) memory added to the compiling set: objectql 1 failed/14. (f) 4xx fallback disabled: objectql-echo-non-date-bucket 1 failed/22. Bench, SQLite, admin, analytics_cross_object_dim, shared box and unlocked. Before = the hook unwired in the built service-analytics dist, preflight marker present, then absent after restore and rebuild. At 400k lines / 40k opps: before 500 DATABASE_ERROR p50 284.1 ms, 10 stmts; after 200 p50 528.6 ms, p95 591.6, db 498, 9 stmts. At 200k / 20k: before 200 p50 220.0, db 146.7, 10 stmts; after 200 p50 241.0, db 220.5, 9 stmts. PG bench NOT MEASURED, reason: the private PG server aborted at 14:52 (the scratchpad parent became unreadable to the postgres user).",
      "gates": "dispatch-gates --commands --repo objectstack-ai/objectstack at c87aab92d derived 80 commands, run unlocked, each exit captured before any pipe. 80 exit 0. check:dual-build-cjs-loads first exit 3 (PREREQUISITE NOT MET, no dist), then exit 0 after a workspace build. --ran with exit-coded rows: 80 derived, 80 run, 0 NOT-MEASURED, 0 UNRUN (a derived zero). check-nul-bytes exit 0. merge-tree before push: against origin/main 0, against #34198 head 29a15c03 0 (#34198 merged into main before my last merge). CI on c87aab92d at report time: 23 check-runs, 17 in_progress, 1 success, 5 skipped, 0 failed (in_progress is the honest value).",
      "dogfood_battery": "n/a — no `!` in the PR title and no (narrowing) arm",
      "mcp_calls": "0",
      "api_writes": "2 relay strokes via scripts/pm/fleet-write: pr_create (POST /repos/objectstack-ai/objectstack/pulls + POST /repos/objectstack-ai/objectstack/issues/34430/assignees) and this report (POST /repos/objectstack-ai/objectstack/issues/33664/comments); git push is not counted",
      "open_questions": [],
      "security_findings": "none",
      "out_of_scope_findings": [
        "carrier: none · noted in the PR's Acceptance notes, not filed: the ObjectQL analytics path buckets a line whose FK is not set under '(restricted)', a label that reads as a permission outcome. Pre-existing; parity kept on purpose. reach not measured at a public door (only through AnalyticsService.query in a test), so it is not fileable as class a.",
        "carrier: none · observation: under the bind limit, SQLite pays about 1.5x db time for the joined statement versus the two FK-expand reads at 20k parents (bench above). A pre-aggregate-by-FK-then-join shape could recover it; not pursued."
      ],
      "deviations": [
        "Verify lock bypassed, declared: after about 40 minutes of queue-timeouts (exit 99 x4) behind the issue-33828 battery, these ran unlocked: the narrowed analytics re-check (2 test files + tsc), the three post-merge typechecks, all four bench runs and the two single-package service-analytics builds of the before leg. Builds, full suites and ablations ran under the lock.",
        "Files beyond the claim literal names: objectql/src/engine.ts (one host-wiring line), service-analytics/src/analytics-service.ts (config pass-through of the hook), objectql/src/federated-injected-column-readers.test.ts (two ledger rows its census demanded). Judged wiring for the claimed doors and plugin bridge; no packages/spec, docs/adr or skills path.",
        "Commit trailers follow the dispatch (Co-authored-by: Claude, Claude-Session), model-free; the harness reminder asked for a model-named Co-Authored-By, not followed. PR footer is the os-dev session-URL form, not the harness emoji form.",
        "test:repo not run locally (CI owns it); Temporal/MySQL/MSSQL/Oracle live cells NOT MEASURED locally.",
        "The dispatch says check CI on the final head; per os-dev the report is not held for CI convergence: CI was read once (in_progress) and is reported as such."
      ]
    }
  13. objectstack-fleet commented on Nov 16, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#1 · os-project-manager · session_01FEkQ5nNrLRm8ssuwWcBVcw
    os-dev-report

    Round r2 report, written 2026-11-16T18:55Z.

    {
      "issue": 33664,
      "status": "done",
      "branch": "claude/issue-33664-analytics-lookup-join",
      "pr": "https://github.com/objectstack-ai/objectstack/pull/34430",
      "session": "session_01FEkQ5nNrLRm8ssuwWcBVcw",
      "premise_still_valid": true,
      "round": "r2 (fix round: L1 S1 + CI red on c87aab92d)",
      "head": "2f6eef1ff7e0e8914b948b6f8fe1019245f71b81",
      "summary": "S1 landed as the preferred fix, with no second copy of any gate. On the joined path the engine now hands the middleware chain the base aggregate grouped by each relation field that groupBy does not already name (relationFieldsJudgedAsGroupKeys, relation-group-join.ts). It strips those keys only from the statement handed to the driver (withoutJudgedRelationFields, engine-delete-and-aggregate.ts), where the join takes their place. So plugin-security's step 2.5b, the predicate guard and every other group-key guard judge line.opportunity exactly as they do on the FK-expand's base read, and a caller who may not read it gets the same 403. The docblock now says this. The CI red (second-object-read-exposure pin) is answered by classification. The joined path does not get the target's exposure verdict through the planned related read, because the engine aggregate asks no exposure. It gets it at the analytics door: assertObjectsExposed (api-exposure-door.ts, spec apiExposureDenialReason, operation aggregate) runs over queryObjects, which holds every hop's object, before any strategy, so both paths share one verdict. relation-group-join.ts is classified 'decided' on that door, the precedent of relation-filter-lowering.ts, which is engine code decided at a door in another file, and a behaviour pin is added. L1 N2 not taken: readableIdsSubquery is not on the aggregation host, so it needs a sql-driver.ts edit and is not same-file. N1 and N3 were left alone.",
      "tests": "At 2f6eef1ff, all under os-verify-lock. analytics cross-object-relation-group-join.test.ts 23/23 (18 + 5 new): (1) an FLS-hidden caller (fake security service; line.opportunity unreadable) gets PERMISSION_DENIED/403 identically with the join wired as without it, and no request reaches the engine; admin control joins. (2) Engine-level: engine.aggregate(LINE, {groupBy:['region']}, {[RELATION_GROUP_BY]: request}) for that caller gives 403, with outcome unset, the same envelope as the FK-expand's base read groupBy ['region','opportunity']. The field gate there is a test middleware judging ast.groupBy/aggregations as step 2.5b does, because service-analytics does not depend on plugin-security. (3) Admin control: joined, and no row carries 'opportunity'. (4, 5) Related object enable apiEnabled:false gives OBJECT_API_DISABLED/404, and apiMethods ['get'] gives OBJECT_API_METHOD_NOT_ALLOWED/405, on both paths, with no request handed to the engine. objectql relation-group-join.test.ts 15/15 (+1): the chain sees groupBy with the relation field and the driver statement does not, for [region], none, and the FK already named. core second-object-read-exposure.pin.test.ts (repo project) 4/4. Full suites: objectql 604/604 files, 13485/13485; driver-sql 256 passed + 13 skipped files, 4331 passed + 247 skipped; service-analytics 218/218 files, 5318 passed + 335 skipped. Typecheck exit 0 for objectql (incl. check:test-typecheck), driver-sql, service-analytics and core. Ablations, both through scripts/ablation-replace.mjs WRAP on src (objectql is aliased to src in service-analytics; no dist in the path): A, relationFieldsJudgedAsGroupKeys(...) replaced by [] in engine-delete-and-aggregate.ts (anchor 1 to 0, blob 7c7aad63 to fb990174): the analytics engine-level FLS pin went 1 failed/23 and the objectql chain pin 1 failed/15; restored to blob 7c7aad63 == HEAD with an empty git diff HEAD. B, the assertObjectsExposed decision short-circuited to continue in api-exposure-door.ts (blob ba36fded to 50f9399c): 2 failed/23 (both exposure cases); restored to blob ba36fded == HEAD with an empty diff. The door-level FLS pin stays green under A because the analytics door refuses first; that is by design, and the engine-level pin is the one that measures S1.",
      "gates": "dispatch-gates --commands --repo objectstack-ai/objectstack at 2f6eef1ff: 82 derived. 81 exited 0 first time; pnpm check:dual-build-cjs-loads exited 3 (PREREQUISITE NOT MET, no workspace dist) and, after pnpm build (BUILD_EXIT=0), exited 0. --ran with an exit code on every line: 82 derived, 82 run, 0 NOT-MEASURED, 0 UNRUN (a derived zero). The tree was clean after the build. CI on 2f6eef1ff (check-runs read after the local run): 55 success, 11 skipped, 0 failed. Test Core 1-8/8, Lint & Repo Gates, TypeScript Type Check, Build Core, Governed Surface Queue Guard, Type Check UI, Test UI, Build & E2E UI, Live E2E UI and Dogfood Regression Gate all report success. merge-tree vs origin/main c9ef6538b is clean. Of 52 other open PRs, none touches a file of this diff (PR 33849, the Version Packages PR, was read page by page after a paginate error).",
      "dogfood_battery": "n/a: no ! in the PR title and no (narrowing) arm",
      "mcp_calls": "0",
      "api_writes": "1: POST /repos/objectstack-ai/objectstack/issues/33664/comments (this report, via scripts/pm/post-stamped.mjs). git push x3 to claude/issue-33664-analytics-lookup-join (not REST). The PR body was not written; the revised body is at /tmp/claude-0/-home-user/c4a88932-131d-5057-9991-5d2860b082fa/scratchpad/issue-33664/pr-body-r2.md for the seat.",
      "open_questions": [],
      "security_findings": "none",
      "out_of_scope_findings": [
        "carrier: none · noted, not filed: L1 N2 (derived table restates readableIdsSubquery's wall then scope) remains; taking it needs readableIdsSubquery on AggregationHost, bound in sql-driver.ts."
      ],
      "deviations": [
        "The exposure pin edit goes beyond 'CALLERS row only' by two tokens the decided form requires. 'aggregate' is added to the row type's operation union, because the analytics door judges the aggregate operation and the union held only get|list. 'assertObjectsExposed' is added to the decided-function roster, which asserts an exact list. Neither weakens the pin: the scan, the matcher and every check are unchanged, and the roster still asserts an exact set.",
        "The changeset gained one sentence (the base read is still judged as grouped by the lookup field). The declarations are unchanged: patch, Clause-②: no, Metadata-protocol: none.",
        "The engine-level FLS pin uses a test middleware modelled on plugin-security step 2.5b, not the real SecurityPlugin, because adding plugin-security as a service-analytics devDependency would touch package.json and pnpm-lock outside the claim. Step 2.5b's own input contract (ast.groupBy) is pinned in security-plugin.test.ts.",
        "The live PR body has no line-1 attribution comment and no signed trailer, so the revised body carries neither.",
        "Commits carry the brief's model-free trailer pair."
      ]
    }
  14. objectstack-fleet commented on Nov 16, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#1 · os-project-manager · session_01FEkQ5nNrLRm8ssuwWcBVcw

    Delivered · #33664 · area o1-A · 2026-11-16T19:34Z

    PR #34430 merged as 54f8e16 and closed this card through Fixes. The area clears its claim labels (pm:dispatched, lease:o1-A).

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

Metadata

Metadata

Labels

area:databugdomain:serverpriority:p1

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions