You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Raise the knowledge base description limit to 10,000 chars via a shared KNOWLEDGE_BASE_DESCRIPTION_MAX_LENGTH constant, enforced consistently across the create/edit UI, the internal API contract, and the v1 API contract (previously 500 / 1000 / uncapped)
Close the internal POST/PUT /api/knowledge gap that had no server-side description cap at all
Fix the create-base modal silently blocking submit on validation errors (red field, no message) — now toasts the first error and shows the description error inline
Edit modal now toasts on validation failure instead of returning silently
Type of Change
Bug fix
Testing
Tested manually. bun run lint, bun run check:api-validation:strict, and tsc --noEmit all pass.
Low Risk
Validation and UX fixes with bounded string length; v1 clients gain a higher description cap (1k → 10k) but no security-sensitive logic changes.
Overview
Introduces KNOWLEDGE_BASE_DESCRIPTION_MAX_LENGTH (10,000) and uses it everywhere knowledge base descriptions are validated, replacing mixed limits (500 in create/edit UI, 1,000 on v1 API, none on internal POST/PUT /api/knowledge).
Create knowledge base modal: react-hook-form invalid submit now toasts the first validation message (via onInvalid) instead of failing silently; description errors show inline on ChipModalField. Primary action uses the same invalid handler.
Edit knowledge base modal: failed client validation toasts the first error instead of returning with no feedback.
API contracts:createKnowledgeBaseBodySchema and v1 create/update bodies enforce the shared max with consistent error text.
Reviewed by Cursor Bugbot for commit 50b1295. Bugbot is set up for automated code reviews on this repo. Configure here.
This PR standardises the knowledge base description length limit to 10,000 characters via a new shared KNOWLEDGE_BASE_DESCRIPTION_MAX_LENGTH constant, and fixes silent UX failures in both the create and edit modals.
Constants: Introduces KNOWLEDGE_BASE_DESCRIPTION_MAX_LENGTH = 10_000 in lib/knowledge/constants.ts, replacing ad-hoc 500/1000/uncapped values across UI, internal API, and v1 API contracts.
API contracts: Adds a .max(10_000) guard to createKnowledgeBaseBodySchema and updateKnowledgeBaseBodySchema (internal), plus the v1 create/update schemas — closing the previous gap where the internal POST/PUT had no server-side description cap.
UX fixes: The create modal now wires onInvalid to react-hook-form's handleSubmit and surfaces the description inline via error={errors.description?.message}; the edit modal's validate() now returns the first error string and toasts it, instead of silently returning.
Confidence Score: 5/5
Safe to merge — all changes are additive validation tightening and UX improvements with no breaking surface.
The constant is introduced cleanly and consumed consistently across UI, internal API, and v1 API. The DB column is PostgreSQL TEXT (unbounded), so no migration is needed for the new 10k limit. The react-hook-form wiring is correct — both the form onSubmit path and the footer button onClick path are updated. The edit modal's validate refactor preserves the original behaviour of setting all inline errors while only toasting the first one. No existing data is at risk of truncation because the new cap (10k) is higher than the previous UI/v1 limits (500/1000).
No files require special attention.
Important Files Changed
Filename
Overview
apps/sim/lib/knowledge/constants.ts
Adds KNOWLEDGE_BASE_DESCRIPTION_MAX_LENGTH = 10_000 as the single source of truth; DB column is TEXT (unbounded), so no migration is required.
apps/sim/lib/api/contracts/knowledge/base.ts
createKnowledgeBaseBodySchema now caps description at 10k chars; updateKnowledgeBaseBodySchema inherits the cap via .pick(), so both POST and PUT are covered.
apps/sim/lib/api/contracts/v1/knowledge/index.ts
v1 create and update schemas updated to use shared constant; previously had an independent 1,000-char cap — now aligned.
Adds onInvalid callback wired to both form submit paths, passes error prop to description ChipModalField; description validation now surfaces both inline and via toast.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
KNOWLEDGE_BASE_DESCRIPTION_MAX_LENGTHconstant, enforced consistently across the create/edit UI, the internal API contract, and the v1 API contract (previously 500 / 1000 / uncapped)POST/PUT /api/knowledgegap that had no server-side description cap at allType of Change
Testing
Tested manually.
bun run lint,bun run check:api-validation:strict, andtsc --noEmitall pass.Checklist
🤖 Generated with Claude Code