review: address Opus findings on the subdevice flat-href fallback
- coordinator: _poll_subdevice_flat_hrefs called sess.pace() outside its try block and re-read self._session instead of using the caller's already-None-checked reference -- a session closed mid-poll (async_close() doesn't hold _session_lock) could crash the whole poll cycle instead of just dropping that one sibling. Now takes sess from the caller and guards pace() the same as get(). - coordinator: skip flat hrefs already covered by the hot/warm sub-poll tiers -- those are refreshed every few seconds by _run_subpolls already, so re-fetching them again on the once-per-summary-poll flat pass only adds GETs, not freshness. Matters because, unlike the Collection path (always one GET), a flat subdevice's summary-poll cost scales with its href count. - subdevices.py module docstring: corrected an overclaim inherited from PR #199 that GET /<uuid>/device/0 had been "confirmed live" on jhkwon19's unit. Only an individual /information/vs/0 read was ever actually confirmed; the Collection endpoint itself has never been observed to answer on any known unit, which is exactly what issue #205 exposes. - SKILL.md: fixed the numofsubdevice cross-check formula to match what coordinator.py actually compares (len(materialized) + 1, not len(subdevices) + len(subdevices_skipped)). - Documented, not yet guarded against: a firmware that echoes state back under any unrecognized prefix instead of 4.04ing could pass the flat probe and the liveness gate, materializing a phantom duplicate of the master. Every board seen so far genuinely 4.04s on paths it doesn't own. - Added test coverage the review flagged as missing: a materialized (not just skipped) flat subdevice re-polling end-to-end through to canonical_resources, the hot/warm skip itself, zero-master-hrefs and two-UUID no-cross-contamination edge cases, and a golden file for the #205 fixture (SKILL.md's "fixture + golden + test" discipline).
This commit is contained in:
8 files changed
+270
-26
No files matched your search
@@ -18,17 +18,22 @@ Pattern B -- UUID-prefixed tree (`TP2X_FAC_BORA_21K`, jhkwon19's board).
|
||||
`/oic/res` hides the whole appliance tree; `/device/0`'s batch instead
|
||||
carries `x.com.samsung.da.subdeviceIdList` on `/subdevices/vs/0`, and that
|
||||
same UUID appears as a literal href prefix in `/oic/res`
|
||||
(`/<uuid>/file/list/vs/0`, ...). On jhkwon19's own first unit, `GET
|
||||
/<uuid>/device/0` returned the second subdevice's own Collection batch,
|
||||
confirmed live to carry a different model/serial than the master
|
||||
(`TP2X_FAC_BORA_RAC_21K`, the wall-mounted subdevice, vs. the master's
|
||||
`TP2X_FAC_BORA_21K`, the floor subdevice) -- but issue #205, a second
|
||||
TP2X_FAC_BORA_21K unit, showed that same `/<uuid>/device/0` probe coming
|
||||
back empty, so it isn't a property of the board family, only of the
|
||||
individual unit/firmware. When it's empty, `enumerate_subdevices` falls back
|
||||
to probing every href the master itself answered this cycle individually
|
||||
under the UUID prefix, on the assumption that a composite device's siblings
|
||||
share the master's resource surface -- see `Subdevice.flat_hrefs`.
|
||||
(`/<uuid>/file/list/vs/0`, ...). What's actually been confirmed live on
|
||||
jhkwon19's unit is narrower than early issue #177 writeups suggested: a
|
||||
single individual `GET /<uuid>/information/vs/0` was read by hand through
|
||||
the debug panel and came back carrying a different model/serial than the
|
||||
master (`TP2X_FAC_BORA_RAC_21K`, the wall-mounted subdevice, vs. the
|
||||
master's `TP2X_FAC_BORA_21K`, the floor subdevice) -- real evidence a
|
||||
second subdevice exists at that prefix, but not evidence that `GET
|
||||
/<uuid>/device/0` (the Collection batch PR #199 built this pattern's seed
|
||||
around) itself returns anything. Issue #205, the same unit on a later
|
||||
version, is that assumption failing: `/<uuid>/device/0` comes back empty.
|
||||
So `enumerate_subdevices` tries it first (a future board might genuinely
|
||||
expose it) and falls back, when it's empty, to probing every href the
|
||||
master itself answered this cycle individually under the UUID prefix --
|
||||
the only thing ever actually confirmed to work for this pattern -- on the
|
||||
assumption that a composite device's siblings share the master's resource
|
||||
surface. See `Subdevice.flat_hrefs`.
|
||||
|
||||
Both are "the same thing wearing different clothes": a logical subdevice is a
|
||||
seed collection path to poll, plus an href transform between the canonical
|
||||
@@ -351,6 +356,17 @@ def enumerate_subdevices(
|
||||
# this UUID's prefix, and keep whichever ones answer. Each is a
|
||||
# plain tolerated-404 RETRIEVE, same posture as every other probe in
|
||||
# this function.
|
||||
#
|
||||
# Known gap, not yet guarded against: a firmware that answers *any*
|
||||
# request under an unrecognized prefix (echoing the master's own
|
||||
# state back rather than 4.04ing) would pass every one of these
|
||||
# probes and, if the echoed state also clears discover_partitioned's
|
||||
# liveness gate, materialize a phantom duplicate of the master
|
||||
# rather than a real sibling. Every board seen so far genuinely
|
||||
# 4.04s on paths it doesn't own (issue #205's own unit answered only
|
||||
# 1 of 31 probes), so this hasn't been built -- the one place it
|
||||
# could hook in later is comparing a candidate's confirmed reps
|
||||
# against the master's own values for those same canonical hrefs.
|
||||
flat_hrefs = []
|
||||
first = True
|
||||
for href in sorted(resources):
|
||||
|
||||
Reference in new issue
Block a user