Repository navigation
feat(controls): support app-owned initial values - #397
Merged
Merged
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved app-owned control bugs can lose resets on reattachment, write incorrect defaults before condition inputs settle, and retain legacy overrides in saved settings and shared URLs.
3 open issues
5 files not reviewed
.github/extensions/replica-prototype/assets/canvas-bridge.js: Generated file.github/extensions/replica-prototype/assets/renderer.js: Generated filehub/.storybook/preview-fixtures/build-controls/controls.js: Generated filehub/app/javascript/features/install-replica-controls-bridge/bridge.js: Generated filehub/app/javascript/utils/prototype-controls/browser.js: Generated file
What changed in this PR
Adds app-owned initialization to Replica’s shared Controls runtime so API-backed page selectors can preserve direct links while the app’s router remains the source of truth.
Changes:
- Adds
initial: "app"to API value bindings, preserving explicit edit and Reset writes. - Updates restoration and persistence to exclude app-owned values.
- Adds regression coverage, updates authoring guidance, and applies the plugin patch bump.
| File | Description |
|---|---|
starters/shared/.agents/skills/prototype-controls/references/authoring.md |
Adds the page-selector recipe and initialization contract. |
hub/docs/prototype-controls.md |
Documents app-owned behavior and compatibility. |
hub/docs/prototype-canvas.md |
Updates URL persistence guidance. |
hub/app/javascript/utils/prototype-controls/controls.test.mjs |
Tests valid and invalid initialization declarations. |
hub/app/javascript/utils/prototype-controls/controls.replica.schema.json |
Allows the API initialization option. |
hub/app/javascript/utils/prototype-controls/controls.d.mts |
Adds the binding type declaration. |
hub/app/javascript/utils/prototype-controls/controls-validation.mjs |
Rejects the option on API buttons. |
hub/app/javascript/utils/prototype-controls/bindings.test.mjs |
Covers initialization, restoration, and Reset behavior. |
hub/app/javascript/utils/prototype-controls/bindings.mjs |
Reads app-owned initial values and filters restored overrides. |
hub/app/javascript/utils/prototype-controls-url/saved-values/index.ts |
Excludes app-owned controls from saved values. |
hub/app/javascript/utils/prototype-controls-connection/index.ts |
Updates persistence, restoration, and reset availability. |
hub/app/javascript/utils/prototype-controls-connection/index.test.ts |
Covers saved settings and copied-link filtering. |
hub/app/javascript/application/prototype-preview-bridge/controls.ts |
Updates bridge restoration and URL filtering. |
hub/app/javascript/application/prototype-preview-bridge/controls.test.ts |
Covers legacy overrides and history adoption. |
.github/extensions/replica-prototype/README.md |
Explains app-owned initialization for canvas users. |
.github/extensions/replica-prototype/plugin.json |
Applies the plugin patch-version bump. |
Review effort: Max (adaptive)
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Agent assessment
Self-reported assessment, not an independent review.
Assessed revision:
c1e7643d7d38976488ffd4bf2f02352845a267ad↑ Local lint, format, tests, build, and Controls and extension asset checks pass.
↓ Checks ran locally rather than in the Hub devcontainer; CI for this revision is pending.
↓ Browser fixture evidence predates the latest merge and review fixes; native canvas and deployed authenticated Build behavior remain unverified.
Why
Page selectors currently write their declared default when Controls starts, which can replace a directly linked page. The app's router should remain the source of truth when users opt into app-owned initialization. Relates to github/replica-internal#82.
What changes
API value bindings can declare
"initial": "app"to read the current app value without a startup write. These controls ignore legacy saved values and never enterrc.*settings or copied override URLs, including before an inactive set mounts. Back/Forward adopts the current route; edits and Reset still write through the app API, with Reset using the declared default. An inactive set writes its app-owned defaults when it returns after Reset all. Existing bindings and hidden-control default writes remain unchanged.The schema, runtime, shared bridge, persistence, generated assets and authoring guides are updated together. The plugin receives the approved patch bump from 1.10.1 to 1.10.2; definition and protocol versions stay at 1. Older runtimes reject the new field while leaving the ordinary app usable. Sharing settings is blocked while saved values cannot be checked.
The Reset fix in #395 and the authoring guide in #394 are merged into main and included in this branch.