Repository navigation
docs(skills): type-check 14 more objectstack-data examples and fix the Field import path - #31618
Conversation
…ield import path Mark 14 more self-contained blocks with the os:check marker (25 of 95), wrap index lists as ObjectIndex[], add the defineHook imports the pattern hooks need, and import Field from @objectstack/spec/data, the subpath that exports it. Paid inside each file by trims; no ceiling moved. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jRhbPVtqq8gkr4md2P
|
domain:skills#3 · zhuangjianguo · session_01QsR2jULfPnqQFGcZUtKDFH Contract-review-claim: session_01QsR2jULfPnqQFGcZUtKDFH · head 1d424c0 · 2026-11-08T17:08Z The lane seat's isolated Fable reviewer runs the |
|
domain:skills#3 · zhuangjianguo · session_01QsR2jULfPnqQFGcZUtKDFH Contract reviewServed-tier: ① Derived judgments
② Semver level
③ Boundary flagsThe dev report (card comment 6724448006) lists seven
④ Design judgmentJudged on the head tree against the gate (
Tried to break it: (a) a wrapper that silently weakens the check — none; every index wrapper is typed to the strict input schema and every hook block goes through Findings: three nits (indexing.md note wording; field-types.md missing fragment note, accepted deviation; validation.md ❌/✅ pair asymmetry). No must-fix, no should-fix. The nits may be fixed on the prose face or left as accepted deviations for the card's next data slice. Implemented-by: VERDICT: PASS |
|
domain:skills#3 · zhuangjianguo · session_01QsR2jULfPnqQFGcZUtKDFH 维护者速读
席位核对Head-sha:
|
Requested by Steedos · project thread
Refs #31112 (slice 2 of a per-skill split: item 4, objectstack-data; the card stays open)
Clause-②: no
Metadata-protocol: none
维护者速读
Field原写成从@objectstack/spec根入口导入,根入口并不导出它,改为@objectstack/spec/data。skills/objectstack-data/rules/field-types.md(唯一的示例修正)、skills/objectstack-data/rules/indexing.md(8 段新接入、改动最多)、skills/objectstack-data/rules/validation.md(删去两句重复说明以支付额度)。pnpm --filter @objectstack/spec check:skill-examples,预期最后一行为 322 段示例全部通过类型检查。What changes
skills/objectstack-datahad 11 of its 95 fencedts/typescriptblocks undercheck:skill-examples(measured onmain158cc2a, all*.mdoutsideevals/,_index.mdexcluded). It now has 25. Every new mark is the os:check marker on the line above the fence; wrappers are an import plus a typedconst, never more than three lines.rules/indexing.mdreferences/data-hooks.mdrules/lifecycle.mdrules/field-types.mdrules/validation.mdreferences/examples-objects.mdSKILL.md,seeds.md,datasources.md,relationships.md,security.mdSkills bundle reading: no
SKILL.mdchanged, so the sum of every publishedSKILL.mdstays 4592 lines.rules/indexing.md: eight index examples becomeconst indexes: ObjectIndex[] = [ … ];(orconst index: ObjectIndex) withimport type { ObjectIndex } from '@objectstack/spec/data'. A retiredtype/partialkey or an unscopedunique: truenow fails the gate. The two blocks holding ❌ keys stay unmarked; the opening "Guide for …" line, which carried no rule, now says so.references/data-hooks.md: the fulldefineHookdefinition is marked as written; patterns 1 to 3 gain theirdefineHookimport. Pattern 4 stays unmarked (itsrecord: anyparameter is a bareany, which the gate refuses), as do the context shapes and fragments; the intro says so once.rules/lifecycle.md: theObjectSchema.createsyntax block is marked as written, paid by "Guide for declaring" becoming "Declaring". The ❌ block sits under the heading "Validation Rules (rejected at parse time)".rules/field-types.md: theField.*factory block is marked asconst fields = { … };.references/examples-objects.md: theprotectiontype excerpt gets one line saying it is an excerpt and unchecked.Example fixes
rules/field-types.md:19(was line 18):import { Field } from '@objectstack/spec'does not compile. The spec root exports noField: namespace exports were removed from the root for tree-shaking (packages/spec/src/index.ts, "NAMESPACE EXPORTS — REMOVED"), and every example app imports it from@objectstack/spec/data. Nowimport { Field } from '@objectstack/spec/data'. The prose at line 12 named the same wrong path, "(@objectstack/spec)"; that parenthetical is removed, because the import line right below it now carries the path and the gate checks it.rules/validation.md:325: the ✅ "Correct — Validation Scoped to Events" example had noname, which every validation rule requires (BaseValidationRuleShape). It gainsname: 'no_draft_publish'. The block stays unmarked because it is an object-literal fragment.Trims that paid the marks (each cut rule and where it survives)
rules/validation.md, Uniqueness section: "There is nouniquevalidation type." This survives at "Available Rule Types": "Nouniquetype — enforce uniqueness with a unique index".rules/validation.md, Cross-Field section: "Same inverted semantics asscript— the predicate is the failure condition." This survives at "Expression Syntax" ("Forscriptandcross_field, the predicate expresses the failure condition") and in the block's own// ❌ TRUE = invalidcomment.rules/field-types.md:11: "overwhelmingly" became "mostly", and the wrong import parenthetical went (see above).rules/indexing.md:3andrules/lifecycle.md:3: intro wording that carried no rule.Tests
check:skill-examples, before and after
main158cc2a):✅ 308 prose examples type-check across 3 surface(s).pnpm --filter @objectstack/spec check:skill-examplesexited 0 with✅ 322 prose examples type-check across 3 surface(s) — every marked block parsed, so tsc ran the SEMANTIC pass on all of them(skills + docs surface 274 → 288).type(rules/indexing.md:142), an unknown hook keyrunAsUser(references/data-hooks.md:747) and the old rootFieldimport (rules/field-types.md:19). The checker exited 1 with TS2353, TS2353 and TS2305 at exactly those lines. Restored withgit checkout HEAD -- skills/objectstack-data;git status --porcelainwas empty after.Acceptance notes
check:skill-examplesis not in the derived gate list for askills/**diff, so it was run by hand.rules/relationships.md(headroom 0; sixObjectSchema.createblocks, which each need an import, and three of them hold twoexport defaults),rules/security.md(0; the tworowLevelSecuritylists),references/seeds.md(0; each block names an object defined elsewhere, so it needs adeclare constline),rules/datasources.md(3; the federated-object block needs an import of about 18 tokens),SKILL.md(9; thesearchableFieldsobject and theindexeslist; the sameindexeslist is checked inrules/indexing.md), and thevalidations: [ … ]lists inrules/validation.md(about 27 tokens each). The probe that sorted the 95 blocks wrapped each of these with its real type, and every one compiled except the deliberate ❌ examples. So no other example is wrong today; they are just not gated.Verification
Derived gates (dispatch-gates --commands, 45 families) on head c4e232f
44 exited 0.
pnpm check:dual-build-cjs-loadsexited 3 (PREREQUISITE NOT MET: it needs every package'sdist; CI runs it).dispatch-gates --ranexited 0: 45 derived, 44 run, 1 NOT-MEASURED. After mergingmain(head 1d424c0, which touches nopackages/specorskills/path), the token ratchet,check:cross-package-test-inputs(whose scriptmainchanged),check:skill-linksandcheck-changeset-no-majorwere re-run, all exit 0.Generated by Claude Code