fix(export): give the miner exports real temperature columns - #192
Open
arif-dewi wants to merge 1 commit into
Open
fix(export): give the miner exports real temperature columns#192arif-dewi wants to merge 1 commit into
arif-dewi wants to merge 1 commit into
Conversation
Both miner exports emitted the whole `temperature_c` object into a single
`temperatureC` field. That is fine in JSON, but the CSV serializer flattens
only one level, so the cell rendered as
`{ambient: 36.1, max: 78, avg: 61.2, chips: [object Object], pcb: [object Object]}`
— unusable in a spreadsheet, and its embedded commas break naive parsers.
Add explicit scalar columns (ambient, liquid inlet, max, avg) via a shared
helper so the two exports cannot drift apart. They are appended to the end of
COLUMNS and `temperatureC` is left in place: consumers read this CSV both by
header name and by column position, so inserting mid-list or removing the old
column would break one or the other.
The liquid inlet column is the one this change is for — the M63S measures a
liquid loop temperature separately from its ambient sensor, and until now
neither export could carry it. A miner that reports no liquid loop yields
`undefined`, so JSON omits the key and CSV leaves the cell empty rather than
claiming zero degrees.
The shared test fixture carried a scalar `temperature_c: 65`, which meant none
of the nested-object handling was exercised; it is now the real snap shape.
tekwani
approved these changes
Aug 20, 2026
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.
Asana
Problem
Both miner exports emitted the whole
temperature_cobject into a singletemperatureCfield.That is fine in JSON, but
serializers.js'sobjectToStringflattens exactly one level, so theCSV cell rendered as:
Unusable in a spreadsheet — and its embedded commas break naive parsers (they broke the first
version of my own test helper, which is how I noticed).
More immediately: the M63S measures a liquid loop temperature separately from its ambient
sensor, and until now neither export could carry it. Adding a key inside
temperature_cwould belegible in JSON but effectively invisible in CSV.
What this does
Adds explicit scalar columns —
temperatureAmbientC,temperatureLiquidInletC,temperatureMaxC,temperatureAvgC— via a sharedmapTemperatureColumns()/TEMPERATURE_COLUMNSpair inmappers.js, sominerStatsandcontainerMinerStatscannot driftapart (ops diff the two).
Appended to the end of
COLUMNS, andtemperatureCis left in place. Consumers read this CSVboth by header name and by column position, so inserting mid-list would break the positional
readers and removing the old column would break the by-name ones. Appending breaks neither. The
blob column can be deprecated separately, announced.
A miner that reports no liquid loop yields
undefined, so JSON omits the key and CSV leaves thecell empty rather than claiming zero degrees. (Note the mdk-prv v3 adapter coerces this to
0—deliberately not copied.)
No projection change was needed:
FIELDSin both exports already pullslast.snap.stats.temperature_cwholesale.Heads-up: the data does not exist yet
temperatureLiquidInletCwill be empty until a miner worker starts publishing the value.Verified twice that it is absent today:
/auth/containers/group-8/miners→temperature_c = { ambient, max, avg, chips[], pcb[] }This repo only re-projects the ork document, so nothing here can conjure it. Merging now means the
column is in place and populates on its own once the worker lands.
Open question for whoever owns the miner workers: production miners are type
miner-wm-m63spp, and that type does not exist inmoria-wrk-miner-whatsminer— not on anybranch, not in any commit, local or
tethertoupstream. Upstream ships onlym30sp / m30spp / m53s / m56s / m63, and the thing type is code-derived(
thing → miner → -wm → -m63), so that repo cannot produce-m63spp. That worker is where theliquid read has to land.
Frontend half: tetherto/moria-app-ui#2906
Verification
brittle tests/unit/handlers/export.handlers.test.js→ 18/18 pass, 84/84 assertsstandardclean on all touched filesbrittle tests/unit/**→ 1475/1477. The two failures (admin_externalrole reads the userslist) fail identically on a clean tree — verified via
git stash— and are unrelated.Four new tests: the liquid value lands in the right positional CSV cell (guards against
append-order drift), JSON carries it both flat and nested, an air-cooled miner omits it in JSON and
blanks it in CSV rather than reporting
0, and the two exports end with an identical temperatureblock.
One fixture change worth flagging:
makeMiner()carried a scalartemperature_c: 65, so none ofthe nested-object handling was ever exercised. It is now the real snap shape, which is why the
pinned CSV header/row assertions move.