Skip to content

MILAB-6922: create block render status contexts - #1893

Open
xnacly wants to merge 5 commits into
mainfrom
MILAB-6922_status-set-data
Open

xnacly wants to merge 5 commits into
mainfrom
MILAB-6922_status-set-data

Conversation

@xnacly

@xnacly xnacly commented Oct 7, 2026 •

Copy link
Copy Markdown
Member
  • new tx.status(rid) with create() and setData() in pl-client, only sent when the backend advertises statusApi:v1
  • heavy block renders get a root status context with name, block-pack and block-id
  • prodStatus/stagingStatus project fields reference the render's status field, so the context outlives the render (renders are garbage collected once their outputs resolve)
  • depends on milaboratory/pl#2265, milaboratory/pl#2273 and milaboratory/pl#2275 (protos synced from #2275)

RetriggerConfidence Score: 4/5

The PR appears safe to merge, with non-blocking feedback to test saved status after render collection and cleanup.

Fix All in Claude CodeFindings

  1. P2 Status lifetime is untested ▶
Fix with agent prompt
### Issue 1
lib/node/pl-client/src/core/transaction.test.ts:243-250
This test keeps the render attached to `clientRoot` and never lets its outputs finish. It cannot catch a regression where `prodStatus` or `stagingStatus` loses the context after the render is collected.

Add a middle-layer test that finishes a render, confirms its removal, and reads the saved status context. Also check that resetting or stopping the block removes the saved reference.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Summary

Adds status contexts for heavy block renders when the backend advertises statusApi:v1.

  • Creates the context and writes block metadata in the render's transaction.
  • Saves the context through prodStatus and stagingStatus, with cleanup on reset and stop.
  • Adds protocol definitions and tests for creation, metadata, immutability, and older-backend fallback.
  • Non-blocking feedback: test the context's lifetime after render collection and cleanup.

Important touched terms:

  • StatusContextHandle: A transaction handle for a render's status context. New methods create() and setData() queue writes; unsupported backends receive nothing.
  • BlockStatusData: New metadata type containing the block's display name, serialized block-pack source, and block ID.
  • ProjectField: Identifies a block field in a project. Adds prodStatus and stagingStatus, and recognizes both when parsing saved field names.
  • BackendCapability: Lists supported backend features. Adds statusApi:v1.
  • PlTransaction: Groups reads and writes into one transaction. Adds statusApiEnabled and status().
  • StatusAPI: New protocol messages for creating contexts, setting data, recording transitions, and setting attributes. This PR exposes creation and data writes through the client handle.
Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Create heavy render] --> B{Backend supports status API?}
  B -- No --> C[Return existing outputs]
  B -- Yes --> D[Create status context]
  D --> E[Write block name, pack source, and ID]
  E --> F[Save context reference in project]
  F --> G[Context remains after render finishes]
  F --> H[Reset or stop removes saved reference]
Loading

Reviews (1) · Last reviewed commit: "MILAB-6922: gate the status context test..." · Reviewed by Greptile

- pl-client: tx.status(rid) with create() and setData(), sent only when
  the backend advertises statusApi:v1
- pl-middle-layer: heavy block renders get a root status context with
  name, block-pack and block-id
- plapi protos: StatusAPI messages and parent fields on creates
@changeset-bot

changeset-bot Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 49f8c6e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 10 packages
Name Type
@milaboratories/pl-client Minor
@milaboratories/pl-middle-layer Minor
@milaboratories/pl-model-backend Patch
@milaboratories/pl-errors Patch
@milaboratories/pl-tree Patch
@milaboratories/pl-drivers Patch
@platforma-sdk/pl-cli Patch
@platforma-sdk/test Patch
@platforma-sdk/tengo-builder Patch
@platforma-sdk/block-tools Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@notion-workspace

Copy link
Copy Markdown

@codecov

codecov Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 33.33333% with 18 lines in your changes missing coverage. Please review.
✅ Project coverage is 57.28%. Comparing base (5f9559f) to head (49f8c6e).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...-middle-layer/src/mutator/template/render_block.ts 12.50% 6 Missing and 1 partial ⚠️
lib/node/pl-middle-layer/src/mutator/project.ts 45.45% 4 Missing and 2 partials ⚠️
lib/node/pl-client/src/core/transaction.ts 0.00% 4 Missing and 1 partial ⚠️

❌ Your patch check has failed because the patch coverage (33.33%) is below the target coverage (50.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1893      +/-   ##
==========================================
- Coverage   57.34%   57.28%   -0.07%     
==========================================
  Files         446      446              
  Lines       23309    23330      +21     
  Branches     5254     5258       +4     
==========================================
- Hits        13367    13365       -2     
- Misses       8402     8418      +16     
- Partials     1540     1547       +7     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

xnacly added 3 commits October 8, 2026 11:22
The render is collected once its outputs resolve, and its status context
with it. prodStatus/stagingStatus reference the render's status field,
so the project keeps the context for the current render.
CI runs pl main, which does not advertise the capability. There the test
now checks that the status calls send nothing and the commit succeeds.
@xnacly
xnacly marked this pull request as ready for review October 8, 2026 10:53
Comment thread lib/node/pl-client/src/core/transaction.test.ts
The context stays readable through prodStatus after the render is
collected, a re-render replaces it, and stopping production removes the
reference. Without statusApi:v1 there is no prodStatus field.
@xnacly
xnacly added this pull request to stack #1896 October 9, 2026 15:03
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.

1 participant