feat(cli): implement missing output element types and handles
CI / benchmark-publish (pull_request) Has been skipped
CI / build (pull_request) Successful in 19s
CI / helm (pull_request) Successful in 21s
CI / lint (pull_request) Successful in 3m19s
CI / quality (pull_request) Successful in 3m52s
CI / typecheck (pull_request) Successful in 3m56s
CI / security (pull_request) Successful in 4m5s
CI / integration_tests (pull_request) Successful in 7m2s
CI / unit_tests (pull_request) Successful in 11m51s
CI / docker (pull_request) Successful in 1m31s
CI / coverage (pull_request) Successful in 11m50s
CI / e2e_tests (pull_request) Successful in 16m31s
CI / status-check (pull_request) Successful in 1s
CI / build (push) Successful in 17s
CI / helm (push) Successful in 21s
CI / lint (push) Successful in 24s
CI / quality (push) Successful in 3m41s
CI / integration_tests (push) Successful in 3m46s
CI / typecheck (push) Successful in 3m55s
CI / security (push) Successful in 4m6s
CI / unit_tests (push) Successful in 7m14s
CI / docker (push) Successful in 1m32s
CI / benchmark-regression (push) Has been skipped
CI / coverage (push) Successful in 11m46s
CI / e2e_tests (push) Successful in 18m1s
CI / status-check (push) Successful in 1s
CI / benchmark-publish (push) Successful in 28m19s
CI / benchmark-regression (pull_request) Successful in 54m43s

Implement LiveMaterializationStrategy as the third materialization
strategy type (alongside sequential_buffer and accumulate) per spec
§26456-26492.  The live strategy renders element updates in-place at
~15 fps by tracking a dirty-element set and coalescing updates into
frame redraws.

RichMaterializer now extends LiveMaterializationStrategy instead of
_BaseBufferStrategy, enabling supports_incremental_updates=True.
Element rendering still delegates to the colour renderer for visual
formatting, maintaining backward compatibility.

Changes:
- Add _LiveMaterializationStrategy class with frame-rate throttling,
  dirty-element tracking, and per-frame composition in declaration
  order
- Update RichMaterializer to extend _LiveMaterializationStrategy
- Export LiveMaterializationStrategy from materializers.py and
  __init__.py
- Update SD-2 and SD-7 documentation in __init__.py
- Add vulture whitelist entry for LiveMaterializationStrategy
- Add 5 Behave scenarios covering live strategy rendering, incremental
  update support, dirty-element coalescing, all-element-type rendering,
  and frame rate validation
- Add step definitions for the new scenarios

ISSUES CLOSED: #903
This commit was merged in pull request #1191.
This commit is contained in:
2026-03-29 06:07:13 +00:00
committed by Forgejo
parent 297823c291
commit afe6b849fe
5 changed files with 272 additions and 11 deletions
+48
View File
@@ -2186,3 +2186,51 @@ Feature: Output Rendering Framework
Given an OutputSession with format "plain"
When I create a tree handle with root label "Root"
Then querying a path with wrong root returns None
# ================================================================
# LiveMaterializationStrategy
# ================================================================
Scenario: LiveMaterializationStrategy renders element on creation
Given an OutputSession with format "rich" using RichMaterializer
When I create a panel handle with title "Live Panel"
And I set entry "Key" to "Val"
And I close the panel handle
And the session is closed
Then the rich output contains "Live Panel"
And the rich output contains "Key"
Scenario: LiveMaterializationStrategy supports incremental updates
Given a RichMaterializer instance
Then the rich materializer supports incremental updates
And the rich materializer strategy name is "rich"
Scenario: LiveMaterializationStrategy coalesces dirty elements
Given an OutputSession with format "rich" using RichMaterializer
When I create a text handle with content "initial"
And I append text " more"
And I close the text handle
And the session is closed
Then the rich output contains "initial more"
Scenario: LiveMaterializationStrategy renders all element types
Given an OutputSession with format "rich" using RichMaterializer
When I create a tree handle with root label "Root"
And I add a tree child "child" under "Root"
And I close the tree handle
And I create a code handle with content "x = 1" and language "python"
And I close the code handle
And I create a diff handle with file_a "a.py" and file_b "b.py"
And I add a diff hunk with header "@@ -1 +1 @@" and context line "ctx" and add line "new"
And I close the diff handle
And I create a separator with style "line"
And I create an action hint with commands "deploy"
And the session is closed
Then the rich output contains "Root"
And the rich output contains "x = 1"
And the rich output contains "a.py"
And the rich output contains "deploy"
Scenario: LiveMaterializationStrategy frame rate is approximately 15 fps
Given a RichMaterializer instance
Then the live strategy frame rate is 15.0