Skip to content

fix(lead): stop requiring an owner pick on the New Lead form - #2099

Merged
objectstack-fleet[bot] merged 5 commits into
mainfrom
claude/issue-2097-lead-owner-not-required
Oct 14, 2026
Merged

objectstack-fleet[bot] merged 5 commits into
mainfrom
claude/issue-2097-lead-owner-not-required

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Fixes #2097
Clause-②: no

What changed

  • src/sales/views/lead.view.ts: in the create form (LeadViews.form, which is the New Lead dialog), the owner_id entry no longer has required: true. The field is still on the form, now as a bare 'owner_id', with a comment explaining why. The Opportunity, Account and Contact New forms already leave it optional.
  • test/ownership-model.test.ts: one new test next to "nothing in the schema fills owner_id". It checks that the New Lead form has owner_id and does not mark it required. The server side (a rep's insert with no owner is saved under the rep, even when round-robin would pick another rep) is already covered end to end by stands down when the middleware already stamped an owner in the same file.
  • .changeset/2097-lead-owner-not-required.md (patch).

Why

As na.rep, Console → Leads → New: clicking Create stopped at "Lead Owner is required" and nothing was sent. The platform already sets the creator as owner when an insert has no owner_id, but required on the form blocked the save in the browser before that could happen.

Measurements

Console on port 4102, @objectstack/* 18.0.0-next.0, demo org from pnpm demo:staff. Checked with DOM and network probes in Playwright, then the row read back over REST.

form actor result
base 2f3d898d (required) na.rep label Lead Owner*, inline error Lead Owner is required, 0 writes to crm_lead
this branch na.rep, lead 1 POST 201, body has no owner_id key, saved owner_id = na.rep
this branch na.rep, lead 2 saved owner_id = na.rep. This run tells the two mechanisms apart: the sales_rep pool is [na.rep, eu.rep] with 1 and 0 open leads, so round-robin would have picked eu.rep
this branch sales.manager (not in the pool) saved owner_id = the manager
this branch sales.manager picks Nina Reyes the chip shows the pick, but the POST body has no owner_id, and saved owner_id = the manager
base 2f3d898d (required) sales.manager picks Nina Reyes same as the row above: no owner_id sent, saved under the manager

Acceptance notes

  • Manager picks another owner on create: this does not work, and it did not work before either. The pick is dropped on both base and this branch. In objectui, the create branch of plugin-form (ModalForm.tsx calls sanitizeFormData) removes owner_id from every create payload. Only the edit path adds back a changed owner (objectui#12205). This is an existing platform issue that this PR does not change. It has been reported to the seat for an upstream card and is not worked around here (AGENTS.md §2). Reading the code, every New form that shows owner_id is affected the same way. Only the Lead form was measured.
  • formViews.advanced_conditional (a showcase form, not the create dialog) also requires owner_id when status is contacted or qualified. It is outside this card's file surface and is only noted here.
  • No sentence under content/docs/**/leads*.mdx says a new lead needs an owner picked, so the docs are unchanged.
  • Branch history: 6b5c8121 accidentally picked up a temporary file from the dev server (objectstack.config.bundled_4tw0mek20uf.mjs). b5237b67 removes it, so the net diff has 3 files. 6b5c8121 also has a harness-attribution Co-Authored-By trailer that names the model. It was not rewritten.

Reverse check (one-time, no permanent test)

node scripts/ablation-replace.mjs (objectstack) put back { field: 'owner_id', required: true } in place of 'owner_id'. The anchor matched once, and the file's blob changed from 049bedbe to 251dc02d. Before the run I predicted the new test would fail. Result: Tests 1 failed | 15 passed (16), AssertionError: the New Lead form demands an owner again: expected true to be false. The file was then restored and its blob matches HEAD (049bedbe), with an empty git diff HEAD. Without the mutation: Tests 16 passed (16). The test imports src/ directly, so dist/ plays no part.

Gates (all on ca836d0d)

  • pnpm validate: ✓ Validation passed, exit 0
  • pnpm typecheck: exit 0 (--listFiles includes both edited .ts files)
  • pnpm lint: 18 suggestion(s), exit 0
  • pnpm lint:i18n-gate: ✓ i18n lint gate: 0 i18n/missing-* issues, exit 0
  • pnpm hygiene: ✓ source hygiene clean, exit 0
  • pnpm hygiene:tokens: ✓ source token ratchet clean, exit 0
  • pnpm build: ✓ Build complete, exit 0
  • pnpm test: Test Files 179 passed (179), Tests 3660 passed | 1 skipped (3661), exit 0

Playwright e2e is left to CI.


Generated by Claude Code

The create form marked owner_id required, so the console refused the
save with "Lead Owner is required" before the platform's insert-time
stamp could make the creator the owner. Keep the field on the form so a
manager can still pick another owner, as the Opportunity, Account and
Contact New forms already do.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01P8mZuzuyZAHSrgQKmv6ASv
Also drops objectstack.config.bundled_4tw0mek20uf.mjs, a dev-server
compile artifact the previous commit picked up by accident.

Claude-Session: https://claude.ai/code/session_01P8mZuzuyZAHSrgQKmv6ASv
Co-authored-by: Claude <noreply@anthropic.com>
@vercel

vercel Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
hotcrm Ignored Ignored Oct 14, 2026 8:28am UTC

Request Review

The owner_id comment on the New Lead form claimed a manager can still
choose another owner. Measured on 18.0.0-next.0, the console drops a
picked owner on create (objectui#12359); the comment now says so.

Claude-Session: https://claude.ai/code/session_01P8mZuzuyZAHSrgQKmv6ASv
Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci/cd CI plumbing and the verification pipeline metadata Declarative metadata — schema, security posture, UI surfaces

Projects

None yet

2 participants