Repository navigation
chore: Prepare compile status and pause points for a background source snapshot capture - #3280
Conversation
get-compile-status now stays not ready while a coordination delegate the hot-reload startup can set reports a running source snapshot capture. Once the capture moves off the main thread, the CLI could otherwise return from compile before it finishes, and an edit made right after could be captured as the source the compiler read. Nothing sets the delegate yet, so the behaviour is unchanged.
The pause point port now takes an in-flight check. While a source snapshot capture runs, it first reads the file on disk and returns it when the PDB checksum confirms those are the bytes the compiler read, so a pause point re-armed on the first update tick after a reload need not wait for the whole capture. Otherwise it ensures the capture and reads the snapshot as before. The live file and the snapshot share one decoder so a byte order mark is handled the same way. The composition root passes a check that is always false until the capture moves to a pool thread.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk | ⚪ Minimal · up to
|
58f1026
into
perf/hot-reload-capture-off-main-thread
Summary
get-compile-statuscan now hold back the compile completion while a capture runs.User Impact
uloop compilestill returns only after the capture finishes, and a pause point re-armed on the first update tick after a reload does not wait for the whole capture.Changes
ToolContracts/HotReloadSnapshotCaptureCoordination.IsHoldingCompileCompletion: a static delegate the hot-reload startup will set. Null means not holding. It has the same shape asHotReloadRuntimeChangeCoordination, because the server assembly may not reference the tool.CompileStatusBridgeCommand:BuildResponsetakesisSnapshotCaptureHolding, andReadyis false while it is true. A pending compile request is then not recovered, because recovery only runs when ready.is_snapshot_capture_holding.HotReloadSourceBaseline.LoadVerifiedLiveSourceOrNull: returns the file on disk when its bytes match the PDB document checksum. It returns null when the file is missing or unreadable, when the PDB has no document for it, or when the checksums differ. It reads the same path the capture copies from. It decodes with the same function as the snapshot, so a byte order mark is handled the same way.HotReloadPausePointPorttakesFunc<bool> isCaptureInFlight. While a capture is in flight, it returns a confirmed live file without ensuring the capture. Otherwise it ensures the capture and reads the snapshot exactly as before. The composition root passes() => falsefor now.Verification
uloop compile: 0 errors. The warnings are all pre-existing ones in test fixtures.uloop run-tests --filter-type regex --filter-value "CompileStatusBridgeCommandTests|HotReloadDomainTests|HotReloadCompositionRootTests|HotReloadSourceSnapshotTests|OnionAssemblyDependencyTests|HotReloadLiveSourceVerificationTests": 173 passed, 0 failed.CompileStatusBridgeCommandTests.BuildResponse_WhileTheSnapshotCaptureHolds_IsNotReadyAndDoesNotRecoverAPendingResult. The pending request has its reload observed, so it would be recovered if ready.HotReloadDomainTests:GetVerifiedSnapshotSource_WhileCaptureRuns_ReturnsTheLiveFileWhenItMatchesThePdbWithoutWaiting..._WhileCaptureRuns_WaitsWhenTheLiveFileDiffersFromThePdb. This uses a source the PDB has no document for, since a real project file cannot be edited in a test. A checksum mismatch is covered at the baseline level below...._WhenNoCaptureRuns_EnsuresTheCaptureEvenIfTheLiveFileMatchesHotReloadLiveSourceVerificationTests:..._WhenNoCaptureRuns_EnsuresTheCaptureEvenIfTheLiveFileMatches..._ReturnsTheLiveFileWhenItMatchesThePdbWithoutWaiting..._WaitsWhenTheLiveFileDiffersFromThePdb,LoadVerifiedLiveSourceAt_WhenTheLiveBytesDifferFromThePdb_ReturnsNull,..._WhenThePdbHasNoDocument_ReturnsNullEncoding.UTF8.GetString(keeps the byte order mark)..._ReturnsTheLiveFileWhenItMatchesThePdbWithoutWaiting,LoadVerifiedLiveSourceOrNull_ReturnsTheSameTextAsTheSnapshotForTheSameBytesReadyBuildResponse_WhileTheSnapshotCaptureHolds_IsNotReadyAndDoesNotRecoverAPendingResult