Brings the review follow-ups across to lts-4.3, adapted to this branch:
- The disconnect side effects use pushStateEventToRuleEngine here, and
scheduleDisconnectNotification stays outside the new guard because
fireDelayedDisconnectNotification re-verifies liveness itself.
- The eviction guard needed no change: lts-4.3 already wraps
evictServiceIdCacheIfOwnedByThisNode in a !sessions.containsKey check, which is
what lts-4.2 gained here.
- The rule-engine stubs from the lts-4.2 tests are dropped: lts-4.3 moved the
notification call out of pushStateEventToRuleEngine into
notifyEdgeConnectivity, so the push no longer depends on the context mock.
Follow-ups from review of the activity-state guard:
1. The guard only covered a reconnect landing on a different node. If the
replacement lands on this node while the stale callback is still tearing its
own session down, isOwnedByAnotherNode sees this node's own service id and the
stale active=false is written anyway - the exact state the guard exists to
prevent. Add the local-session check, matching the eviction guard which
already tests for a newer local session.
2. LAST_DISCONNECT_TIME and the DISCONNECT_EVENT push ran unconditionally. The
timestamp would contradict the live session's lastConnectTime, and the event
payload is {"active": false, ...} with SERVER_SCOPE in its metadata - exactly
what a Save Attributes node persists, so a rule chain wiring Disconnect Event
to Save Attributes writes active=false straight back and re-creates the
dropped-event behaviour through the rule engine. Both now sit inside the same
guard. scheduleDisconnectNotification stays outside: it re-verifies liveness
itself before firing.
3. The eviction guard only checked cache ownership, so a replacement on this node
would have its claim evicted by the stale callback. It now also requires that
no live session holds the edge.
4. cleanupZombieSessions removed by edge id unconditionally after destroy(),
which is not instantaneous. If the edge reconnected in that gap the live
session was dropped from 'sessions' while remaining in 'sessionsById', so it
was never torn down but every downlink lookup silently no-opped. Use a
compare-and-remove. removeFunc becomes a Consumer, since its return value was
already discarded.
5. Document that the guard narrows rather than closes the race - the attribute is
last-writer-wins across nodes - and that the dead-owner fallback does not
cover a node restarting under the same service id.
Tests: cover the same-node replacement, the DISCONNECT_EVENT suppression and its
positive counterpart, and pin the onEdgeConnect ownership publish order with an
InOrder assertion, which nothing held before. The rule-engine stubs in the
suppression tests are lenient on purpose: without them the push could never fire
and the never() assertions would pass vacuously.
Forward-port of thingsboard/thingsboard#16148: the hero search popup asks the Hub for
sectioned results and renders them, the search page gains a filter panel and a
column-driven page size, and relevance becomes the sort default on every surface that
carries a search field.
Merged with no conflicts. Two files auto-merged - iot-hub-components.module.ts, where
lts-4.3 and this branch each added a declaration, and the en_US locale, where lts-4.3
added 708 lines and this branch four keys.
The flag was set by any user selection, but only the keyboard leaves a second half to
deal with: the trigger acts on keydown, the field's own handler on keyup, and
preventDefault on the first does not stop the second. A pointer selection is finished
when it returns, so the flag stayed set with nothing to consume it, and the next
onSearch took the early return - click a result, close the detail dialog, press the
magnifier, and the search page did not open. The magnifier is the plain case because
it calls onSearch with no keystroke at all; Enter in the field does the same once the
dialog restores focus there.
It is armed from the trigger's activeOption now, which is readable only at that moment
- the trigger holds it while it calls _selectViaInteraction and clears it on the next
line of its own handler - and which a pointer never sets. Focusing the field and
clearing it drop the flag as well, which covers the one pointer selection that can
still arm it: arrowing to a row and then clicking a different one.
Three things from the re-review, two of them introduced by the commit that turned the
popup's header and footer into options.
**The Enter guard never fired.** It asked the autocomplete trigger for its active
option during keyup, but the trigger clears that inside the same keydown - it calls
_selectViaInteraction and then _resetActiveItem, which with no autoActiveFirstOption
sets the active index to -1. So the guard always fell through, and one Enter on a
highlighted row opened it and then navigated away from it. That is worse than the
behaviour before, where the click handler simply never ran. The row that acts now
records it through rowSelectedByUser, which does not depend on the order the two
handlers run in, and typing clears the flag since a pointer selection leaves no keyup
behind it.
**The header's own padding was overridden.** Under one ancestor chain,
`.mat-mdc-option.tb-search-popup-group-header` and
`.mat-mdc-option:not(.mat-mdc-option-multiple)` both weigh (0,4,0), and the second was
declared later, so every section header shipped 8px taller than the 4px the comment
above it documents - with up to six of them in a 424px panel. The catch-all could not
match the old span header; it matches an option. Each row kind now carries its own
class and the shared parts sit in one rule, so nothing here rests on source order. The
footer had the same collision and only won by being declared last.
**The hover-scrollbar block is a mixin.** This branch added a second byte-identical
copy of it. Both now call tb-iot-hub-hover-scrollbar from the partial they already
import. The mixin records what is deliberately NOT settled here: whether these panels
should keep a thumb that is invisible until hover, and whether to add the standardised
scrollbar-width / scrollbar-color that Firefox reads, is a question for the IoT Hub
filter UI as a whole - iot-hub-browse and dashboard-widget-select carry the same
treatment and predate this branch.
Adapts the lts-4.2 fix to lts-4.3, which already has the disconnect notification
debounce and its ownership helpers:
- isOwnedByAnotherNode is added next to the existing isOwnedByThisNode /
isConnectedClusterWide helpers instead of introducing them.
- The service-id cache eviction is already guarded here by
evictServiceIdCacheIfOwnedByThisNode, so the lts-4.2 change to that call site
is dropped.
- The new activity-state tests join the existing EdgeGrpcServiceTest rather than
creating it, and keep the debounce coverage already on this branch.
onEdgeDisconnect persisted active=false based only on this node's in-memory
session map. When an edge drops and reconnects to a different TB-Core node, the
new node sets active=true while the old node writes active=false whenever it
finally notices its dead stream. If the stale write lands last, the edge stays
marked inactive while its gRPC session is alive.
That flag is not only a status indicator: saveEdgeEvent() consults it before
queueing any server-to-edge event, and actions that are not on the offline
allowlist - device and entity-group assignments among them - are dropped
outright rather than queued. A stale active=false therefore makes assignments
silently never reach the edge, with a full "Sync Edge" as the only recovery.
- Guard the write with the cluster-wide service-id cache, skipping it only when
another node is the recorded owner and that node is still a live TB_CORE
service. An absent entry means ownership is unknown, not claimed elsewhere, so
that case still persists the inactive state; and a node that died without
evicting its claim cannot leave the edge marked active forever.
- Publish the ownership claim before writing active=true in onEdgeConnect, so a
disconnect callback on the node the edge just left cannot read a stale owner.
- Only evict the service-id cache entry when it still points at this node.
A stale callback would otherwise wipe the live owner's claim and defeat the
guard above for any later disconnect.
- Remove the session atomically in onEdgeDisconnect. get() and remove() were not
atomic, so a session replaced between the two was dropped from the map, torn
down and marked inactive by the stale callback even though it was the live one.
LAST_DISCONNECT_TIME and the rule-engine DISCONNECT_EVENT are intentionally left
unguarded - they are accurate statements about this session, and the timestamps
are the main diagnostic signal for flapping edges.
Backport of thingsboard/thingsboard#16155 to lts-4.2, which has no disconnect
notification debounce and therefore none of the ownership helpers the 4.3 change
builds on; they are introduced here.
Activating any other root profile (skip-pkg, skip-pkg-without-*) switches off the
activeByDefault packaging profile, which held the only build-info execution, so such builds
had no build-info.properties and ProjectInfo failed at runtime. The jar plugin config
(logback.xml exclusion, manifest) moves out of the profile for the same reason.
The popup keeps focus in the input and walks its rows with an active-descendant key
manager, which only knows about options. A section header written as a span with
role="button" and tabindex="0" is therefore unreachable: the arrow keys skip it, its
keyup.enter can never fire because it can never hold focus, and Tab does not help
since leaving the input closes the panel. That header is the only way from the popup
into a type page, so without a mouse there was no way in at all. The footer had the
same shape, though its action is also on the input's own Enter.
The header also sat inside the group's label element, which is presentational, so the
section's name came out as the header's whole text - "Devices +12 more" - wrapping a
control nobody could operate.
Header and footer are now options like every other row. They take part in arrow
navigation, they read as part of the list, and the group wrapper goes away with the
label it was distorting.
Rows also acted on (click) alone. Pressing Enter on a highlighted result runs
_selectViaInteraction, which is not a DOM click, so the card never opened from the
keyboard. Every row now acts on (onSelectionChange) guarded by isUserInput, one path
for pointer and keyboard both.
Enter in the field needed a guard to go with that: the trigger acts on keydown and
this handler runs on keyup, which the trigger's preventDefault does not stop, so one
Enter would have opened a result and then navigated away from it.
Packages built without the UI are incomplete, so -Dskip.yarn=true and
-Dskip.ui.build=true now imply -Dpkg.skip=true through dedicated profiles
in the root pom and msa/pom.xml.
This replaces the module-level pkg.skip.zip properties in msa/js-executor
and msa/web-ui, which shadowed the root skip-pkg profile and made
-Dpkg.skip=true build their Windows ZIPs again.
frontend-maven-plugin reads skip.yarn on its own, so -Dskip.yarn=true switches
off every yarn invocation in the project at once. That is the right shortcut for
a local backend build, but it is too blunt for CI: it also silences the
msa/js-executor sandbox tests, which are the only yarn-driven tests worth
keeping.
skip.ui.build is declared once in the root pom and defaults to ${skip.yarn}. It
is wired into the frontend-maven-plugin configuration of ui-ngx and msa/web-ui,
and into the pkg.skip.zip of msa/web-ui, whose Windows ZIP bundles the launcher
that `yarn run pkg` produces. It is deliberately NOT wired into
msa/js-executor: with -Dskip.ui.build=true that module still runs its yarn
install, its `yarn run pkg` and its sandbox tests.
Behaviour:
no flags everything builds and is tested as before
-Dskip.ui.build=true ui-ngx and msa/web-ui skip;
msa/js-executor still builds and runs its tests
-Dskip.yarn=true everything skips, exactly as before
The <skip> element is declared at plugin level rather than per execution so that
it also covers the executions contributed by the yarn-build and yarn-start
profiles, and so that node/yarn itself is no longer downloaded when there is
nothing to run.
The yarn test execution in msa/js-executor declared its own skip flag,
which overrode the mojo default of ${skip.yarn}, so a build run with
-Dskip.yarn=true still invoked yarn run test with no node_modules
installed. The two JS packaging modules had the same gap: the ZIP
assembly requires a launcher binary produced by yarn run pkg, so it
failed on a missing file rather than being skipped along with the yarn
work that would have produced it.
Both now follow skip.yarn while continuing to honour maven.test.skip.
Updating a solution template deletes and reinstalls every entity it created, and
unlike the other item types it is not stopped by the modified-entity check, so a
tenant's own edits to those dashboards, devices and rule chains are lost without
warning. The dialog showed the generic "replace the current version" wording,
which does not suggest anything is destroyed.
A second, smaller mismatch: a listing renamed between releases shows one name in
the installed-items table and another in the dialog that table opens, because the
dialog took its title from the published version while the table reads the
tracking row.
- show a dedicated description for SOLUTION_TEMPLATE that names what is deleted
and recreated, and says local changes are lost
- take the item details title from the tracking row while the dialog shows
exactly the installed version; any other displayed version keeps its own name
Two comments explaining why relevance is the default in both states pointed at an
internal ticket, one of them at three numbered sections of it that are being rewritten
precisely because the code no longer matches them. Neither pointer is reachable from
this repository, and the numbering is due to move.
The reasoning stays inline, with the accepted cost named: the menu reads "Most
relevant" over an install-ordered list until the user types.
The type page adopted `?creatorId=` from the URL whenever its input was unbound.
Nothing in the platform builds such a URL: the only navigations carrying query
parameters send `search` and `itemType`, and the creator profile scopes its list by
binding the component's input rather than by navigating. The branch was reachable
only by typing the parameter in by hand, and there it rescoped a Hub-wide type page
with no visible sign of why the counts had changed.
Both live callers - the creator profile and the add-item dialog - bind the input,
which the removed code deferred to in any case.
These were the only two of the thirteen fields interpolated raw, and creatorId is not
an internal value: iot-hub-browse and the creator profile both read it straight off the
route with nothing between the URL and the request, so a crafted id could close the
parameter and append its own. The UUID shape is a convention here, not something this
code enforces.
The results container kept its old indentation after being wrapped in
.tb-search-layout, so it read as a sibling of the wrapper and the two closing tags
lined up at the same depth while closing different elements. The popup's @for sat in
an ng-container carrying no directive. Removing the -compact rule left a blank line
before the closing brace in four places.
The sort options lived in three arrays behind three identical local interfaces, and
'relevance' was spelled four ways; the six cross-type item types lived in two more
arrays, byte-identical and renamed by this branch on both sides. Adding one option
here meant editing three places, and a seventh item type would have needed two.
All of it moves to iot-hub-item.models.ts as SortOption, IOT_HUB_SORT_OPTIONS,
RELEVANCE_SORT_PROPERTY and CROSS_TYPE_ITEM_TYPES. The type list stays separate from
CREATOR_VISIBLE_ITEM_TYPES, which holds the same six: that one is a membership test
carrying the type tabs' order, this one is display order with DEVICE leading, and
folding them together would have silently reordered the Type facet.
The hero popup now sends relevance in both states like every other surface, rather
than switching on whether the field has text. Both spellings ask the server for the
same rows - with no text it substitutes the install count either way - so this is the
code agreeing with the decision recorded on TBIOH-33, not a behaviour change.
Two failures that were not survivable:
- One of the six getFilterInfo calls failing emptied the whole filter panel. forkJoin
is all-or-nothing, so typeOptions went unassigned although it needs no server data,
and the i?.categories guards below could never fire. Each request now carries its
own catchError, which is what those guards already expected.
- A section arriving without items would have thrown inside a subscribe callback,
out of reach of the catchError upstream, leaving the popup on its spinner. The
response is an unvalidated cast of a new endpoint, so items is defaulted.
The facet list held a Set the host mutated in place, which works only while that
component is on default change detection. The host now hands over a new Set per
toggle. SearchResultGroup.total went unread, and @for takes a track expression
rather than a TrackByFunction.