build(node): ship qualified installers with CAN maintenance and rollback

Publish qualified Node and device bundles through versioned installers. Coordinate CAN maintenance, dependency closure, retained rollback and packaging provenance.
This commit is contained in:
DCCONSTRUCTIONS
2026-10-29 09:10:02 +03:00
parent fa8bde584f
commit 755a124bd8
36 changed files with 2322 additions and 59 deletions
+106
View File
@@ -0,0 +1,106 @@
# CAN maintenance during Node installation
The standard Node owner installer owns this transition on Ubuntu 24.04 amd64.
The USB adapter can remain connected. No device firmware, motor configuration,
control route, current setpoint or motion command is changed by maintenance.
## Admission and sequencing
1. The installer serializes maintenance with a root-owned lock under
`/run/mission-core-node-maintenance`.
2. The VESC service admits maintenance only when no client operation, live
control lease, control worker, motor procedure, firmware operation, pending
configuration/limits/code restoration, or Sample Data capture owns it.
Active control is rejected before closing admission; it is not stopped to
force an update through.
3. A condition-protected gate closes new client and observer/discovery work.
Already admitted passive callbacks drain within five seconds. State is
checked again; transport links are closed and old device generations retired.
This path never invokes current, duty, RPM, calibration or firmware RPCs.
4. Only then does the installer stop the VESC service. The CAN owner must confirm
that every channel has stopped; an independent analyser/transmit job is not
silently cancelled. CAN is stopped before APT/dpkg replaces runtime files.
5. A root-owned volatile marker keeps newly started services in maintenance
throughout package configuration. The owner installer removes it and leaves
maintenance after the transaction, including ordinary failure cleanup.
Previously stopped services are started in CAN-before-VESC order; running
services are not redundantly restarted. A clean installation also releases
newly created services even though no predecessor existed.
6. Discovery/observation resumes with new connection generations. VESC remote
control must be primed again through its normal operator path; no prior
motor command or input lease is replayed.
Both services expose only root-peer Unix-socket `/maintenance/enter` and
`/maintenance/leave` operations. They are not public HTTP, Core UI, arbitrary
command or controller-command endpoints. The existing service users, network
namespace and device permissions remain unchanged. `GET /prepare-safe` remains
compatible with device preparation and package removal checks.
## Migration from the pre-maintenance runtime
The first transition uses the exact reviewed server SHA-256 identities carried
in `apps/node-agent/packaging/can_maintenance.py`. Unknown predecessor code is
not guessed or patched in place. For this bounded compatibility path, the
installer relocates the old Unix socket into a root-controlled private directory,
so normal Node clients cannot open another request. It waits out the old
10-second socket read deadline plus bounded read admission and checks the Node
operation journal and old service snapshots before stopping anything. Active
control is checked before this fence as well. Recent Sample Data activity and
unresolved hardware changes refuse the migration.
The old CAN bridge's expiring claims are allowed to close their channels; the
old root `/prepare-safe` check must then pass. Failure restores the same socket
inode when its original path is still vacant; a newly started service generation
is never overwritten by an old socket. The compatibility path sends only
inventory/observation/lifecycle queries, never an OperationRequest.
## Failure boundary and portability
A normal Python/APT failure runs maintenance cleanup and records the result in
`report.json`. An unknown service state fails closed. A hard process kill or
power loss is not represented as successful recovery: an orphaned marker/fence
blocks another installer until reconciled; `/run` is volatile across reboot.
There is deliberately no timer that re-enables commands during a long install.
No installer kills APT/dpkg to meet a polling deadline.
The common gate comes from the plugin SDK and its exact bytes are included in
both model payloads. The installer embeds its maintenance owner in the signed-off
release content, and Node also ships that source. There are no manual board-only
service edits, USB resets, extra packages or compiler requirements. Clean-OS
branch behavior is covered by synthetic tests; a new Ubuntu installation was
not exercised in this task.
## Evidence
Private qualification, installation receipt, immutable release hashes and Core
read acceptance are recorded under `outputs/can-maintenance-20261022`.
No movement, new sample capture, new diagnostic logging or firmware flashing is
part of this acceptance. The separate Hall UI does not claim raw H1/H2/H3 data:
stock firmware 5.02 does not expose those inputs through the admitted passive API.
## Lost Hall measurement reply (recovery v1)
The owner installer also reconciles an abandoned `COMM_DETECT_HALL_FOC`
operation on the explicitly qualified FW 5.02 / 75_300_R2 profile. This is not
calibration recovery or a generic pending-file exemption. It supports only the
reviewed service/procedure source hashes and a terminal receipt recording lost
completion with no configuration write. Other pending changes still refuse it.
Before recovery, active control/procedures are refused and the existing socket
is fenced; admitted requests drain. At least 60 seconds must have elapsed since
this bounded native procedure started. Time alone is insufficient: the exact
controller set/firmware identity and both raw configuration hashes must match
the pre-measurement backups. Three new reads per controller must show zero ERPM,
low zero-output current/duty, no fault and no receiver pulses. Only the fixed
configuration/telemetry/input read operations are allowed; no motion, release,
configuration write or replay is sent. Any unavailable or changed evidence
leaves the interlock intact. This does not claim to measure physical standstill.
A durable `hall_recovered_<operation>.json` stores the original pending record,
configuration hashes and fresh evidence before removing the pending marker.
The original failed receipt is preserved, and the outcome remains
`measurement-result-unknown`. The ordinary service maintenance admission guard
must then pass before it is stopped. On update completion normal observation
resumes; a new measurement requires a separate explicitly requested operation.
The installer ships this recovery source on every supported installation; no
board-specific identifiers, manual file deletion or service override is needed.