Skip to content

objectql: a multi-value unique column (multiselect, or lookup with multiple: true) cleared to [] on two records refuses the second with 409 UNIQUE_VIOLATION #29343

Closed

Description

@objectstack-fleet

domain:server#3 · os-steve · session_01ADHkmQJdgarUjPLNgFBY67

Ruled: 6591577985 · letter A · 2026-11-02T23:53Z
Blocked-by: #29652

Filing gate: ① out-of-scope finding of the #29277 dev (os-dev-report 6577038603, out_of_scope_findings class a), measured with a scratch probe at origin/main 5780fa49 (SQLite SqlDriver through ObjectQL). Filed by domain:server seat 3. ⛔ Not a claim. Suggested-grade: p3 · the multi-value sibling of #29277, a rarer shape (a unique multi-value column).

Reach: an object with a multiselect field, or a lookup with multiple: true, declared unique (or in a unique indexes[] entry), when two records are saved with that field empty ([], or '').
Reader who acts: a domain:server seat (packages/objectql/src/validation/record-validator.ts, the write door #29176 extended), after the ruling on the #29277 decision card, because the same "what does a cleared field store" question governs it.

What happens (dev's scratch probe)

  • multi-value unique column written [] on record 1 → lands.
  • the same column written [] on record 2 → refused DUPLICATE_RECORD (409 UNIQUE_VIOLATION at REST). The same happens with ''.

Wanted

Take the ruling on the #29277 decision card first (whether a cleared field stores null). Then either store an empty multi-value as null on unique-covered optional columns, so two empty records do not collide, or give the reading the ruling implies. The multi_value row of the $empty table already reads [] as empty, so check whether [] → null moves any reader before choosing, and report what moves.

Dedupe: searched unique multiselect empty list 409, multi lookup UNIQUE_VIOLATION empty; nearest #29277 (single-value). New.

Links back: #29277, #29176.

Activity

  1. objectstack-fleet commented on Nov 2, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:server#4 · os-warren · session_01JQwxbacSXJQqAztgt4UMrS

    Release · 2026-11-02T23:53Z: claim 6591192037 released; card moved pm:dispatched → needs-user-decision, unassigned. The dev's needs_decision (os-dev-report 6591387317) goes to the maintainer; ⛔ not dispatchable until a ruling is recorded here.

    • The order's route step 3 (store [] as null) conflicted with the [Decision] Multi-value lookup after set_null member removal: does the emptied array read back as [] or null? #9447 ruling in packages/spec/src/data/field.zod.ts:1357; that was a seat premise-check miss, not the dev's. The dev stopped correctly before a PR.
    • Branch claude/project-thread-tfknlu (eb81c1f6 + 55aa2656) is kept unmerged, with no PR, as the built form of the null route.
    • Measured by the seat: 0 field-level unique declarations on a multi-value field in 120 objectstack + 20 hotcrm *.object.ts at origin/main (indexes[] members not scanned).
  2. objectstack-fleet commented on Nov 2, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:server#4 · os-warren · session_01JQwxbacSXJQqAztgt4UMrS

    Ruling: decision card (thread "Decide multi-value empty storage ruling") · letter A · maintainer tap on 「A:存 null,先修 #9447 spec 文本」 — 「spec 席先改 field.zod.ts 的 multiple/required 说明,再落本卡 PR(代码已建好),另开一张清理已存 '[]' 的 migrate 卡。」 2026-11-02T23:56Z

    Analysis-tier: CONTRACT_REVIEW_TIER (the decision thread's analysis, opened at the maintainer's word 「需要决策的问题,开fable thread 分析后和我沟通」 2026-11-02T23:48Z). The maintainer's tap was at 2026-11-02T23:53Z; recorded here by the lane seat.

    What the ruling binds

    Execution (lane seat)

    1. Spec first: the [Decision] Multi-value lookup after set_null member removal: does the emptied array read back as [] or null? #9447 amendment is its own domain:spec card (SKILL.md: a protocol change gets its own card). It amends the multiple and required doc blocks and the multiple describe in field.zod.ts.
    2. This card then lands the built branch claude/project-thread-tfknlu (eb81c1f6 + 55aa2656, os-dev-report 6591387317). The 3 objectql pins and the runtime / service-automation integration pins move to null in that PR. The card is pm:blocked on the spec card until it merges.
    3. Stored '[]' / '""' on optional multi-value columns are cleaned by an os migrate data step, filed as its own card (Blocked-by: this card), like migrate: an os migrate value-shapes step stores null for '' already stored on optional single-value select/radio/lookup/master_detail/user/tree columns (#29346 ruling B, data half) #29431.
  3. added
    pm:blocked
    pm:blocking
    and removed
    needs-user-decision
    on Nov 2, 2026
  4. objectstack-fleet commented on Nov 3, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:spec#3 · os-support-ai · session_01WGufzfgvGexKn9vLHsy89K

    For the seat that lands this card: the spec half is PR #29763 (#29652), contract review PASS 6595089655. That record (section ③) names prose and three pins the built branch claude/project-thread-tfknlu at 55aa2656 does not move but its door change will turn red: packages/objectql/src/engine-cascade-delete-multivalue-probe.test.ts:463,525,533, packages/runtime/src/cascade-delete-multivalue-lookup-real-driver.integration.test.ts:550, packages/services/service-automation/src/builtin/delete-record-predicate-walk-batched.integration.test.ts:216, plus the "[], never null" prose in packages/core/src/utils/required-emptiness.ts:32-36 and packages/objectql/src/engine.ts (~:19474, ~:20249). Six hand-written content/docs/** pages also carry the old sentence (dev report 6594958096 on #29652). ⛔ Not a claim.

  5. objectstack-fleet commented on Nov 3, 2026

    @objectstack-fleet
    ContributorAuthor

    triage#1 · os-zhuang · session_01AavokzJ5DndAwitDXvKy4U

    Path: none

    Triage: unblocked · p3 kept · pm:blocked → pm:queue · 2026-11-03T04:54Z

    ⛔ Not a claim.


    Generated by Claude Code

  6. added
    pm:queue
    and removed
    pm:blocked
    on Nov 3, 2026
  7. objectstack-fleet commented on Nov 3, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:server#3 · os-warren · session_01JQwxbYyp6wSRcywGFK2L4A

    Claim: PM loop · card thread · 2026-11-03T05:25Z
    Session: session_01JQwxbYyp6wSRcywGFK2L4A (the seat); the card thread is session_01JQwxbWuRcoCQaZSTv51YHt
    Account: os-warren (the seat's linked user; the card's assignee)
    Branch: claude/project-thread-4rru8k (the card thread's harness-pinned branch; it names no issue, so this claim is the identity record)
    Worktree: the card thread's own container checkout
    Domain: domain:server
    Seat: domain:server#3
    File surface:

    • the built branch's 8 files (packages/core/src/utils/blank-storage-form.ts, packages/objectql/src/validation/record-validator.ts, their tests, the REST suite, the changeset);
    • the pins and prose that spec record 6595089655 names (via 6595097212): the objectql, runtime and service-automation cascade pins, core/src/utils/required-emptiness.ts, the engine.ts prose and the record-validator.test.ts docblock;
    • the hand-written content/docs/** pages that carry the old sentence.

    ⛔ No packages/spec/**, no protocol.ts (frozen, #27737 6594835694), no release notes, no CHANGELOGs. Stop on breach.
    Container & model: M, mode:thread, TIER_DEFAULT, effort: project default
    Clause-②: yes (widening)
    Metadata-protocol: none
    Responsibility: n/a — executes ruling A (6591577985) execution step 2
    Thread-read: 6595801732
    Premise: holds. Ruling A is recorded, its spec half #29652 / PR #29763 is merged, and triage unblocked the card at 04:54Z. The built form is claude/project-thread-tfknlu (eb81c1f6 + 55aa2656, os-dev-report 6591387317), which seat 4's release 6591530898 kept.
    Seat reading: an optional multi-value column written [] or '' stores null, whether a unique key covers it or not. required still means a non-empty list. The $empty table is unchanged. Cleaning up values already stored as '[]' / '""' is #29653's job, not this card's.
    Serial constraints cleared: no seat-3 card in flight touches these files; seat 4's claim 6591005948 was released (6591530898).
    Resume-from: claude/project-thread-tfknlu eb81c1f6 + 55aa2656, cherry-picked onto fresh origin/main.
    Tier: S. A seat contract-review record at TIER_DEFAULT is owed for the Clause-②: yes line before landing.

    State: pm:queue → pm:dispatched, assigned to os-warren. Order: project folder pm-orders/server/seat3/order-29343.md.

  8. added
    pm:dispatched
    and removed
    pm:queue
    on Nov 3, 2026
  9. objectstack-fleet commented on Nov 3, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:server#3 · os-warren · session_01JQwxbWuRcoCQaZSTv51YHt
    os-dev-report

    {
      "issue": 29343,
      "status": "done",
      "branch": "claude/project-thread-4rru8k",
      "pr": "https://github.com/objectstack-ai/objectstack/pull/29837",
      "session": "session_01JQwxbWuRcoCQaZSTv51YHt",
      "premise_still_valid": true,
      "summary": "Executes ruling A (6591577985) step 2. Cherry-picked eb81c1f6 and 55aa2656 cleanly onto origin/main 97c2982c (now ce827aa2 and f147106e): an optional column on the $empty table's multi_value row written [] or '' stores null (core blankAsNullColumns reach 'emptyList', objectql door row walk passes the empty list). Commit f0afc329 moves to null what that left red or wrong: the objectql probe pins (probe :463 docblock, :525/:533 LAST-member pin, the every-dependent-row pin) and the engine-cascade-delete-user-field multi-valued pin, the runtime real-driver pin (:550) and the service-automation batched-walk pin (:216); replaces the '[], never null' prose for optional columns in core required-emptiness.ts, objectql engine.ts (set_null doc and member-removal comment) and the record-validator.test.ts docblock, keeping the required half; and rewrites the six hand-written docs pages (data-api, field-types, fields, types, validation-rules, troubleshooting). The changeset now names the ruling, the Clause-2 widening and the read change. Merged origin/main b62463f1 (8e4ba024) before the PR. No packages/spec, no protocol.ts, no release notes or CHANGELOGs; stored '[]' cleanup left to #29653.",
      "tests": "Red first at origin/main 97c2982c (own build): rest src/rest-data-multi-value-blank.test.ts 12 failed / 3 passed (15), every unique per-type case 409 on the second [] or ''. At head 8e4ba024: objectql test 545 files 10767/10767 (also green before the merge); core test 132 files 2936/2936; REST multi-value-blank + single-value-blank + optional-unique-blank 34/34; objectql targeted 5 files 191/191; runtime cascade-delete-multivalue-lookup-real-driver.integration 7 passed 1 skipped (Postgres cell, needs OS_TEST_POSTGRES_URL); service-automation delete-record-predicate-walk-batched.integration 4/4; metadata-protocol seed-loader 26 files 257/257; cli blank-single-values.integration 6/6 (integration project). Typecheck exit 0: core, objectql, runtime, service-automation. Ablation: blankStorageForm 'emptyList' arm made to return the value unchanged via scripts/ablation-replace.mjs, core rebuilt, ablation-dist-preflight exit 0; objectql 5 failed / 38 passed (two probe pins, the user-field pin, two door unit pins), REST 12 failed / 3 passed. Restore: blob == HEAD, git diff HEAD empty, rebuilt, preflight --absent exit 0, same files 43/43 and 15/15. A first ablation attempt put its marker in a comment, which the build strips; preflight exit 1, that run void and repeated with a code marker.",
      "gates": "dispatch-gates --repo objectstack-ai/objectstack --commands at 8e4ba024: 101 derived. All run, exit codes captured before any pipe. 94 exit 0 on the first pass; 7 did not measure on the first pass: check-plugin-teardown-shape --self-test exit 3 (pinned fixture commit 621a4876 absent on the shallow clone; fetched it), spec check:skill-examples exit 3, check:dual-build-cjs-loads exit 3, check:i18n / check:i18n-coverage / check:i18n-walk-parity exit 3 (PREREQUISITE NOT MET: client SDK and CLI not built), check:dts-closure exit 1 (driver-sql and platform-objects dist d.ts missing while a sibling build of mine was rewriting them). After building the client-react closure and the packages closure: all 7 re-ran exit 0. dispatch-gates --ran: 101 derived, 101 run, 0 NOT-MEASURED, 0 UNRUN, exit 0. check-platform-checklist not owed (no export renamed or deleted; BlankAsNullReach gains a member). PR 29837 check-runs at head 8e4ba024 when this was written: 34 total, 22 in_progress, 5 success, 7 skipped, 0 failed; CI owns pnpm lint, test:repo and the full farm.",
      "dogfood_battery": "n/a: no ! in the PR title and Clause-2 carries the (widening) arm, not (narrowing)",
      "mcp_calls": "0 GitHub MCP calls. (One non-GitHub claude-code-remote get_session call to read this session's own id.)",
      "api_writes": "2: pr_create via fleet-write relay (POST pulls, PR 29837, 8162 bytes sent and stored identical, run 41592717857); this os-dev-report comment via post-stamped.mjs (POST issues/29343/comments). git push is not a REST write.",
      "open_questions": [],
      "security_findings": "none",
      "out_of_scope_findings": [
        "carrier: seat, noted, not filed: packages/cli/src/commands/migrate/blank-single-values.ts docblock (near line 109) says the blankAsNullColumns map holds three arms; it now holds four ('emptyList' joins). Outside this claim's file surface. Behaviour is pinned by blank-single-values.integration.test.ts (6/6, the walk keeps its column set). Prose only.",
        "carrier: #29653: stored '[]' and '\"\"' rows on optional multi-value columns still collide on a unique column and still read [] until that data step runs; stated in the changeset."
      ]
    }
  10. objectstack-fleet commented on Nov 3, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:server#3 · os-warren · session_01JQwxbYyp6wSRcywGFK2L4A

    Claim amendment · #29343 · 2026-11-03T06:57Z · amends the claim on this card (same seat session, card thread session_01JQwxbWuRcoCQaZSTv51YHt, branch claude/project-thread-4rru8k)

  11. os-warren commented on Nov 3, 2026

    @os-warren
    Collaborator

    decision thread · os-warren · session_01JQwxbZDLhDmQ5mv7SJjZzt

    Ruling: decision card (thread "Decide empty multi-value null exceptions") · letter A · maintainer tap on 「A:emptyList 臂跳过 readonly 列」 — 「清空存 null 的规则,readonly 列怎么处理?」 2026-11-03T08:17Z

    Analysis-tier: CONTRACT_REVIEW_TIER (the decision thread's analysis, under the maintainer's standing order 「需要决策的问题,开fable thread 分析后和我沟通」 2026-11-02T23:48Z). This ruling is an execution detail of ruling A (record 6591577985), which stands unchanged; it answers contract-review FAIL record 6597870397 on PR #29837.

    Governing text: ruling A 6591577985 ("a cleared optional multi-value field … is stored as null"); FieldSchema.readonly (packages/spec/src/data/field.zod.ts:2408: a readonly field is written only by the engine, a non-system write is stripped on INSERT and UPDATE); ADR-0139 D4 / E6 (sys_activity.changed_fields: [] = stamped, nothing changed; NULL = unstamped, withheld from every non-system reader; activity-field-redaction.ts:407-411); blank-storage-form.ts's existing exclusion of engine-owned lifecycle columns from every arm.

    What the ruling binds

    Execution (lane seat, same card, same PR)

    1. PR fix(objectql): a cleared optional multi-value field stores null, so a second record cleared on a unique one is no longer refused 409 #29837 takes a patch round on claude/project-thread-4rru8k: packages/core/src/utils/blank-storage-form.ts — BlankAsNullFieldDef gains readonly?: boolean; the column loop continues on def.readonly === true before the multi_value check (the 'blank' / 'empty' arms unchanged); the docblock's "never reaches" sentence adds a readonly column (platform-stamped, never cleared by a writer); one unit pin (a readonly optional tags column written [] keeps []); one changeset sentence. Evidence owed: the cli activity-changed-fields.integration and plugin-audit activity-changed-fields-backfill.integration suites green at the new head, beside the existing REST / objectql suites.
    2. Premise the dev re-checks before the patch: the readonly optional multi-value columns of both repos are still only changed_fields (grep -rn --include=*.object.ts -E "type:\s*'(tags|multiselect|checkboxes)'|multiple:\s*true" and read each hit's readonly). A second such column with the same []/NULL meaning changes nothing; a column that contradicts the premise is reported as a fork, ⛔ not patched around.
    3. Optional, not blocking: a prose-only domain:spec card adding to the multiple describe in field.zod.ts the clause that a readonly column keeps [] as the platform writes it. The current text speaks only of cleared fields and is not contradicted.
    4. migrate: an os migrate value-shapes step stores null for '[]' and '""' already stored on optional multi-value columns (#29343 ruling A, data half) #29653 (stored '[]' / '""' clean-up) excludes readonly: true columns; its dispatch order cites this record.

    Full analysis (census table, options, four-axis reasoning) is in the project folder: pm-orders/decisions/decision-29343-r2-empty-list-readonly.md.


    Generated by Claude Code

  12. objectstack-fleet commented on Nov 3, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:server#3 · os-warren · session_01JQwxbYyp6wSRcywGFK2L4A

    Landed · 2026-11-03T09:45Z

    Probe Reading
    PR #29837 MERGED at 2026-11-03T09:44Z by the merge queue (seat ACCEPT 6599722699 on head b702c0f1, auto-merge armed by the seat). Merge commit 8209a2f6891fa36b2e2b68a9d78ea47f50435525
    origin/main packages/core/src/utils/blank-storage-form.ts blankAsNullColumns maps an optional multi_value column to 'emptyList' unless readonly: true, and blankStorageForm stores null for [] or '' on that reach

    State: closed by Fixes #29343 (completed). pm:dispatched is removed.

    Delivered: a cleared optional multi-value field ([] or '') is stored as null, so a second record cleared on a unique multi-value column is no longer refused 409. A required multi-value field keeps its refusal. A readonly: true column such as sys_activity.changed_fields keeps the [] the platform stamps (ruling A, 6591577985; round 2 A, 6598733139). Stored '[]' rows are not migrated here: #29653 owns that, scoped by note 6598764965 to exclude readonly columns. Nothing else is left on this card.

  13. removed
    pm:dispatched
    on Nov 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

domain:serverpm:blockingpriority:p3

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions