Skip to content

πŸ› Hub: serve /api/saas/my-hives from a background snapshot - #11429

Merged
hivecommons-hive[bot] merged 1 commit into
v5from
perf/hub-my-hives
Oct 10, 2026
Merged

hivecommons-hive[bot] merged 1 commit into
v5from
perf/hub-my-hives

Conversation

@clubanderson

Copy link
Copy Markdown
Member

Fixes #11427

Summary

  • cache /api/saas/my-hives JSON per authenticated user/query for 5s and serve bounded stale snapshots while a background refresh rebuilds them
  • add Server-Timing for cache hit/stale/miss/build visibility
  • keep compatible v5 localStorage hive caches paintable under the v6 dashboard assets so returning operators do not fall back to the spinner after deploy

Measurements

Before, live hub /api/saas/my-hives via read-only port-forward returned 97 hives and ~1.46 MB with TTFB/total:

  • 23.969s / 24.420s
  • 34.564s / 35.579s
  • 25.717s / 26.348s

Other boot endpoints were ~0.13-0.70s, making my-hives the spinner gate.

Validation

  • gofmt -l src/pkg/hub/saas_hives_api.go src/pkg/hub/server.go src/pkg/hub/my_hives_snapshot_test.go
  • git diff --check

Per AGENTS.md, I did not run go test, go vet, or docs/citation guards locally; CI is the test/coverage verdict for this repo.

@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Oct 10, 2026
@kubestellar-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign nicholasjackson for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubestellar-prow kubestellar-prow Bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Oct 10, 2026
@github-actions

github-actions Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Open PR overlap check

Base branch: v5

Conflicts are checked with every PR merged onto the current tip of v5, so a PR that only needs a rebase is not reported as conflicting with its siblings.

PR Title Relation Files
#11436 ✨ Show fork badge with last upstream check on repo cards same files src/docs/api-reference.md

@hivecommons-hive

Copy link
Copy Markdown
Contributor

hive/ci-report (head 1eeb282, re-checked against 9ae1880):

Two PR-local test failures in test (hub 1/4, 2/4); coverage and test fail downstream of them. The baseline (v5) is green for these checks.

  1. TestHandleMyHivesServesCachedSnapshotWithoutNetwork β€” saveSaaSUser: open /data/saas/users/snapshot-owner.json.tmp: no such file or directory. Your follow-up push 9ae1880 already overrides saasUsersDir with t.TempDir(), so this one should turn green on the next run.

  2. TestDashboardHivesCacheIsBoundedAndVersioned/version_is_enforced_on_read β€” still red on 9ae1880. src/pkg/hub/spark_downsample_test.go:151 pins the old read guard literally, and this PR replaced it with the min/max window:

		{"version is enforced on read", "if (!c || c.version > HIVES_CACHE_VERSION || c.version < HIVES_CACHE_MIN_READ_VERSION) return null;"},
		{"min read version is declared", "var HIVES_CACHE_MIN_READ_VERSION = 5;"},

(replace the single "version is enforced on read" row at line 151). Nothing else in that table changed.

I can't push to a human-authored branch, so leaving this as a suggestion. hive/awaiting-ci: once pushed, the sweep merges when green.


🐝 Hive Agent: scanner | Instance: hosted-available-oke-11-placeholder-r05x | SHA: unknown

β€” hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88

Signed-off-by: Andrew Anderson <andy@clubanderson.com>
@hivecommons-hive
hivecommons-hive Bot merged commit 5945432 into v5 Oct 10, 2026
64 of 65 checks passed
@hivecommons-hive

Copy link
Copy Markdown
Contributor

merged by Hive trusted-author auto-merge: author @clubanderson holds role owner and GitHub permission admin on repo; CI green at a95987e.

@kubestellar-prow
kubestellar-prow Bot deleted the perf/hub-my-hives branch October 10, 2026 14:12
@github-actions

Copy link
Copy Markdown
Contributor

Thank you for your contribution! Your PR has been merged.

We'd love to hear how your experience was: share feedback

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dco-signoff: yes Indicates the PR's author has signed the DCO. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

πŸ› Hub fleet page: 'Loading your hives' spinner lingers; /api/saas/my-hives slow

1 participant