Repository navigation
feat(phases): add the manual phase's group (HBM / ACME Container) to the grouped consumption - #312
Merged
shrutesh-tether merged 2 commits intoOct 15, 2026
Conversation
The Miner Type / Mining Unit energy views read GET /auth/metrics/consumption?groupBy=miner|container, which only sums miner telemetry, so a phase whose power is entered by hand (HBM / acme-container) never showed there. Each daily row now carries the phase's group at the mean of the hours logged that day, as the grouped hashrate already does with the pool hashrate.
…over 24 h A day with only some hours entered reported hours that were never logged (one 123 MWh hour came back as 2952 MWh). The row now carries the logged MWh, and the grouped summary totals use it; telemetry groups are unchanged.
tekwani
approved these changes
Oct 14, 2026
shrutesh-tether
approved these changes
Oct 15, 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
Summary
ACME-MCS Phase 1.5, BE-04 for consumption.
The Energy Miner Type View and Mining Unit View (moria-app-ui #3159) read
GET /auth/metrics/consumption?groupBy=miner|container.getGroupedConsumptiononly adds up miner telemetry, so a phase whose power is entered by hand never shows there, even though featureConfig names its groups (groups: { minerType: 'HBM', container: 'acme-container' }). Grouped hashrate already adds these groups (injectSyntheticHashrateGroups); grouped consumption did not.This PR adds
injectSyntheticConsumptionGroups, called ingetGroupedConsumptionjust before the summary is built:groupBy=minerorgroupBy=container(notrack);phase=total(a concrete phase withgroupByis still rejected withERR_PHASE_NOT_SUPPORTED);consumption.source: 'manual'. Its key isgroups.minerTypefor the miner grouping andgroups.containerfor the container grouping.powerW[key]).consumptionMWh[key]is the MWh actually entered that day, not the mean × 24 h. Otherwise a day with only some hours entered would report hours that were never logged: one 123 MWh hour would read as 2952 MWh.getPhaseConsumptionalready does. A day with nothing entered gets no key rather than a 0.start.calculateGroupedConsumptionSummarylists the new group. ItstotalConsumptionMWh, and the site total, use the entered MWh instead of power × 24 h. Telemetry groups give exactly the same numbers as before, because their MWh is still power × 24 h.Tests
New in
tests/unit/handlers/metrics.handlers.test.js:summary.groupedBy.HBM; one read starting at the first row's UTC midnightacme-container= 1.2 MW and no HBM key;phase=totalgives the same resultHBMkey keeps its telemetry valueChecks
HBMandacme-containerappear only on days with entered hours, and the values match the entered data (04/10 2663.67 MW, 05/10 132 MW, 13/10 123 MW). Miner Type and Mining Unit show HBM and ACME Container as the last bars. That run was before the MWh change, which only affectsconsumptionMWhand the summary, not the bars.NODE_ENV=test brittle 'tests/unit/**/*.test.js': 1947/1947 passstandard: cleanQA steps
NODE_ENV=test npx brittle tests/unit/handlers/metrics.handlers.test.js. Expect all to pass, including the 4getConsumption - groupBy …tests above.featureConfig.phasescontaining aconsumption.source: 'manual'phase withgroups, and Central DCS enabled (staging has both):metrics/consumption?…&groupBy=minerreturns anHBMkey on every day that has hand-entered hours. HBM is the last bar.…&groupBy=containerreturnsacme-container, and ACME Container is the last bar, after group-16.groupByand are unchanged.?phase=phase1_5&groupBy=minerstill returns400 ERR_PHASE_NOT_SUPPORTED.Note: staging's Phase 1.5 currently reads about 123 MW (very likely an oversized hand-entered value). The ACME Container bar will show that value until the entry is corrected. That is a data issue, not part of this change.
FE dependency
None. moria-app-ui #3159 already labels
HBM/acme-containerand puts them last in both charts.