Skip to content

fix(orb): cap gate_verdict length in orb_signals ingest (#8333)#8429

Merged
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
joaovictor91123:fix/orb-ingest-gate-verdict-cap-8333
Jul 24, 2026
Merged

fix(orb): cap gate_verdict length in orb_signals ingest (#8333)#8429
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
joaovictor91123:fix/orb-ingest-gate-verdict-cap-8333

Conversation

@joaovictor91123

Copy link
Copy Markdown
Contributor

Summary

  • src/orb/ingest.ts's orb_signals insert loop capped every sibling string field (repo_hash/pr_hash at MAX_HASH_CHARS, gate_reasoncode_bucket at MAX_BUCKET_CHARS, instance_id at MAX_INSTANCE_ID_CHARS) except gate_verdict, which was only type-checked. Added a MAX_VERDICT_CHARS (32) constant and gated the gate_verdict bind the same way gate_reasoncode_bucket already is, so an oversized value from a malformed or hostile self-hosted instance is coerced to null instead of written unbounded.

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.

Closes #8333

Validation

  • git diff --check
  • npm run typecheck
  • npx vitest run test/integration/orb-ingest.test.ts --coverage --coverage.include="src/orb/ingest.ts" — 100% statements/branches/functions/lines on src/orb/ingest.ts
  • npm run actionlint
  • 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: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:

  • This change touches only src/orb/ingest.ts and its integration test (no UI/MCP/worker/OpenAPI surface touched), so the UI/MCP/workers/OpenAPI-specific checks above were not run locally; they are unaffected by this diff and are still exercised by the full CI gate.

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. (N/A — no auth/session/CORS code touched.)
  • API/OpenAPI/MCP behavior is updated and tested where needed. (Ingest validation behavior updated and covered by the updated test; no OpenAPI schema shape changed since gate_verdict was already a nullable string field.)
  • UI changes use live API data or real empty/error/loading states, not production mock/demo fallbacks. (N/A — no UI touched.)
  • Visible UI changes include a UI Evidence section below. (N/A — no visible UI change.)
  • Public docs/changelogs are updated where needed. (N/A — no docs/changelog change needed.)

UI Evidence

N/A — this is a backend validation-only change with no visible UI surface.

Notes

  • Only gate_verdict's validation changed; no other field in the insert loop was touched, per the issue's own scope note.

@superagent-security

Copy link
Copy Markdown
Contributor

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

@codecov

codecov Bot commented Jul 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.61%. Comparing base (712836f) to head (f7ffd73).
⚠️ Report is 12 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8429      +/-   ##
==========================================
- Coverage   92.42%   89.61%   -2.81%     
==========================================
  Files         791       98     -693     
  Lines       79259    22772   -56487     
  Branches    23948     3896   -20052     
==========================================
- Hits        73252    20407   -52845     
+ Misses       4868     2187    -2681     
+ Partials     1139      178     -961     
Flag Coverage Δ
shard-1 37.87% <50.00%> (-15.46%) ⬇️
shard-2 100.00% <100.00%> (+47.55%) ⬆️
shard-3 37.87% <50.00%> (-18.28%) ⬇️

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

Files with missing lines Coverage Δ
src/orb/ingest.ts 100.00% <100.00%> (ø)

... and 693 files with indirect coverage changes

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

loopover-orb Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Tip

✅ LoopOver review result - approve/merge recommended

Review updated: 2026-07-24 13:11:32 UTC

2 files · 1 AI reviewer · no blockers · readiness 93/100 · CI green · clean

✅ Suggested Action - Approve/Merge

  • safe to merge

Review summary
This PR adds a MAX_VERDICT_CHARS=32 cap and applies it to gate_verdict the same way MAX_BUCKET_CHARS is already applied to gate_reasoncode_bucket, closing the one inconsistency the issue called out. The fix is minimal, mirrors an existing pattern in the same insert exactly, and the added test asserts the new boundary (33-char value coerced to null) alongside the existing string/null cases. This is a small, well-targeted, low-risk consistency fix with 100% coverage reported on the touched file.

Nits — 3 non-blocking
  • The 32-char cap for gate_verdict is much tighter than the 64-char cap for gate_reasoncode_bucket; worth confirming 32 is actually sufficient for real verdict values (e.g. 'needs_changes_reasoncode_bucket'-style strings) rather than an arbitrary pick — src/orb/ingest.ts:10.
  • No test exercises the exact boundary value (length === MAX_VERDICT_CHARS, i.e. 32 chars) to confirm it's accepted, only the 33-char over-limit case — test/integration/orb-ingest.test.ts:42.
  • Consider extracting the repeated `typeof x === "string" && x.length <= MAX` pattern (now duplicated 3x across gate_verdict/gate_reasoncode_bucket/hashes) into a small helper for readability, though this is optional given the diff's small size.

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 #8333
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: 176 registered-repo PR(s), 81 merged, 5 issue(s).
Contributor context ✅ Confirmed Gittensor contributor joaovictor91123; Gittensor profile; 176 PR(s), 5 issue(s).
Improvement ✅ Minor risk: clean · value: minor · LLM: minor
Linked issue satisfaction

Addressed
The diff adds MAX_VERDICT_CHARS=32 and gates the gate_verdict bind exactly as specified, matching the gate_reasoncode_bucket pattern, and the accompanying test verifies both within-cap storage and over-cap coercion to null.

Review context
  • Author: joaovictor91123
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: Python, JavaScript, MDX, TypeScript, C++, CSS, Rust
  • Official Gittensor activity: 176 PR(s), 5 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Start here: Triage stale or unlinked PRs.
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

@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 0b5d6d8 into JSONbored:main Jul 24, 2026
12 checks passed
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.

orb_signals.gate_verdict has no length cap, unlike every sibling string field in the same insert

1 participant