- A passed form step stops counting as completed while it is invalid, so the
linear stepper header can't skip past a form edited to an invalid value
(e.g. the MQTT host changed to localhost after Back).
- The host accepts host name, IPv4 and IPv6 characters only; quotes,
semicolons and the like would break the C string in the sketch or a JSON
template. The field keeps the bare host once the step is passed.
- Package form files can't set readOnly, helpPopupId or row; they are for the
fields the dialog adds.
- tb-iot-hub-markdown doesn't render before its data arrives.
- The connectivity service test uses an IP, so it doesn't do a DNS lookup.
- The connectivity endpoint no longer guesses BASE_URL vs REQUEST by comparing
URLs: SystemSecurityService.resolveBaseUrl returns the base URL together
with whether it came from the request, and getBaseUrl delegates to it.
- The synthetic "Connection" step stores its values under a fixed key instead
of its translated label, so review mode finds them in any UI language.
- In review mode the gateway docker-compose is resolved after the wizard is
built, so it uses the same transport values as the install.
Follows the install form design:
- The MQTT host and port get a "ThingsBoard connection" header and share one
line; the port has no hint and neither field has a copy button.
- The renderer supports field groups (one header above the first field of a
group, the same `group` property PE uses for integration templates) and
`row`, which puts consecutive fields on one line.
- Hint and help texts match the design; the localhost hint names the host the
page was opened with.
- The form uses a smaller gap between fields.
The install form now uses the hostSource from /api/iot-hub/connectivity:
- DEVICE_CONNECTIVITY (set by the system administrator): MQTT host and port
are read-only, with a copy button and a hint saying where they come from.
- BASE_URL / REQUEST: both are editable. The host is prefilled, or empty and
required when it resolved to a loopback address; the hint names the source.
A "Which host should I use?" help popup explains what to enter.
- A package that uses ${mqtt.port} also gets an MQTT port field (1-65535). The
entered port replaces ${mqtt.port} in every step and is kept for review mode,
like the host.
The renderer shows a copy button for read-only fields and the help popup for
fields that set one.
/api/iot-hub/connectivity now returns, per enabled transport:
- hostSource: DEVICE_CONNECTIVITY when the host is set in the Device
connectivity settings, otherwise BASE_URL or REQUEST, depending on whether
the base URL came from General settings or from the request. The install
dialog uses it to decide whether the user may change the host.
- port: a blank port is replaced with the standard port of the protocol
(MQTT 1883, MQTTS 8883, HTTP 80, HTTPS 443, CoAP 5683, CoAPS 5684), as the
settings page promises. Before, packages got an empty ${mqtt.port} and the
generated sketch didn't compile.
hostSource is added to the response only; DeviceConnectivityInfo stays the
model of the stored settings.
Instruction steps stay rendered, and tb-iot-hub-markdown resolved variables
only when its data changed. After Back, a corrected form value and Next, the
sketch kept showing the old value. The markdown component now also re-resolves
when the resolver changes, and the dialog passes a new resolver whenever form
values are committed.
Review follow-up for the device install host field:
- Only DIRECT_MQTT packages that use ${mqtt.host} get the field. ChirpStack
packages build the ThingsBoard URL from ${mqtt.host} and gateway packages put
it into docker-compose; they keep the resolved value until handled separately.
- The input is reduced to the bare host: any scheme, port and path are dropped,
so a pasted http://192.168.1.10:8080 no longer ends up in the sketch with the
port, and http://localhost:8080 is rejected as loopback.
- The field is labelled "MQTT host"; the MQTT host can differ from the address
of the ThingsBoard web UI.
- The loopback check comment says what is checked instead of claiming to mirror
DeviceConnectivityUtil.isLocalhost.
Device packages put ${<protocol>.host} into firmware sketches and templates.
When ThingsBoard is opened via localhost and no device connectivity host is
configured, that resolves to "localhost", which on a microcontroller is the
device itself, so the flashed device never connects.
The install dialog now detects packages that use ${<protocol>.host} and adds
a "ThingsBoard server address" field to the last form before its first use
(or a separate "Server address" step if there is no such form). The field is
prefilled with the resolved host; when that host is a loopback address it
starts empty, is required and rejects loopback values. The entered address
(scheme and trailing slash stripped) replaces ${<protocol>.host} everywhere
in the install. Packages that don't use the host get no field.
The SHOW_FORM step renders a text input right before an
<input type="password"> and no input set autocomplete, so browsers and
password managers took it for a ThingsBoard login form on the same origin.
Saved TB credentials were filled into fields such as WiFi SSID / WiFi
Password and ended up in the generated firmware sketch (PROD-9020).
- PASSWORD input: autocomplete="new-password". With no current-password
field in the form, Chrome's password manager no longer fills it on load.
- Text and number inputs: autocomplete="off".
- All inputs: data-lpignore="true", data-1p-ignore, data-bwignore. These are
vendor-specific opt-outs for the LastPass, 1Password and Bitwarden
extensions, which do their own field detection and ignore the standard
autocomplete hint. They are set on the text inputs as well, so an
extension cannot put the saved email into the field in front of the
password (e.g. SSID). Do not remove them as noise.
partitionService is a mock, so an unstubbed getAllServiceIds() returns an
empty set and the known-id tests also passed through the fail-open branch.
Assert that a live member is accepted without consulting getAllServiceIds,
so the tests fail if the isKnownServiceId check is broken.
The recently-seen grace period and fails-open-on-unknown-topology paths
of isUnknownService were only tested for pushNotificationToCore. Mirror
those tests for pushNotificationToRuleEngine and pushNotificationToTransport
so a regression scoped to those service types doesn't slip through.
- Use the new isKnownServiceId() instead of getAllServiceIds().contains(),
avoiding two collection allocations on the common (live member) path.
- Reuse SetCache instead of a hand-rolled Caffeine cache for
recentlySeenServices.
- Drop pushNotificationToTransport's null/empty serviceId guard, now
redundant with isUnknownService() treating null/empty as unknown.
- Track skipped-due-to-unknown-service notifications in a counter and
surface it via the existing periodic stats log, since the point of
this guard is to catch a leak that was previously invisible.
getAllServiceIds() rebuilds two HashSets just to test membership of a
single id - PartitionService#isKnownServiceId scans the live service
lists directly instead, for the hot path in DefaultTbClusterService's
per-notification unknown-service guard. SetCache.boundedBySize() adds
an LRU-by-size variant alongside the existing TTL-based constructor.
The clusterService field is typed as the TbClusterService interface, which
does not declare onServiceListChanged (it is a concrete-class @EventListener).
Cast to DefaultTbClusterService in the recently-seen test so it compiles.
Make the unknown-service-id skip a lenient safety net rather than a
precise gatekeeper. A service id is treated as known if it is either a
current member (PartitionService.getAllServiceIds) OR a recently seen one.
The recently-seen set is a bounded (1024) LRU cache fed from
ServiceListChangedEvent, so a node that is briefly absent from the live
snapshot - discovery-propagation lag, rolling restart, transient
scale-down - still receives its notifications instead of having them
dropped; genuine non-delivery to a node that is actually gone is already
handled by the caller-side RPC/REST timeout. An id gone for good ages out
via LRU eviction and the guard tightens again.
The live-snapshot check stays authoritative for current members (discovery
events are change-only, so a pure recently-seen cache would go cold in a
quiet cluster); recently-seen only widens 'known', it never adds a new
drop. Adds a test for the offline-but-recently-seen path.
Follow the existing pushNotificationToTransport convention: a deliberate
skip to a non-member service id now completes the callback as a no-op
success instead of onFailure, so callers don't treat an intentional skip
as a delivery error. Aligns all three skip paths (core, rule engine,
transport) on one contract.
- Extend the unknown-service-id orphan-topic guard to pushNotificationToTransport
- Make HashPartitionService.currentOtherServices volatile (now read on the
per-notification path, written under the synchronized recalculatePartitions)
- Lower the per-skip log from warn to debug to avoid noise when stale service
ids appear in message metadata during normal operation
- Add tests for the transport guard (unknown skipped, known sent)
Per-service notification topics (<notifications-topic>.<serviceId>) are
auto-created by the Kafka producer on first send. pushNotificationToCore and
pushNotificationToRuleEngine forwarded the target service id as-is. That id may
come from message metadata (e.g. the originServiceId of RPC reply and
integration-downlink flows), so an id that does not belong to the cluster
created an orphan notification topic that no node ever consumes and that is
never cleaned up, growing the topic count without bound.
Validate the target service id against current cluster membership
(PartitionService.getAllServiceIds) before sending; when the id is not a known
TB_CORE / TB_RULE_ENGINE service, skip the push and report delivery failure on
the callback (the message was not delivered, so onFailure is the correct signal
and it also lets a waiting caller complete). The check fails open while the
cluster topology is not yet known (empty membership, e.g. right after startup)
so legitimate notifications are never dropped.
With the entity partitioning strategy, DummyTask.getEntityId() returns a new
random id per task, so the 200 tasks spread over many partitions and run in
parallel. 200 x 50 ms tasks could all finish within the fixed Thread.sleep(500),
so the cancel found nothing left to discard (discardedCount == 0).
Use 30 s tasks (60 s task timeout) so tasks are always in flight when the job
is cancelled, whatever the partitioning strategy, and cancel as soon as the job
is RUNNING. Cancellation interrupts running tasks (TaskProcessor.cancelRunningTasks),
so the test still finishes quickly. One test body covers both strategies.
The server accepts the WebSocket handshake and closes the session right
away when it rejects a pre-verification token in afterConnectionEstablished.
Java-WebSocket's connectBlocking() releases its latch on both open and close
and then returns engine.isOpen(), so it returns false when the client reads
the close frame before the caller checks the state. The asserted connect in
buildAndConnectWebSocketClient then failed.
The test now connects without asserting the connect result, waits for the
close, and asserts the server close code (1011), so it still proves the
token was rejected.
The rule engine stats report runs on a schedule. On its first report for
a tenant it creates a QUEUE_STATS entity, whose SaveEntityEvent becomes
an ADDED sendNotificationMsgToEdge call. When that tick fell between
Mockito.reset and verify, testFindTenantAssets and
testFindAssetTypesByTenantId saw one extra invocation (179 vs 178, 4 vs 3).
Count only entity ids that have an edge event type, which is the same
filter DefaultTbClusterService applies before sending to an edge.