Skip to content

Console FormPage seeds a RUNTIME-default defaultValue literally into the control (readPrefill), suppressing the server-side resolution the declaration asks for #5727

Description

@os-zhuang

Found while implementing #5627 (wiring the section-level and object-level conditional
rules into apps/console/src/components/FormPage.tsx). Not fixed in that PR — it is a
different defect class (seeding, not conditional-rule evaluation), and that card's fence was
the four conditional-rule surfaces.

Measured on origin/mainc7cd2b60b.

Mechanism

readPrefill in apps/console/src/components/FormPage.tsx seeds every declared default
unconditionally:

for(constfoffields){if(f.defaultValue!==undefined)out[f.name]=f.defaultValue;
...
}

A defaultValue may be a literal, or an instruction the server resolves per insert
the DEFAULT_VALUE_TOKENS family (NOW(), current_user) or a CEL Expression envelope.
@object-ui/core owns the classifier for exactly that distinction
(packages/core/src/validation/server-owned-value.ts, isRuntimeDefault), and its own
docstring names seeding as consumer #1:

seeding (#4047 / #4068) — such a default is not seeded, because putting the literal text
NOW() into a datetime input and submitting it suppresses the very resolution the
declaration asked for

@object-ui/plugin-formschemaDefaults.ts routes its seeding through that classifier
(return !isRuntimeDefault(v)). FormPage.tsx calls neither: isRuntimeDefault returns
zero hits in that file. So on the console's two form routes a field declared
defaultValue: 'NOW()' opens with the literal string NOW() in the input, and a submit
sends that string as the value — which is not "absent or null", so
ObjectQL.applyFieldDefaults never resolves the declared default.

Why this is not a duplicate

Searched open issues before filing (readPrefill, seeding, runtime default, NOW(),
console form, server-owned) — no open match.

Severity note, honestly bounded

User-reachable on the public /f/:slug route as well as the internal one. The visible harm
is a control pre-filled with the text NOW() and a record whose column stores that string
rather than a timestamp. Not browser-verified — this is static evidence (the call site,
the absent classifier, and the sibling chain's guard). A fix presumably means routing this
seed through isRuntimeDefault the way schemaDefaults.ts does, but whether the console's
hand-rolled prefill path should import that classifier or grow a shared helper is a call for
triage, not for this note.

Related: #5627, #4047, #4068, #4069, #4085.

Metadata

Metadata

Assignees

Labels

domain:uiobjectui ui stream: fix lands on the published library or apps — objectui execution seatpm:queue

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions