Repository navigation
perf(stagehand): take the hot list from the broker, without REST checks - #575
Merged
Merged
Conversation
The hot list kept every message the broker sent, so a module's earlier values still matched after it changed, and could not read the empty payload source sends when it removes a topic, so deleted modules stayed listed. Each alert was then checked again over REST, a module list and a state read per alert, on every message, one at a time. Now the latest value of each topic is kept, an emptied topic is removed, and alerts are worked out from those alone (broker-alerts.ts). The REST checks and their module cache are gone. Also: - GT, LT, GTE and LTE compare the status with the expected value; they were the wrong way round, hidden by the REST check - comparisons read a status's sub-keys - the conditions of one alert must hold on the same system - values are cleared on (re)subscribing, as the broker hands every retained value back SH-HOT-03 covers a deleted module leaving the list with no REST calls. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
Nothing injected it, but it opened its own MQTT connection and logged every message had it been. The hot list's Alert type moves to broker-alerts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Why
Stagehand was slow because it double-checked every MQTT alert over REST. That check was covering for two bugs in how stagehand read the broker, not just for bad broker data:
connected: falseand back totruestill matched "disconnected" through its old entry.JSON.parse('')threw, so deleted modules stayed listed. This is the "alerts for deleted modules" field report.Then on every message (10ms debounce), each alert was checked one at a time with a module-list query and a
systemModuleStateread per comparison.Change
broker-alerts.ts(pure functions): keep the latest value per topic, treat an empty payload as removal, and work out alerts from those values alone.DashboardsService, which goes from 827 to about 390 lines.Fixed along the way, previously hidden by the REST check:
GT/LT/GTE/LTEcomparedexpected OP value, the wrong way round. They now comparevalue OP expected, the same semantics as the old REST check, including string coercion.left.keys).Depends on
This trusts the broker, so it needs source with PlaceOS/source#65 and #66 (1.22.2 or later) on the backend. Without them a deleted module's topics may never be removed, and the reorder bug returns.
Testing
broker-alerts.spec.ts(removal, operator direction, sub-keys, per-system grouping) and service tests that a value change and a removal update the alerts with no REST calls.local): 16/16 against source master. New SH-HOT-03: two disconnected Displays, then the first is deleted. The other must be listed asDisplay_1with nothing atDisplay_2, and reconnecting it must clear the list, with no module-list or module-state requests. It fails against develop's stagehand, where the deleted module stays listed.tsc(app + spec) and oxlint: no new findings.nx build stagehandpasses.🤖 Generated with Claude Code