Skip to content

engine: start rules while the cloud prefetch is still running, on main's onCall/accumulator code #2121

Description

@nc9

pub#1888 overlapped the cloud prefetch with the rule run, but main already shipped the rest of that PR in a different shape (2961631, repo#2129: per-call events through onCall and the accumulator, concurrent page batches through planRenderConcurrency, budgets in core-contracts AUDIT_RUNTIME). The one piece main does not have is starting the rules while the prefetch is still running. This issue rebuilds that overlap on main's code.

The review of pub#1888 found two ordering bugs in its live-write design. Any rebuild that writes prefetch results into the store while batches are still running must avoid both.

Acceptance Criteria

  • Rules start on pages whose prefetch has finished while later page batches are still rendering, using main's onCall/accumulator code in packages/audit-engine/src/cloud-prefetch.ts and cloud-prefetch-run.ts (no second event or budget mechanism).
  • The final prefetch store is in batch order, not batch completion order: with batch 0 made slow in a test, the render keys of the awaited prefetchCloudData result start with page 0's keys (setting an existing Map key does not move it, so a live write followed by a merge needs delete-then-set).
  • A batch that lands after the prefetch was abandoned does not overwrite the service-unavailable skips that abandon() wrote: tested by abandoning, then letting a slow batch finish, and checking those pages keep the skip.
  • The overlap does not change any finding, score or report output against the serial path on the canonical golden fixture (byte-identical report JSON apart from timing fields).
  • The time saved is measured on one large cloud audit fixture and stated in the PR (before/after wall time).

Metadata

Metadata

Assignees

No one assigned

    Labels

    engineenhancementperformancesize: M

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions