Skip to content

feat(calibration): operator visibility for the satisfaction-floor loosening loop - #8180

Merged
JSONbored merged 1 commit into
mainfrom
feat/loosening-operator-visibility
Jul 23, 2026
Merged

feat(calibration): operator visibility for the satisfaction-floor loosening loop#8180
JSONbored merged 1 commit into
mainfrom
feat/loosening-operator-visibility

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

Summary

  • Closes calibration: operator visibility for applied loosenings — live floor + history on the internal calibration surface #8161: applied loosenings stop being D1-archaeology. loadSatisfactionFloorStatus reports the flag state, shipped vs live floor, the validated stored override — shown even while the flag is off, because an operator must see a lingering row that would take effect the moment the flag flips (while liveFloor only follows it when on) — and the applied-loosening history projected newest-first from the calibration.satisfaction_floor_loosened audit events with both split verdicts and sample sizes.
  • Honesty properties, each pinned: a corrupt or non-object history row degrades to a nulls entry rather than hiding that an apply happened; out-of-bounds/garbled stored values are rejected from both storedOverride and liveFloor; every read fails safe.
  • Served at GET /v1/internal/calibration/satisfaction-floor — deliberately NOT flag-gated (visibility must survive a flag flip), same INTERNAL_JOB_TOKEN gate as its calibration siblings, aggregate numbers/verdicts only (leak-guard pinned).

Closes #8161

Scope

  • The PR title follows type(scope): short summary Conventional Commit format, for example fix(api): restore profile access checks.
  • This PR is focused and does not mix unrelated backend, UI, MCP, docs, dependency, and deploy changes.
  • This follows CONTRIBUTING.md and does not reintroduce GitHub Pages, VitePress, site/, or CNAME.
  • I linked a currently open issue this PR resolves (e.g. Closes #123) — a linked open issue is required for every contributor PR.

Validation

  • git diff --check
  • npm run actionlint
  • npm run typecheck
  • npm run test:coverage locally; codecov/patch requires ≥99% coverage of the lines AND branches you changed (aim for 100% on your diff so CI variance does not fail near the threshold). Global coverage is a non-blocking trend with a loose 90% backstop, not the gate.
  • npm run test:workers
  • npm run build:mcp
  • npm run test:mcp-pack
  • npm run ui:openapi:check
  • npm run ui:lint
  • npm run ui:typecheck
  • npm run ui:test
  • npm run ui:build
  • npm audit --audit-level=moderate
  • New or changed behavior has unit/integration tests for new branches, fallback paths, and sanitizer boundaries

If any required check was skipped, explain why:

Safety

  • No secrets, wallet details, hotkeys, coldkeys, user PATs, private keys, raw trust scores, private rankings, or private maintainer evidence are exposed.
  • Public GitHub text stays sanitized, low-noise, and does not imply compensation guarantees or optimization tactics.
  • Auth, cookie, CORS, GitHub App, Cloudflare, or session changes include negative-path tests.
  • API/OpenAPI/MCP behavior is updated and tested where needed.
  • UI changes use live API data or real empty/error/loading states, not production mock/demo fallbacks.
  • Visible UI changes include a UI Evidence section below with JPG/JPEG or PNG screenshots arranged as organized, captioned, clickable thumbnails. SVG screenshots are not used as review evidence. Review-only screenshots or recordings are not committed to the repository.
  • Public docs/changelogs are updated where needed; changelogs are only edited for release-prep PRs.

401-without-token negative path tested; the endpoint is read-only and carries no corpus content of any kind.

UI Evidence

Not applicable — no UI change (internal operator endpoint).

Notes

@JSONbored JSONbored self-assigned this Jul 23, 2026
@superagent-security

Copy link
Copy Markdown
Contributor

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

@loopover-orb loopover-orb Bot added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jul 23, 2026
@loopover-orb

loopover-orb Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Warning

⏸️ LoopOver review result - manual review recommended

Review updated: 2026-07-23 08:57:36 UTC

3 files · 1 AI reviewer · no blockers · CI pending · dirty

⏸️ Suggested Action - Manual Review

Review summary
This PR adds a read-only operator-status endpoint for the satisfaction-floor loosening loop: it reports flag state, shipped vs. live floor, the raw stored override (deliberately shown even when the flag is off), and the applied-loosening audit history projected newest-first with fail-safe degradation on corrupt rows or DB errors. The bounds check on `storedOverride` (< shipped floor, >= hard minimum) correctly mirrors the existing `getSatisfactionFloorOverride` validation, and the route is properly gated by the shared `INTERNAL_JOB_TOKEN` middleware while intentionally not flag-gated, which is the whole point of the feature. Test coverage is thorough (defaults, override on/off asymmetry, out-of-bounds rejection, corrupt-row degradation, DB-error fail-safe, and a leak-guard on the route response).

Nits — 6 non-blocking
  • `verdictOrNull` reads `proposal.visible`/`proposal.heldOut` (satisfaction-floor-loosening-run.ts:52-55) and the test fabricates that exact shape (satisfaction-floor-status.test.ts:75-76), but only `currentFloor`/`proposedFloor`/`visibleCases`/`heldOutCases` are independently confirmed against the pre-existing `runScheduledSatisfactionFloorLoosening` logging (satisfaction-floor-loosening-run.ts, unchanged lines) — worth double-checking `SatisfactionFloorLooseningProposal`'s real field names in satisfaction-floor-loosening.ts so `visibleVerdict`/`heldOutVerdict` don't silently null out in production.
  • The `storedOverride` read in `loadSatisfactionFloorStatus` (satisfaction-floor-loosening-run.ts:194-206) duplicates the query + bounds check already in `getSatisfactionFloorOverride`, just without the flag short-circuit; consider extracting a shared `readValidatedOverrideRow(env)` helper to avoid the two bound-checks drifting apart later.
  • `SATISFACTION_FLOOR_STATUS_HISTORY_LIMIT` of 25 is a reasonable but unexplained magic number — a one-line comment on why 25 (vs. e.g. matching some other history-limit convention) would help future readers.
  • Extract the override-row read+validate logic shared between `getSatisfactionFloorOverride` and `loadSatisfactionFloorStatus` into one helper to keep the bounds check single-sourced.
  • Add a brief comment or link to `SatisfactionFloorLooseningProposal`'s definition confirming `visible`/`heldOut` are the real field names the write path emits, so the verdict-mapping in `verdictOrNull` is traceable end-to-end.
  • PR author also opened the linked issue — Link an issue that was opened by a different contributor, or provide a rationale for why this self-authored issue represents genuine discovery work.

Decision drivers

  • ✅ Code review — No blockers (1 reviewer)
  • ✅ Gate result — Passing (No configured blocker found.)
Context & advisory signals — never blocks the verdict
Signal Result Evidence
Linked issue ✅ Linked #8161
Related work ✅ No active overlap found No same-issue or scoped active PR overlap found.
Change scope ✅ 20/20 Low 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: 14 registered-repo PR(s), 14 merged, 253 issue(s).
Contributor context ✅ Confirmed Gittensor contributor JSONbored; Gittensor profile; 14 PR(s), 253 issue(s).
Improvement ✅ Minor risk: clean · value: minor · LLM: moderate
Linked issue satisfaction

Addressed
The PR adds loadSatisfactionFloorStatus reporting flag state, shipped vs live floor, stored override, and applied-loosening history with split verdicts, and exposes it via a new INTERNAL_JOB_TOKEN-gated route as a sibling internal read, matching the issue's required pattern rather than the trend-endpoint alternative but satisfying its either/or framing.

Review context
  • Author: JSONbored
  • Role context: owner (maintainer lane)
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: Python, TypeScript, Ruby, Go, JavaScript, MDX, Shell, Solidity
  • Official Gittensor activity: 14 PR(s), 253 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Start here: Treat this as maintainer-lane context rather than normal contributor-lane activity.
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://loopover.ai/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

…sening loop (#8161)

The loop's applied loosenings only existed as audit rows an operator had to
query by hand. Adds loadSatisfactionFloorStatus: flag state, shipped vs LIVE
floor, the validated stored override (reported even while the flag is off --
an operator must see a lingering row that would take effect the moment the
flag flips, while liveFloor only follows it when on), and the applied history
projected newest-first from the calibration.satisfaction_floor_loosened
events with both split verdicts and sample sizes. Corrupt/non-object rows
degrade to a nulls entry rather than hiding that an apply happened; every
read fails safe. Served at GET /v1/internal/calibration/satisfaction-floor --
deliberately NOT flag-gated (visibility must survive a flag flip), same
INTERNAL_JOB_TOKEN gate, aggregate numbers/verdicts only (leak-guard pinned).

Closes #8161.
@JSONbored
JSONbored force-pushed the feat/loosening-operator-visibility branch from a4f3456 to c1ba3ac Compare July 23, 2026 08:57
@JSONbored
JSONbored merged commit d89698d into main Jul 23, 2026
10 checks passed
@JSONbored
JSONbored deleted the feat/loosening-operator-visibility branch July 23, 2026 09:01
@codecov

codecov Bot commented Jul 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.15%. Comparing base (a41206a) to head (c1ba3ac).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8180      +/-   ##
==========================================
+ Coverage   81.77%   90.15%   +8.38%     
==========================================
  Files         769       99     -670     
  Lines       77863    25257   -52606     
  Branches    23523     4725   -18798     
==========================================
- Hits        63673    22771   -40902     
+ Misses      11317     2214    -9103     
+ Partials     2873      272    -2601     
Flag Coverage Δ
shard-1 30.39% <100.00%> (-24.51%) ⬇️
shard-2 44.47% <10.52%> (-10.01%) ⬇️
shard-3 69.07% <10.52%> (?)

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

Files with missing lines Coverage Δ
src/api/routes.ts 95.28% <100.00%> (+13.90%) ⬆️
src/services/satisfaction-floor-loosening-run.ts 100.00% <100.00%> (+44.89%) ⬆️

... and 670 files with indirect coverage changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

calibration: operator visibility for applied loosenings — live floor + history on the internal calibration surface

1 participant