Skip to content

feat(engine): assemble the customer-facing loop dashboard view - #6136

Merged
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
luciferlive112116:feat/customer-loop-view
Jul 15, 2026
Merged

feat(engine): assemble the customer-facing loop dashboard view#6136
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
luciferlive112116:feat/customer-loop-view

Conversation

@luciferlive112116

Copy link
Copy Markdown
Contributor

Summary

Closes #4807

A customer has no place to see their loop's status, spend, and results — "distinct from any internal operations view." The issue's proposal is to surface #4800's progress stream and #4792's spend/ledger data; both have since landed, so the data this surface needs now exists.

This adds that surface's pure view model. buildCustomerLoopView(input) assembles one customer's loop into what their dashboard shows — the submit → watch progress → see spend and results path, computed once, so the eventual UI only lays it out:

Field Source
progress #4800's ProgressSnapshot, passed through untouched — the customer already sees exactly this in the stream
spend #4792's totalConsumptionForTenant, plus headroom against their #4796 allocation
results / resultsReady #4801's ResultsPayload, surfaced only once it really exists

The central guarantee: tenant isolation

#4807 exists because a customer's view is distinct from #4808's internal ops fleet view: a customer sees their loop and nothing else. So the tenant filter runs here, via #4792's own audited totalConsumptionForTenant, rather than trusting a caller to have handed in a pre-filtered list. A dashboard that renders one customer another's spend is the worst bug this surface could have, and "the caller filtered it" is not a defense. A test passes another tenant's rows in and asserts they reach neither the totals nor the serialized view.

One deliberate omission

Only #4796's spend dimensions are read from the quota decision. Its third dimension, concurrency, is not reported: a spend view has no honest activeLoops reading, and inventing one would make the customer's "within allocation" answer depend on a number nobody measured — the same rule #4792's totalConsumptionForTenant follows for exactly this reason. evaluateTenantQuota still computes the headroom, so the customer's figures and the enforcement path can never disagree about their allocation. A test pins this: a concurrency-only limit never makes a within-allocation customer read as over spend.

Scope — what this deliberately does not do

It assembles a view only: no fetching, no rendering, no clock read. Building the surface is the separate UI work, which the issue additionally gates on the shared design system (#4966/#4967) — "do not scaffold a third divergent styling approach." So this core carries no styling or framework opinion, touches no UI path, and stays correct whatever renders it. This is the same pure-decision-core shape the sibling Rent-a-Loop issues merged as (#4801, #4800, #4806, #4796, #4792, #4808).

  • Conventional Commit title (feat(engine): …).
  • Focused: one new pure module + its barrel export + its test. No existing behavior changed.
  • Follows CONTRIBUTING.md; no site//CNAME/lovable; no changelog edit.
  • Linked open issue (Closes Customer-facing dashboard #4807, above).

Validation

  • git diff --check clean.
  • npm run build:miner — exit 0 (the engine package compiles + emits).
  • npm run typecheck — exit 0.
  • npx vitest run over this module and every sibling it composes (loop-consumption, tenant-quota, loop-progress, results-payload) — 49 tests passed, so the reused primitives still hold.
  • Coverage on packages/loopover-engine/src/customer-loop-view.ts (in Codecov's coverage.include): 100% statements (5/5), 100% branch (16/16), 100% functions (1/1), 100% lines (5/5).
  • Rebased onto current main.

Invariants a customer-facing surface must not get wrong — each tested:

Invariant Why it matters
Another tenant's entries never reach the view The whole reason this is "distinct from any internal operations view"
No quota → remaining/withinQuota are null A customer must tell "no limit is set" from "you have room" — never a fabricated ceiling
A concurrency-only limit never reads as over-spend A spend view has no honest activeLoops input, so it must not answer that question
resultsReady needs a finished loop and a real payload Never invite a customer to "see results" that do not exist yet
Spend with no consumption is 0, not undefined A new loop's dashboard renders real zeros

Safety

  • No secrets, wallets, hotkeys, trust scores, rewards, private rankings, or private maintainer evidence. No pricing or payout value is computed — this reports metered consumption and the customer's own allocation headroom.
  • Cross-tenant isolation is the module's core invariant, enforced in-module (not delegated to the caller) and covered by a dedicated test that asserts the foreign tenant's id never appears in the serialized view.
  • No auth/cookie/CORS/GitHub App/session change. This computes a view model; it performs no authorization and is not a substitute for the caller authenticating the customer.
  • Additive and inert: a new module plus its barrel export. Nothing imports it yet, so runtime behavior is byte-identical until the UI is built.
  • Pure and side-effect-free: no IO, no storage, no Date.now(), so it is deterministic and trivially testable.
  • No API/OpenAPI/MCP change; no schema change; no generated artifact affected.
  • No UI changes (no apps/**) — despite closing a visual-labelled issue, this PR touches only packages/loopover-engine/src/** and test/**; no changelog edit.

A customer has no place to see their loop's status, spend, and results,
distinct from any internal operations view (JSONbored#4807). Its proposal is to
surface JSONbored#4800's progress stream and JSONbored#4792's spend/ledger data; both have
since landed, so the data the surface needs now exists.

Add that surface's pure view model. buildCustomerLoopView assembles one
customer's loop into what their dashboard shows: where it is (JSONbored#4800's
ProgressSnapshot, passed through untouched), what it has cost them
(JSONbored#4792's spend, plus headroom against their JSONbored#4796 allocation), and what
came out of it (JSONbored#4801's results payload) -- the submit -> watch progress
-> see spend and results path, computed once, so the eventual UI only
lays it out.

The central guarantee is tenant isolation. JSONbored#4807 exists because a
customer's view is distinct from JSONbored#4808's internal ops fleet view: a
customer sees THEIR loop and nothing else. So the tenant filter runs
here, via JSONbored#4792's own audited totalConsumptionForTenant, rather than
trusting a caller to have pre-filtered -- a dashboard that renders one
customer another's spend is the worst bug this surface could have, and
"the caller filtered it" is not a defense. A test passes another
tenant's rows in and asserts they reach neither the totals nor the
serialized view.

Only JSONbored#4796's spend dimensions are read from the quota decision.
Concurrency is not reported: a spend view has no honest activeLoops
reading, and inventing one would make the customer's "within allocation"
answer depend on a number nobody measured -- the same rule JSONbored#4792 follows.
evaluateTenantQuota still computes the headroom, so the customer's
figures and the enforcement path cannot disagree.

Assembles a view only: no fetching, no rendering, no clock read.
Building the surface is the separate UI work, which the issue gates on
the shared design system (JSONbored#4966/JSONbored#4967), so this core carries no styling
or framework opinion and touches no UI path.

Invariants tested: no quota reports null rather than a fabricated
ceiling, so a customer can tell "no limit is set" from "you have room";
a concurrency-only limit never makes a within-allocation customer read as
over spend; and resultsReady requires both a finished loop and a real
payload, so the dashboard never invites a customer to see results that do
not exist yet.

Closes JSONbored#4807
@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@codecov

codecov Bot commented Jul 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.33%. Comparing base (45973f0) to head (19456a8).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6136   +/-   ##
=======================================
  Coverage   95.33%   95.33%           
=======================================
  Files         598      599    +1     
  Lines       47177    47185    +8     
  Branches    15025    15032    +7     
=======================================
+ Hits        44974    44982    +8     
  Misses       1477     1477           
  Partials      726      726           
Flag Coverage Δ
shard-1 43.94% <0.00%> (-0.01%) ⬇️
shard-2 36.68% <100.00%> (+0.01%) ⬆️
shard-3 32.29% <0.00%> (+0.13%) ⬆️
shard-4 33.98% <0.00%> (-0.17%) ⬇️
shard-5 31.63% <0.00%> (-0.58%) ⬇️
shard-6 44.89% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
packages/loopover-engine/src/customer-loop-view.ts 100.00% <100.00%> (ø)

@loopover-orb loopover-orb Bot added the gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier. label Jul 15, 2026
@loopover-orb

loopover-orb Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Tip

🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩

✅ LoopOver review result - approve/merge recommended

Review updated: 2026-07-15 12:40:37 UTC

3 files · 1 AI reviewer · no blockers · readiness 82/100 · CI green · clean

✅ Suggested Action - Approve/Merge

  • safe to merge

Review summary
This PR adds a pure, side-effect-free `buildCustomerLoopView` function that assembles a customer's loop dashboard view from already-merged primitives (progress snapshot, tenant-scoped consumption totals, quota decision, results payload), and re-exports it from the package index. The tenant-isolation guarantee is delegated to the already-audited `totalConsumptionForTenant` rather than reimplemented, and the test suite explicitly covers cross-tenant leakage, null-quota vs zero-quota semantics, and the done+payload gating for `resultsReady`. The PR closes #4807 as claimed and stays narrowly scoped to the view-model layer with no UI or fetching logic bundled in.

Nits — 5 non-blocking
  • The module-level and function-level comments in customer-loop-view.ts are unusually long (multiple paragraphs) for a small file — consider trimming to what's non-obvious.
  • spend.remaining is derived from `decision.remaining`, whose clamping behavior (can it go negative if usage exceeds quota?) isn't verified in this diff — worth a test asserting it doesn't go negative if evaluateTenantQuota doesn't already clamp it.
  • The `withinQuota` check hardcodes `exceeded !== "compute" && exceeded !== "time"` rather than referencing an exported constant/type for the exceeded dimensions, which could silently drift if evaluateTenantQuota adds a new dimension name.
  • Add a short top-of-file JSDoc instead of the long banner comment, per typical TS conventions in the rest of the package (see loop-consumption.ts style).
  • Consider exporting a helper or type guard for the 'exceeded' compute/time check so this logic isn't duplicated if another surface needs the same within-quota computation.
Signal Result Evidence
Code review ✅ No blockers 1 reviewer
Linked issue ✅ Linked #4807
Related work ⚠️ 2 scoped overlaps Top overlaps are listed below; lower-confidence bulk is hidden.
Change scope ❌ 8/20 High review scope from cached public metadata (1 linked issue).
Validation posture ✅ 25/25 PR body includes validation/test evidence.
Contributor workload ✅ 10/10 Author activity: 120 registered-repo PR(s), 62 merged, 35 issue(s).
Contributor context ✅ Confirmed Gittensor contributor luciferlive112116; Gittensor profile; 120 PR(s), 35 issue(s).
Gate result ✅ Passing No configured blocker found.
Improvement ✅ Minor risk: clean · value: minor · LLM: moderate
Linked issue satisfaction

Partially addressed
The PR adds a solid pure view-model layer (buildCustomerLoopView) that composes progress, tenant-filtered spend, and results per the issue's data proposal, but the issue's actual deliverable and acceptance criterion are a working dashboard/UI a pilot customer can use end-to-end, and this diff contains no UI, submission flow, or rendering — only backend/data assembly.

Review context
  • Author: luciferlive112116
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: Python, JavaScript, MDX, Rust, TypeScript
  • Official Gittensor activity: 120 PR(s), 35 issue(s).
  • Related work: Items reference the same linked issue Customer-facing dashboard #4807. (issue #4807)
  • Related work: Open PR work references issue Customer-facing dashboard #4807. (issue #4807)
Contributor next steps
  • Start here: Review top overlaps.
  • Then work through the remaining 2 steps in the Signals table above.
Signal definitions
  • Related work = same linked issue, overlapping active PRs, or title/path similarity.
  • Change scope = cached public metadata such as size labels, draft state, and review-burden hints.
  • Validation posture = whether the PR provides enough public validation/test evidence for maintainer review.
  • Contributor workload = public contributor activity and cleanup pressure, not a repo-wide quality failure.
  • Contributor context = public GitHub/Gittensor identity context; non-Gittensor status is not a blocker.
🧪 Chat with LoopOver

Ask LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.

  • @loopover ask &lt;question&gt; answers contribution-quality Q&A with source citations and freshness.
  • @loopover chat &lt;question&gt; answers in natural prose from cached decision-pack facts via local inference (maintainer/collaborator; read-only).
  • A plain-language @loopover mention with a real question is routed to the closest matching read-only command automatically — no exact syntax required.

Full command reference: https://gittensory.aethereal.dev/docs/loopover-commands

🧪 Experimental — new and may change.

🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed


💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →.

Checked by LoopOver, a quiet PR intelligence layer for OSS maintainers.

  • Re-run LoopOver review

@loopover-orb loopover-orb Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LoopOver approves — the gate is satisfied and CI is green.

@loopover-orb
loopover-orb Bot merged commit 6915288 into JSONbored:main Jul 15, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Customer-facing dashboard

1 participant