Skip to content

Name the compose runtime's hand-written group keys [CLF-649] - #1594

Merged
zach-klippenstein merged 4 commits into
mainfrom
zachklipp/clf-649-draft-d06df7
Oct 29, 2026
Merged

zach-klippenstein merged 4 commits into
mainfrom
zachklipp/clf-649-draft-d06df7

Conversation

@zach-klippenstein

@zach-klippenstein zach-klippenstein commented Oct 28, 2026 •

Copy link
Copy Markdown
Collaborator

Follow-up to this review comment on #1442.

The compose runtime starts a few groups by calling Composer APIs directly, and their keys were made-up literals (23975234 and -895982 in renderWorkflowRestartableImpl, which the code said were chosen by mashing the keyboard, and GROUP_KEY = -9287345 in ComposeRenderContext). This PR moves all three into a new internal ComposeGroupKeys object:

Constant Value Replaces Used for
RENDER_WORKFLOW_RESTART_GROUP 1 23975234 Restart group around renderWorkflowRestartableImpl
RENDER_WORKFLOW_SKIP_GROUP 2 -895982 Inner replace group that lets renderSelf be skipped
RENDER_CONTEXT_CHILD_GROUP 3 ComposeRenderContext.GROUP_KEY Movable group around each child, side effect, and remember

A key only has to be unique within its parent group, so plain small values are enough. Compose's own reserved keys (100, 125, 200–207, 1000, -127) don't overlap with these, and the runtime doesn't treat key 0 specially.

Behavior change: the key values are different now, which changes currentCompositeKeyHashCode for everything below these groups. The compose runtime uses that hash to key saveable state. As a result, saved state written by an older build won't be restored by this one. That should only matter for state saved by an earlier version of the app, and this runtime is still experimental.

No benchmarks were run because the change doesn't touch any hot code: the keys are compile-time constants, same as before.

Testing

  • ./gradlew :workflow-runtime:jvmTest passes, including the Burst compose-runtime configs.

🤖 Generated with Claude Code

The keys passed to Composer group APIs in RenderWorkflow and ComposeRenderContext were
arbitrary literals. Move them into ComposeGroupKeys as named constants whose values are
the String.hashCode of their qualified names, and add a test that enforces that scheme.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Use trivial sequential values, shorten the KDoc, drop the per-constant docs and the
test, and statically import the constants.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@zach-klippenstein
zach-klippenstein marked this pull request as ready for review October 29, 2026 02:38
@zach-klippenstein
zach-klippenstein requested a review from a team as a code owner October 29, 2026 02:38
@zach-klippenstein
zach-klippenstein merged commit 482c50c into main Oct 29, 2026
77 checks passed
@zach-klippenstein
zach-klippenstein deleted the zachklipp/clf-649-draft-d06df7 branch October 29, 2026 19:31
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