Skip to content

docs(plans): execution plan for init/increment perf (PR-P1..PR-P3)#339

Merged
HumanBean17 merged 2 commits into
masterfrom
plan/init-increment-perf-plan
Jun 22, 2026
Merged

docs(plans): execution plan for init/increment perf (PR-P1..PR-P3)#339
HumanBean17 merged 2 commits into
masterfrom
plan/init-increment-perf-plan

Conversation

@HumanBean17

Copy link
Copy Markdown
Owner

What

Adds the execution plan for the approved proposal propose/active/INIT-INCREMENT-PERF-PROPOSE.md (PR #338):

  • plans/active/PLAN-INIT-INCREMENT-PERF.md — 3-PR delivery split.
  • plans/AGENT-PROMPTS-INIT-INCREMENT-PERF.md — self-contained per-PR agent prompts.

No production code changed.

Why now

The proposal was reviewed (5-lens subagent review on #338) and is stable. This splits it into execution-ready PRs with binding contracts before any implementation starts.

Highlights

Three PRs, grounded in verified code:

  • PR-P1 — Bulk in-memory-pyarrow COPY FROM for the full rebuild path (build_ast_graph.py write_ladybug). Adds a _bulk_copy(conn, table, columns, rows) helper using the verified ladybug syntax conn.execute("COPY <table> FROM $rows", {"rows": pa_table}). Staging invariants spelled out: REL tables stage FROM/TO node ids first; CALLS dedup (seen_calls) + callee_declaring_role materialized at staging; node tables loaded before REL tables. Merge gate: a mandatory equivalence harness (test_bulk_write_graph_matches_per_row_baseline + determinism + sampled-edge rows). Open Q1 resolved (GraphMeta folded in). No ontology bump; re-index-free.
  • PR-P2 — Same primitive for the incremental path; pass5/6 MERGE (r:Route) dedup retained by name. Depends on PR-P1.
  • PR-P3 — Hoist LayeredIgnore to a cocoindex ContextKey (built once per flow run) and memoize is_ignored's _mega by directory (mega depends on the file's directory, not filename — verified against path_filtering.py). Independent of PR-P1/P2.

The AGENT-PROMPTS file gives each PR a self-contained block (branch/base, @-files, scope, out-of-scope guardrails, pytest commands, binding sentinel greps — e.g. _CREATE_SYMBOL must be gone after PR-P1, MERGE (r:Route) must remain; _MERGE_SYMBOL gone after PR-P2), manual-evidence commands, and exact PR titles.

Landing order: PR-P1 → PR-P2; PR-P3 independent.

Tests

Docs-only; baseline unchanged.

Out of scope

References

HumanBean17 and others added 2 commits June 21, 2026 23:42
Adds plans/active/PLAN-INIT-INCREMENT-PERF.md and the companion
plans/AGENT-PROMPTS-INIT-INCREMENT-PERF.md implementing the approved proposal
propose/active/INIT-INCREMENT-PERF-PROPOSE.md.

Three PRs:
- PR-P1: bulk in-memory-pyarrow COPY FROM for the full rebuild path; equivalence
  harness is the merge gate.
- PR-P2: same primitive for the incremental path (Route-MERGE dedup retained).
- PR-P3: lifespan-cached LayeredIgnore (ContextKey) + is_ignored _mega memo.

No production code. Stacks behind proposal PR #338.

Co-Authored-By: Claude <noreply@anthropic.com>
5-lens subagent review of the plan found the PR-P1/P2 boundary was
architecturally wrong: the graph write helpers are SHARED between the full
and incremental paths, so a "full-path-only" split is impossible.
- Verified call graph: _write_edges/_write_routes_and_exposes/_write_nodes_impl/
  _write_meta are each called by BOTH paths; _write_clients_producers_and_calls
  is incremental-only (global pass5/6).
- Re-split by write-FUNCTION: PR-P1 = _bulk_copy + _write_edges (the ~250s
  prize, accelerates both paths); PR-P2 = _write_nodes_impl +
  _write_routes_and_exposes + _write_clients_producers_and_calls; PR-P3 = ignore
  cache (independent).
- GraphMeta (_write_meta) left on MERGE (shared, one row) — reverses Open Q1.
- Fixed all binding sentinel greps: PR-P1 zeros the edge _CREATE_* only;
  PR-P2 zeros node/route/client constants + _MERGE_SYMBOL only after both
  routes functions convert; PR-P3 sentinel narrowed to
  LayeredIgnore(project_root).is_ignored (the bare-constructor grep wrongly
  matched once-per-run sites :177/:569, which are correctly left alone).
- Load-order §1f corrected (UnresolvedCallSite before UNRESOLVED_AT;
  Route/Client/Producer before their edges). Test files qualified
  (test_brownfield_routes / test_mcp_v2_compose / test_vectors_progress /
  test_path_filtering). PR-P2 tests placed in TestIncrementalOrchestrator.
  Baseline flagged as equivalence anchor, not production invariant.
  PR-P1 DoD lists the four test names.

Co-Authored-By: Claude <noreply@anthropic.com>
@HumanBean17 HumanBean17 merged commit 030500f into master Jun 22, 2026
1 check passed
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