Add application summary projection callback - #28319
Vlad Sudzilouski (vladsud) wants to merge 1 commit into
Conversation
Adds an optional applicationSummaryProjection callback to LoadContainerRuntimeParams, letting applications contribute an incrementally-reusable subtree to the container summary alongside the runtime's own summary roots. Includes unit tests and a documented, runnable example (summaryProjectionExample) demonstrating incremental reuse across two independently-projected blobs. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Hi! Thank you for opening this PR. Want me to review it? Based on the diff (865 lines, 11 files), I've queued these reviewers:
How this works
|
|
🔗 No broken links found! ✅ Your attention to detail is admirable. linkcheck output |
Bundle size comparisonBase commit: Notable changes
Per-bundle deltas
|
Mark Fields (markfields)
left a comment
There was a problem hiding this comment.
[release-hold:client:3.3.0] Process hold to avoid release conflicts; not code-review feedback. Will dismiss after the version bump.
Client 3.3.0 release hold lifted: 3.4.0 bump #28355 merged. Not code-review feedback.
Description
Applications sometimes need to contribute their own projection of data into the container summary — for example, a denormalized or application-format representation of content that is otherwise stored inside a DDS, produced incrementally alongside the runtime's ordinary summarize flow.
This PR adds a small, self-contained extension point for that: an optional
applicationSummaryProjectioncallback onLoadContainerRuntimeParams. When provided,ContainerRuntimeinvokes it during summarization and inserts the returned subtree alongside its own summary roots (.channels,.metadata, etc.), tracks acceptance against summary acks/nacks, and calls back into the application (onAccepted) once a generated summary is durably accepted. Unchanged content can be returned as anISummaryHandlepointing at the previous summary so it isn't re-serialized/re-uploaded every summary cycle.This is intentionally scoped down from the larger prototype in #28280 (which also handles detached-construction options like
fullTreePolicyand GC-adoption-correlation retry logic). Only the "register callback → contribute a subtree during summarize → correlate acceptance with the right summary" capability is included here; the detached-construction pieces are left as potential future follow-up work if/when needed.New API surface (
@fluidframework/container-runtime,@legacy @beta)IApplicationSummaryProjection— the callback contract (key,summarize).IApplicationSummaryProjectionContext— passed tosummarize; exposes the previously-accepted projection (if any) for incremental reuse.IApplicationSummaryProjectionResult— returned fromsummarize; the projectedISummaryTreeplus an optionalonAcceptedcallback.LoadContainerRuntimeParams.applicationSummaryProjection— new optional field wiring the callback intoContainerRuntime.loadRuntime/loadRuntime2.Tests and example
src/test/applicationSummaryProjection.spec.ts— unit tests for the controller in isolation (key validation, handle-without-previous-summary rejection,onAcceptedrejection for promise-like values, pruning of stale pending generations, multi-cycle generate → submit → ack tracking).src/test/summaryProjectionExample/— a documented, runnable example (projectionSample.ts+projectionExample.spec.ts+README.md) demonstrating incremental reuse across two independently-projected blobs (left/right): after an unchanged second summary, one blob is emitted as a handle while the other remains a fresh blob. The README explicitly separates "sample code" (usable close to as-is by consumers) from "test-harness code" (written only to drive/assert the sample in this repo's test suite).Reviewer Guidance
The review process is outlined in the pull request guidelines.
containerRuntime.tsis the highest-risk file touched (widely used, heavily tested core class). The new capability is wired in via a new public method,initializeApplicationSummaryProjection(), called once right after construction inloadRuntime2, rather than adding a new constructor parameter — this was a deliberate choice to avoid touching the already very long constructor parameter list that other packages (e.g.mixinAttributor) depend on. Feedback on whether this is the right integration seam vs. an alternative is welcome.src/summary/applicationSummaryProjection.tsfor the core contract/controller, thensrc/test/summaryProjectionExample/README.mdfor the intended consumer-facing usage pattern.