Skip to content

docs(content): reconcile stale rollup docs with native Field.summary reality - #70

Merged
xuyushun441-sys merged 1 commit into
mainfrom
fix/content-piece-summary-rollups
Jun 20, 2026
Merged

xuyushun441-sys merged 1 commit into
mainfrom
fix/content-piece-summary-rollups

Conversation

@xuyushun441-sys

Copy link
Copy Markdown
Contributor

Context

Following the 9.11.0 upgrade I investigated the content_piece.total_* rollups reading null (flagged as a possible bug). It's not a bug — the chained Field.summary cascade works correctly.

What I verified (runtime, all env)

The rollup is a two-level chain: content_metric.views → publication.total_* (summary) → piece.total_* (summary of the publication summary). The engine recomputes a parent summary on every child write and that write itself cascades one level up.

Measured across all 14 seeded pieces:

  • 3 pieces with publications → totals all correct (e.g. "Why we kept the demo gate": total_views = 11370 = 3720 + 7650; 2670; 4200).
  • 11 pieces with zero publications → total_views = null. A parent summary is only initialized when a child write triggers a recompute, so a piece that never had a publication keeps the column default (null) rather than 0. Cosmetic, framework-level (engine.ts recomputeSummaries), pre-existing, not 9.11.0-specific.

My earlier "null" reading was a sampling artifact — an OData $filter that silently didn't apply, returning backlog (publication-less) pieces.

What this PR changes (docs/comments only)

Several docs still described the long-removed publication_rollup flow and a non-existent content_rollup.hook.ts / metricRollupHook:

  • content_publication.object.ts docstring: "total_* … STORED fields (seed/client-maintained)" → native Field.summary roll-ups that cascade to the piece (matches the already-correct field-level comment and hooks/index.ts).
  • README.md: corrected the flows-table row and the "Known v0 caveats" rollup note.
  • SPEC.md: replaced the stale publication_rollup flow item with the real publish_approval flow + a native-summary note.

No metadata or behavior change. pnpm --filter @objectlab/content build green, pnpm format:check clean.

🤖 Generated with Claude Code

…reality

Investigated the piece-level `total_*` rollups reading null and confirmed the
chained `Field.summary` cascade actually works: the engine recomputes
`publication.total_*` from child `content_metric` rows and cascades one level up
to `piece.total_*`. All 3 seeded pieces that have publications show correct
totals (e.g. 11370 = 3720 + 7650); only pieces with zero publications read null,
because a parent summary is never initialized until its first child write — a
cosmetic framework-level null-vs-0 behavior, not a content bug.

Several docs still described the long-removed `publication_rollup` flow / a
non-existent `content_rollup.hook.ts`. Reconcile them to reality:
- content_publication.object.ts docstring: "STORED fields (seed/client-
  maintained)" → native Field.summary roll-ups that cascade to the piece.
- README: fix the flows-table entry and the "Known v0 caveats" rollup note.
- SPEC: replace the stale `publication_rollup` flow item with `publish_approval`
  and a note that the totals are native summaries.

Docs/comments only — no metadata or behavior change.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@xuyushun441-sys
xuyushun441-sys merged commit d1fbc35 into main Jun 20, 2026
3 checks passed
@xuyushun441-sys
xuyushun441-sys deleted the fix/content-piece-summary-rollups branch June 20, 2026 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants