Skip to content

perf(hub,core): Stage 1 & 1.5 read-path speed, per-payload invalidation, and warm worker - #95

Open
xserban wants to merge 1 commit into
mainfrom
hub-stage1-speed
Open

xserban wants to merge 1 commit into
mainfrom
hub-stage1-speed

Conversation

@xserban

@xserban xserban commented Nov 29, 2026

Copy link
Copy Markdown
Owner

Summary

Implements Stage 1 (+ Stage 1.5) of docs/plans/2026-11-29-hub-stage1-speed.md with no PROJECTION_VERSION bump and no write-path changes (JSONL under events/ remains the source of truth):

  • Core SQL read optimizations: Replaced full JSONL scans in level_statement, conductor, gate_trust, gates, site_search, agreement, and extraction_agreement with synced SQLite queries or targeted read_typed + call_memo.
  • Lightweight corpus stubs: Added WorkStub / canonical_work_stubs in search.py / dedup.py for prisma_flow and flow_ledger (reusing merge_works only for active merges); reused HubContext.graph in build_overview.
  • Sync-loop fixes (Stage 1.5): Batched protocols lookup in gate_acts via bisect_left, and wrapped trust_ledger, level_statement, prisma_flow, flow_ledger, and human_queue in frozen_sync() + call_memo.entering().
  • True per-payload invalidation: Decoupled hub_ui.asset_version() from payload fingerprints, added AST-based per-builder payload_code_hash, and completed PAYLOAD_INPUTS for all registered builders.
  • Warm worker & startup control: Added WarmBuilder + hidden factory hub worker CLI, capped MainHub builds to max_concurrent_builds=1, made --all strictly on-demand, and rendered the classic site.py hub lazily on visit.

Checks

  • Stage 1 pytest (18 touched suites): 573 passed, 2 skipped in 121.12 s
  • Reflink pilot equivalence (agentic-science, Stage 1): zero non-timestamp data diffs across prisma_flow, flow_ledger, level_statement, trust_ledger, human_queue, conductor_status, and hub payloads (shell, overview, levels, sources, learn); 5-payload build subset 401.08 s -> 128.23 s (levels: 130.67 s -> 5.16 s, overview: 97.75 s -> 21.84 s, sources: 109.74 s -> 47.94 s).
  • Stage 1.5 static checks (after final format): ruff format --check, ruff check, and mypy --strict passed across all 17 modified source files and 11 test files. Full test suite + Stage 1.5 tests deferred to CI on this PR.

…on, and warm worker

- Replace full JSONL scans in level_statement, conductor, gate_trust, gates, site_search, agreement, and extraction_agreement with synced SQLite queries or targeted read_typed + call_memo
- Add lightweight WorkStub/canonical_work_stubs for prisma_flow and flow_ledger; reuse HubContext graph in build_overview
- Batch protocol lookup in gate_acts and wrap top-level read entrypoints (trust_ledger, level_statement, prisma_flow, flow_ledger, human_queue) in frozen_sync + call_memo
- Decouple hub_ui.asset_version() from payload fingerprints, add AST-based per-payload payload_code_hash, and complete PAYLOAD_INPUTS
- Add WarmBuilder + hidden 'factory hub worker' CLI, cap MainHub builds to 1 concurrent worker, make '--all' strictly on-demand, and render classic site.py hub lazily on visit
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

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.

1 participant