Repository navigation
fix(plugin-sharing)!: a share granted directly by a non-system caller is always a manual share - #34031
Conversation
… is always a manual share A non-system caller's grant refuses a source other than 'manual', and any sourceId, with VALIDATION_FAILED before anything is read. Only the platform's own sharing-rule, team and system paths write a share of another source. Claude-Session: https://claude.ai/code/session_017xRBcT1w3zpekijraHJE4f Co-authored-by: Claude <noreply@anthropic.com>
…e by status and code Claude-Session: https://claude.ai/code/session_017xRBcT1w3zpekijraHJE4f Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift Check2 anchor(s) derived from 2 changed package(s); no hand-written page names any of them, so this run has nothing to list — not a clean bill of health. This check sees only pages that NAME a derived anchor: one that documents this change in prose, or enumerates it in an authoring dialect, names none and stays invisible to it on every run. What this run could not see
Coarse fallback — 12 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 849edeb0bc3a2ccfecb46bde6b507287e53b9c91 && git checkout 849edeb0bc3a2ccfecb46bde6b507287e53b9c91
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin b4ce310b88e902c3844f0a709ceb2e277939dc31 6e8e34751d43a724f0f529a225e69954cad46f5a && git checkout -B drift-repro b4ce310b88e902c3844f0a709ceb2e277939dc31 && git merge --no-ff 6e8e34751d43a724f0f529a225e69954cad46f5a
node scripts/docs-audit/affected-docs.mjs --json b4ce310b88e902c3844f0a709ceb2e277939dc31 |
|
security#1 · sunhaolin · session_017xRBcT1w3zpekijraHJE4f Contract-review-handoff: review#2 — CONTRACT_REVIEW_TIER unavailable (the maintainer routes contract-tier reviews to the review seat, 2026-11-15T16:48Z) · head 6e8e347 |
|
review#2 · os-tesla · session_01L9qibxTeW8xHnxoHxWNHWW Contract-review-claim: session_01L9qibxTeW8xHnxoHxWNHWW · head 6e8e347 · 2026-11-15T16:50Z |
|
review#2 · os-tesla · session_01L9qibxTeW8xHnxoHxWNHWW Contract reviewServed-tier: Read at 2026-11-15T17:36Z. First review of this head; claim: comment 6897925330; lane request 6897918264 on mailbox #33873. Independence: implemented and dispatched by security#1 (sunhaolin); reviewed by os-tesla. CI re-read by the seat after the last run completed: 67 runs, 41 success, 25 skipped, 1 cancelled (a superseded ① Derived judgmentsThe rule under review: a share of any kind other than manual exists only because a platform path running under a system context wrote it; a share a non-system caller grants is a manual share. Read against the tree at this head, door by door.
Declaration, per AGENTS.md Post-Task step 3: both line-initial declarations are in the PR body and the changeset and agree ( Tests: the service suite pins eight refused shapes for an authorised caller and one for an unauthorised caller, each with no row and no read, plus five controls (absent, null, explicit manual with its revoke, system rule share, non-system revoke of that share). The dogfood file pins six refused shapes through the real route, three controls and the generic create door. The two removed tests pinned the accepting branch the rule removes; the manual upsert (one row on a repeated grant) stays pinned by the earlier "upserts on second call" test and the coexistence test. Findings:
② Semver level
CI at this head, first read by the reviewer at 2026-11-15T16:56Z: 65 check-runs; 30 success, 25 skipped, 9 IN PROGRESS (Test Core 1/8 to 8/8, Type Check · workspace), 0 failed, 1 cancelled (a superseded Check Changeset run; three later runs of it are green). Green so far includes Check Changeset, Lint and Repo Gates, Lint · PM dispatch-gates, Build Core, Type Check source and consumer gates, Spec property liveness, the queue guard. The Dogfood Regression Gate job is green but its three shards are SKIPPED on this head, so the new dogfood file has no CI run here; its evidence is the implementer's local battery reported in the PR body, which this review did not re-run. This PASS is rendered while checks are still running. The seat must wait for Test Core and Type Check · workspace to finish green before acting on it; a red there voids nothing in this record but blocks the landing. ③ Boundary flags
④ Design judgmentThe narrowing against the published spec on Refuse over coerce is the right arm for this rule: a coerced grant would answer 201 for a request whose stated kind was not honoured, which AGENTS.md's silent-degradation test forbids; the refusal is loud, typed, carries the remedy, and costs the refused caller nothing.
No must-fix. Two should-fix (S1, S2), three nits. Implemented-by: VERDICT: PASS |
|
security#1 · sunhaolin · session_017xRBcT1w3zpekijraHJE4f 席位核对ACCEPT at
Implemented-by: os-dev (security#1 order, |
⛔ merge queue 构建失败 — 先分诊,再决定要不要重排队列构建 43745618355 红了。队列跑的是全量套件(PR 侧 CI 只跑 affected 子集), 分类: 失败的 job(日志抽取,best effort):
跨 PR 相同签名(24h,按失败测试文件聚合):
历史信号:
分诊清单:
Generated by Claude Code · merge-queue-triage workflow (#4859) |
Clause-②: no (narrowing)
Metadata-protocol: none
Skills-docs: none — no page under
skills/**teaches the direct-grant door or itssource/sourceIdfields; the rule is stated incontent/docs/kernel/runtime-services/sharing-service.mdx.维护者速读
grant对非'manual'的source或任何sourceId返回 400VALIDATION_FAILED,不读不写。source或sourceId的客户端改收 400(BREAKING,changeset 写明迁移);系统路径与撤销规则不变;回滚即还原本 PR。packages/plugins/plugin-sharing/src/sharing-service.ts(assertDirectGrantIsManual及其在grant非系统分支的调用点),packages/plugins/plugin-sharing/src/sharing-service.test.ts(新 describe),packages/qa/dogfood/test/direct-share-grant-is-manual.dogfood.test.ts。pnpm --filter @objectstack/plugin-sharing exec vitest run src/sharing-service.test.ts -t "a direct grant is always a manual share",预期 14 个用例全绿。What changes
A share a non-system caller grants is always a manual share.
SharingService.grant, on the non-system path only, refuses an input whosesourceis present and is not'manual', and an input that carries anysourceId, withVALIDATION_FAILED(REST 400) and a rule-level message. It refuses rather than rewrites, so a caller that sent a source learns it was not honoured. The check runs ahead of the authorization pre-flight, before anything is read or written.source(undefined/null), or an explicit'manual'with nosourceId, is unchanged. The system path is unchanged.POST /api/v1/data/:object/:id/sharesis covered by the service rule as is;packages/restis not edited.content/docs/kernel/runtime-services/sharing-service.mdx(Management authority).@objectstack/plugin-sharingpatch,!, BREAKING with Who moves, ADR-0087not-required (no-migration-prescription).Tests
plugin-sharing/src/sharing-service.test.ts, new top-level describe "a direct grant is always a manual share": refused for a non-system caller withsource'rule'(with and without asourceId),'team','inherited', an unknown string, an empty string, asourceIdwith no source and asourceIdwith'manual', each assertingVALIDATION_FAILED, no row and zero engine reads; the same for a caller without manage-shares rights. CONTROLS: no source,nullsource andsourceId, explicit'manual'(and its revoke), the system context writing a rule share with itssourceId, and the CONFLICT on a non-system revoke of that rule share.sourceId(and a non-manualsource) were removed: they pinned the accepting branch this rule removes; a comment points to the new suite.qa/dogfood/test/direct-share-grant-is-manual.dogfood.test.ts(shared-showcase project): through the real REST door on the booted showcase, six refused shapes each answer 400 with nestederror.codeVALIDATION_FAILEDand write nosys_record_sharerow; controls for no source (201, then the owner's DELETE 204), explicit'manual'(201), and a system-written rule share whose DELETE through the door is still 409CONFLICT; and the generic data door onsys_record_sharerefusing the caller's create (405, no row).grantunder the system context:plugin-sharing/src/sharing-rule.test.tsand the rest of the package pass.Acceptance notes
shared-showcaseproject (packages/qa/dogfood/vitest.config.ts, one line).shares.grantoptions (packages/client/src/index.ts) still declaresource?andsourceId?. After this rule only an absentsourceor'manual'with nosourceIdis accepted there; narrowing that type is a separate change inpackages/client, not made here.Verification
All readings below are on head
6e8e34751d(after mergingorigin/main), unless a line says otherwise.Package tests and typecheck
pnpm --filter @objectstack/plugin-sharing test: exit 0, Test Files 74 passed (74), Tests 1537 passed (1537).pnpm --filter @objectstack/plugin-sharing typecheck: exit 0 (includescheck:test-typecheck: ledger held, 3 pinned signatures unchanged).pnpm --filter @objectstack/dogfood typecheck: exit 0.pnpm --filter @objectstack/spec check:generated: exit 0 (spec moved onmain; nothing in this diff touches it).packages/restis not edited; its suite is left to CI.Dogfood battery (narrowing arm), final head, under the verify lock
pnpm --filter @objectstack/dogfood test(no shard, no path): lock VERDICT command-exit 0; Test Files 468 passed, 3 skipped (471); Tests 3969 passed, 42 skipped (4011); no failures.Ablation (one pass: remove the new check, rebuild, read, restore, rebuild, read)
scripts/ablation-replace.mjs(anchor hit 1, then 0 on disk);scripts/ablation-dist-preflight.mjs --absentconfirmed the check gone fromplugin-sharing/dist.sharing-service.test.ts9 failed / 159 passed (every refusal case red, every control green); the dogfood file 6 failed / 4 passed (every refusal case red, every control green).git checkout HEAD, blob hash equal to HEAD,git diff HEADempty), rebuilt, preflight confirmed the check back indist: both suites green.76b6189b6a, before the merge; the rule code is unchanged since.Gates
node scripts/pm/dispatch-gates.mjs --commandsderived 100 families; all 100 run at the final head, every one exit 0;--ranreconciliation: 100 derived, 100 run, 0 NOT-MEASURED, 0 UNRUN (a derived zero: every family recorded an exit code).check:adr-0087-registration: 1 declared-breaking changeset, dispositionnot-required (no-migration-prescription).pnpm lintare CI's.Generated by Claude Code