Bound live observation work across requests and polling - #367
Open
jhgaylor wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
An 11-member Kubernetes estate took 153s to observe, then 147s on a repeated read with the source cache warmed. A single member made 217 API requests in 28s. Polling and HTTP requests launched duplicate live scans, while one browser change event scheduled four estate refreshes within 15 seconds. The existing per-estate pool limited each request separately.
This change bounds observation work across the Behold process and removes the browser amplification:
BEHOLD_ESTATE_CONCURRENCYglobally, and bound the waiting queue to 64 distinct reads.The source-stamp walker moves to a dependency-neutral module so both the existing source cache and the new scheduler use the same identity rules.
Validation:
VITEST_MAX_WORKERS=2 just checkpassed: typecheck, 85 test files / 1,638 passed, 1 existing skipped, and production bundle build. New tests exercise shared concurrency, in-flight-only reuse, bounded queues, failure/deadline recovery, source/env/namespace isolation, HTTP cancellation with another subscriber still present, and termination of a real descendant that ignores TERM. A browser burst of 20 notifications produces one follow-up with peak concurrency one.Preserved full-suite timeout evidence (related to #334)
The default parallel local run timed out at 5s in these existing tests:
src/carve-route.test.ts: “finds the manifests in the project's carveout and publishes what they record”src/ops-route.test.ts: “keeps a step's entities on the card and degrades the estate link to unresolved when no member can be graphed here (chant#2022)”The same two failures reproduced on unchanged main (
1a00dfd) using the same dependency installation. Both files passed in isolation (29 tests), and the complete required gate passed with two test workers. First-failure JSON and terminal logs were preserved during investigation. No test timeout was increased and no existing test was disabled.This addresses duplicate work and resource spikes; it does not remove Chant's per-read Kubernetes discovery cost. No production latency improvement is claimed yet. Windows cancellation terminates the direct child only. Queued reads wait outside the running-read deadline. Removing timed browser follow-ups means eventual post-operation changes are picked up by subsequent drift events or manual refresh.