Skip to content

fix(hub): reduce manage prototypes latency - #25

Merged
weastler merged 2 commits into
mainfrom
weastler-manage-prototypes-latency
Oct 19, 2026
Merged

weastler merged 2 commits into
mainfrom
weastler-manage-prototypes-latency

Conversation

@weastler

@weastler weastler commented Oct 19, 2026 •

Copy link
Copy Markdown
Collaborator

Why

Manage prototypes currently waits for GitHub branch and repository checks before showing the page. Slow checks can make the button feel unresponsive and delay editing existing prototypes.

What changes

Show the authorized page and existing prototypes first, then load available branches and repository choices independently, each with loading, error, and retry states. Reuse GitHub installation tokens and run at most four checks concurrently instead of repeating them serially.

Keep the current layout, branch eligibility rules, and fresh access checks when adding a prototype. Both sections also reload correctly after same-page refreshes.

Loading state (Storybook fixture)

Existing prototypes remain editable while available branches load

Render the authorized management page before fetching eligible branches and repository choices. Load each section independently with its own loading state and retry, keeping listed prototype edits available.

Reuse request-scoped GitHub configuration and installation tokens, and bound concurrent permission and authorship checks to four workers. Retain complete branch-history checks, eligible-only pagination, and fresh registration authorization.

Reload deferred sections when a full response replaces the same URL without remounting. Preserve the current management UI and gear-button spinner, without introducing a global loading overlay.

Add regression coverage for authorization, cache reuse and invalidation, concurrent requests, retries, section grafts, and same-URL refreshes, and document the loading flow.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 19c396a8-0c3a-446d-98d0-3105b22af77a
@weastler
weastler requested review from a team and nshki as code owners October 19, 2026 04:40
Copilot AI max review requested due to automatic review settings October 19, 2026 04:40

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

Shared authorization concurrency and asynchronous refresh behavior need final human review with runtime verification.

1 open issue
What changed in this PR

Reduces Hub’s Manage prototypes latency by showing listed prototypes before loading branch candidates and repository choices.

Changes:

  • Loads sections independently with loading, error, retry, and refresh handling.
  • Reuses installation tokens and limits concurrent GitHub checks to four.
  • Adds regression coverage, presentation states, and documentation.
File Description
hub/​test/​models/​repository/​prototype_candidates_test.rb Covers bounded comparisons and caching.
hub/​test/​models/​repository/​authorization_test.rb Protects fresh permission checks.
hub/​test/​models/​github_client_batch_test.rb Covers concurrency and failures.
hub/​test/​integration/​repositories_test.rb Checks permission and token reuse.
hub/​test/​integration/​prototype_registrations_test.rb Covers independent sections and registration checks.
hub/​test/​integration/​local_development_test.rb Covers local section loading.
hub/​docs/​gallery.md Explains loading and retry behavior.
hub/​docs/​architecture.md Documents asynchronous checks.
hub/​config/​locales/​gallery.en.yml Adds loading and retry labels.
hub/​app/​views/​prototype_management/​show.tsx Connects section-loading hooks.
hub/​app/​views/​prototype_management/​show.json.props Supplies shell and section data.
hub/​app/​models/​repository/​prototype_candidates.rb Batches uncached branch comparisons.
hub/​app/​models/​repository/​authorization.rb Supports prefetched permissions.
hub/​app/​models/​github_client/​repositories.rb Batches repository permission requests.
hub/​app/​models/​github_client/​batch.rb Adds bounded parallel execution.
hub/​app/​javascript/​pages/​prototype-management-page/​types.ts Defines section presentation data.
hub/​app/​javascript/​pages/​prototype-management-page/​stories.tsx Adds loading and failure examples.
hub/​app/​javascript/​pages/​prototype-management-page/​index.tsx Passes section states to features.
hub/​app/​javascript/​hooks/​use-page-section/​index.ts Loads, retries, and cancels sections.
hub/​app/​javascript/​hooks/​use-page-section/​index.test.tsx Covers independent request lifecycles.
hub/​app/​javascript/​features/​workspace-sidebar/​index.tsx Passes repository-choice status.
hub/​app/​javascript/​features/​repository-workspace/​index.tsx Forwards repository-choice status.
hub/​app/​javascript/​features/​repository-navigation/​index.tsx Connects selector status.
hub/​app/​javascript/​features/​prototype-metadata-management/​types.ts Adds branch-loading fields.
hub/​app/​javascript/​features/​prototype-metadata-management/​styles.css Styles branch-loading feedback.
hub/​app/​javascript/​features/​prototype-metadata-management/​index.tsx Displays loading and retry controls.
hub/​app/​javascript/​features/​prototype-metadata-management/​index.test.tsx Covers loading and retry presentation.
hub/​app/​javascript/​components/​repository-selector/​types.ts Defines selector status props.
hub/​app/​javascript/​components/​repository-selector/​index.tsx Displays repository-loading states.
hub/​app/​javascript/​components/​repository-selector/​index.test.tsx Covers status and keyboard retries.
hub/​app/​javascript/​application/​sidebar-inbox-views.test.tsx Updates management view fixtures.
hub/​app/​javascript/​application/​build-visit-and-remote/​management.test.tsx Covers partial updates and refreshes.
hub/​app/​controllers/​prototype_management_controller.rb Separates shell and section requests.
hub/​app/​controllers/​concerns/​has_repository_workspace.rb Defers choices and batches permissions.

Review effort: Max

Comment thread hub/app/models/repository/prototype_candidates.rb

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

Approving with a minor comment. Thanks, @weastler!

Comment thread hub/app/javascript/hooks/use-page-section/index.ts Outdated
Cache completed branch comparisons even when another GitHub request fails. Skip queued comparisons after a failure, let in-flight calls finish, and write successful results on the request thread before surfacing the original error.

Cover mixed-success retries and queued-call cancellation. Clarify when to use the deferred page-section hook and how Superglue updates the rendered page data.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 19c396a8-0c3a-446d-98d0-3105b22af77a
@weastler
weastler merged commit d362bb9 into main Oct 19, 2026
40 checks passed
@weastler
weastler deleted the weastler-manage-prototypes-latency branch October 19, 2026 21:05
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