Skip to content

fix(controls): clear saved settings before Reset all - #395

Merged
lukasoppermann merged 2 commits into
mainfrom
lukasoppermann-controls-runtime-fixes
Nov 26, 2026
Merged

lukasoppermann merged 2 commits into
mainfrom
lukasoppermann-controls-runtime-fixes

Conversation

@lukasoppermann

@lukasoppermann lukasoppermann commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Agent assessment

Self-reported assessment, not an independent review.

Assessed revision: 6d79294876a0bdb15fc86a0b9399a54c028415d9

Dimension Assessment Rationale
Change confidence 8.5/10 ↑ Bridge regression test reproduces the stale page and passes with the fix.
↑ Hub, Controls and extension checks pass after merging main.
↓ Not checked manually in the canvas with a real routed prototype.
Diagnosis confidence 9/10 ↑ The failing test showed rc.navigation.page surviving Reset all before the fix.
Evidence fit 8/10 ↑ Matches the reported "Reset restores the old page" symptom from the page-selector guidance work.
↓ No trace from the original report confirms this exact path.

Why

Reset all controls should remove every saved setting. For a page selector that changes the app's route, it didn't always do that. While Reset ran, the app navigated to the default page, but the preview still had the old rc.* settings in memory and copied them into the new URL. The next Back/Forward or reconnect then restored the old page. Related to github/replica-internal#82 and the page-selector recipe in #394.

What changes

The preview bridge now clears its saved rc.* settings before it resets the bindings, instead of waiting for the host's later url "" update. Any navigation the app does during Reset then starts from a clean ?rc=1 URL.

sequenceDiagram
  participant Host
  participant Bridge
  participant App
  Host->>Bridge: reset-all
  Bridge->>Bridge: clear saved rc.* (new)
  Bridge->>App: write default page
  App->>App: pushState(/org)  — URL keeps only rc=1
  Bridge-->>Host: reply
Loading

Single-scope reset and the protocol are unchanged. Two small side effects:

  • If Reset fails partway, the saved settings are already cleared. This matches the host, which clears them after any Reset.
  • During an identity-change reset, inactive sets' settings leave the URL briefly until the host saves them again.

The plugin version moves to 1.10.1 (patch).

App navigation during Reset all could copy stale rc.* settings into the
new URL, so a page selector could restore the old page afterwards.

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 08:57
Copilot AI adaptive review requested due to automatic review settings November 26, 2026 08:57

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.

🔵 Needs a closer look

Reset-all changes URL persistence before asynchronous binding writes across navigation, reconnects, and checkout-identity recovery, warranting human review of the interacting lifecycle effects.

No open issues 🎉

3 files not reviewed
  • .github/extensions/replica-prototype/assets/canvas-bridge.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
What changed in this PR

Fixes Reset all in the shared Controls preview bridge so navigation triggered by resetting a page selector cannot carry stale saved settings forward. This supports the page-selector guidance added in #394.

Changes:

  • Clears saved rc.* settings before resetting app bindings.
  • Adds regression coverage for reset-triggered navigation and the subsequent history event.
  • Updates the generated bridge and bumps the plugin version to 1.9.1.
File Description
hub/​app/​javascript/​features/​install-replica-controls-bridge/​bridge.js Regenerates the bundled bridge with the reset-ordering fix.
hub/​app/​javascript/​application/​prototype-preview-bridge/​controls.ts Clears saved settings before resetting bindings.
hub/​app/​javascript/​application/​prototype-preview-bridge/​controls.test.ts Checks that reset navigation does not retain the saved page.
.github/​extensions/​replica-prototype/​plugin.json Bumps the plugin patch version to 1.9.1.

Review effort: Balanced (adaptive)

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@lukasoppermann
lukasoppermann merged commit d4ba4d6 into main Nov 26, 2026
41 checks passed
@lukasoppermann
lukasoppermann deleted the lukasoppermann-controls-runtime-fixes branch November 26, 2026 09:54
lukasoppermann added a commit that referenced this pull request Nov 26, 2026
<!-- copilot-assessment:v1 -->
### 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.<br>↑ Local lint, format, tests, build, and Controls and extension
asset checks pass.<br>↓ Checks ran locally rather than in the Hub
devcontainer; CI for this revision is pending.<br>↓ Browser fixture
evidence predates the latest merge and review fixes; native canvas and
deployed authenticated Build behavior remain unverified. |
<!-- /copilot-assessment -->

<!-- Use a conventional commit-style title, such as "fix(hub): retain
prototype history". -->

## Why

<!-- Explain the problem and why this change matters in a short,
plain-English paragraph. Link the issue when applicable. -->

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

<!-- Describe what becomes different for a first-time reader. Explain
necessary terms. Include accurate Mermaid diagrams when they clarify the
proposal, using before/after diagrams when helpful. Add screenshots for
meaningful UI changes. -->
<!-- Omit validation sections, checklists, and routine test/CI summaries
such as "CI is green" or "tests passed". Mention only known verification
gaps that affect the change, not disclaimers about drafting this
description. -->
<!-- For UI changes, prune obsolete and duplicate stories in the
affected catalogues as part of the change. Explain removed UI or
consolidated coverage where needed; see
hub/docs/storybook.md#ui-changes-and-pull-request-evidence. -->

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>
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