Repository navigation
Description
Filing category: ② a decision only the maintainer can make.
维护者速读
- 现象:加班申请里,和一张已批准加班完全相同时段的新申请照样能建、能提交;如果再批一次,调休就记了两遍。请假单同理(同一天请两次)。校验规则只能看当前这一条记录,读不到同一个人的其他记录,所以 AI 和人都写不出"时间不能重叠"的规则。
- 要你裁:平台是否提供"同一人时间段不重叠"的声明式约束。
- 推荐:A:对象级
exclusion约束(分组字段 + 起止字段 + 状态过滤),写入时由服务端查询判定,与唯一索引同一层。
One-sentence problem
Every time-booking app (overtime, leave, room booking, shifts) needs "no two of mine overlap", and the platform's rules cannot see the other records.
Evidence (reach)
Hosted tenant (pnpm dev:stack --with-ui, Team plan; cloud ff373e02, framework d7c3d44e), member's MCP OAuth token:
el5z_ot_req"11月10日版本上线加班" 18:30–21:30, approved, 3 h credited.create_record el5z_ot_req { start_time: '2026-11-10T18:30:00+08:00', end_time: '2026-11-10T21:30:00+08:00', compensation: 'comp_leave', … }→ created (draft), submittable.- A validation
conditionseesrecord,previous, one-hop references; no query over sibling rows. Unique indexes (indexes[].unique) compare equal values only.
Options
| Option | What it does | What the customer sees | Effort |
|---|---|---|---|
| A | Object-level declarative constraint, e.g. exclusions: [{ name, groupBy: ['owner_id'], range: ['start_time', 'end_time'], where: { status: { $ne: 'rejected' } }, message }], checked on insert/update by the data layer with a range query |
"该时段已有加班申请" on save, from AI or form | data + spec seats · 2–3 PRs · precedent: unique indexes |
| B | Let validation scripts call a bounded aggregate, e.g. count('el5z_ot_req', { owner_id: record.owner_id, … }) > 0 |
Same message; authors write the query | formula + data seats · 2 PRs · opens queries inside every validation |
| C | Keep as is; approvers catch duplicates | Double credit unless a person notices | none |
Business reading: A covers the common case with one declared line; B is general but every rule becomes a query; C leaves money/time to human attention.
Recommendation
A. It is the pattern behind every booking app, it stays declarative (lintable, explainable to an agent), and it lives where unique indexes already live. Confidence gap: whether where should be a status filter only or a full filter; recommend the same filter shape summaries use.
Self-check: ① A; ② A or B; ③ A (an agent cannot write B wrong in a way that silently passes); ④ A smaller than B.
After the ruling
A: spec key on the object, data-layer check on write with a range query over the group, lint for unknown fields, AI authoring rule; e2e: second overlapping overtime is refused, an adjacent one (21:30–23:00) is accepted.
os-decision-facets
① 项目长远合理性: A 与唯一索引同层、声明式,可被 lint 与 AI 规则覆盖。
② 实际业务拉动: 加班、请假、会议室、排班都需要;本次实测重复加班可提交。
③ 防 AI 犯错: A 由平台判定;B 让 agent 写查询,易写错且难核验。
④ 创业阶段不扩散: A 一个新约束类型;B 给所有校验开查询能力。
Prior rulings read: none found; thread: none
Reader who acts: the data seat and the spec seat, after the ruling.
Dedupe: repo:objectstack-ai/objectstack is:issue overlapping time range validation cross-record → 11 hits, none on this; validation query other records uniqueness overlap → 14 hits (#8413 closed, turso unique) — none on this.
Activity
objectstack-fleet commentedon Nov 14, 2026
domain:spec#2 · os-tesla · session_01L9qibwo1JzKTz7boR9JXuG
os-dev-report
{ "issue": 32979, "status": "done", "branch": "claude/project-thread-9apm8i", "pr": "https://github.com/objectstack-ai/objectstack/pull/33190", "session": "session_01L9qibwo1JzKTz7boR9JXuG", "premise_still_valid": true, "summary": "Step 1 only: docs/design/exclusion-constraints.md (152 lines, head c35ff03c). It quotes ruling record 6844907250 and answers every attached condition. Key shape: exclusions beside indexes, organization scope implied, and where = FilterConditionSchema narrowed to an immutable own-field subset (the ruling cites an existing conditional-index form, but none exists on main: indexes[].partial was retired at protocol 17). Half-open interval semantics. An 11-face atomicity table: a guard-row lock on all SQL dialects, BEGIN IMMEDIATE on SQLite, synchronous checks on memory, a guard document plus transaction on MongoDB, and refusal via EXCLUSION_CONSTRAINT_UNSUPPORTED at boot, publish and install on remote Turso, standalone MongoDB, OData and drivers without the bit. Existing data: report, then enforce going forward. Write refusal: EXCLUSION_VIOLATION 409. Also a conformance test shape, the seams for steps 2 and 3, and 5 open questions with recommendations. No code, no docs/adr, and no docs/design index exists.", "tests": "none owed: docs-only diff", "gates": "dispatch-gates --commands at c35ff03c derived 15 commands. All 15 exit 0, captured before any pipe; check:doc-formula-expressions first exited 3 (prerequisite stop), and after building formula and lint (os-verify-lock VERDICT command-exit 0) it exited 0. --ran reconciliation with exit codes: 15 derived, 15 run, 0 NOT-MEASURED, 0 UNRUN (a derived zero). CI check-runs on PR 33190: in_progress at report time.", "dogfood_battery": "n/a — no ! in the PR title and no (narrowing) arm", "mcp_calls": "3 — mcp__github__issue_read (get x1, get_comments x2); 0 write tools", "api_writes": "2 — fleet-write relay pr_create (POST pulls, plus its assignees and labels legs, run 43536226650); this os-dev-report comment via post-stamped", "open_questions": [ { "question": "Should start == end be accepted?", "options": [ "A accept it as empty, conflicting with nothing", "B refuse it" ], "recommendation": "A: this is the documented range semantics of every SQL engine" }, { "question": "Should a date-typed end mean the whole day?", "options": [ "A [start, end+1day)", "B a literal half-open reading of days" ], "recommendation": "A: under B two one-day leaves on the same day are both empty and both pass" }, { "question": "Native Postgres EXCLUDE in v1?", "options": [ "A guard-row lock on every SQL dialect, native later", "B native EXCLUDE on Postgres now" ], "recommendation": "A: one code path, no btree_gist privilege needed, and it enforces over legacy overlaps" }, { "question": "Which error code?", "options": [ "A a new EXCLUSION_VIOLATION, one spelling", "B reuse RESOURCE_CONFLICT" ], "recommendation": "A: B is too generic for an agent to branch on" }, { "question": "Can an object_extension add exclusions?", "options": [ "A not in v1", "B yes, like indexes" ], "recommendation": "A: the package that owns the data owns its invariant" } ], "security_findings": "none", "out_of_scope_findings": [ "carrier: #32979 step 2 · validation.zod.ts:41 still points to the retired indexes[].partial for a conditional constraint; a parse refuses it loudly, so not class c; noted in the design step 2 file list, not filed" ] }objectstack-fleet commentedon Nov 14, 2026
domain:spec#2 · os-tesla · session_01L9qibvfX5bawZKtfa6u7j9
决策卡 · #32979 第 2、3 步之前的 11 个设计问题 · 2026-11-14T02:33Z
第 1 步已落地: PR #33190 于 2026-11-14T02:32Z 合入
main(7257f57a),docs/design/exclusion-constraints.md在 main 上(§8 在第 197 行)。卡片保持打开,第 2、3 步待下列裁决。一句话问题: 同一资源(会议室、人员、设备)的两条预订时间段不能重叠,这条约束的第一步设计已合入;落地规格和驱动之前,有 11 处产品语义要维护者定方向。
背景: 裁决 6844907250(A,18.4.0 之后)要求
domain:spec先写一页设计并过契约审查。设计docs/design/exclusion-constraints.md由 PR #33190 交付并已合入(seat ACCEPT 6870058039,契约审查三轮:6869162700 FAIL → 6869686158 FAIL → 6870023790 PASS)。设计 §8 把留给维护者的问题集中成一批,下面逐题给出选项与推荐。第 2 步(spec 键 + 作者端检查)和第 3 步(各驱动强制)是 p2,按维护者「spec ui 后续还是只处理 p1」暂不派发;本卡改挂needs-user-decision,裁后转pm:on-hold等车道重开 p2。Governing text:
packages/spec/src/data/validation.zod.ts:SELECT-then-INSERT 的规则天然有竞态,校验不做 I/O(所以放在数据层,不放校验规则)。协议声明: 本卡裁的是第 2 步要新增的公开契约形状(
exclusions键、where形状、错误码),协议要变,但变更随第 2 步的 PR 走,本卡不改协议。前提(带 re-check):
git show origin/main:docs/design/exclusion-constraints.md | grep -n '^## 8'(读数:第 197 行)。indexes[].partial已在协议 17 退役,裁决说的「既有条件索引形式」不存在:grep -n "partial" packages/spec/src/data/object.zod.ts | head。sed -n 285,295p packages/drivers/driver-turso/src/turso-driver.ts。逐题:选项 × 代价 × 推荐
EXCLUDEbtree_gist扩展,还能容纳已存在的重叠旧数据;原生EXCLUDE没有NOT VALIDEXCLUSION_VIOLATION(409)或沿用RESOURCE_CONFLICT;并发输家:CONCURRENT_UPDATE或CONCURRENT_MODIFICATIONEXCLUSION_VIOLATION+CONCURRENT_UPDATE:通用码让 agent 无法据此分支;CONCURRENT_UPDATE是数据路径已有的“别人先写了”409,各入口已识别,CONCURRENT_MODIFICATION无人发出。反向先例:upsert 冲突裁决没有新增码object_extension能否给别人的对象加排他约束where(只对某些状态生效)用什么形状FilterConditionSchema再收窄;B 复用生命周期的lifecycleOnlyWhenSchema(等于、$in、$null);C 专用封闭形状,只含 §1 列的运算符$ne/$nin失败即封闭(以后新增状态默认受约束),又保留 B 的“JSON Schema 和类型就等于解析所接受的”。B 会失败即放开:$in列表悄悄漏掉新状态'global'/ 要求声明scope'global':ADR-0120 D1 要求索引声明范围,是因为裸true按位置有两种意思;这里只有一种。将来要'global'时作为必填scope键随 D5e 安装门一起来INSERT … WHERE NOT EXISTS、UPDATE … WHERE id = ? AND NOT EXISTS,影响 0 行即拒)工作量(裁后两步,按推荐): 第 2 步
domain:spec· 1 个 PR(键、where封闭形状、作者端检查、两条台账码),先例:#33119(+616 行,对象扩展门);第 3 步domain:data· 1–2 个 PR(SQL 守卫表 + 远程 Turso 条件语句),无同形先例。两份 ADR 另各一个 Tier H PR。Q11 选 A 则第 3 步少一套机制(约 −1 个 PR),但托管租户拿不到保护。四棱
os-decision-facets
EXCLUDE、Salesforce/Dynamics 靠插件补的那类业务约束),一套封闭键形 + 一套守卫机制,不另开“校验规则带 I/O”的特例;Q11-B 新增第二机制是唯一扩大项。'global'、不许扩展加约束、不用原生EXCLUDE,每个不开的键都省一份永久义务。exclusion constraint|EXCLUSION_VIOLATIONin docs/adr → 0 hits (12 ADRs mention "exclusion" in other senses); ruling 6844907250; ADR-0053 D-D1, ADR-0113 D1, ADR-0120 D1/D4, ADR-0148 D2; thread: none自检行: 只看①选 1A·2A·3否·4新码+CONCURRENT_UPDATE·5否·6B·7C·8无限远·9隐含·10两份·11B;②③④ 是否翻转:否(④只把
'global'、扩展约束、原生EXCLUDE推到 v1 之后,不翻字母)。置信缺口: MySQL 未实测,按源码和 InnoDB 文档判断;Q11-B 的服务端部分依赖 SQLite 单写者,与该面计数器同一依赖。
裁后执行段: 维护者只需回一行,例如「1A 2A 3否 4推荐 5否 6B 7C 8推荐 9推荐 10推荐 11B」。席位据此:本卡
needs-user-decision→pm:on-hold(车道目前只接 p1);车道重开 p2 后按设计 §7 和契约审查遗留的 N14–N19 写第 2 步(spec)派发令,第 3 步(data)在第 2 步合入后派发;两份 ADR 由席位起草、走 os-zhuang 审批。若 Q11 选 A,第 2 步的作者端规则按数据源条件化。Analysis-tier: seat (domain:spec#2), from the design doc's §8 and contract-review records 6869686158 / 6870023790; no separate ceiling-tier read.
Generated by Claude Code
objectstack-fleet commentedon Nov 14, 2026
domain:spec#2 · os-tesla · session_01L9qibvfX5bawZKtfa6u7j9
Release: session_01L9qibvfX5bawZKtfa6u7j9 · seat signs off on the maintainer's 「所有座位当前任务处理完,合并后就下班」 · the card stays
needs-user-decisionfor the maintainer; whichever spec seat records the ruling moves it topm:on-holdwhile the lane takes p1 onlyResume-from: none
Step 1 (the design, PR #33190) is merged. The 11 open questions are in decision comment 6870279667. Steps 2 and 3 get fresh orders from design §7 and contract-review nits N14 to N19 (record 6870023790 on PR #33190) after the ruling, once the lane takes p2 cards again.
Generated by Claude Code
os-tesla commentedon Nov 14, 2026
Maintainer ruling · 2026-11-14 11:03Z
Tesla chose, on a decision card in the discussion thread: 「脚本模板,内核不动」 — for now, overlapping-booking rules are written as hook scripts; no kernel change. This supersedes ruling 6844907250 (declarative, atomic data-layer constraint) and the 11 questions in decision comment 6870279667.
Work:
docs/design/exclusion-constraints.md, added by docs(design): exclusion constraints — key shape, interval semantics, per-driver atomicity, existing data #33190 (7257f57a). It is the only file that landed for this card: no spec key, code, ledger row or reference exists onmain. Done in docs(design): revert the exclusion-constraints design doc #33239, ordered directly by the maintainer: 「回退设计稿,让座位现在就处理」.skills/) and the docs, covering both insert and update: merge the previous values on update, exclude the record itself, write the status filter as$ne/$nin, refuse with a fixed message. About one docs PR.When to revisit a declarative key (a light
exclusionskey that checks on write without a concurrency guarantee): when two or three apps need it, or when one of the gaps a hook cannot cover causes a real problem — recycle-bin restore runs no insert hook, an import with automations off skips hooks, and rows that overlap each other inside one bulk insert do not see each other.Background: the evidence on this card came from our own test tenant (a duplicate submitted later, not a concurrent one), not from a customer report. Research and review notes are in the project files
research/32979-exclusion-platform-comparison.md,research/32979-script-concurrency-primitives.mdandresearch/32979-fable-review.md.Generated by Claude Code
os-tesla commentedon Nov 14, 2026
Correction to the comment above: this card goes to
pm:queue, notpm:on-hold. The maintainer clarified that the current pause stops dispatch from the queue; ruled cards still enter it. Item 1 (the revert) is #33239; item 2 (the hook template) waits for dispatch.Generated by Claude Code
os-tesla commentedon Nov 14, 2026
Landed: PR #33239 merged at 295ce12, removing
docs/design/exclusion-constraints.md(the design for theexclusionskey that the ruling above did not adopt).git ls-tree origin/main docs/design/exclusion-constraints.mdnow returns nothing.What remains on this card: the vetted overlap hook template in docs/skills, per the ruling. The card stays open in
pm:queuefor that;skills/**is a Tier H surface, so that PR needs a maintainer approval when it lands.Generated by Claude Code
Generated by Claude Code
[-]data layer: a declarative exclusion constraint refuses two records of one person over overlapping time (e.g. overtime twice) — ruled A, after 18.4.0[/-][+]skills: a vetted hook template refuses two records of one person over overlapping time — ruled: no exclusions key, no kernel change (6876330213)[/+]objectstack-fleet commentedon Nov 14, 2026
triage#1 · hotlong · session_01Q4EjjMnyLqJdzuktEmRPXH
Path: none
Triage: retitled and re-laned to the new ruling ·
domain:spec→domain:skills· 2026-11-14T13:46Z⛔ Not a claim; the grade is unchanged (p2).
exclusionskey and no kernel change, and a vetted hook template to follow in a docs change. The step-1 design doc was reverted (PR docs(design): revert the exclusion-constraints design doc #33239). My earlier title described the option that was not adopted, so it is replaced.domain:skills.objectstack-fleet commentedon Nov 14, 2026
domain:skills#1 · os-project-manager · session_01FEkQ5pjSPT7ui2EUcunaVb
Claim: PM loop round 1
Session:
session_01FEkQ5pjSPT7ui2EUcunaVbAccount:
os-project-managerBranch:
claude/project-thread-0sjbarWorktree:
objectstack-issue-32979Domain:
domain:skillsSeat:
domain:skills#1File surface: one
skills/objectstack-*rules/references file that already teaches hooks (+ its eval if expected behaviour moves), onecontent/docs/**hooks page, the proving test,.changeset/(stop on breach; explain in the report)Container & model:
M,mode:thread,model: CONTRACT_REVIEW_TIER(MANDATORY:skills/**hit indispatch-gates --tier),effort: highClause-②: no
Metadata-protocol: none
Responsibility:
the platform has no cross-record overlap check (ruled: stays in hook scripts, 6876330213) | none — no vetted template exists | every time-booking app an AI author writesThread-read: 6878198537
Premise: holds
Serial constraints cleared: #33235 (also
skills/**, objectstack-ui files) — disjoint; PR #33239 (item 1) mergedOrder:
/mnt/project-files/pm-orders/skills/order-32979.md(project file). Ruling-ref: the maintainer's summons 「开一个 skills 车道,派发 p1 p2」 (2026-11-14T15:13Z, this account's project).objectstack-fleet commentedon Nov 14, 2026
domain:skills#1 · os-project-manager · session_01FEkQ5kKeYvkiYDEFCNhNhU
os-dev-report
{
"issue": 32979,
"status": "done",
"branch": "claude/project-thread-0sjbar",
"pr": "#33292",
"session": "session_01FEkQ5kKeYvkiYDEFCNhNhU",
"premise_still_valid": true,
"summary": "Ruling 6876330213 item 2: skills/objectstack-data/references/data-hooks.md (the file that already teaches hooks) gains pattern 5, a beforeInsert + beforeUpdate overlap-check hook with a sandboxed body: stored row merged under the patch, the record itself excluded with $ne, ignored statuses named with $nin (fail closed), half-open ranges, a declared refusals entry OVERLAP 409. Its limits sit beside it: the ruling's three plus the read-then-write race. content/docs/automation/hooks.mdx gains the same template with a reason per rule (+62 lines). The skills file pays for itself: five Key Properties subsections that restated the defineHook example comments, the Before vs After table and Best Practices are deleted, file 943 to 907 lines, 10007 to 10005 tokens, no ceiling raise. No spec, engine, data-layer or runtime change. Head 500642a.",
"tests": "packages/runtime/src/sandbox/overlap-hook-template.integration.test.ts runs the template on a real ObjectQL + SQLite driver + QuickJSScriptRunner + bindHooksToEngine, read off mapDataError (409, declaredCode OVERLAP): overlapping insert refused; null or unlisted status sibling still counts; adjacent, other owner and rejected rows accepted; update moving into overlap refused (stored row merged) and reviving a rejected row refused; self update not refused. Head 500642a under os-verify-lock: Test Files 1 passed, Tests 5 passed, VERDICT command-exit 0. Mutation proof via ablation-replace.mjs on the test copy, restored to HEAD blob 90ec0c34 each time: drop the $ne self-exclusion 2 failed; $lt to $lte 1 failed; $nin to $in approved 1 failed; drop ctx.previous from the merge 1 failed. pnpm --filter @objectstack/runtime typecheck (tsc + check:test-typecheck) exit 0.",
"gates": "dispatch-gates --commands at 500642a derived 97 commands, exit codes captured before any pipe. 94 exit 0 first pass. check-plugin-teardown-shape --self-test exit 3 (shallow clone) then exit 0 after git fetch --depth=1 of the pinned commit. spec check:skill-examples exit 3 (client-react unbuilt) then exit 0 after building client-react and its closure under the lock: 345 prose examples type-check, new os:check block included. check:dual-build-cjs-loads exit 3 PREREQUISITE NOT MET (41 packages without dist), NOT MEASURED; no package source touched, CI runs it. --ran reconciliation: 97 derived, 96 run, 1 NOT-MEASURED, 0 UNRUN, exit 0 (record: project file pm-orders/skills/32979-gates-ran.txt). check-skills-token-ratchet exit 0 (data-hooks.md 10005 of 10011). dispatch-gates --tier: MANDATORY CONTRACT_REVIEW_TIER (skills/). check-governed-merges --branch: exit 3 GOVERNED, Tier H, skills/ x1, 348 changed lines. CI check-runs on PR 33292: in_progress at report time.",
"line_budget": "skills/** net -36 lines (budget +45); docs page +62 lines (budget +80)",
"dogfood_battery": "n/a — no ! in the PR title and no (narrowing) arm",
"mcp_calls": "6 — mcp__github__issue_read (get x1, get_comments x2), mcp__claude-code-remote__get_session x1, plus 2 hearthbot thread messages; 0 GitHub write tools",
"api_writes": "2 — fleet-write relay pr_create (run 43612654278, PR 33292, body read back identical); this os-dev-report comment via post-stamped",
"deviations": [
"Standing lines ask for a trailing signed HTML comment in the PR body; os-dev.md forbids dev-written HTML comments, and the standing lines lose to it where they conflict, so the body ends with a plain Signed: line instead.",
"pr_create sent no labels key: the order names no label and the relay refuses an empty labels array.",
"The four mutation runs and one probe run went outside os-verify-lock (single-file vitest, about 10 s each)."
],
"open_questions": [],
"security_findings": "none",
"out_of_scope_findings": [
"carrier: none · the proving test holds a byte-identical copy of the template rather than reading skills/, because a read needs scripts/cross-package-test-inputs.mjs and packages/runtime/vitest.repo-tests.json, outside the claim's file surface; a seat may widen it to make drift impossible",
"carrier: none · ctx.api reads as the saver (runAs inherit), so with a group key whose rows the saver cannot read (a room under private sharing) the count can miss them; runAs system is the documented remedy; not measured, not in the template, noted in the PR acceptance notes"
]
}
objectstack-fleet commentedon Nov 14, 2026
domain:skills#1 · os-project-manager · session_01FEkQ5pjSPT7ui2EUcunaVb
ACCEPT → PR #33292 comment 6881847814 · contract review PASS 6881830735 · held for the maintainer (Tier H; reviewers requested) · 2026-11-14T18:00Z
docs(design): revert the exclusion-constraints design doc (objectstac…
docs(skills): a vetted overlap-check hook template for insert and upd…