Skip to content

feat(controls): support app-owned initial values - #397

Merged
lukasoppermann merged 4 commits into
mainfrom
lukasoppermann-controls-app-initial-value
Nov 26, 2026
Merged

lukasoppermann merged 4 commits into
mainfrom
lukasoppermann-controls-app-initial-value

Conversation

@lukasoppermann

@lukasoppermann lukasoppermann commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Agent assessment

Self-reported assessment, not an independent review.

Assessed revision: c1e7643d7d38976488ffd4bf2f02352845a267ad

Dimension Assessment Rationale
Change confidence 8/10 ↑ Independent regression tests cover inactive legacy overrides, conditional initialization, and deferred reset.
↑ 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 enter rc.* 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.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@lukasoppermann
lukasoppermann requested review from a team and nshki as code owners November 26, 2026 09:17
Copilot AI adaptive review requested due to automatic review settings November 26, 2026 09:17
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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 file
  • hub/.storybook/preview-fixtures/build-controls/controls.js: Generated file
  • hub/app/javascript/features/install-replica-controls-bridge/bridge.js: Generated file
  • hub/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)

@lukasoppermann
lukasoppermann merged commit 4f596f3 into main Nov 26, 2026
49 checks passed
@lukasoppermann
lukasoppermann deleted the lukasoppermann-controls-app-initial-value branch November 26, 2026 12:13
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