Repository navigation
fix(plugin-auth)!: Copy Invite Link is no longer offered or answered for a pending invitation past its expiry - #28529
Conversation
…ending invitation past its expiry Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5mvxN1Jh9iwvcsEv1R
📓 Docs Drift CheckThis PR changes 2 package(s): 11 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 5 release-owned page(s) also name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 23 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 0431b5bec7561c9720952a5cf02ca6c8918c1d51 && git checkout 0431b5bec7561c9720952a5cf02ca6c8918c1d51
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 35b178bd0a9090aaccf9c767b0c6abf1067eff01 52e7cd7ccff36f221153d1dec165045f87bf5899 && git checkout -B drift-repro 35b178bd0a9090aaccf9c767b0c6abf1067eff01 && git merge --no-ff 52e7cd7ccff36f221153d1dec165045f87bf5899
node scripts/docs-audit/affected-docs.mjs --json 35b178bd0a9090aaccf9c767b0c6abf1067eff01
|
|
domain:server#2 · os-project-manager · session_0186vfjHHMsRXC9EUT9hTFMo Contract reviewServed-tier: Face: narrowing ( ① Derived judgments
② Semver levelThe changeset grades ③ Boundary flags
④ Design judgmentThe narrowing against the spec on Implemented-by: VERDICT: PASS Generated by Claude Code |
|
domain:server#2 · os-project-manager · session_0186vfjHHMsRXC9EUT9hTFMo 席位核对ACCEPT · The maintainer's standing authorisation for landing reviewed PRs, verbatim: 「按照 pm-dispatch 规则复核过的都授权」.
Generated by Claude Code |
Requested by Leehom · project thread
Fixes #28384
Clause-②: no (narrowing)
Metadata-protocol: none
维护者速读
expires_at。邀请已过期但状态仍是 pending 时,行菜单和记录页头不再显示这个操作;直接调用也会被拒,返回 409RESOURCE_CONFLICT,文案说明邀请已过期、请重新发送。Clause-②: no (narrowing))。未过期的 pending 邀请照旧拿到链接;「重新发送邀请」不受影响,过期邀请上仍然显示,是补救办法。回滚即 revert 本 PR。packages/plugins/plugin-auth/src/invitation-link-action.ts的新过期门(排在 pending 门之后)与isBeforeExpiry;packages/platform-objects/src/identity/sys-invitation.object.ts中copy_invitation_link的visible;invitation-delivery-outcome.test.ts末尾新增的 describe 块。pnpm --filter @objectstack/plugin-auth exec vitest run --maxWorkers=2 src/invitation-delivery-outcome.test.ts,预期 32 条全绿,其中过期 pending 邀请得 409。What changes
The rule. An expired invitation's link is no longer offered or answered. A
sys_invitationrow can still readpendingafter itsexpires_athas passed, because nothing moves it toexpired.packages/plugins/plugin-auth/src/invitation-link-action.ts).createCopyInvitationLinkHandlernow readsexpires_atwith the row and adds a sixth gate after the pending gate, in the order the docblock lists: a row whoseexpires_atis not in the future is refused409 RESOURCE_CONFLICTwith "This invitation has expired, so its link no longer lets anyone join. Resend the invitation to give the person a link that works." A missing or unreadableexpires_atcounts as expired, the way the vendor's own check reads it. The value is read whether the driver returns aDate, ISO text or epoch milliseconds. Reach is still judged first, so a caller outside the invite reach learns nothing about an expired row.packages/platform-objects/src/identity/sys-invitation.object.ts).copy_invitation_link'svisibleaddshas(record.expires_at) && record.expires_at != null && datetime(record.expires_at) > now().has()opens the operand for the sparselist_itemface, asstatusis opened, and the!= nullhalf is the one an ordering comparison needs (the rule inmaterializeDeclaredFields,packages/objectql/src/declared-fields.ts). The grid already puts everyrecord.FIELDan action predicate names into the row$select(collectPredicateFieldRefs), so no list view needed a new column.resend_invitationdoes not share the copy-link check (itsvisibleis the lowered feature and reach gates only), and it is the remedy, so it stays offered on an expired row and gets no expiry gate.Tests
packages/plugins/plugin-auth/src/invitation-delivery-outcome.test.ts, new block#28384 (e), on a realAuthManagerover the installed better-auth: an expired pending row is refused 409RESOURCE_CONFLICTand the message's first sentence is pinned; a row with an unreadableexpires_atis refused the same way; controls: a pending row before expiry still answers its link for aDate, ISO text and epoch-milliseconds value; a plain member on an expired row still gets 403 (reach before expiry); Resend still answers 200 for the invitee and its answer has a link to copy.packages/platform-objects/src/identity/invitation-delivery-copy.test.ts: the evaluatedvisibleis false on a pending row pastexpires_at, and on a pending row projected without, or holding no,expires_at; Resend's evaluatedvisiblestays true on that expired row. The existing "offered on a pending row" fixtures now carry a futureexpires_at.Acceptance notes
Clause-②measured asno (narrowing). The claim expectedyes (narrowing). Measured: the diff narrows one surface (the handler refuses a row it answered, andvisiblefollows) and widens none, so the value isno, with the narrowing arm.Metadata-protocol: none. No key of any schema moves and no authorable value is refused: thevisiblevalue of one platform action changes, not its shape.pending. Resend's confirmation text ("Its expiry date starts over") is therefore not what happens on an expired row, and the Pending list then shows both rows for the same person. Out of this card's scope.Verification
All readings on head 52e7cd7 (branch
claude/project-thread-rypvzz, baseorigin/main1f1a369).Red first: production sources at base, new tests kept
git restore --source=1f1a369bon the two production files, tests at head (both suites importsrc/directly):invitation-delivery-copy.test.ts: 2 failed / 29 passed. Failed: "is not offered on a row still pending after its expires_at", "is not offered on a pending row projected without, or holding no, expires_at".invitation-delivery-outcome.test.ts: 2 failed / 30 passed. Failed: "a row still pending after expires_at is refused 409", "a pending row with no readable expires_at is refused the same way". The controls (future row, reach before expiry, Resend) passed on base.git checkout HEAD --;git diff HEADempty.Ablation: the handler gate alone
node scripts/ablation-replace.mjsoninvitation-link-action.ts, anchorif (!isBeforeExpiry(→if (["ABL28384"].length < 0 && !isBeforeExpiry((anchor x1 → x0, marker x0 → x1, blob df97aacb → c0980674),visibleleft at head: plugin-auth suite 2 failed / 30 passed, the same two handler cases. Restore: blob after restore df97aacb = blob at HEAD; marker count 0. Thevisiblechange alone does not pass the handler cases, sincevisibleis courtesy.Package suites, typecheck, lint
pnpm --filter @objectstack/platform-objects test: exit 0, 104 files, 1477 passed.pnpm --filter @objectstack/plugin-auth test: exit 0, 207 files, 3943 passed, 10 skipped.pnpm --filter @objectstack/platform-objects typecheck: exit 0.pnpm --filter @objectstack/plugin-auth typecheck: exit 0.pnpm exec eslint --no-inline-config packages/platform-objects/src/identity packages/plugins/plugin-auth/src/invitation-link-action.ts packages/plugins/plugin-auth/src/invitation-delivery-outcome.test.ts: exit 0.Derived gates
node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstackderived 62 families;--ranreconciliation: 61 run with exit 0, 1 NOT MEASURED (pnpm check:dual-build-cjs-loads, exit 3, PREREQUISITE NOT MET: it needs every package'sdist, only the dogfood closure was built; CI runs it).check-plugin-teardown-shape --self-testfirst answered exit 3 on the shallow clone and exit 0 after fetching its pinned control commit. Alsocheck-commit-card-trailers --range origin/main..HEADexit 0 andcheck-platform-checklist --changed-from origin/mainexit 0.Dogfood battery
Head 52e7cd7,
pnpm --filter '@objectstack/dogfood^...' build(exit 0), then under the lockpnpm --filter @objectstack/dogfood testwith no shard and no path:os-verify-lock: VERDICT command-exit 0, Test Files 363 passed / 3 skipped (366), Tests 2932 passed / 28 skipped (2960), no failure.🤖 Generated with Claude Code
https://claude.ai/code/session_01FEkQ5mvxN1Jh9iwvcsEv1R
Generated by Claude Code