fix(engine): cap idea-intake acceptanceHints entry length#7285
Conversation
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
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. 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
Flags with carried forward coverage won't be shown. Click here to find out more.
|
|
Tip ✅ LoopOver review result - approve/merge recommendedReview updated: 2026-07-19 12:44:27 UTC
Review summary Nits — 2 non-blocking
Decision drivers
Context & advisory signals — never blocks the verdict
Linked issue satisfactionAddressed Review context
Contributor next steps
Signal definitions
🧪 Chat with LoopOverAsk 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.
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.
|
Summary
packages/loopover-engine/src/idea-intake.ts:12-14states 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 fortitle,body, andconstraints(IDEA_CONSTRAINT_MAX_CHARS), butacceptanceHints— a renter-suppliedstring[]of the identical shape asconstraints— had no per-entry length check at all, only a shape check (array of strings).acceptanceHintsentries are later folded verbatim intoAcceptanceCriterion.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.constraintsalready uses (IDEA_CONSTRAINT_MAX_CHARS, both are short freeform renter strings of the same shape — no new constant introduced) and a newacceptance_hint_too_longerror code, mirroring the existingconstraint_too_longpattern: checked only in theelse ifbranch after the shape check passes, so a malformed (non-array/non-string) input still surfacesacceptance_hints_invalid, not a length error.validateIdeaSubmissionstill returns every failure in one pass (never short-circuits), unchanged.Scope
type(scope): short summaryConventional Commit format.CONTRIBUTING.mdand does not reintroduce GitHub Pages, VitePress,site/, orCNAME.Closes #7243
Validation
git diff --check— clean.npm run actionlint— clean.npm run typecheck— the whole-repotsc --noEmitreliably 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 wholeloopover-engineworkspace package (small enough to avoid the OOM), clean; (2) a standalone scopedtsc --noEmitagainst the changed test file using this project's exact roottsconfig.jsoncompiler 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 returnsacceptance_hint_too_long, a malformed (non-array)acceptanceHintsraises 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 (percodecov.yml). Ranvitest --coveragescoped toidea-intake.tsacross 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:
npm run typecheckOOMs on this specific sandbox under current memory pressure regardless of diff size; the two scopedtsc --noEmitchecks above (full package + exact-flags scoped check) are the local proxy, and CI's isolated runner performs the real whole-repotsc --noEmit.Safety
validateIdeaSubmission's existing callers already surface itserrorsarray verbatim, so no route/schema/MCP wiring changed; the new error code is additive to an existing, already-passed-through list.)UI Evidencesection below with JPG/JPEG or PNG screenshots. (N/A — no UI changes.)