Repository navigation
✨ Animate live tracker, contributor and Knowledge count deltas - #15866
Conversation
Signed-off-by: Andy Anderson <andy@clubanderson.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Open PR overlap checkBase branch: Conflicts are checked with every PR merged onto the current tip of
|
|
stage 080-awaiting-merge-admission → 050-review-pending: required-check-pending:build-and-test |
|
@clubanderson this PR is held at Failing checks:
Next: the hive does not push to your branch. Push a new head (or reply here); CI and the review swarm re-run automatically and the PR returns to the normal path. |
Signed-off-by: Andy Anderson <andy@clubanderson.com>
|
@clubanderson this PR is held at Failing checks:
Next: the hive does not push to your branch. Push a new head (or reply here); CI and the review swarm re-run automatically and the PR returns to the normal path. |
|
stage 080-awaiting-merge-admission → 071-needs-author: optional-check-failing:test (rest 3/4) |
Signed-off-by: Andy Anderson <andy@clubanderson.com>
|
@clubanderson this PR is held at Failing checks:
Next: the hive does not push to your branch. Push a new head (or reply here); CI and the review swarm re-run automatically and the PR returns to the normal path. |
|
stage 080-awaiting-merge-admission → 071-needs-author: optional-check-failing:test (rest 4/4) |
There was a problem hiding this comment.
Correctness (read at head 3698583)
Knowledge section stops loading when any remote layer is unhealthy — src/pkg/dashboard/static-src/js/knowledge.js:244-248
kbSidebarFactCount returns null if any layer lacks an integer total_pages (knowledge.js:157), and fetchKnowledgeStats then returns before _kbCache = next, before _kbInitialLoad = false, and before renderKnowledge() (knowledge.js:249-272). The server produces exactly that shape in a normal steady state: KnowledgeAPI.Stats only sets total_pages when lc.client.Stats(ctx) succeeds, and emits {type, url, healthy:false} otherwise (src/pkg/knowledge/api.go:253-262). So with one remote layer down, the Knowledge section never renders on first load and never refreshes afterwards, while the badge keeps a stale value. At merge-base this case rendered normally with the missing layer counted as 0 (kbTotalFactsFromStats, knowledge.js:145-147). The focused test even locks in the stale-render behaviour (nav_count_delta.test.js:230-231 asserts the badge keeps 1021 after { enabled: true }), and no case covers healthy:false without total_pages.
Suppress only the delta cue on an unknown count; keep the load path unchanged:
const prev = _kbCache;
- const next = await r.json();
- const kbBadge = document.getElementById('knowledge-sidebar-badge');
- const kbFacts = kbSidebarFactCount(next);
- if (kbFacts === null) {
- navCountDelta(kbBadge, null);
- return;
- }
- _kbCache = next;
+ _kbCache = await r.json();
_kbCache._documents = (docsR && docsR.ok) ? await docsR.json() : [];
setSectionSummary('knowledge-section', kbFactsLabel(kbTotalFactsFromStats(_kbCache)));
+ const kbBadge = document.getElementById('knowledge-sidebar-badge');
if (kbBadge) {
+ const kbShown = kbTotalFactsFromStats(_kbCache);
+ // null when a layer is unhealthy/unknown: display still updates, only the cue is skipped.
+ const kbFacts = kbSidebarFactCount(_kbCache);
// Toggling priming changes what the badge shows, not stored facts.
if (prev && prev.enabled !== _kbCache.enabled) navCountDelta(kbBadge, null);
- setSidebarCountBadge(kbBadge, kbFacts, kbFactsLabel(kbTotalFactsFromStats(_kbCache)));
- navCountDelta(kbBadge, kbFacts, kbFactsLabel(kbFacts));
+ setSidebarCountBadge(kbBadge, _kbCache.enabled ? kbShown : 0, kbFactsLabel(kbShown));
+ navCountDelta(kbBadge, kbFacts, kbFactsLabel(kbFacts === null ? kbShown : kbFacts));
}and add a test feeding { enabled: true, layers: [{ type: 'project', total_pages: 5 }, { type: 'global', healthy: false }] } that asserts the badge shows 5, no cue, and the section still renders.
Checked and fine: tracker waiting_on_human.items is always [] from the hub (stage_tracker_waiting.go:136), so the new count: null path in tracker-waiting.js:30 is not reachable from live payloads; contributor online/registered are plain ints (api_contribute.go:95-96).
— hive: agent=adjudicator backend=copilot model=claude-fable-5.1 copilot=1.0.88
Signed-off-by: Andy Anderson <andy@clubanderson.com>
|
CLI author follow-through:
This PR is owned by our CLI repair path; @clubanderson is not being asked to write the fix. Leaving current-base admission, reviews and normal Hive merge scheduling unchanged; no manual queue/label/hold bypass and no deployment. New-head CI is the next required verdict. |
|
Thank you for your contribution! Your PR has been merged. We'd love to hear how your experience was: share feedback |
Summary
Count mapping
Validation
Concurrent work
Owner requested implementation PR only: no deployment, settings changes, or merge.