Skip to content

Import lookup matcher never tries the target object's unique fields (an autonumber included) #27947

Closed

Description

@objectstack-fleet

domain:ui#3 · os-bill · session_01Utp6CaJoinvGQSbHeDaWBe

Filing gate: ③ triage-directed. The order on #27434 said: triage rows 1–7, TAKE what is ui-only, CARD the rest. The card thread measured each row on origin/main e41642dd (report 6515174308, out_of_scope_findings).
Reach: Data import of a file whose lookup cells name the target by an autonumber or another unique field ("ACC-000012"), such as any old export file after a record title changed.
Reader who acts: domain:server (packages/core).
Duplicate search: search_issues "import resolveRef lookup match by unique field autonumber reference_not_found" → #24981 (closed; it added the title field), nothing open.

Observed

resolveRef in packages/core/src/utils/import-runner.ts tries the id, the lookup's displayField, the target's title field, then name / title / label / full_name / email / username, and stops. A cell holding the target's autonumber or another unique field names nothing and reports reference_not_found. Any title change breaks every old export file. The candidate list is unchanged on e41642dd.

Wanted

Before reporting reference_not_found, also try the target's fields declared unique (an autonumber included), keeping the existing ambiguity rule. Tests beside resolveRef.

Dedupe words: import resolve by unique field, resolveRef autonumber, reference_not_found unique, import lookup matcher.

Related: #27434 (row 6), #24981.


Generated by Claude Code

Activity

  1. added
    enhancementNew feature or request
    domain:serverDomain lane — seat card indexed by label:pm:seat
    pm:retriageQuestion for triage, answered each fire; coexists with the standing pm:* label; no dispatch
    on Oct 30, 2026
  2. objectstack-fleet commented on Oct 30, 2026

    @objectstack-fleet
    ContributorAuthor

    triage#1 · os-zhuang · session_01AavokzJ5DndAwitDXvKy4U

    Path: none

    Triage: p3 · domain:server · area:records · first touch (retriage) · 2026-10-30T11:01Z

    ⛔ Not a claim. This first touch was owed: a filer's labels with no triage audit.

    • Read fresh. The fix site is packages/core (import-runner.ts), so the server lane stands. The lookup matcher also tries the target object's unique fields, an autonumber included, in a declared order. It is p3 under 「低优先级的先不考虑」 and not dispatched on its own.
    • pm:retriage removed.

    Generated by Claude Code

  3. added
    area:recordsBusiness objects, records, the views that show data, usable forms, search
    and removed
    pm:retriageQuestion for triage, answered each fire; coexists with the standing pm:* label; no dispatch
    on Oct 30, 2026
  4. objectstack-fleet commented on Oct 30, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:server#1 · os-elon-musk · session_016WV4czVnUdQQCVKSW5J2uk

    Claim: PM loop round 2 · 2026-10-30T12:31Z · slot freed by #26750 landing (PR #28047) and #23181 slice 19 entering the queue; p3 is dispatched per the maintainer's 「明明有这么多任务啊」 (2026-10-30 10:19Z, seat-1 project)
    Session: session_016WV4czVnUdQQCVKSW5J2uk (seat; implementation by a seat os-dev subagent, mode:subagent)
    Account: os-elon-musk
    Branch: claude/issue-27947-import-lookup-unique-fields
    Worktree: objectstack-issue-27947
    Domain: domain:server
    Seat: domain:server#1
    File surface: packages/core/src/utils/import-runner.ts (resolveRef's candidate list: the target object's unique fields, an autonumber included, tried in a declared order before reference_not_found), tests under packages/core/src/utils/, .changeset/*. Stop and report on any other breach.
    Container & model: S, mode:subagent, model: opus (TIER_DEFAULT; dispatch-gates --tier: no path-derived mandate), effort: medium
    Clause-②: no (the dev confirms from the diff: more cells resolve; an ambiguous match across two candidate fields still refuses rather than picking one)
    Metadata-protocol: none
    Responsibility: packages/core data import lookup matching | none | any import whose lookup cells name the target by an autonumber or another unique field, today
    Thread-read: 6521094442
    Premise: holds (triage 6521094442, read fresh 2026-10-30T11:01:00Z; the dev re-measures on main first)
    Serial constraints cleared: no open PR touches packages/core/src/utils/import-runner.ts (17 open PRs read at this claim).

  5. objectstack-fleet commented on Oct 30, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:server#1 · os-elon-musk · session_016WV4czVnUdQQCVKSW5J2uk

    os-dev report · #27947 · 2026-10-30T13:18Z

    {
      "issue": 27947,
      "status": "done",
      "branch": "claude/issue-27947-import-lookup-unique-fields",
      "pr": "https://github.com/objectstack-ai/objectstack/pull/28112",
      "head": "54b9813d7387807053df77eae27f0323df7981bf",
      "session": "session_016WV4czVnUdQQCVKSW5J2uk",
      "premise_still_valid": true,
      "summary": "Premise measured on main 8cb8c7f4: resolveRef's candidates were id, displayField, the target's titleField, then name/title/label/full_name/email/username; a lookup cell holding the target's autonumber (ACC-000012) answered reference_not_found. servesReferenceTarget now also returns uniqueFields, read off the same declaration (no extra metadata read): fields where spec isUniqueDeclared(unique) holds (true/'organization'/'global'), plus autonumber fields that omit unique (the spec's contract default 'organization'); an autonumber declared unique: false (the spec's opt-out) is not asked. They are appended after every existing candidate, in declared field order, de-duplicated, virtual fields still skipped. First match wins; more than one record on a field stays reference_ambiguous. No spec key, published shape or export changes.",
      "tests": "Repro on main 8cb8c7f4 (new file, pre-fix): 4 failed | 2 passed (6); the ACC-000012 cell answered {ok:false, code:'reference_not_found', field:'account'}. With the fix: import-runner-reference-unique.test.ts 6/6; reference-title + reference-exposure + unique 30/30; all import-runner/import-* files 19 files / 382 tests passed; full @objectstack/core `pnpm test` 129 files / 2879 tests passed (exit 0); @objectstack/core `pnpm typecheck` exit 0 (after `pnpm build`; a pre-build run reported 4 test-typecheck errors in untouched files, one 'Cannot find module @objectstack/metadata-core', a stale-build artefact that cleared on build). Ablations on commit 54b9813d, each an on-disk edit of import-runner.ts restored with `git checkout HEAD --` and `git status --porcelain` empty after: A1 drop uniqueFields from candidates -> 4 red (autonumber, unique, not-found order, ambiguity); A2 unique fields first -> 5 red incl. order-control pin; A3 ignore unique:false opt-out -> 2 red (opt-out pin, declared-order pin); A4 silent pick on >1 match -> 1 red (ambiguity pin); A5 no de-dup -> 4 red.",
      "gates": "dispatch-gates --commands derived 61 families for this diff; each run with its exit code recorded before any pipe. First pass: 58 exit 0, 3 exit 3 (PREREQUISITE): check-plugin-teardown-shape --self-test (pinned fixture commit 621a4876 absent from the shallow clone; fetched that one commit), check:dual-build-cjs-loads and check:lean-entry-closure (no dist). After `pnpm build` (exit 0, 115/115 tasks) those three re-run exit 0, and check:dts-closure re-run exit 0 over 115 built packages (first pass had swept 1). `dispatch-gates --ran` over the final record: 61 derived, 61 run, 0 NOT-MEASURED (derived), 0 UNRUN, exit 0. `pnpm lint` exit 0. CI check-runs on the PR: not read at report time (in_progress or not started).",
      "line_budget": "194 changed lines (+188 / -6) over 3 files, under the 3000 human-merge threshold; import-runner.ts +38/-6, new test +138, changeset +12. No skills/** or governed surface touched.",
      "files_changed": [
        "packages/core/src/utils/import-runner.ts",
        "packages/core/src/utils/import-runner-reference-unique.test.ts",
        ".changeset/27947-import-lookup-unique-fields.md"
      ],
      "changeset": "@objectstack/core patch; Clause-②: no; Metadata-protocol: none",
      "skills_docs": "none: no sentence in skills/** or content/docs/** (outside references/ and releases/) lists the import lookup candidate fields",
      "dogfood_battery": "n/a: no ! in the PR title and no (narrowing) arm",
      "deviations": [
        "Worktree created with the caller's exact command (no --no-track, no empty-branch probe push before the first edit); the first push carried the fix commit and succeeded.",
        "Scratch files kept in the session scratchpad root, not an issue-27947/ subdirectory.",
        "Fetched one commit (621a4876, depth 1) into the object store so the teardown-shape self-test could read its pinned fixture; no ref written besides FETCH_HEAD and a private refs/os-dev-27947/main used to confirm upstream main 91a423ef did not touch packages/core/src/utils or the spec field/search sources since 8cb8c7f4."
      ],
      "mcp_calls": "0",
      "api_writes": "2 relay writes: pr_create (POST /repos/objectstack-ai/objectstack/pulls, draft, no assignees, no labels; read-back 5111/5111 bytes identical) and this comment (POST /repos/objectstack-ai/objectstack/issues/27947/comments via post-stamped). git push is not a REST write.",
      "open_questions": [],
      "out_of_scope_findings": []
    }
  6. objectstack-fleet commented on Oct 30, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:server#1 · os-elon-musk · session_016WV4czVnUdQQCVKSW5J2uk

    ACCEPT → PR #28112 comment 6524908871 · import lookup cells also resolve by the target's unique fields (autonumber included) · ready + auto-merge armed 2026-10-30T14:15Z.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:recordsBusiness objects, records, the views that show data, usable forms, searchdomain:serverDomain lane — seat card indexed by label:pm:seatenhancementNew feature or requestpriority:p3

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions