Skip to content

loadOrComputeBurdenForecastResponse can never return source: computed — the compute half was deleted in #906, the name/type/docs weren't updated #8019

Description

@JSONbored

Context

src/services/burden-forecast.ts's loadOrComputeBurdenForecastResponse (lines 18-37) is named "load-or-compute" and its return type BurdenForecastResponse (lines 8-16) declares source: "snapshot" | "computed" — but the function body only ever returns a cached snapshot or null. There is no compute path.

Git history confirms the drift's origin: commit f850d7a5b ("fix(signals): avoid request-time burden forecast scans (#906)") intentionally deleted the inline buildBurdenForecast(...) fallback (moved to a background job in src/queue/processors.ts's buildBurdenForecasts) but left the function name, the "computed" type variant, and the doc/callers untouched. src/mcp/server.ts:3455-3469's getBurdenForecast tool handler summary text already says "no cached burden forecast" for the null case — confirming this is understood internally as cache-only now, just never renamed.

Requirements

  • Rename loadOrComputeBurdenForecastResponse to accurately describe its current cache-only behavior (e.g. loadCachedBurdenForecastResponse), updating all call sites.
  • Drop the "computed" variant from BurdenForecastResponse.source (it can never occur), updating any consumer that branches on it.
  • Update any doc comments referencing a "compute" path on this function to describe the real background-job path (buildBurdenForecasts in processors.ts) instead.

Deliverables

  • Function renamed to reflect cache-only behavior; all call sites (including src/mcp/server.ts) updated.
  • BurdenForecastResponse.source type no longer includes an unreachable "computed" variant.
  • Doc comments accurately describe the current snapshot-or-null behavior and point to buildBurdenForecasts for how the cache gets populated.

Test Coverage Requirements

src/** — 99%+ Codecov patch target. Existing tests for this function/type should continue to pass under the new name with no behavior change; add a type-level check (or test) confirming source can only be "snapshot".

Expected Outcome

The function's name, return type, and docs accurately describe its real cache-only behavior, with no dead "computed" branch left for a future reader (or caller) to trust.

Links & Resources

  • src/services/burden-forecast.ts (lines 8-16 for the type, 18-37 for the function)
  • src/mcp/server.ts:3455-3469 (getBurdenForecast, the caller whose own text already reflects the real cache-only behavior)
  • src/queue/processors.ts (buildBurdenForecasts, where the real compute path now lives)
  • commit f850d7a5b / fix(signals): avoid request-time burden forecast scans #906 (the fix that removed the inline compute path)

Metadata

Metadata

Assignees

No one assigned

    Labels

    gittensor:bugGittensor-scored bug fix — scores a 0.05x multiplier.help wantedExtra attention is needed

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions