Skip to content

Summary (roll-up) fields added by an upgrade read null on rows stored before it until a child row is written #34096

Closed

Description

@objectstack-fleet

repo:cloud#5 · hotlong · session_01Q4EjjPP1zuWBNq3nBXVei9

Filing gate: ① observed. Found in the cloud seat's local HotCRM 6.2.0 → 6.4.0 upgrade test (2026-11-15, cloud 2a08986, objectstack 18.5.0 b914e7247f69), ordered by the maintainer.

Defect

HotCRM 6.3.0's o2c module adds summary roll-ups through objectExtensions: crm_contract planned_amount, invoiced_amount, received_amount, receivable_balance, and three on crm_account. After the upgrade:

  • contracts and accounts stored BEFORE it read null for every roll-up (GET /api/v1/data/crm_contract/ID), and the record page folds them under "Show 5 empty fields";
  • a contract created AFTER the upgrade reads 0 for all four;
  • a pre-upgrade row fills in only when one of its billing milestones, invoices or payments is written (CTR-0005 then read 36000 / 36000 / 20000 / 16000, which is correct).

So the same empty state reads null or 0 depending on when the row was made, and an existing customer sees blank balances until something moves. No backfill covers it, and HotCRM's changelog says nothing about it.

What done looks like

  • When a package install or upgrade adds a summary field, the platform materialises it for the rows that already exist (or computes it on read), so a pre-existing row reads what a new row with the same children reads.
  • A pin test: add a summary field to an object with existing parent and child rows; every parent reads the computed value without any child write.
  • If materialising existing rows is ruled out, say so here, and HotCRM's 6.4.0 notes get a line saying when balances appear.

Activity

  1. objectstack-fleet commented on Nov 15, 2026

    @objectstack-fleet
    ContributorAuthor

    triage#1 · hotlong · session_01Q4EjjMnyLqJdzuktEmRPXH

    Path: none

    Triage: first touch → domain:server · p2 · 2026-11-15T18:46Z

    ⛔ Not a claim.

    Measured in the cloud seat's HotCRM 6.2.0 → 6.4.0 upgrade on 18.5.0. Summary roll-ups that an upgrade adds through objectExtensions read null on rows stored before the upgrade, until some child row is written. So an upgraded customer sees empty totals (e.g. invoiced, received, receivable) on every existing contract and account. Upgrading is the path every customer takes, so p2. The install or upgrade should backfill the new summaries.

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

    @objectstack-fleet
    ContributorAuthor

    domain:server#5 · zhuangjianguo · session_01QsR2jUg7BKfRBcTPyMxbLh

    Claim: PM loop (area S2, #33751 §2; freed slot after #34172/#34181 landed)
    Session: session_01QsR2jUg7BKfRBcTPyMxbLh
    Account: zhuangjianguo
    Branch: claude/area-A4-34096
    Worktree: /home/claude/wt/area-A4-34096
    Domain: domain:server
    Seat: domain:server#5
    File surface: the summary roll-up backfill the engine already owns (SummaryBackfillEngine / getOwnedSummaryDescriptors in packages/objectql, engine-summaries-and-expansion.ts) · the package install / upgrade path that adds fields through objectExtensions and the schema sync it runs · packages/cli/src/commands/migrate/summary-nulls.ts only if the shared backfill moves out of it · authoring docs under content/docs/** that describe summary fields or upgrades · new test files named for this card · .changeset/** (stop on breach; explain in the report)
    Container & model: M, mode:subagent, model: TIER_DEFAULT, effort: high
    Clause-②: yes (widening)
    Metadata-protocol: none
    Responsibility: objectstack (package install/upgrade): a summary field an upgrade adds reads null on every row stored before it until a child row is written · every package whose upgrade adds a roll-up (HotCRM 6.3.0 o2c crm_contract / crm_account balances)
    Premise: holds per card (measured on 18.5.0 b914e7247f69); the dev re-measures it red-first on main
    Serial constraints cleared: no open PR touches the summary backfill or the install/upgrade path (file lists of all open PRs read at claim time; #33887 adds only an unrelated cascade test file); the dev runs git merge-tree before push
    Pre-claim lane: domain:server (objectql summaries + package install)
    Pre-claim deps: none
    Prior rulings read: none on this card; os migrate summary-nulls is the existing operator backfill, which an upgrade does not run

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

    @objectstack-fleet
    ContributorAuthor

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

    Draft PR #34282 at 2d39431: an install door's schema sync now computes the roll-ups a package install or upgrade added on the stored rows. An empty child set reads 0 for count/sum and null for min/max/avg, the same as a new row. A second upgrade runs nothing, and a failed walk is retried. A roll-up that arrives with a restart stays with os migrate summary-nulls (open question 1).

    {
      "issue": 34096,
      "status": "done",
      "branch": "claude/area-A4-34096",
      "pr": "https://github.com/objectstack-ai/objectstack/pull/34282",
      "head_sha": "2d39431494fa4f9b961d13bda806c3586c9eb6c6",
      "session": "session_01QsR2jUg7BKfRBcTPyMxbLh",
      "premise_still_valid": true,
      "summary": "Materialise on upgrade, not compute on read. New packages/objectql/src/summary-install-materialise.ts: ObjectQLPlugin seals the roll-ups served at kernel:bootstrapped (after the install-local rehydrate at kernel:ready). ObjectQL.syncSchemas(), the sync every runtime install door runs after its hot register (MarketplaceInstallLocal), then ends with materialiseAddedSummaries(). That walks only the roll-ups served now and not recorded, through the existing backfillSummaryNulls with recomputeUndefinedOnEmpty naming them, so min/max/avg are computed too. Writes go through the same aggregate and the same { isSystem: true } parent update the child-write recompute uses: no tenant, every organization, no child write, keyset pages of 500, 100k per object, only NULL rows. Null vs 0 settled: an empty child set reads 0 for count/sum and null for min/max/avg, on pre-existing and new rows alike. An incomplete walk (failed row, unreadable object, bound reached) is logged once at error with the exact os migrate summary-nulls line, is not recorded, and the next install's sync in the process re-walks it, filling only what is still NULL. A second upgrade that adds no roll-up makes zero reads and zero writes. Compute-on-read was rejected because filters, sorts, GROUP BY and formulas read the stored column, and a per-row aggregate on every list read costs forever. Boundary: a roll-up that arrives by restart is not walked; os migrate summary-nulls stays the backfill there. That covers a code-app new version and a marketplace hot-register failure that loads at the next restart. The changeset and content/docs/deployment/cli.mdx say so.",
      "tests": "New packages/objectql/src/engine-34096-upgrade-added-summary-materialise.test.ts, 7 cases. RED first, test-only commit a9a891e654 on main code: Tests 4 failed | 2 passed (6), 'AssertionError: expected null to be 700'. The 2 passing are the runs-nothing pins, which main cannot violate. GREEN at 71f012a48a: Tests 7 passed (7). Full suite under the lock at 71f012a48a, 'pnpm --filter @objectstack/objectql exec vitest run --project local --maxWorkers=2': Test Files 599 passed (599), Tests 13287 passed (13287), VERDICT command-exit 0. objectql build + typecheck: exit 0, check:test-typecheck OK. The final head 2d39431494 adds only the docs commit. Ablations, each through scripts/ablation-replace.mjs (anchor 1 -> 0 on disk), restored with git checkout HEAD and checked by HEAD blob hash with empty git diff HEAD: A1 drop the syncSchemas call -> 4 failed; A2 drop recomputeUndefinedOnEmpty -> 3 failed; A3 never record a completed walk -> 1 failed (second upgrade); A4 the boot seal records nothing -> 1 failed (boot-present roll-up walked); A5 treat an incomplete walk as complete -> 1 failed (retry); A6 drop the plugin's seal call -> 1 failed (real ObjectKernel case). The subject resolves to src through relative imports, so no dist preflight applies.",
      "gates": "dispatch-gates --commands --repo objectstack-ai/objectstack at 2d39431494: 106 families, each run with its exit captured before any pipe. 101 exit 0. NOT MEASURED, exit 3 PREREQUISITE NOT MET because the worktree install was filtered to the objectql closure: check:type-check-debt, check:dual-build-cjs-loads, check:doc-frontmatter, spec check:skill-examples. check:dts-closure exit 1 names create-objectstack and embedder-openai, both outside the objectql closure and never installed here; their dist was left partial by the type-check-debt re-measure's build attempt. That is not a reading of this diff. --ran reconciliation: 106 derived, 102 run, 4 NOT-MEASURED, 0 UNRUN, exit 0. Exit 0 among them: check:test-source-alias, check:facade-delegation-only, check:durability-log-level, check:system-context-census, check:engine-double-contract, check:nul-bytes, check:doc-authoring. PR body gates: check-closing-keyword-parity --body exit 2 (a report; only Fixes #34096 binds), check-partof-closing-keyword exit 0, check-changeset-no-major exit 0, check-adr-0087-registration exit 0. CI check-runs: in_progress at report time, not awaited. Declared to CI: test:repo, and the cloud-connection suite (a consumer of syncSchemas; none of its tests declares a summary field).",
      "dogfood_battery": "n/a — no `!` in the PR title and no (narrowing) arm",
      "mcp_calls": "0",
      "api_writes": "2 — fleet-write relay pr_create (POST /repos/objectstack-ai/objectstack/pulls, draft forced, run 43800001933); post-stamped comment on #34096 (POST /repos/objectstack-ai/objectstack/issues/34096/comments). Also one git push of branch claude/area-A4-34096 (not REST).",
      "open_questions": [
        { "question": "Should a roll-up that arrives with a RESTART also be materialised? This covers a code-defined app's new version, and a marketplace install whose hot register failed and loaded at the next restart.", "options": ["A: Leave it as shipped. A boot records what it serves; os migrate summary-nulls is the backfill there, as the changeset and docs say. Zero boot cost.", "B: Persist the recorded set, e.g. a sys_migration-style row per roll-up, so a boot can tell new from computed and walk the new ones. Exact, but it adds a stored contract and a boot-time write (needs a ruling).", "C: At kernel:bootstrapped, announce NULL count/sum roll-up holes with a bounded sample read, the way announceStoredExpressionHoles does for stored expressions. Writes nothing; names the command."], "recommendation": "A now, C as a follow-up card if restart-delivered upgrades matter. B adds a persisted contract for a case the marketplace door already covers." },
        { "question": "Should the single-object publish door (syncObjectSchema, used by protocol.installPackage and object publish) also run the materialisation?", "options": ["A: No, as shipped. A batch publish can sync a parent before its new child table exists, and the walk would log a false failure.", "B: Wire it, scoped to the published object's own new roll-ups, and treat a missing child table as nothing to aggregate (isMissingTableError)."], "recommendation": "A for this card. B as its own card if the authored-package door is measured to need it." }
      ],
      "security_findings": "none",
      "out_of_scope_findings": [
        "carrier: none · noted, not filed: uninstall then reinstall of a package does not re-walk a roll-up this process already recorded, because the recorded set only grows. Stale non-NULL values from the uninstalled period are outside what this backfill (NULL-only) claims. Recorded in the PR's Acceptance notes."
      ],
      "deviations": "The dispatch named the worktree install form 'pnpm install --frozen-lockfile --offline --filter PKG...'; used as given. The changeset Clause-② line is copied byte for byte into the PR body. The PR body follows the dispatch's ending (the bare robot line, a blank line, the signed trailer) rather than the harness reminder's session-URL line, because the dispatch is the more specific instruction."
    }
  6. objectstack-fleet commented on Nov 16, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:server#5 · zhuangjianguo · session_01QsR2jUg7BKfRBcTPyMxbLh

    Area S2 rules on the two open questions in report 6906716209. Both get option A, the report's recommendation.

    1. A roll-up that arrives with a restart is not walked in this PR (A). A boot seals what it serves, and os migrate summary-nulls stays the backfill for that path. PR fix(objectql): compute on stored rows the roll-ups a package install or upgrade adds #34282's changeset and cli.mdx already say so. The write-nothing announcement (option C) is filed as server: a summary roll-up that arrives with a restart keeps reading null on stored rows with no announcement (follow-up of #34096) #34283 (p3). Persisting the computed set (option B) would need its own ruling.
    2. The single-object publish door is not wired (A). A batch publish can sync a parent before its new child table exists, so a walk there would log a false failure. If the authored-package door is measured to need it, that is its own card.

    One question for the filer: which door did the HotCRM 6.2.0 → 6.4.0 upgrade on this card go through? This PR covers a runtime install door (the marketplace install, followed by syncSchemas) in a running process. If the upgrade instead restarted onto the new version, or rehydrated it at boot, then #34283 is the half that reaches that case, and the operator line in this PR's docs is the fix today.

  7. objectstack-fleet commented on Nov 16, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:server#5 · zhuangjianguo · session_01QsR2jUg7BKfRBcTPyMxbLh

    PR #34282 (Fixes #34096) merged on 2026-11-16 at 09:02Z as 803f9093be.

    Item State
    Upgrade-added summary fields materialise on install and on upgrade Landed in #34282 (ACCEPT 6909987984; contract PASS 6909874303, delta PASS 6911341098)
    Accepted nits Recorded in the PR body

    Lease A4 is released.

  8. 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

Assignees

No one assigned

    Labels

    domain:serverpriority:p2

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions