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
{{ message }}
This repository was archived by the owner on Nov 4, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Nov 4, 2026. It is now read-only.
Create-form does not resolve the current_user defaultValue token — spec-correct "default applicant = me" renders as an empty field until save #5683
The spec's defaultValue runtime token current_user (@objectstack/spec/dataDEFAULT_VALUE_TOKENS, #7127 family — legal on user fields and lookup with reference: 'sys_user') is resolved only by the engine at INSERT time (objectql/engine.ts — isCurrentUserDefaultToken → out[f.name] = execCtx.userId). ObjectForm resolves neither this token nor any dynamic default client-side: a new-record form renders the field empty, and the value appears only after save.
Why it matters (live prod repro, 2026-08-22)
Env os-6vp51e.objectos.ai, app app.v4b4 (报销流程): the owner asked the build agent 「报销单申请人默认不应该就是自己吗?」. The agent authored the spec-correct metadata —
— and the engine WILL stamp the actor on save (verified: an untouched lookup is omitted from ObjectForm's insert payload — server error text "insert … did not supply 'project'" proves absence, not '' — so the omitted-or-null default path fires). But the user opened the new-record form, saw 申请人 empty, and reasonably concluded the change did not work. Two sessions of back-and-forth followed. The "default = current user" a user asks for IS form pre-fill; engine-on-save alone reads as broken.
Ask
When building the initial values for a create form, resolve defaultValue: 'current_user' on user / lookup→sys_user fields to the session user (id + display), the same way static schema defaults are seeded today (the objectui-form-defaults-and-falsy seam). The token spelling must come from @objectstack/spec (DEFAULT_VALUE_TOKEN_CURRENT_USER), not a local literal — that drift is exactly how #4560 happened engine-side. NOW() on date/datetime deserves the same treatment while in there. Engine-side resolution stays as the authority for non-form writers; the form seed is a UX mirror, and an untouched pre-filled value submits the same id the engine would have chosen, so no behavior fork.
Verified end-to-end on staging (env os-1cvf2x.objectos.app, 2026-08-22, console @ 3c9fca3d via cloud#1588): asked the build agent for a 「审核人」 user field defaulting to 当前登录用户 → metadata landed with the token → the create form now renders the field pre-filled with the session user (ME · Magic Flow E2E chip, clearable/replaceable). Bonus: with cloud#1587's skill rules live, the agent unprompted narrated the save-time semantics correctly (「默认值是保存时由系统解析填入的…表单里可能显示为空,留空提交即可」) — both halves of the fix confirmed in one round.
Activity
os-zhuang commentedon Aug 22, 2026
Claim — session
30b1d4ba(cloud epic #1521 PM seat), branchfix/current-user-default-prefill, surface: ObjectForm create-mode initial-value seeding (+ shared default resolution helper). Maintainer directive 2026-08-22: 「相关问题你都直接处理」.changeset for #5683
os-zhuang commentedon Aug 22, 2026
Verified end-to-end on staging (env
os-1cvf2x.objectos.app, 2026-08-22, console @3c9fca3dvia cloud#1588): asked the build agent for a 「审核人」 user field defaulting to 当前登录用户 → metadata landed with the token → the create form now renders the field pre-filled with the session user (ME · Magic Flow E2Echip, clearable/replaceable). Bonus: with cloud#1587's skill rules live, the agent unprompted narrated the save-time semantics correctly (「默认值是保存时由系统解析填入的…表单里可能显示为空,留空提交即可」) — both halves of the fix confirmed in one round.feat(plugin-form): pre-fill the current_user defaultValue token on cr…