Skip to content

fix(engine): cap idea-intake acceptanceHints entry length#7285

Merged
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
galuis116:fix/idea-intake-acceptance-hint-length-cap-7243
Jul 19, 2026
Merged

fix(engine): cap idea-intake acceptanceHints entry length#7285
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
galuis116:fix/idea-intake-acceptance-hint-length-cap-7243

Conversation

@galuis116

Copy link
Copy Markdown
Contributor

Summary

  • packages/loopover-engine/src/idea-intake.ts:12-14 states the module's own invariant: a renter's freeform text is length-capped so one submission can never dominate a public surface. This is enforced for title, body, and constraints (IDEA_CONSTRAINT_MAX_CHARS), but acceptanceHints — a renter-supplied string[] of the identical shape as constraints — had no per-entry length check at all, only a shape check (array of strings).
  • acceptanceHints entries are later folded verbatim into AcceptanceCriterion.statement, which becomes part of the public constituent-issue body a contributor reads — an unbounded entry could dominate that surface exactly the way the module's stated invariant says it shouldn't.
  • Added the same bound constraints already uses (IDEA_CONSTRAINT_MAX_CHARS, both are short freeform renter strings of the same shape — no new constant introduced) and a new acceptance_hint_too_long error code, mirroring the existing constraint_too_long pattern: checked only in the else if branch after the shape check passes, so a malformed (non-array/non-string) input still surfaces acceptance_hints_invalid, not a length error.
  • validateIdeaSubmission still returns every failure in one pass (never short-circuits), unchanged.

Scope

  • The PR title follows type(scope): short summary Conventional Commit format.
  • 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.

Closes #7243

Validation

  • git diff --check — clean.
  • npm run actionlint — clean.
  • npm run typecheck — the whole-repo tsc --noEmit reliably OOMs on this shared, memory-constrained sandbox regardless of diff size (documented pattern from prior PRs in this repo's history). Verified instead with two targeted checks: (1) tsc --noEmit -p packages/loopover-engine/tsconfig.json — the whole loopover-engine workspace package (small enough to avoid the OOM), clean; (2) a standalone scoped tsc --noEmit against the changed test file using this project's exact root tsconfig.json compiler options (--strict --exactOptionalPropertyTypes --noUncheckedIndexedAccess --noImplicitOverride --noFallthroughCasesInSwitch --forceConsistentCasingInFileNames), clean.
  • npx vitest run test/unit/idea-intake-bridge.test.ts test/unit/routes-intake-idea.test.ts test/unit/mcp-cli-intake-idea-tool.test.ts — 37/37 passing, including three new regression tests: an entry at exactly the cap passes, one character over returns acceptance_hint_too_long, a malformed (non-array) acceptanceHints raises only the shape error (not the length error), and an over-length hint combines correctly with other unrelated field errors in one pass.
  • packages/loopover-engine/src/** is measured by Codecov (per codecov.yml). Ran vitest --coverage scoped to idea-intake.ts across every test file that exercises it: 100% statements, 100% branches, 100% functions, 100% lines.
  • npm run test:workers / npm run build:mcp / npm run test:mcp-pack / npm run ui:openapi:check (not applicable — no Worker route, MCP transport, UI, or OpenAPI surface changed; this only affects an existing pure-validation function's behavior)
  • npm audit --audit-level=moderate (no dependency changes)

If any required check was skipped, explain why:

  • The whole-repo npm run typecheck OOMs on this specific sandbox under current memory pressure regardless of diff size; the two scoped tsc --noEmit checks above (full package + exact-flags scoped check) are the local proxy, and CI's isolated runner performs the real whole-repo tsc --noEmit.

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 — pure input-validation change; no auth/cookie/CORS/session changes.)
  • API/OpenAPI/MCP behavior is updated and tested where needed. (N/A — validateIdeaSubmission's existing callers already surface its errors array verbatim, so no route/schema/MCP wiring changed; the new error code is additive to an existing, already-passed-through list.)
  • UI changes use live API data or real empty/error/loading states, not production mock/demo fallbacks. (N/A — no UI changes.)
  • Visible UI changes include a UI Evidence section below with JPG/JPEG or PNG screenshots. (N/A — no UI changes.)
  • Public docs/changelogs are updated where needed; changelogs are only edited for release-prep PRs.

acceptanceHints is a renter-supplied string[] of the same shape as
constraints, which already enforces IDEA_CONSTRAINT_MAX_CHARS per
entry. acceptanceHints had no equivalent bound, so an unbounded entry
could dominate the public acceptance-criteria surface it's later
folded into, contradicting the module's own stated invariant that
every renter freeform text field is length-capped.

Closes JSONbored#7243
@galuis116
galuis116 requested a review from JSONbored as a code owner July 19, 2026 12:35
@superagent-security

superagent-security Bot commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

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

@codecov

codecov Bot commented Jul 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.81%. Comparing base (2372739) to head (e72b012).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7285   +/-   ##
=======================================
  Coverage   93.81%   93.81%           
=======================================
  Files         704      704           
  Lines       69462    69463    +1     
  Branches    18896    18896           
=======================================
+ Hits        65167    65168    +1     
  Misses       3302     3302           
  Partials      993      993           
Flag Coverage Δ
shard-1 43.61% <33.33%> (+<0.01%) ⬆️
shard-2 37.34% <100.00%> (+<0.01%) ⬆️
shard-3 33.18% <33.33%> (+0.13%) ⬆️
shard-4 33.74% <33.33%> (-0.58%) ⬇️
shard-5 32.89% <0.00%> (+0.70%) ⬆️
shard-6 45.49% <0.00%> (-0.30%) ⬇️

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

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

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

loopover-orb Bot commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Tip

✅ LoopOver review result - approve/merge recommended

Review updated: 2026-07-19 12:44:27 UTC

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

✅ Suggested Action - Approve/Merge

  • safe to merge

Review summary
This PR closes a real gap: acceptanceHints was validated for shape but not length, unlike the structurally identical constraints field, and unbounded entries flow verbatim into the public-facing AcceptanceCriterion.statement. The fix mirrors the existing constraints pattern exactly (else-if after shape check, reuses IDEA_CONSTRAINT_MAX_CHARS, new acceptance_hint_too_long code), and the added tests correctly exercise the at-cap/over-cap boundary, the malformed-input non-interference case, and multi-error collection in one pass — all against the real validateIdeaSubmission code path, not a fabricated scenario.

Nits — 2 non-blocking
  • Reusing IDEA_CONSTRAINT_MAX_CHARS for acceptanceHints is reasonable per the PR's stated rationale (same freeform-string shape), but a distinct constant name (e.g. IDEA_ACCEPTANCE_HINT_MAX_CHARS aliased to the same value) would make the two invariants independently tunable later without being misleading about why one type's constant is used for another field.
  • packages/loopover-engine/src/idea-intake.ts:12-14 — consider updating the comment block to explicitly mention acceptanceHints alongside title/body/constraints now that it's covered, since the comment currently enumerates the capped fields and a future reader may miss that acceptanceHints is included.

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 #7243
Related work ✅ No active overlap found No same-issue or scoped active PR overlap found.
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: 1953 registered-repo PR(s), 1282 merged, 51 issue(s).
Contributor context ✅ Confirmed Gittensor contributor galuis116; Gittensor profile; 1953 PR(s), 51 issue(s).
Improvement ✅ Minor risk: clean · value: minor · LLM: minor
Linked issue satisfaction

Addressed
The diff adds a length check for acceptanceHints entries reusing IDEA_CONSTRAINT_MAX_CHARS, pushes a new distinct 'acceptance_hint_too_long' error code only in the else-if branch after the shape check passes (so malformed input still yields 'acceptance_hints_invalid'), and preserves the non-short-circuiting multi-error collection—matching all stated requirements.

Review context
  • Author: galuis116
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: JavaScript, Python, Dart, TypeScript, HTML, MDX, Rust, C++
  • Official Gittensor activity: 1953 PR(s), 51 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Start here: Add a concise scope and risk note.
  • Then work through the remaining 1 step 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://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 93113d7 into JSONbored:main Jul 19, 2026
16 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.

idea-intake's acceptanceHints has no length cap, unlike the structurally identical constraints field

1 participant