perf(concepts): avoid full catalogue read without pending parent changes (#740)

Merged
FO
1d ago
+195-1

Purpose — measured Concept-detail latency reduction (#740)

Counterbalanced order-control run 39070620726 showed the Graph test's ~2-second Concept penalty follows Concept detail entry/return, not first-use Graph initialization.

The culprit is an extra full Concept vocabulary read in prksEffectiveConceptDetailView. The read is useful in two cases: while online it rewarms concepts:index for future offline hierarchy edits; while offline it supplies names when an unsettled SET_CONCEPT_PARENTS operation changes parent/child relationships.

Implementation and correctness guarantees

  • Online and uncertain runtime state: continue awaiting the full catalogue fetch exactly as before, so detail navigation rewarms the index after Concept or Research Notes invalidation.
  • Definitely offline: skip the extra failed-fetch/cache fallback only when there is no unsettled Concept parent-set operation; acknowledged parents/children already carry their names.
  • Keep catalogue lookups for pending, syncing, failed and conflicted hierarchy operations. Preserve deletion/identity/field overlays, revision hydration, Work references and route-staleness checks.
  • Run a dedicated Node test against the real app helper to cover all modes/statuses and to ensure already-named parent/child relationships remain intact.
  • Add a real Chromium offline regression that invalidates concepts:index, opens Concept detail online without visiting the index, checks it is rewarmed, then reparents offline and verifies both ends display the correct names.
  • All existing Graph test assertions, storage isolation and automatic CI coverage stay intact.

Measured, same-runner A/B validation

  • Original broad fast-path run: Concept roundtrip 5.312s → 3.231s, test wall 29.105s → 26.101s.
  • Revised offline-only candidate run 39072190567: 2 excluded warm-ups + 6 counterbalanced real-Chromium runs on exact base and candidate commits, 8/8 passed:
    • Concept roundtrip median 5.043s → 3.349s (1.694s saved).
    • Concept entry 1.964s → 1.102s; return 2.005s → 1.012s.
    • Whole test wall 29.616s → 27.107s (2.509s saved).
    • Position control ~3.247s → 3.151s.
  • These are single-test medians, not a claim about suite-wide savings. The temporary PR-only A/B workflow has been deleted after collecting the measurements.

Required validation

Final-head unit/E2E/packaged/static/security checks must pass and review threads must remain resolved. This PR is intentionally open for maintainer-approved merge only. No change to packaged smoke-vs-full CI policy.