Skip to content

fix(hub): omit default build query parameter - #59

Open
alliscode wants to merge 4 commits into
mainfrom
alliscode-prototype-build-defaults
Open

alliscode wants to merge 4 commits into
mainfrom
alliscode-prototype-build-defaults

Conversation

@alliscode

Copy link
Copy Markdown
Collaborator

Why

Prototype review links without an explicit Build selection should follow the latest successful Build. Hub currently adds a build query parameter while someone browses, which silently turns the default link into a pinned snapshot.

What changes

Hub now leaves default prototype views unpinned while preserving the preview route, Controls settings, and minimized state. Explicit Build links remain pinned through navigation, copied URLs, share management, and prototype detail edits. Build selectors, Build details, comment links, canvas links, and public shares continue to identify a specific Build. Template and Default previews continue to ignore incoming Build parameters.

The dependency-age metadata check could not reach the public npm registry over TLS in the local verification environment. The focused frontend and Rails checks, complete Rails suite, and every other Hub CI step completed successfully.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Share-link mutation redirects still turn default review links into pinned snapshots.

1 open issue
What changed in this PR

Keeps default Hub prototype review links on the latest successful Build when reopened, while preserving explicit Build selections.

Changes:

  • Stops automatically adding build to default viewer URLs.
  • Distinguishes default and pinned navigation and detail edits.
  • Updates regression coverage, Storybook fixtures, and documentation.
File Description
hub/​test/​integration/​share_links_test.rb Checks default and pinned management paths.
hub/​test/​integration/​prototype_registrations_test.rb Covers unpinned detail-edit redirects.
hub/​test/​integration/​gallery_test.rb Covers latest-successful selection and navigation.
hub/​docs/​preview-serving.md Documents default and pinned URL behavior.
hub/​app/​views/​shared/​_review_workspace.json.props Conditions close and sharing paths on explicit selection.
hub/​app/​views/​share_links/​index.json.props Makes the prototype-name link unpinned.
hub/​app/​views/​replica_browses/​show.tsx Ignores Build parameters for template previews.
hub/​app/​views/​prototypes/​show.json.props Exposes pin state and adjusts navigation paths.
hub/​app/​views/​builds/​show.json.props Makes the prototype-name link unpinned.
hub/​app/​views/​builds/​index.json.props Makes the prototype-name link unpinned.
hub/​app/​javascript/​storybook/​fixtures/​prototype-workspace.ts Updates shared default-link fixtures.
hub/​app/​javascript/​pages/​share-links-index-page/​stories.tsx Uses unpinned management URLs.
hub/​app/​javascript/​pages/​replica-browse-page/​index.test.tsx Checks removal of ignored parameters.
hub/​app/​javascript/​pages/​prototypes-show-page/​types.ts Adds explicit Build-selection state.
hub/​app/​javascript/​pages/​prototypes-show-page/​stories.tsx Models the unpinned default view.
hub/​app/​javascript/​pages/​prototypes-show-page/​prototype-description-dialog/​index.tsx Submits Build selection only when pinned.
hub/​app/​javascript/​pages/​prototypes-show-page/​index.test.tsx Updates editing and navigation coverage.
hub/​app/​javascript/​pages/​builds-index-page/​stories.tsx Uses default history-navigation links.
hub/​app/​javascript/​hooks/​use-prototype-viewer-url/​index.ts Preserves existing selections without automatic pinning.
hub/​app/​javascript/​hooks/​use-prototype-viewer-url/​index.test.ts Covers default, pinned, and restored URL state.
hub/​app/​javascript/​features/​prototype-workspace-header/​stories.tsx Updates default header links.

Review effort: Max

Comment thread hub/app/views/shared/_review_workspace.json.props Outdated
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Invalid management selections can return an error after public share-link mutations have already committed.

1 open issue
1 previously missed issue

In code that hasn't changed since last review

Medium severity History close drops explicitly pinned Build selection

hub/​app/​views/​shared/​_review_workspace.json.props:31

An explicitly pinned review loses its pin through History → Close. Both historyPath values (prototypes/show.json.props:64 and this partial's line 28) omit build, so the history request has neither @build nor a Build parameter. This new condition then produces an unpinned closePath. Even a review pinned to the current latest Build will follow future Builds after this round trip.

Carry the optional selection through history links and pagination, resolve that selection in BuildsController, and use it for the return link. Default history visits should remain unpinned. Add a round-trip test for both default and explicitly selected reviews.

1 resolved since last review

Review effort: Max

Comment thread hub/app/controllers/share_links_controller.rb Outdated
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Cross-layer URL state and authorization return behavior need final human verification.

1 open issue
1 previously missed issue

In code that hasn't changed since last review

Medium severity Cover delete-form and default-view management_build omissions

hub/​app/​javascript/​pages/​share-links-index-page/​index.test.tsx:159

Both this assertion and line 166 check the create form: container.querySelector returns its input first. The delete form's new management_build field is therefore untested. There is also no frontend case checking that both forms omit this field for a default management view.

The Rails tests submit management_build directly, so they would not catch a missing delete-form field or a default form that starts submitting the displayed Build. Check the delete form here, keep the scoped create-form assertion, and add a default-view case that expects no management_build inputs.

1 resolved since last review

Review effort: Max

Comment thread hub/app/controllers/concerns/has_share_link_context.rb
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Cross-layer navigation and authorization returns need runtime confirmation, and History failure-path coverage remains incomplete.

No open issues 🎉

2 previously missed issues

In code that hasn't changed since last review

Medium severity Test invalid Build selections and preserve selection on cursor redirects

hub/​app/​controllers/​builds_controller.rb:107

The new History tests cover valid Build selections and pagination, but not rejection of invalid selections or preservation through the legacy cursor redirect. The existing legacy-cursor test omits build, so it would still pass if that redirect silently unpinned an explicit selection.

Add focused cases in gallery_test.rb: History should return 404 for build=0, an unknown number such as 999, and a queued Build. Extend the legacy-cursor coverage to send an explicit successful Build and assert that the redirected URL retains it alongside before and before_at.

Low severity Update gallery guide for default Build selection behavior

hub/​docs/​preview-serving.md:56

The new behavior conflicts with the canonical gallery guide. hub/docs/gallery.md:140 still says the prototype name links to the selected Build, and line 144 says saving details returns to the same Build. With an unpinned URL, both actions now open the latest successful Build, which may be newer than the preview being viewed.

Update those sentences to say that the name opens the default latest-successful view and that saving preserves whether the review explicitly selected a Build.

1 resolved since last review

Review effort: Max

@alliscode
alliscode marked this pull request as ready for review October 21, 2026 19:59
@alliscode
alliscode requested review from a team and nshki as code owners October 21, 2026 19:59

@nshki nshki 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.

🙇🏻 Thank you, @alliscode!

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.

3 participants