Repository navigation
fix(plugin-approvals): inbox search finds a request by the title, process label, object label and requester its row shows - #36976
Conversation
… on main) Claude-Session: https://claude.ai/code/session_01WGufziG2t1d9cfRQJDrHkB Co-authored-by: Claude <noreply@anthropic.com>
… object label and requester a row shows Claude-Session: https://claude.ai/code/session_01WGufziG2t1d9cfRQJDrHkB Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WGufziG2t1d9cfRQJDrHkB Co-authored-by: Claude <noreply@anthropic.com>
…curity-wired shape Claude-Session: https://claude.ai/code/session_01WGufziG2t1d9cfRQJDrHkB Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 1 package(s): 18 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: ⛔ 5 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails. What this run could not see
Coarse fallback — 6 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 932104ded86e28f8ebb6290710dba99ca507c0ea && git checkout 932104ded86e28f8ebb6290710dba99ca507c0ea
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 57445a699810a0545d8b3a7649a77327d47fb18b 2fb042637378ff461bd0101f54ed9f4bb908c55b && git checkout -B drift-repro 57445a699810a0545d8b3a7649a77327d47fb18b && git merge --no-ff 2fb042637378ff461bd0101f54ed9f4bb908c55b
node scripts/docs-audit/affected-docs.mjs --json 57445a699810a0545d8b3a7649a77327d47fb18b
|
|
repo:objectstack#3 · os-support-ai · session_01WGufzesUz1Y8VZuKJRhVL8 席位核对 — ACCEPT · repo:objectstack#3 · head 2fb0426 · 2026-11-24T13:21ZL1 read of #36976 (card #36959, p1) at Against the card. The invariant (read hardest). A request is never found by text the same caller is not served.
Changeset. It names Nits (none block).
Mechanical. All-checks: 37 success · 16 expected skips · 0 failed · 0 pending. Floor checks are green, Every open finding is a nit. ACCEPT, ordinary queue landing. |
|
repo:objectstack#3 · os-support-ai · session_01WGufziG2t1d9cfRQJDrHkB Landing: 2026-11-24T13:22Z · area ux-C · p1 · head
State: ready + auto-merge (merge queue). |
Requested by Yibo Wang · project thread
Fixes #36959
Clause-②: no — the
qparameter's accept set is unchanged; what it matches widens to the labels the row already shows the same caller.Metadata-protocol: none — nothing an author writes changes.
维护者速读
What changes
ApprovalService.buildRequestWhere(packages/plugins/plugin-approvals/src/approval-service.ts) now adds served-text arms to the free-text$or, beside the four machine-column arms and the gated snapshot arm (both unchanged). A newservedTextArmsworks out the labels first, as this caller is served them, and turns each one into the machine values that name it:readerLabelspicks a translation for the reader,process_name INthe flows whose picked label holds the term. For the other flows,process_label(the stored column, which is what those rows serve) holds the term ANDprocess_name INthose flows. So a reader who is shown a translation is never found by the stored text they are not shown.readerLabels' pick, else the schema label (the same pairobject_labelis set from), givingobject_name IN.resolveUserNames(the resolver behindsubmitter_name) over the scope's submitters, givingsubmitter_id IN.recordsTitledWith, per subject object, givingobject_name = O AND record_id IN. The title is the sharedtitleAsServedover the caller's served fields fromservedFields, which is the sameresolveReadableSnapshotFieldsanswer, asked as the caller, thatredactPayloadsand the servedrecord_titleuse. With a schema, the driver read is first narrowed to records where a served title field holds the term; the served title still decides.pickTitle's candidate list is now one sharedtitleCandidates.The flows, objects, records and submitters to resolve come from one read of the requests under the query's own non-text filter (tenant, object, record, submitter, status; status is now set before the arms), newest first, capped at 5,000 with a
warnwhen the cap is hit. Every arm carries a non-empty set. Anything that cannot be resolved adds no arm, so a failure narrows the search and never widens it.freeTextMayMatchSnapshotand its narrowing are unchanged. Matching stays case-sensitive ($contains), like the existing arms.The placeholder ("Search record, process, requester…") is now accurate, so
ApprovalsInboxPage.tsxand the i18n packs are untouched.Read first (by risk):
approval-service.ts,servedTextArms: the process-label split (picked flows vs. the stored column narrowed to unpicked flows) is where the invariant could leak.approval-service.ts,recordsTitledWith: the candidate filter by served fields and thetitleAsServedpost-filter.approval-inbox-search-display-text.integration.test.ts: the "a term the caller is not served finds nothing" block.Two-minute check:
pnpm --filter @objectstack/plugin-approvals exec vitest run --maxWorkers=2 src/approval-inbox-search-display-text.integration.test.ts. Expect 21 tests to pass.Tests
New
src/approval-inbox-search-display-text.integration.test.tsruns the realApprovalServiceon a realObjectQLoverSqlDriver(better-sqlite3, in-memory, real DDL), in the filer's shape: security wired (so the snapshot arm is dropped) and an approver who can read every field. It covers:Polar,Cargo,上海,拜访,UI测试), process labels (大额,出差申请审批), requester names (Dev,Admin,Sam Submitter) and the object label (商机). Also checked with the object filter set, andcountRequestsagrees;crm_still finds every row andlarge_opportunityfinds its row. With no field-visibility source wired, titles still match through the snapshot arm;approval-free-text-scope.test.ts: the expected column sets now includeprocess_label, and the "never empty" arm count goes from 4 to 5. Its four properties are unchanged.Red on main (the service at the base commit, the new test file)
git restore --source=0212714711 -- approval-service.ts(count ofservedTextArms5 to 0), then the file:Tests 16 failed | 5 passed (21). Every filer term failed (titles, process labels, requester names, object label, object-filtered, count, the readable control and the translated-label case). The five that passed are the fixture-serves check, the two machine controls, the unwired-titles check and the masked-title pin, which passes on main only because nothing matched. Restored withgit checkout HEAD --:git diff HEADempty, blob equals HEAD.Ablations (scripts/ablation-replace.mjs, restore verified by blob == HEAD and an empty diff)
recordsTitledWith(object, ids, undefined, q)), anchor 1 to 0:Tests 2 failed | 19 passed. The failures are both masked-title pins.arms.push({ process_label: { $contains: q } })), anchor 1 to 0:Tests 1 failed | 20 passed. The failure is the translated-label pin.The subject is imported from source (
./approval-service.js), so nodist/leg applies.Acceptance notes
$containsis case-exact on every backend), sopolardoes not findPolar Cargo, which matches the existing machine arms. A case-insensitive search would be its own change ($icontainsis ASCII-only).process_labelis blank serves a fallback label (the config snapshot or a prettified machine name) that is not searched. The display-label backfill fills that column at boot.sys_userread for the scope's submitters, and one title read per subject object in scope.Verification
All local readings were taken at head
2fb0426373.Package test and typecheck
pnpm --filter @objectstack/plugin-approvals exec vitest run --maxWorkers=2(whole package):Test Files 128 passed (128),Tests 1920 passed (1920), exit 0.pnpm --filter @objectstack/plugin-approvals typecheck: exit 0.check:test-typecheck: OK; the test layer compiles undertsconfig.test.jsonwith the ledger unchanged.pnpm --filter '@objectstack/plugin-approvals^...' build, lock VERDICT command-exit 0.Derived gate families (dispatch-gates --commands, 72 derived)
check:engine-double-contract,check:nul-bytes,check:cross-package-test-inputs,check:test-source-alias,check:issue-citations,check:doc-authoring,check:empty-changeset,check:adr-0087-registrationandcheck:type-check-coverage.check-plugin-teardown-shape --self-testneeds a pinned commit the shallow clone lacks.check:dual-build-cjs-loadsandcheck:i18nneed a full build this run did not do.check:type-check-debtlost its closure build to the shared verify lock (queue-timeout). CI runs all four.dispatch-gates --ranreconciliation: 72 derived, 68 run, 4 NOT-MEASURED (derived from recorded exit 3), 0 UNRUN.overlap-check: clean againstorigin/main, with 0 overlapping open PR heads.Generated by Claude Code