docs(error-catalog): VALUE_TOO_LONG / VALUE_TOO_SHORT name the field-level codes that really arrive - #20004
docs(error-catalog): VALUE_TOO_LONG / VALUE_TOO_SHORT name the field-level codes that really arrive#20004objectstack-fleet[bot] wants to merge 2 commits into
Conversation
…level codes that really arrive No producer emits either top-level code; a length miss is refused inside VALIDATION_FAILED with fields[].code max_length / min_length (record validator, settings values, Zod-parsed request bodies). Both entries now say so and tell clients to branch on VALIDATION_FAILED + fields[].code, mirroring the INVALID_FORMAT entry. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VDtqoecgES7ScQYGbFVDRv
…entry A settings write refuses a length miss as 400 SETTINGS_VALIDATION with the entry in details.fields[], not VALIDATION_FAILED; record writes and Zod-parsed bodies answer VALIDATION_FAILED with the entry in fields[] (top-level on /data, under details via the runtime dispatcher). Both entries and their Fix lines now name both envelopes. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VDtqoecgES7ScQYGbFVDRv
Contract reviewServed-tier: ① Derived judgmentsMeasured on
Advisory, not a failing claim: the analytics dataset-selection door ( ② Semver levelNone (docs-only). One file under ③ Boundary flags
Implemented-by: VERDICT: PASS Landing still needs, separately from this verdict: the Generated by Claude Code |
Fixes #19879
Clause-②: no
What
content/docs/api/error-catalog.mdx, theVALUE_TOO_LONGandVALUE_TOO_SHORTentries only. Both entries gave a live cause and a fix, as if a client could branch on the code. No producer emits either code. Both entries now say so, following the shape theINVALID_FORMATentry got in #19878: the code is reserved, no route emits it today, and a length miss arrives as a field-levelmax_length/min_lengthentry. Each entry now says where that entry rides on each path:400 VALIDATION_FAILEDwithfields[]for record writes and Zod-parsed request bodies (top-level on/data, underdetailsthrough the runtime dispatcher), and400 SETTINGS_VALIDATIONwithdetails.fields[]for a settings write. The fix line names both envelopes. Both entries stay because the enum still declares the codes.Evidence (measured on
origin/maine8f163fc)git grep -nE 'VALUE_TOO_(LONG|SHORT)'outside tests hits only the enum memberspackages/spec/src/api/errors.zod.ts:58-59, the baseline rowsscripts/error-status-unpinned-baseline.json:27-28, this page, the generatedcontent/docs/references/**pages, and ADR-0114, which records these members as a known wart. A grep for other spellings (VALUE_TOO,TOO_LONG,TOO_SHORT) finds only the unrelatedPASSWORD_TOO_SHORTin a plugin-auth test. Positive control:INVALID_FORMAThitserrors.zod.ts:57.packages/objectql/src/validation/record-validator.ts:695-699sendsfail('max_length', { maxLength, actual })andfail('min_length', { minLength, actual })forBOUNDED_STRING_FIELD_TYPES.buildFieldErrorputs that object on the wire asfields[].constraint, and the envelope's top-level code isVALIDATION_FAILED(VALIDATION_FAILED_CODE,:195).packages/spec/src/api/zod-issues-to-fields.ts:74-81mapstoo_small/too_bigtomin_length/max_lengthwhen the value is not a number, bigint, date, array or set. Numbers and dates map tomin_value/max_value, and arrays and sets tomin_items/max_items. That is why the page says "a string". The REST routes that use this sendcode: 'VALIDATION_FAILED'(for examplepackages/rest/src/rest-server.ts:8960-8963).packages/services/service-settings/src/settings-service.ts:397-400returnsmax_length/min_lengthwithconstraint { minLength?, maxLength?, actual }for a settings value outside its declared length window.:2145pushes it into the errors list, and:2167throwsSettingsValidationError(settings-service.types.ts:583-584,code = 'SETTINGS_VALIDATION').packages/services/service-settings/src/settings-routes.ts:215-217serves it assendError(res, 400, 'SETTINGS_VALIDATION', …, { details: { namespace, fields } }), andpackages/types/src/response-envelope.tssendErrorwrites that as{ success: false, error: { code, message, details } }. So a settings length miss is top-levelSETTINGS_VALIDATIONwith the entry inerror.details.fields[], notVALIDATION_FAILED.VALIDATION_FAILEDputs the list. On the/dataroutes it is flat (packages/rest/src/error-response.ts:1152-1160,mapDataError: top-levelfields). Through the runtime dispatcher it is nested (packages/runtime/src/dispatcher-plugin.ts:645,validationFailureDetails:details.fields). The page's ownVALIDATION_FAILEDcallout already documents both, so the entries link to it rather than restating it.max_length/min_length. The envelope differs:VALIDATION_FAILEDfor records and Zod bodies,SETTINGS_VALIDATIONfor settings.Not touched
:6, theCONCURRENT_LIMIT_EXCEEDEDentry andscripts/error-status-unpinned-baseline.jsonare not changed. Open PR feat(spec)!: retire CONCURRENT_LIMIT_EXCEEDED from StandardErrorCode #19957 edits them.VALUE_OUT_OF_RANGEandMISSING_REQUIRED_FIELDare not changed. Both have producers.Changeset
None. This is a docs-only change under
content/docs/, and no published package'sfiles[]changes, so it falls underskip-changeset. The PM seat applies the label.Gates
Derived with
node scripts/pm/dispatch-gates.mjs --repo objectstack-ai/objectstack --commandsfrom the merge-base change set (1 path). All 41 derived commands ran on HEAD37431df1and exited 0. The derivation is unchanged from the first head,ab8b19ea. They includepnpm check:doc-authoring,pnpm check:doc-anchors,pnpm check:nul-bytes,pnpm check:error-status-conformance,pnpm check:docs-spec-enumerationsandpnpm --filter @objectstack/spec run check:docs. The prerequisite closures (lint/formula/client-react, which pulls inspec) were built under the verify lock first. Reconciliation with--ranand the recorded exit codes:41 derived, 41 run, 0 NOT-MEASURED, 0 UNRUN(a derived zero). No package source changed, so no package tests or typecheck are owed.Rework (PM review)
The first head said every length miss arrives in
VALIDATION_FAILED, which is wrong for settings writes. The second commit,37431df1, namesSETTINGS_VALIDATION+details.fields[]for that path in both the Cause and the Fix lines. The#validation_failedlink resolves:check:doc-anchorspasses, with 377 fragment links resolved.Acceptance notes
INVALID_FORMAT,INVALID_REFERENCE, and now these two). Whether that count should include reserved codes is a question for the line PR feat(spec)!: retire CONCURRENT_LIMIT_EXCEEDED from StandardErrorCode #19957 already edits. It is not changed here.Generated by Claude Code