Skip to content

fix: processTailLogData drills into .val for nested TAIL_LOG_RANGE_AGGR#65

Closed
mukama wants to merge 1 commit intotetherto:developfrom
mukama:fix/process-tail-log-data
Closed

fix: processTailLogData drills into .val for nested TAIL_LOG_RANGE_AGGR#65
mukama wants to merge 1 commit intotetherto:developfrom
mukama:fix/process-tail-log-data

Conversation

@mukama
Copy link
Copy Markdown
Contributor

@mukama mukama commented Apr 28, 2026

Summary

Fixes Bug A from the FE refactor smoke test: processTailLogData read item[AGGR_FIELDS.SITE_POWER] directly, but the production response wraps measurements as {ts, val: {site_power_w, hashrate_mhs_5m_sum_aggr}}. Result: powerW and hashrateMhs were 0 for every log entry, so RevenueSummary showed 0 for Avg Power / Avg Hashrate / Hashrate Capacity Factor (and EBITDA's per-day power/hashrate were similarly zeroed). Mirror the .val || item fallback pattern that processConsumptionData already uses on line 172.

Asana: https://app.asana.com/1/45238840754660/project/1205537444723387/task/1214118019754311

Test plan

  • 61/61 unit tests pass; standard lint clean
  • Verified end-to-end against dev-moria.tether.to/auth/tail-log/range-aggr — fixed processTailLogData produces 59 days with non-zero powerW (478.9 MW) and hashrateMhs (18.13 EH/s) from the real production response. Pre-fix returned 0 for both fields on every day.
  • Smoke against dev-moria once deployed: RevenueSummary renders real Avg Power / Avg Hashrate / Hashrate Capacity Factor.

The TAIL_LOG_RANGE_AGGR RPC returns per-day items as
{ts, val: {site_power_w, hashrate_mhs_5m_sum_aggr}}, but
processTailLogData read item[AGGR_FIELDS.SITE_POWER] directly without
drilling into .val, so powerW and hashrateMhs were 0 for every entry.
RevenueSummary then showed 0 for Avg Power, Avg Hashrate, and Hashrate
Capacity Factor; EBITDA's per-day power/hashrate were similarly zeroed.

Mirror the .val/.flat fallback pattern that processConsumptionData
already uses (workers/lib/server/handlers/finance.handlers.js:172).
@mukama
Copy link
Copy Markdown
Contributor Author

mukama commented Apr 28, 2026

Consolidated into #67.

@mukama mukama closed this Apr 28, 2026
@mukama mukama deleted the fix/process-tail-log-data branch April 28, 2026 10:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant