feat(spec): refuse an auto-launched flow whose stack omits requires: ['triggers'] - #14330

Merged
os-zhuang merged 2 commits into
mainfrom
claude/issue-14153-trigger-capability-validator
Sep 2, 2026
Merged

feat(spec): refuse an auto-launched flow whose stack omits requires: ['triggers']#14330
os-zhuang merged 2 commits into
mainfrom
claude/issue-14153-trigger-capability-validator

Conversation

@claude

@claudeclaudeBot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Fixes#14153

What

defineStack now refuses a stack that declares an auto-launched flow (record_change / schedule / time_relative / api) while requires omits 'triggers' — a sibling of validateHierarchyScopeCapability, in the same throw-site family:

defineStack trigger capability validation failed (1 issue):
✗ flow 'duly_assignment_fanout' declares a 'record_change' trigger but `requires` does not include 'triggers' — no 'record_change' trigger would be registered, so the flow would never auto-launch. Add requires: ['triggers'] (record_change/schedule/time_relative/api ship in @objectstack/trigger-*).

The wording is the automation engine's boot-audit line (getTriggerBindingAudit), moved from post-deploy to author time — no second vocabulary. triggers is one membership test (one token installs all four kinds), no per-kind table.

Ruling premise — verified (in-tree corpus census at a39b02a6)

stackrequiresflowsverdict
examples/app-crm['ui', 'automation']convert-lead.flow.ts is type: 'screen'passes (measured: defineStack import through the built dist, flows=1 types=["screen"])
examples/app-showcasedeclares 'triggers' (objectstack.config.ts:107)autolaunched + screen + one schedulepasses by the membership test
packages/create-objectstack blank template['automation']no flows (src/objects only)passes
examples/app-todoabsent2 × schedule ('0 8 * * *'), 1 × record_change, 1 × screentripped — repaired (see below)
packages/**/objectstack.config.ts (5)none declare flowspass

No in-tree stack declares a record_change / schedule / time_relative / api flow and launches it only by hand (no type: 'flow' action targeting such a flow, no docs saying so). The premise holds; the reroute condition is not met — the remedy is in defineStack, nothing was built in packages/lint beyond the declared import-site edit.

Absent requires — measured Outcome B

packages/cli/src/commands/serve.ts: an absent requires reads as [] (:2295), the CLI appends only its convenience defaults — email iff auth, mcp, pinyin-search, the always-on slate (PLATFORM_ALWAYS_ON_CAPABILITIES = queue, job, cache, settings, email, storage, sms, sharing, messaging, analytics — neither automation nor triggers), queue/job — and the capability resolver loads a provider only for tokens in that list (for (const cap of requires) :3985; automation :1460, triggers :1506 are entries of Serve.CAPABILITY_PROVIDERS; no other block imports @objectstack/service-automation or @objectstack/trigger-*). os dev forwards to a serve child. So a stack that declares nothing gets no trigger — and no engine. ⇒ the validator fires on absent requires too, and examples/app-todo (whose task-completion-trigger.test.ts hand-assembles RecordChangeTriggerPlugin precisely because its record_change flow is meant to fire) now declares requires: ['automation', 'triggers']. Not booted live: booting app-todo needs the whole CLI closure built in this worktree; the reading above is from the resolver's own source, line-cited.

Predicate — hoisted into spec (single source)

resolveFlowTriggerKind (packages/spec/src/automation/flow-trigger-kind.ts, exported from @objectstack/spec/automation) mirrors the engine's resolveTriggerBinding chain, kind only, in its precedence (timeRelative descriptor outranks a sibling schedule cadence). @objectstack/lint's validate-flow-trigger-readiness.ts now reads isAutoTriggered = resolveFlowTriggerKind(flow) !== undefinedbyte-identical to the six-term disjunction it replaces (the resolver answers a kind exactly when one of those terms held). The one documented divergence from the engine is the array-formtriggerType (unsupported, #3457): the engine routes it to the record-change trigger only so the trigger can refuse it loudly at bind time, lint 1d already reports it as an error, and lint's predicate never counted it — so the resolver answers no kind for it, which is what keeps the lint edit identical by construction rather than by test coverage. Lint's suite (92 files / 2685 tests) is the proof; see Tests.

Fixture triage

  • packages/lint/src/authoring-rule-input-tier.test.ts — its flowStack uses a schedule flow only as a vehicle for a parse-time default; the new refusal tripped it. Declaredrequires: ['triggers'] on the fixture (the flow's auto-trigger is incidental; the test's meaning is unchanged).
  • Every other defineStack test consumer with flows (git grep -ln defineStack -- '**/*.test.ts' → 85 files, 20 with flows) either declares no auto-triggered flow, declares triggers, or does not go through defineStack for it — the spec (451 files) and lint (92 files) suites ran green after the two repairs above.

Downstream

Out of scope, filed as #14328 (finding, open): the automation engine's resolveTriggerBinding keeps a private copy of the trigger-kind chain the spec resolver now mirrors — hoisting the kind onto resolveFlowTriggerKind is a service-automation change, not this card's.

objectstack-ai/duly's test/trigger-capability.test.ts stopgap can be deleted in that repo once this lands and the pin moves — a follow-up there, not here.

Files

  • packages/spec/src/automation/flow-trigger-kind.ts (+ test, + barrel export, + regenerated api-surface/automation.json and export-origins/automation.json)
  • packages/spec/src/stack.zod.tsvalidateTriggerCapability + wiring after the hierarchy sibling
  • packages/spec/src/stack-requires.test.ts — the defineStack trigger capability validation suite
  • packages/lint/src/validate-flow-trigger-readiness.ts — import-site edit only (+ one comment that named the old predicate)
  • packages/lint/src/authoring-rule-input-tier.test.ts — fixture declares the token
  • examples/app-todo/objectstack.config.ts — corpus repair
  • content/docs/permissions/capabilities.mdx, content/docs/automation/flows.mdx — one table row, one paragraph
  • .changeset/define-stack-trigger-capability-refusal.md@objectstack/specminor (BREAKING accept-set narrowing under the launch-window convention; ADR-0087 not-required (no-migration-prescription) — the refusal names the one-line fix, nothing is renamed or removed), @objectstack/lint patch

Tests

All runs through scripts/pm/os-verify-lock.sh; verdicts quoted from each runner's own summary line, exit codes captured before any pipe. Head for every re-run: 24aec0a0.

  • pnpm --filter @objectstack/spec exec vitest run --maxWorkers=2 (whole suite, at 66d5d580): Test Files 2 failed | 449 passed (451) · Tests 3 failed | 12084 passed (12087) — all three failures were the stale export-origins/automation.json (the module exports these at runtime and export-origins does not record them), regenerated with check:generated --fix together with api-surface/automation.json (the only two artifacts it proved stale). Targeted re-run at 24aec0a0 of scripts/export-origins.test.ts src/automation/state-machine.test.ts src/stack-requires.test.ts src/automation/flow-trigger-kind.test.ts: Test Files 4 passed (4) · Tests 64 passed (64).
  • pnpm --filter @objectstack/lint exec vitest run --maxWorkers=2 (whole suite): Test Files 1 failed | 91 passed (92) · Tests 1 failed | 2684 passed (2685) — the one failure was the tier fixture (see Fixture triage). Targeted re-run at 24aec0a0 of src/authoring-rule-input-tier.test.ts src/validate-flow-trigger-readiness.test.ts: Test Files 2 passed (2) · Tests 80 passed (80) — the readiness suite (60 cases, untouched) is the byte-identical proof for the import-site edit.
  • pnpm --filter @objectstack/spec typecheck exit 0 (check:test-typecheck: OK — … 54 file(s) / 262 error(s) / 146 pinned signature(s), ledger unchanged); pnpm --filter @objectstack/lint typecheck exit 0.
  • Reverse verification (ablation, committed state): the wiring line const triggerErrors = validateTriggerCapability(data); replaced by const triggerErrors: string[] = []; — on-disk proof injected=1 removed-anchor-left=0; run: Tests 6 failed | 18 passed (24) — exactly the six refusal cases red, every pass-through case and the whole resolver suite green; restore git checkout HEAD -- ABSOLUTE_PATH proven by hash d8411f45… == HEAD blob; git diff HEAD empty (trap-guarded script). Spec's own tests import ./stack.zod from src, so no dist was involved in this leg; spec was rebuilt afterwards regardless (the restore's touch had turned the mtime-based dist-freshness guards red) and the dist-reading gates re-run on that rebuilt tree.
  • Corpus through the built dist:tsx import of examples/app-todo/objectstack.config.tsrequires=["automation","triggers"] flows=4 types=["schedule","record_change","screen"]; examples/app-crmrequires=["ui","automation"] flows=1 types=["screen"]. examples/app-showcase is not importable in this worktree (its @objectstack/connector-mcp dist is unbuilt) and passes on the static membership test ('triggers' at objectstack.config.ts:107). pnpm validate per example NOT run (it needs the CLI closure built); the import exercises the exact defineStack refusal, and the lint half of os validate is unchanged (readiness suite green).
  • Not run locally, declared: the example apps' own vitest suites and the packages/cli suites (their defineStack consumers declare no auto-triggered flow — census in Fixture triage); full pnpm test — CI's.

Gates

node scripts/pm/dispatch-gates.mjs --commands with no paths at 24aec0a0 (answer stamped objectstack-ai/objectstack at 24aec0a0): 71 commands (the PM's three-path reading gave 40; the same three paths gave 46 here — 41 by path + 7 by change KIND; the real change set adds the changeset, docs, example and artifact families). Every command run with its exit code captured by redirection; 67 green, including the ones this card names: check:stack-collection-maps, check:api-surface (public API surface + factory signatures unchanged ✓ — the two new exports are in the regenerated shard), check:docs, check:llms-txt, check:liveness, check:where-matcher, check:objectql-double-limit, check-adr-0087-registration, check:export-origins, check:dual-source-exports (0 accepted dual-source), check:exported-any, check:entry-nameability, check:skill-examples (259 prose examples type-check across 3 surface(s) — after building @objectstack/client-react...), check:cross-package-test-inputs, check:test-source-alias, check:doc-authoring, check-affected-docs, check:changeset-gate-self-tests, check-empty-changeset, check-changeset-no-major.

4 NOT MEASURED locally — each exits with its own prerequisite code, nothing measured, CI owns them: check-dev-prereqs (exit 1: 63 of 67 workspace packages unbuilt here), check-test-completeness (exit 3: needs a saved turbo run test log), check:dual-build-cjs-loads (exit 3: PREREQUISITE NOT MET, unbuilt dists), check:type-check-debt (exit 3: needs the whole closure built).

Also run, not in the derived list: pnpm check:nul-bytes (OK … 7815 text file(s) … no raw ASCII control bytes) plus a control-character self-scan over every edited file (clean).

skip-changeset: not applicable — this PR ships a changeset. needs:contract-review hung on this PR and on #14153 (Clause ②: defineStack gains a refusal).

Session: https://claude.ai/code/session_01GDA48PuRFrHyRfdkBz8m21

🤖 Generated with Claude Code

Generated by Claude Code


Generated by Claude Code

…['triggers'] (#14153)
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GDA48PuRFrHyRfdkBz8m21
…utomation exports; declare triggers on the lint tier fixture (#14153)
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GDA48PuRFrHyRfdkBz8m21
@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 2 package(s): @objectstack/lint, @objectstack/spec, touching 7 documentable anchor(s). ⚠️3 changed file(s) yielded no anchor (packages/spec/api-surface/automation.json, packages/spec/export-origins/automation.json, packages/spec/src/automation/index.ts), so the pages documenting them are NOT COVERED by this run — this is not a clean bill of health for those files.

10 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:

  • content/docs/api/plugin-endpoints.mdx(via record_change (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))
  • content/docs/automation/approvals.mdx(via record_change (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))
  • content/docs/automation/flows.mdx(via record_change (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind), time_relative (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))
  • content/docs/automation/hooks.mdx(via record_change (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))
  • content/docs/automation/workflows.mdx(via record_change (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))
  • content/docs/concepts/architecture.mdx(via record_change (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))
  • content/docs/getting-started/common-patterns.mdx(via record_change (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))
  • content/docs/kernel/services-checklist.mdx(via record_change (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))
  • content/docs/permissions/capabilities.mdx(via record_change (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind), time_relative (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))
  • content/docs/protocol/objectql/schema.mdx(via record_change (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))

3 release-owned page(s) also name something this change touched. These are read-only:

  • content/docs/releases/v12.mdx(via record_change (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))
  • content/docs/releases/v16.mdx(via time_relative (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))
  • content/docs/releases/v17.mdx(via record_change (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))

content/docs/releases/ is RELEASE-OWNED (AGENTS.md "Documentation Guardrails"): release
notes are written centrally at release time, and a code PR that edits them is the exact PR
that guardrail exists to stop. They are still audited — read-only. If one of them is actually
wrong, file an issue or open a dedicated docs-only PR; do not edit it here.

What this run could not see
  • 3 changed file(s) yielded no anchor (packages/spec/api-surface/automation.json, packages/spec/export-origins/automation.json, packages/spec/src/automation/index.ts) — pages documenting those are invisible to this run
  • 1 anchor(s) matched too much of the corpus to be a work list: defineStack (symbol, 57 pages)
  • the SDK route bridge reached 47 of 219 client-bound route-ledger rows — the other 172 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 172: 14 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 56 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 102 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.

Coarse fallback — 128 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json f645d6f8879f5e868b8c0aac978dc0db92552739packageMentionDocs.

Which tree this was computed on

This run read content/docs from 3b3c9e059159c1ea382daa3f44ee0f2f220f0ac5 — the merge of head 24aec0a0a2ffe42e339eded184f60ffff85569ac into base f645d6f8879f5e868b8c0aac978dc0db92552739, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 3b3c9e059159c1ea382daa3f44ee0f2f220f0ac5 && git checkout 3b3c9e059159c1ea382daa3f44ee0f2f220f0ac5
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin f645d6f8879f5e868b8c0aac978dc0db92552739 24aec0a0a2ffe42e339eded184f60ffff85569ac && git checkout -B drift-repro f645d6f8879f5e868b8c0aac978dc0db92552739 && git merge --no-ff 24aec0a0a2ffe42e339eded184f60ffff85569ac
node scripts/docs-audit/affected-docs.mjs --json f645d6f8879f5e868b8c0aac978dc0db92552739

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs f645d6f8879f5e868b8c0aac978dc0db92552739 → pass the list as
args.docs, on the commit named under Which tree this was computed on.

@github-actionsgithub-actionsBot added documentation Improvements or additions to documentation tests tooling labels Sep 2, 2026
@os-zhuang
os-zhuang marked this pull request as ready for review September 2, 2026 02:41
@os-zhuang
os-zhuang added this pull request to the merge queueSep 2, 2026
Merged via the queue into main with commit 948dd6bSep 2, 2026
43 checks passed
@os-zhuang
os-zhuang deleted the claude/issue-14153-trigger-capability-validator branch September 2, 2026 03:07
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentationImprovements or additions to documentationsize/mteststooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

defineStack hard-errors on an undeclared hierarchy scope but is silent on an undeclared trigger capability — every autolaunched flow ships inert

2 participants

@os-zhuang@claude
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Add copy buttons to all
 blocks\n(function() {\n function addCopyButtons() {\n document.querySelectorAll('pre code').forEach(function(codeBlock) {\n if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;\n codeBlock.parentElement.setAttribute('data-copy-added', 'true');\n \n var btn = document.createElement('button');\n btn.textContent = 'Copy';\n btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';\n btn.onmouseover = function() { this.style.opacity = '1'; };\n btn.onmouseout = function() { this.style.opacity = '0.7'; };\n btn.onclick = function() {\n navigator.clipboard.writeText(codeBlock.textContent).then(function() {\n btn.textContent = 'Copied!';\n setTimeout(function() { btn.textContent = 'Copy'; }, 1500);\n });\n };\n codeBlock.parentElement.style.position = 'relative';\n codeBlock.parentElement.appendChild(btn);\n });\n }\n \n addCopyButtons();\n \n // Re-run on dynamic content\n var observer = new MutationObserver(addCopyButtons);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Add Copy Buttons to Code Blocks");
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Skip to content

feat(spec): refuse an auto-launched flow whose stack omits requires: ['triggers'] - #14330

Merged
os-zhuang merged 2 commits into
mainfrom
claude/issue-14153-trigger-capability-validator
Sep 2, 2026
Merged

feat(spec): refuse an auto-launched flow whose stack omits requires: ['triggers']#14330
os-zhuang merged 2 commits into
mainfrom
claude/issue-14153-trigger-capability-validator

Conversation

@claude

@claudeclaudeBot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Fixes#14153

What

defineStack now refuses a stack that declares an auto-launched flow (record_change / schedule / time_relative / api) while requires omits 'triggers' — a sibling of validateHierarchyScopeCapability, in the same throw-site family:

defineStack trigger capability validation failed (1 issue):
✗ flow 'duly_assignment_fanout' declares a 'record_change' trigger but `requires` does not include 'triggers' — no 'record_change' trigger would be registered, so the flow would never auto-launch. Add requires: ['triggers'] (record_change/schedule/time_relative/api ship in @objectstack/trigger-*).

The wording is the automation engine's boot-audit line (getTriggerBindingAudit), moved from post-deploy to author time — no second vocabulary. triggers is one membership test (one token installs all four kinds), no per-kind table.

Ruling premise — verified (in-tree corpus census at a39b02a6)

stackrequiresflowsverdict
examples/app-crm['ui', 'automation']convert-lead.flow.ts is type: 'screen'passes (measured: defineStack import through the built dist, flows=1 types=["screen"])
examples/app-showcasedeclares 'triggers' (objectstack.config.ts:107)autolaunched + screen + one schedulepasses by the membership test
packages/create-objectstack blank template['automation']no flows (src/objects only)passes
examples/app-todoabsent2 × schedule ('0 8 * * *'), 1 × record_change, 1 × screentripped — repaired (see below)
packages/**/objectstack.config.ts (5)none declare flowspass

No in-tree stack declares a record_change / schedule / time_relative / api flow and launches it only by hand (no type: 'flow' action targeting such a flow, no docs saying so). The premise holds; the reroute condition is not met — the remedy is in defineStack, nothing was built in packages/lint beyond the declared import-site edit.

Absent requires — measured Outcome B

packages/cli/src/commands/serve.ts: an absent requires reads as [] (:2295), the CLI appends only its convenience defaults — email iff auth, mcp, pinyin-search, the always-on slate (PLATFORM_ALWAYS_ON_CAPABILITIES = queue, job, cache, settings, email, storage, sms, sharing, messaging, analytics — neither automation nor triggers), queue/job — and the capability resolver loads a provider only for tokens in that list (for (const cap of requires) :3985; automation :1460, triggers :1506 are entries of Serve.CAPABILITY_PROVIDERS; no other block imports @objectstack/service-automation or @objectstack/trigger-*). os dev forwards to a serve child. So a stack that declares nothing gets no trigger — and no engine. ⇒ the validator fires on absent requires too, and examples/app-todo (whose task-completion-trigger.test.ts hand-assembles RecordChangeTriggerPlugin precisely because its record_change flow is meant to fire) now declares requires: ['automation', 'triggers']. Not booted live: booting app-todo needs the whole CLI closure built in this worktree; the reading above is from the resolver's own source, line-cited.

Predicate — hoisted into spec (single source)

resolveFlowTriggerKind (packages/spec/src/automation/flow-trigger-kind.ts, exported from @objectstack/spec/automation) mirrors the engine's resolveTriggerBinding chain, kind only, in its precedence (timeRelative descriptor outranks a sibling schedule cadence). @objectstack/lint's validate-flow-trigger-readiness.ts now reads isAutoTriggered = resolveFlowTriggerKind(flow) !== undefinedbyte-identical to the six-term disjunction it replaces (the resolver answers a kind exactly when one of those terms held). The one documented divergence from the engine is the array-formtriggerType (unsupported, #3457): the engine routes it to the record-change trigger only so the trigger can refuse it loudly at bind time, lint 1d already reports it as an error, and lint's predicate never counted it — so the resolver answers no kind for it, which is what keeps the lint edit identical by construction rather than by test coverage. Lint's suite (92 files / 2685 tests) is the proof; see Tests.

Fixture triage

  • packages/lint/src/authoring-rule-input-tier.test.ts — its flowStack uses a schedule flow only as a vehicle for a parse-time default; the new refusal tripped it. Declaredrequires: ['triggers'] on the fixture (the flow's auto-trigger is incidental; the test's meaning is unchanged).
  • Every other defineStack test consumer with flows (git grep -ln defineStack -- '**/*.test.ts' → 85 files, 20 with flows) either declares no auto-triggered flow, declares triggers, or does not go through defineStack for it — the spec (451 files) and lint (92 files) suites ran green after the two repairs above.

Downstream

Out of scope, filed as #14328 (finding, open): the automation engine's resolveTriggerBinding keeps a private copy of the trigger-kind chain the spec resolver now mirrors — hoisting the kind onto resolveFlowTriggerKind is a service-automation change, not this card's.

objectstack-ai/duly's test/trigger-capability.test.ts stopgap can be deleted in that repo once this lands and the pin moves — a follow-up there, not here.

Files

  • packages/spec/src/automation/flow-trigger-kind.ts (+ test, + barrel export, + regenerated api-surface/automation.json and export-origins/automation.json)
  • packages/spec/src/stack.zod.tsvalidateTriggerCapability + wiring after the hierarchy sibling
  • packages/spec/src/stack-requires.test.ts — the defineStack trigger capability validation suite
  • packages/lint/src/validate-flow-trigger-readiness.ts — import-site edit only (+ one comment that named the old predicate)
  • packages/lint/src/authoring-rule-input-tier.test.ts — fixture declares the token
  • examples/app-todo/objectstack.config.ts — corpus repair
  • content/docs/permissions/capabilities.mdx, content/docs/automation/flows.mdx — one table row, one paragraph
  • .changeset/define-stack-trigger-capability-refusal.md@objectstack/specminor (BREAKING accept-set narrowing under the launch-window convention; ADR-0087 not-required (no-migration-prescription) — the refusal names the one-line fix, nothing is renamed or removed), @objectstack/lint patch

Tests

All runs through scripts/pm/os-verify-lock.sh; verdicts quoted from each runner's own summary line, exit codes captured before any pipe. Head for every re-run: 24aec0a0.

  • pnpm --filter @objectstack/spec exec vitest run --maxWorkers=2 (whole suite, at 66d5d580): Test Files 2 failed | 449 passed (451) · Tests 3 failed | 12084 passed (12087) — all three failures were the stale export-origins/automation.json (the module exports these at runtime and export-origins does not record them), regenerated with check:generated --fix together with api-surface/automation.json (the only two artifacts it proved stale). Targeted re-run at 24aec0a0 of scripts/export-origins.test.ts src/automation/state-machine.test.ts src/stack-requires.test.ts src/automation/flow-trigger-kind.test.ts: Test Files 4 passed (4) · Tests 64 passed (64).
  • pnpm --filter @objectstack/lint exec vitest run --maxWorkers=2 (whole suite): Test Files 1 failed | 91 passed (92) · Tests 1 failed | 2684 passed (2685) — the one failure was the tier fixture (see Fixture triage). Targeted re-run at 24aec0a0 of src/authoring-rule-input-tier.test.ts src/validate-flow-trigger-readiness.test.ts: Test Files 2 passed (2) · Tests 80 passed (80) — the readiness suite (60 cases, untouched) is the byte-identical proof for the import-site edit.
  • pnpm --filter @objectstack/spec typecheck exit 0 (check:test-typecheck: OK — … 54 file(s) / 262 error(s) / 146 pinned signature(s), ledger unchanged); pnpm --filter @objectstack/lint typecheck exit 0.
  • Reverse verification (ablation, committed state): the wiring line const triggerErrors = validateTriggerCapability(data); replaced by const triggerErrors: string[] = []; — on-disk proof injected=1 removed-anchor-left=0; run: Tests 6 failed | 18 passed (24) — exactly the six refusal cases red, every pass-through case and the whole resolver suite green; restore git checkout HEAD -- ABSOLUTE_PATH proven by hash d8411f45… == HEAD blob; git diff HEAD empty (trap-guarded script). Spec's own tests import ./stack.zod from src, so no dist was involved in this leg; spec was rebuilt afterwards regardless (the restore's touch had turned the mtime-based dist-freshness guards red) and the dist-reading gates re-run on that rebuilt tree.
  • Corpus through the built dist:tsx import of examples/app-todo/objectstack.config.tsrequires=["automation","triggers"] flows=4 types=["schedule","record_change","screen"]; examples/app-crmrequires=["ui","automation"] flows=1 types=["screen"]. examples/app-showcase is not importable in this worktree (its @objectstack/connector-mcp dist is unbuilt) and passes on the static membership test ('triggers' at objectstack.config.ts:107). pnpm validate per example NOT run (it needs the CLI closure built); the import exercises the exact defineStack refusal, and the lint half of os validate is unchanged (readiness suite green).
  • Not run locally, declared: the example apps' own vitest suites and the packages/cli suites (their defineStack consumers declare no auto-triggered flow — census in Fixture triage); full pnpm test — CI's.

Gates

node scripts/pm/dispatch-gates.mjs --commands with no paths at 24aec0a0 (answer stamped objectstack-ai/objectstack at 24aec0a0): 71 commands (the PM's three-path reading gave 40; the same three paths gave 46 here — 41 by path + 7 by change KIND; the real change set adds the changeset, docs, example and artifact families). Every command run with its exit code captured by redirection; 67 green, including the ones this card names: check:stack-collection-maps, check:api-surface (public API surface + factory signatures unchanged ✓ — the two new exports are in the regenerated shard), check:docs, check:llms-txt, check:liveness, check:where-matcher, check:objectql-double-limit, check-adr-0087-registration, check:export-origins, check:dual-source-exports (0 accepted dual-source), check:exported-any, check:entry-nameability, check:skill-examples (259 prose examples type-check across 3 surface(s) — after building @objectstack/client-react...), check:cross-package-test-inputs, check:test-source-alias, check:doc-authoring, check-affected-docs, check:changeset-gate-self-tests, check-empty-changeset, check-changeset-no-major.

4 NOT MEASURED locally — each exits with its own prerequisite code, nothing measured, CI owns them: check-dev-prereqs (exit 1: 63 of 67 workspace packages unbuilt here), check-test-completeness (exit 3: needs a saved turbo run test log), check:dual-build-cjs-loads (exit 3: PREREQUISITE NOT MET, unbuilt dists), check:type-check-debt (exit 3: needs the whole closure built).

Also run, not in the derived list: pnpm check:nul-bytes (OK … 7815 text file(s) … no raw ASCII control bytes) plus a control-character self-scan over every edited file (clean).

skip-changeset: not applicable — this PR ships a changeset. needs:contract-review hung on this PR and on #14153 (Clause ②: defineStack gains a refusal).

Session: https://claude.ai/code/session_01GDA48PuRFrHyRfdkBz8m21

🤖 Generated with Claude Code

Generated by Claude Code


Generated by Claude Code

…['triggers'] (#14153)
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GDA48PuRFrHyRfdkBz8m21
…utomation exports; declare triggers on the lint tier fixture (#14153)
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GDA48PuRFrHyRfdkBz8m21
@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 2 package(s): @objectstack/lint, @objectstack/spec, touching 7 documentable anchor(s). ⚠️3 changed file(s) yielded no anchor (packages/spec/api-surface/automation.json, packages/spec/export-origins/automation.json, packages/spec/src/automation/index.ts), so the pages documenting them are NOT COVERED by this run — this is not a clean bill of health for those files.

10 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:

  • content/docs/api/plugin-endpoints.mdx(via record_change (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))
  • content/docs/automation/approvals.mdx(via record_change (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))
  • content/docs/automation/flows.mdx(via record_change (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind), time_relative (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))
  • content/docs/automation/hooks.mdx(via record_change (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))
  • content/docs/automation/workflows.mdx(via record_change (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))
  • content/docs/concepts/architecture.mdx(via record_change (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))
  • content/docs/getting-started/common-patterns.mdx(via record_change (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))
  • content/docs/kernel/services-checklist.mdx(via record_change (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))
  • content/docs/permissions/capabilities.mdx(via record_change (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind), time_relative (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))
  • content/docs/protocol/objectql/schema.mdx(via record_change (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))

3 release-owned page(s) also name something this change touched. These are read-only:

  • content/docs/releases/v12.mdx(via record_change (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))
  • content/docs/releases/v16.mdx(via time_relative (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))
  • content/docs/releases/v17.mdx(via record_change (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))

content/docs/releases/ is RELEASE-OWNED (AGENTS.md "Documentation Guardrails"): release
notes are written centrally at release time, and a code PR that edits them is the exact PR
that guardrail exists to stop. They are still audited — read-only. If one of them is actually
wrong, file an issue or open a dedicated docs-only PR; do not edit it here.

What this run could not see
  • 3 changed file(s) yielded no anchor (packages/spec/api-surface/automation.json, packages/spec/export-origins/automation.json, packages/spec/src/automation/index.ts) — pages documenting those are invisible to this run
  • 1 anchor(s) matched too much of the corpus to be a work list: defineStack (symbol, 57 pages)
  • the SDK route bridge reached 47 of 219 client-bound route-ledger rows — the other 172 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 172: 14 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 56 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 102 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.

Coarse fallback — 128 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json f645d6f8879f5e868b8c0aac978dc0db92552739packageMentionDocs.

Which tree this was computed on

This run read content/docs from 3b3c9e059159c1ea382daa3f44ee0f2f220f0ac5 — the merge of head 24aec0a0a2ffe42e339eded184f60ffff85569ac into base f645d6f8879f5e868b8c0aac978dc0db92552739, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 3b3c9e059159c1ea382daa3f44ee0f2f220f0ac5 && git checkout 3b3c9e059159c1ea382daa3f44ee0f2f220f0ac5
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin f645d6f8879f5e868b8c0aac978dc0db92552739 24aec0a0a2ffe42e339eded184f60ffff85569ac && git checkout -B drift-repro f645d6f8879f5e868b8c0aac978dc0db92552739 && git merge --no-ff 24aec0a0a2ffe42e339eded184f60ffff85569ac
node scripts/docs-audit/affected-docs.mjs --json f645d6f8879f5e868b8c0aac978dc0db92552739

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs f645d6f8879f5e868b8c0aac978dc0db92552739 → pass the list as
args.docs, on the commit named under Which tree this was computed on.

@github-actionsgithub-actionsBot added documentation Improvements or additions to documentation tests tooling labels Sep 2, 2026
@os-zhuang
os-zhuang marked this pull request as ready for review September 2, 2026 02:41
@os-zhuang
os-zhuang added this pull request to the merge queueSep 2, 2026
Merged via the queue into main with commit 948dd6bSep 2, 2026
43 checks passed
@os-zhuang
os-zhuang deleted the claude/issue-14153-trigger-capability-validator branch September 2, 2026 03:07
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentationImprovements or additions to documentationsize/mteststooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

defineStack hard-errors on an undeclared hierarchy scope but is silent on an undeclared trigger capability — every autolaunched flow ships inert

2 participants

@os-zhuang@claude
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Force GitHub README to respect dark mode\n(function() {\n var style = document.createElement('style');\n style.textContent = '\n .markdown-body {\n color-scheme: dark light;\n }\n .markdown-body pre { background: #161b22 !important; }\n .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; }\n .markdown-body table th, .markdown-body table td { border-color: #30363d !important; }\n .markdown-body img { background: #0d1117; }\n .markdown-body blockquote { border-left-color: #8b949e; }\n .markdown-body hr { border-color: #30363d; }\n ';\n document.head.appendChild(style);\n})();", "GitHub Dark Mode README Fix"); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

feat(spec): refuse an auto-launched flow whose stack omits requires: ['triggers'] - #14330

Merged
os-zhuang merged 2 commits into
mainfrom
claude/issue-14153-trigger-capability-validator
Sep 2, 2026
Merged

feat(spec): refuse an auto-launched flow whose stack omits requires: ['triggers']#14330
os-zhuang merged 2 commits into
mainfrom
claude/issue-14153-trigger-capability-validator

Conversation

@claude

@claudeclaudeBot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Fixes#14153

What

defineStack now refuses a stack that declares an auto-launched flow (record_change / schedule / time_relative / api) while requires omits 'triggers' — a sibling of validateHierarchyScopeCapability, in the same throw-site family:

defineStack trigger capability validation failed (1 issue):
✗ flow 'duly_assignment_fanout' declares a 'record_change' trigger but `requires` does not include 'triggers' — no 'record_change' trigger would be registered, so the flow would never auto-launch. Add requires: ['triggers'] (record_change/schedule/time_relative/api ship in @objectstack/trigger-*).

The wording is the automation engine's boot-audit line (getTriggerBindingAudit), moved from post-deploy to author time — no second vocabulary. triggers is one membership test (one token installs all four kinds), no per-kind table.

Ruling premise — verified (in-tree corpus census at a39b02a6)

stackrequiresflowsverdict
examples/app-crm['ui', 'automation']convert-lead.flow.ts is type: 'screen'passes (measured: defineStack import through the built dist, flows=1 types=["screen"])
examples/app-showcasedeclares 'triggers' (objectstack.config.ts:107)autolaunched + screen + one schedulepasses by the membership test
packages/create-objectstack blank template['automation']no flows (src/objects only)passes
examples/app-todoabsent2 × schedule ('0 8 * * *'), 1 × record_change, 1 × screentripped — repaired (see below)
packages/**/objectstack.config.ts (5)none declare flowspass

No in-tree stack declares a record_change / schedule / time_relative / api flow and launches it only by hand (no type: 'flow' action targeting such a flow, no docs saying so). The premise holds; the reroute condition is not met — the remedy is in defineStack, nothing was built in packages/lint beyond the declared import-site edit.

Absent requires — measured Outcome B

packages/cli/src/commands/serve.ts: an absent requires reads as [] (:2295), the CLI appends only its convenience defaults — email iff auth, mcp, pinyin-search, the always-on slate (PLATFORM_ALWAYS_ON_CAPABILITIES = queue, job, cache, settings, email, storage, sms, sharing, messaging, analytics — neither automation nor triggers), queue/job — and the capability resolver loads a provider only for tokens in that list (for (const cap of requires) :3985; automation :1460, triggers :1506 are entries of Serve.CAPABILITY_PROVIDERS; no other block imports @objectstack/service-automation or @objectstack/trigger-*). os dev forwards to a serve child. So a stack that declares nothing gets no trigger — and no engine. ⇒ the validator fires on absent requires too, and examples/app-todo (whose task-completion-trigger.test.ts hand-assembles RecordChangeTriggerPlugin precisely because its record_change flow is meant to fire) now declares requires: ['automation', 'triggers']. Not booted live: booting app-todo needs the whole CLI closure built in this worktree; the reading above is from the resolver's own source, line-cited.

Predicate — hoisted into spec (single source)

resolveFlowTriggerKind (packages/spec/src/automation/flow-trigger-kind.ts, exported from @objectstack/spec/automation) mirrors the engine's resolveTriggerBinding chain, kind only, in its precedence (timeRelative descriptor outranks a sibling schedule cadence). @objectstack/lint's validate-flow-trigger-readiness.ts now reads isAutoTriggered = resolveFlowTriggerKind(flow) !== undefinedbyte-identical to the six-term disjunction it replaces (the resolver answers a kind exactly when one of those terms held). The one documented divergence from the engine is the array-formtriggerType (unsupported, #3457): the engine routes it to the record-change trigger only so the trigger can refuse it loudly at bind time, lint 1d already reports it as an error, and lint's predicate never counted it — so the resolver answers no kind for it, which is what keeps the lint edit identical by construction rather than by test coverage. Lint's suite (92 files / 2685 tests) is the proof; see Tests.

Fixture triage

  • packages/lint/src/authoring-rule-input-tier.test.ts — its flowStack uses a schedule flow only as a vehicle for a parse-time default; the new refusal tripped it. Declaredrequires: ['triggers'] on the fixture (the flow's auto-trigger is incidental; the test's meaning is unchanged).
  • Every other defineStack test consumer with flows (git grep -ln defineStack -- '**/*.test.ts' → 85 files, 20 with flows) either declares no auto-triggered flow, declares triggers, or does not go through defineStack for it — the spec (451 files) and lint (92 files) suites ran green after the two repairs above.

Downstream

Out of scope, filed as #14328 (finding, open): the automation engine's resolveTriggerBinding keeps a private copy of the trigger-kind chain the spec resolver now mirrors — hoisting the kind onto resolveFlowTriggerKind is a service-automation change, not this card's.

objectstack-ai/duly's test/trigger-capability.test.ts stopgap can be deleted in that repo once this lands and the pin moves — a follow-up there, not here.

Files

  • packages/spec/src/automation/flow-trigger-kind.ts (+ test, + barrel export, + regenerated api-surface/automation.json and export-origins/automation.json)
  • packages/spec/src/stack.zod.tsvalidateTriggerCapability + wiring after the hierarchy sibling
  • packages/spec/src/stack-requires.test.ts — the defineStack trigger capability validation suite
  • packages/lint/src/validate-flow-trigger-readiness.ts — import-site edit only (+ one comment that named the old predicate)
  • packages/lint/src/authoring-rule-input-tier.test.ts — fixture declares the token
  • examples/app-todo/objectstack.config.ts — corpus repair
  • content/docs/permissions/capabilities.mdx, content/docs/automation/flows.mdx — one table row, one paragraph
  • .changeset/define-stack-trigger-capability-refusal.md@objectstack/specminor (BREAKING accept-set narrowing under the launch-window convention; ADR-0087 not-required (no-migration-prescription) — the refusal names the one-line fix, nothing is renamed or removed), @objectstack/lint patch

Tests

All runs through scripts/pm/os-verify-lock.sh; verdicts quoted from each runner's own summary line, exit codes captured before any pipe. Head for every re-run: 24aec0a0.

  • pnpm --filter @objectstack/spec exec vitest run --maxWorkers=2 (whole suite, at 66d5d580): Test Files 2 failed | 449 passed (451) · Tests 3 failed | 12084 passed (12087) — all three failures were the stale export-origins/automation.json (the module exports these at runtime and export-origins does not record them), regenerated with check:generated --fix together with api-surface/automation.json (the only two artifacts it proved stale). Targeted re-run at 24aec0a0 of scripts/export-origins.test.ts src/automation/state-machine.test.ts src/stack-requires.test.ts src/automation/flow-trigger-kind.test.ts: Test Files 4 passed (4) · Tests 64 passed (64).
  • pnpm --filter @objectstack/lint exec vitest run --maxWorkers=2 (whole suite): Test Files 1 failed | 91 passed (92) · Tests 1 failed | 2684 passed (2685) — the one failure was the tier fixture (see Fixture triage). Targeted re-run at 24aec0a0 of src/authoring-rule-input-tier.test.ts src/validate-flow-trigger-readiness.test.ts: Test Files 2 passed (2) · Tests 80 passed (80) — the readiness suite (60 cases, untouched) is the byte-identical proof for the import-site edit.
  • pnpm --filter @objectstack/spec typecheck exit 0 (check:test-typecheck: OK — … 54 file(s) / 262 error(s) / 146 pinned signature(s), ledger unchanged); pnpm --filter @objectstack/lint typecheck exit 0.
  • Reverse verification (ablation, committed state): the wiring line const triggerErrors = validateTriggerCapability(data); replaced by const triggerErrors: string[] = []; — on-disk proof injected=1 removed-anchor-left=0; run: Tests 6 failed | 18 passed (24) — exactly the six refusal cases red, every pass-through case and the whole resolver suite green; restore git checkout HEAD -- ABSOLUTE_PATH proven by hash d8411f45… == HEAD blob; git diff HEAD empty (trap-guarded script). Spec's own tests import ./stack.zod from src, so no dist was involved in this leg; spec was rebuilt afterwards regardless (the restore's touch had turned the mtime-based dist-freshness guards red) and the dist-reading gates re-run on that rebuilt tree.
  • Corpus through the built dist:tsx import of examples/app-todo/objectstack.config.tsrequires=["automation","triggers"] flows=4 types=["schedule","record_change","screen"]; examples/app-crmrequires=["ui","automation"] flows=1 types=["screen"]. examples/app-showcase is not importable in this worktree (its @objectstack/connector-mcp dist is unbuilt) and passes on the static membership test ('triggers' at objectstack.config.ts:107). pnpm validate per example NOT run (it needs the CLI closure built); the import exercises the exact defineStack refusal, and the lint half of os validate is unchanged (readiness suite green).
  • Not run locally, declared: the example apps' own vitest suites and the packages/cli suites (their defineStack consumers declare no auto-triggered flow — census in Fixture triage); full pnpm test — CI's.

Gates

node scripts/pm/dispatch-gates.mjs --commands with no paths at 24aec0a0 (answer stamped objectstack-ai/objectstack at 24aec0a0): 71 commands (the PM's three-path reading gave 40; the same three paths gave 46 here — 41 by path + 7 by change KIND; the real change set adds the changeset, docs, example and artifact families). Every command run with its exit code captured by redirection; 67 green, including the ones this card names: check:stack-collection-maps, check:api-surface (public API surface + factory signatures unchanged ✓ — the two new exports are in the regenerated shard), check:docs, check:llms-txt, check:liveness, check:where-matcher, check:objectql-double-limit, check-adr-0087-registration, check:export-origins, check:dual-source-exports (0 accepted dual-source), check:exported-any, check:entry-nameability, check:skill-examples (259 prose examples type-check across 3 surface(s) — after building @objectstack/client-react...), check:cross-package-test-inputs, check:test-source-alias, check:doc-authoring, check-affected-docs, check:changeset-gate-self-tests, check-empty-changeset, check-changeset-no-major.

4 NOT MEASURED locally — each exits with its own prerequisite code, nothing measured, CI owns them: check-dev-prereqs (exit 1: 63 of 67 workspace packages unbuilt here), check-test-completeness (exit 3: needs a saved turbo run test log), check:dual-build-cjs-loads (exit 3: PREREQUISITE NOT MET, unbuilt dists), check:type-check-debt (exit 3: needs the whole closure built).

Also run, not in the derived list: pnpm check:nul-bytes (OK … 7815 text file(s) … no raw ASCII control bytes) plus a control-character self-scan over every edited file (clean).

skip-changeset: not applicable — this PR ships a changeset. needs:contract-review hung on this PR and on #14153 (Clause ②: defineStack gains a refusal).

Session: https://claude.ai/code/session_01GDA48PuRFrHyRfdkBz8m21

🤖 Generated with Claude Code

Generated by Claude Code


Generated by Claude Code

…['triggers'] (#14153)
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GDA48PuRFrHyRfdkBz8m21
…utomation exports; declare triggers on the lint tier fixture (#14153)
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GDA48PuRFrHyRfdkBz8m21
@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 2 package(s): @objectstack/lint, @objectstack/spec, touching 7 documentable anchor(s). ⚠️3 changed file(s) yielded no anchor (packages/spec/api-surface/automation.json, packages/spec/export-origins/automation.json, packages/spec/src/automation/index.ts), so the pages documenting them are NOT COVERED by this run — this is not a clean bill of health for those files.

10 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:

  • content/docs/api/plugin-endpoints.mdx(via record_change (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))
  • content/docs/automation/approvals.mdx(via record_change (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))
  • content/docs/automation/flows.mdx(via record_change (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind), time_relative (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))
  • content/docs/automation/hooks.mdx(via record_change (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))
  • content/docs/automation/workflows.mdx(via record_change (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))
  • content/docs/concepts/architecture.mdx(via record_change (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))
  • content/docs/getting-started/common-patterns.mdx(via record_change (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))
  • content/docs/kernel/services-checklist.mdx(via record_change (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))
  • content/docs/permissions/capabilities.mdx(via record_change (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind), time_relative (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))
  • content/docs/protocol/objectql/schema.mdx(via record_change (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))

3 release-owned page(s) also name something this change touched. These are read-only:

  • content/docs/releases/v12.mdx(via record_change (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))
  • content/docs/releases/v16.mdx(via time_relative (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))
  • content/docs/releases/v17.mdx(via record_change (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))

content/docs/releases/ is RELEASE-OWNED (AGENTS.md "Documentation Guardrails"): release
notes are written centrally at release time, and a code PR that edits them is the exact PR
that guardrail exists to stop. They are still audited — read-only. If one of them is actually
wrong, file an issue or open a dedicated docs-only PR; do not edit it here.

What this run could not see
  • 3 changed file(s) yielded no anchor (packages/spec/api-surface/automation.json, packages/spec/export-origins/automation.json, packages/spec/src/automation/index.ts) — pages documenting those are invisible to this run
  • 1 anchor(s) matched too much of the corpus to be a work list: defineStack (symbol, 57 pages)
  • the SDK route bridge reached 47 of 219 client-bound route-ledger rows — the other 172 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 172: 14 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 56 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 102 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.

Coarse fallback — 128 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json f645d6f8879f5e868b8c0aac978dc0db92552739packageMentionDocs.

Which tree this was computed on

This run read content/docs from 3b3c9e059159c1ea382daa3f44ee0f2f220f0ac5 — the merge of head 24aec0a0a2ffe42e339eded184f60ffff85569ac into base f645d6f8879f5e868b8c0aac978dc0db92552739, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 3b3c9e059159c1ea382daa3f44ee0f2f220f0ac5 && git checkout 3b3c9e059159c1ea382daa3f44ee0f2f220f0ac5
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin f645d6f8879f5e868b8c0aac978dc0db92552739 24aec0a0a2ffe42e339eded184f60ffff85569ac && git checkout -B drift-repro f645d6f8879f5e868b8c0aac978dc0db92552739 && git merge --no-ff 24aec0a0a2ffe42e339eded184f60ffff85569ac
node scripts/docs-audit/affected-docs.mjs --json f645d6f8879f5e868b8c0aac978dc0db92552739

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs f645d6f8879f5e868b8c0aac978dc0db92552739 → pass the list as
args.docs, on the commit named under Which tree this was computed on.

@github-actionsgithub-actionsBot added documentation Improvements or additions to documentation tests tooling labels Sep 2, 2026
@os-zhuang
os-zhuang marked this pull request as ready for review September 2, 2026 02:41
@os-zhuang
os-zhuang added this pull request to the merge queueSep 2, 2026
Merged via the queue into main with commit 948dd6bSep 2, 2026
43 checks passed
@os-zhuang
os-zhuang deleted the claude/issue-14153-trigger-capability-validator branch September 2, 2026 03:07
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentationImprovements or additions to documentationsize/mteststooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

defineStack hard-errors on an undeclared hierarchy scope but is silent on an undeclared trigger capability — every autolaunched flow ships inert

2 participants

@os-zhuang@claude
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Highlight search terms from Google/DuckDuckGo/Bing referrer\n(function() {\n var ref = document.referrer;\n var terms = [];\n \n if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) {\n var url = new URL(ref);\n var q = url.searchParams.get('q') || url.searchParams.get('p');\n if (q) {\n terms = q.split(/\\s+/).filter(function(t) { return t.length > 2; });\n }\n }\n \n if (terms.length === 0) return;\n \n var style = document.createElement('style');\n style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }';\n document.head.appendChild(style);\n \n function highlight(node) {\n if (node.nodeType === 3) { // text node\n var text = node.textContent;\n var found = false;\n terms.forEach(function(term) {\n var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\') + ')', 'gi');\n if (regex.test(text)) {\n found = true;\n var frag = document.createDocumentFragment();\n var parts = text.split(regex);\n parts.forEach(function(part, i) {\n if (i % 2 === 0) {\n frag.appendChild(document.createTextNode(part));\n } else {\n var span = document.createElement('span');\n span.className = 'userscript-highlight';\n span.textContent = part;\n frag.appendChild(span);\n }\n });\n node.parentNode.replaceChild(frag, node);\n }\n });\n } else if (node.nodeType === 1 && node.childNodes) { // element\n var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT'];\n if (!skipTags.includes(node.tagName)) {\n Array.from(node.childNodes).forEach(highlight);\n }\n }\n }\n \n highlight(document.body);\n \n // Re-highlight on dynamic content\n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1 || node.nodeType === 3) highlight(node);\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Highlight Search Terms"); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

feat(spec): refuse an auto-launched flow whose stack omits requires: ['triggers'] - #14330

Merged
os-zhuang merged 2 commits into
mainfrom
claude/issue-14153-trigger-capability-validator
Sep 2, 2026
Merged

feat(spec): refuse an auto-launched flow whose stack omits requires: ['triggers']#14330
os-zhuang merged 2 commits into
mainfrom
claude/issue-14153-trigger-capability-validator

Conversation

@claude

@claudeclaudeBot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Fixes#14153

What

defineStack now refuses a stack that declares an auto-launched flow (record_change / schedule / time_relative / api) while requires omits 'triggers' — a sibling of validateHierarchyScopeCapability, in the same throw-site family:

defineStack trigger capability validation failed (1 issue):
✗ flow 'duly_assignment_fanout' declares a 'record_change' trigger but `requires` does not include 'triggers' — no 'record_change' trigger would be registered, so the flow would never auto-launch. Add requires: ['triggers'] (record_change/schedule/time_relative/api ship in @objectstack/trigger-*).

The wording is the automation engine's boot-audit line (getTriggerBindingAudit), moved from post-deploy to author time — no second vocabulary. triggers is one membership test (one token installs all four kinds), no per-kind table.

Ruling premise — verified (in-tree corpus census at a39b02a6)

stackrequiresflowsverdict
examples/app-crm['ui', 'automation']convert-lead.flow.ts is type: 'screen'passes (measured: defineStack import through the built dist, flows=1 types=["screen"])
examples/app-showcasedeclares 'triggers' (objectstack.config.ts:107)autolaunched + screen + one schedulepasses by the membership test
packages/create-objectstack blank template['automation']no flows (src/objects only)passes
examples/app-todoabsent2 × schedule ('0 8 * * *'), 1 × record_change, 1 × screentripped — repaired (see below)
packages/**/objectstack.config.ts (5)none declare flowspass

No in-tree stack declares a record_change / schedule / time_relative / api flow and launches it only by hand (no type: 'flow' action targeting such a flow, no docs saying so). The premise holds; the reroute condition is not met — the remedy is in defineStack, nothing was built in packages/lint beyond the declared import-site edit.

Absent requires — measured Outcome B

packages/cli/src/commands/serve.ts: an absent requires reads as [] (:2295), the CLI appends only its convenience defaults — email iff auth, mcp, pinyin-search, the always-on slate (PLATFORM_ALWAYS_ON_CAPABILITIES = queue, job, cache, settings, email, storage, sms, sharing, messaging, analytics — neither automation nor triggers), queue/job — and the capability resolver loads a provider only for tokens in that list (for (const cap of requires) :3985; automation :1460, triggers :1506 are entries of Serve.CAPABILITY_PROVIDERS; no other block imports @objectstack/service-automation or @objectstack/trigger-*). os dev forwards to a serve child. So a stack that declares nothing gets no trigger — and no engine. ⇒ the validator fires on absent requires too, and examples/app-todo (whose task-completion-trigger.test.ts hand-assembles RecordChangeTriggerPlugin precisely because its record_change flow is meant to fire) now declares requires: ['automation', 'triggers']. Not booted live: booting app-todo needs the whole CLI closure built in this worktree; the reading above is from the resolver's own source, line-cited.

Predicate — hoisted into spec (single source)

resolveFlowTriggerKind (packages/spec/src/automation/flow-trigger-kind.ts, exported from @objectstack/spec/automation) mirrors the engine's resolveTriggerBinding chain, kind only, in its precedence (timeRelative descriptor outranks a sibling schedule cadence). @objectstack/lint's validate-flow-trigger-readiness.ts now reads isAutoTriggered = resolveFlowTriggerKind(flow) !== undefinedbyte-identical to the six-term disjunction it replaces (the resolver answers a kind exactly when one of those terms held). The one documented divergence from the engine is the array-formtriggerType (unsupported, #3457): the engine routes it to the record-change trigger only so the trigger can refuse it loudly at bind time, lint 1d already reports it as an error, and lint's predicate never counted it — so the resolver answers no kind for it, which is what keeps the lint edit identical by construction rather than by test coverage. Lint's suite (92 files / 2685 tests) is the proof; see Tests.

Fixture triage

  • packages/lint/src/authoring-rule-input-tier.test.ts — its flowStack uses a schedule flow only as a vehicle for a parse-time default; the new refusal tripped it. Declaredrequires: ['triggers'] on the fixture (the flow's auto-trigger is incidental; the test's meaning is unchanged).
  • Every other defineStack test consumer with flows (git grep -ln defineStack -- '**/*.test.ts' → 85 files, 20 with flows) either declares no auto-triggered flow, declares triggers, or does not go through defineStack for it — the spec (451 files) and lint (92 files) suites ran green after the two repairs above.

Downstream

Out of scope, filed as #14328 (finding, open): the automation engine's resolveTriggerBinding keeps a private copy of the trigger-kind chain the spec resolver now mirrors — hoisting the kind onto resolveFlowTriggerKind is a service-automation change, not this card's.

objectstack-ai/duly's test/trigger-capability.test.ts stopgap can be deleted in that repo once this lands and the pin moves — a follow-up there, not here.

Files

  • packages/spec/src/automation/flow-trigger-kind.ts (+ test, + barrel export, + regenerated api-surface/automation.json and export-origins/automation.json)
  • packages/spec/src/stack.zod.tsvalidateTriggerCapability + wiring after the hierarchy sibling
  • packages/spec/src/stack-requires.test.ts — the defineStack trigger capability validation suite
  • packages/lint/src/validate-flow-trigger-readiness.ts — import-site edit only (+ one comment that named the old predicate)
  • packages/lint/src/authoring-rule-input-tier.test.ts — fixture declares the token
  • examples/app-todo/objectstack.config.ts — corpus repair
  • content/docs/permissions/capabilities.mdx, content/docs/automation/flows.mdx — one table row, one paragraph
  • .changeset/define-stack-trigger-capability-refusal.md@objectstack/specminor (BREAKING accept-set narrowing under the launch-window convention; ADR-0087 not-required (no-migration-prescription) — the refusal names the one-line fix, nothing is renamed or removed), @objectstack/lint patch

Tests

All runs through scripts/pm/os-verify-lock.sh; verdicts quoted from each runner's own summary line, exit codes captured before any pipe. Head for every re-run: 24aec0a0.

  • pnpm --filter @objectstack/spec exec vitest run --maxWorkers=2 (whole suite, at 66d5d580): Test Files 2 failed | 449 passed (451) · Tests 3 failed | 12084 passed (12087) — all three failures were the stale export-origins/automation.json (the module exports these at runtime and export-origins does not record them), regenerated with check:generated --fix together with api-surface/automation.json (the only two artifacts it proved stale). Targeted re-run at 24aec0a0 of scripts/export-origins.test.ts src/automation/state-machine.test.ts src/stack-requires.test.ts src/automation/flow-trigger-kind.test.ts: Test Files 4 passed (4) · Tests 64 passed (64).
  • pnpm --filter @objectstack/lint exec vitest run --maxWorkers=2 (whole suite): Test Files 1 failed | 91 passed (92) · Tests 1 failed | 2684 passed (2685) — the one failure was the tier fixture (see Fixture triage). Targeted re-run at 24aec0a0 of src/authoring-rule-input-tier.test.ts src/validate-flow-trigger-readiness.test.ts: Test Files 2 passed (2) · Tests 80 passed (80) — the readiness suite (60 cases, untouched) is the byte-identical proof for the import-site edit.
  • pnpm --filter @objectstack/spec typecheck exit 0 (check:test-typecheck: OK — … 54 file(s) / 262 error(s) / 146 pinned signature(s), ledger unchanged); pnpm --filter @objectstack/lint typecheck exit 0.
  • Reverse verification (ablation, committed state): the wiring line const triggerErrors = validateTriggerCapability(data); replaced by const triggerErrors: string[] = []; — on-disk proof injected=1 removed-anchor-left=0; run: Tests 6 failed | 18 passed (24) — exactly the six refusal cases red, every pass-through case and the whole resolver suite green; restore git checkout HEAD -- ABSOLUTE_PATH proven by hash d8411f45… == HEAD blob; git diff HEAD empty (trap-guarded script). Spec's own tests import ./stack.zod from src, so no dist was involved in this leg; spec was rebuilt afterwards regardless (the restore's touch had turned the mtime-based dist-freshness guards red) and the dist-reading gates re-run on that rebuilt tree.
  • Corpus through the built dist:tsx import of examples/app-todo/objectstack.config.tsrequires=["automation","triggers"] flows=4 types=["schedule","record_change","screen"]; examples/app-crmrequires=["ui","automation"] flows=1 types=["screen"]. examples/app-showcase is not importable in this worktree (its @objectstack/connector-mcp dist is unbuilt) and passes on the static membership test ('triggers' at objectstack.config.ts:107). pnpm validate per example NOT run (it needs the CLI closure built); the import exercises the exact defineStack refusal, and the lint half of os validate is unchanged (readiness suite green).
  • Not run locally, declared: the example apps' own vitest suites and the packages/cli suites (their defineStack consumers declare no auto-triggered flow — census in Fixture triage); full pnpm test — CI's.

Gates

node scripts/pm/dispatch-gates.mjs --commands with no paths at 24aec0a0 (answer stamped objectstack-ai/objectstack at 24aec0a0): 71 commands (the PM's three-path reading gave 40; the same three paths gave 46 here — 41 by path + 7 by change KIND; the real change set adds the changeset, docs, example and artifact families). Every command run with its exit code captured by redirection; 67 green, including the ones this card names: check:stack-collection-maps, check:api-surface (public API surface + factory signatures unchanged ✓ — the two new exports are in the regenerated shard), check:docs, check:llms-txt, check:liveness, check:where-matcher, check:objectql-double-limit, check-adr-0087-registration, check:export-origins, check:dual-source-exports (0 accepted dual-source), check:exported-any, check:entry-nameability, check:skill-examples (259 prose examples type-check across 3 surface(s) — after building @objectstack/client-react...), check:cross-package-test-inputs, check:test-source-alias, check:doc-authoring, check-affected-docs, check:changeset-gate-self-tests, check-empty-changeset, check-changeset-no-major.

4 NOT MEASURED locally — each exits with its own prerequisite code, nothing measured, CI owns them: check-dev-prereqs (exit 1: 63 of 67 workspace packages unbuilt here), check-test-completeness (exit 3: needs a saved turbo run test log), check:dual-build-cjs-loads (exit 3: PREREQUISITE NOT MET, unbuilt dists), check:type-check-debt (exit 3: needs the whole closure built).

Also run, not in the derived list: pnpm check:nul-bytes (OK … 7815 text file(s) … no raw ASCII control bytes) plus a control-character self-scan over every edited file (clean).

skip-changeset: not applicable — this PR ships a changeset. needs:contract-review hung on this PR and on #14153 (Clause ②: defineStack gains a refusal).

Session: https://claude.ai/code/session_01GDA48PuRFrHyRfdkBz8m21

🤖 Generated with Claude Code

Generated by Claude Code


Generated by Claude Code

…['triggers'] (#14153)
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GDA48PuRFrHyRfdkBz8m21
…utomation exports; declare triggers on the lint tier fixture (#14153)
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GDA48PuRFrHyRfdkBz8m21
@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 2 package(s): @objectstack/lint, @objectstack/spec, touching 7 documentable anchor(s). ⚠️3 changed file(s) yielded no anchor (packages/spec/api-surface/automation.json, packages/spec/export-origins/automation.json, packages/spec/src/automation/index.ts), so the pages documenting them are NOT COVERED by this run — this is not a clean bill of health for those files.

10 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:

  • content/docs/api/plugin-endpoints.mdx(via record_change (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))
  • content/docs/automation/approvals.mdx(via record_change (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))
  • content/docs/automation/flows.mdx(via record_change (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind), time_relative (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))
  • content/docs/automation/hooks.mdx(via record_change (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))
  • content/docs/automation/workflows.mdx(via record_change (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))
  • content/docs/concepts/architecture.mdx(via record_change (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))
  • content/docs/getting-started/common-patterns.mdx(via record_change (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))
  • content/docs/kernel/services-checklist.mdx(via record_change (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))
  • content/docs/permissions/capabilities.mdx(via record_change (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind), time_relative (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))
  • content/docs/protocol/objectql/schema.mdx(via record_change (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))

3 release-owned page(s) also name something this change touched. These are read-only:

  • content/docs/releases/v12.mdx(via record_change (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))
  • content/docs/releases/v16.mdx(via time_relative (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))
  • content/docs/releases/v17.mdx(via record_change (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))

content/docs/releases/ is RELEASE-OWNED (AGENTS.md "Documentation Guardrails"): release
notes are written centrally at release time, and a code PR that edits them is the exact PR
that guardrail exists to stop. They are still audited — read-only. If one of them is actually
wrong, file an issue or open a dedicated docs-only PR; do not edit it here.

What this run could not see
  • 3 changed file(s) yielded no anchor (packages/spec/api-surface/automation.json, packages/spec/export-origins/automation.json, packages/spec/src/automation/index.ts) — pages documenting those are invisible to this run
  • 1 anchor(s) matched too much of the corpus to be a work list: defineStack (symbol, 57 pages)
  • the SDK route bridge reached 47 of 219 client-bound route-ledger rows — the other 172 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 172: 14 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 56 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 102 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.

Coarse fallback — 128 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json f645d6f8879f5e868b8c0aac978dc0db92552739packageMentionDocs.

Which tree this was computed on

This run read content/docs from 3b3c9e059159c1ea382daa3f44ee0f2f220f0ac5 — the merge of head 24aec0a0a2ffe42e339eded184f60ffff85569ac into base f645d6f8879f5e868b8c0aac978dc0db92552739, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 3b3c9e059159c1ea382daa3f44ee0f2f220f0ac5 && git checkout 3b3c9e059159c1ea382daa3f44ee0f2f220f0ac5
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin f645d6f8879f5e868b8c0aac978dc0db92552739 24aec0a0a2ffe42e339eded184f60ffff85569ac && git checkout -B drift-repro f645d6f8879f5e868b8c0aac978dc0db92552739 && git merge --no-ff 24aec0a0a2ffe42e339eded184f60ffff85569ac
node scripts/docs-audit/affected-docs.mjs --json f645d6f8879f5e868b8c0aac978dc0db92552739

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs f645d6f8879f5e868b8c0aac978dc0db92552739 → pass the list as
args.docs, on the commit named under Which tree this was computed on.

@github-actionsgithub-actionsBot added documentation Improvements or additions to documentation tests tooling labels Sep 2, 2026
@os-zhuang
os-zhuang marked this pull request as ready for review September 2, 2026 02:41
@os-zhuang
os-zhuang added this pull request to the merge queueSep 2, 2026
Merged via the queue into main with commit 948dd6bSep 2, 2026
43 checks passed
@os-zhuang
os-zhuang deleted the claude/issue-14153-trigger-capability-validator branch September 2, 2026 03:07
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentationImprovements or additions to documentationsize/mteststooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

defineStack hard-errors on an undeclared hierarchy scope but is silent on an undeclared trigger capability — every autolaunched flow ships inert

2 participants

@os-zhuang@claude
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Strip utm_, fbclid, gclid, etc. from all links on page\n(function() {\n var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content',\n 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid',\n 'ref', 'ref_src', 'source', 'medium', 'campaign'];\n \n function cleanUrl(url) {\n try {\n var u = new URL(url, window.location.origin);\n var changed = false;\n trackingParams.forEach(function(p) {\n if (u.searchParams.has(p)) {\n u.searchParams.delete(p);\n changed = true;\n }\n });\n return changed ? u.toString() : url;\n } catch (e) {\n return url;\n }\n }\n \n function cleanLinks() {\n document.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n \n cleanLinks();\n \n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1) {\n if (node.tagName === 'A') cleanLinks();\n node.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Remove Tracking Parameters from Links"); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content

feat(spec): refuse an auto-launched flow whose stack omits requires: ['triggers'] - #14330

Merged
os-zhuang merged 2 commits into
mainfrom
claude/issue-14153-trigger-capability-validator
Sep 2, 2026
Merged

feat(spec): refuse an auto-launched flow whose stack omits requires: ['triggers']#14330
os-zhuang merged 2 commits into
mainfrom
claude/issue-14153-trigger-capability-validator

Conversation

@claude

@claudeclaudeBot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Fixes#14153

What

defineStack now refuses a stack that declares an auto-launched flow (record_change / schedule / time_relative / api) while requires omits 'triggers' — a sibling of validateHierarchyScopeCapability, in the same throw-site family:

defineStack trigger capability validation failed (1 issue):
✗ flow 'duly_assignment_fanout' declares a 'record_change' trigger but `requires` does not include 'triggers' — no 'record_change' trigger would be registered, so the flow would never auto-launch. Add requires: ['triggers'] (record_change/schedule/time_relative/api ship in @objectstack/trigger-*).

The wording is the automation engine's boot-audit line (getTriggerBindingAudit), moved from post-deploy to author time — no second vocabulary. triggers is one membership test (one token installs all four kinds), no per-kind table.

Ruling premise — verified (in-tree corpus census at a39b02a6)

stackrequiresflowsverdict
examples/app-crm['ui', 'automation']convert-lead.flow.ts is type: 'screen'passes (measured: defineStack import through the built dist, flows=1 types=["screen"])
examples/app-showcasedeclares 'triggers' (objectstack.config.ts:107)autolaunched + screen + one schedulepasses by the membership test
packages/create-objectstack blank template['automation']no flows (src/objects only)passes
examples/app-todoabsent2 × schedule ('0 8 * * *'), 1 × record_change, 1 × screentripped — repaired (see below)
packages/**/objectstack.config.ts (5)none declare flowspass

No in-tree stack declares a record_change / schedule / time_relative / api flow and launches it only by hand (no type: 'flow' action targeting such a flow, no docs saying so). The premise holds; the reroute condition is not met — the remedy is in defineStack, nothing was built in packages/lint beyond the declared import-site edit.

Absent requires — measured Outcome B

packages/cli/src/commands/serve.ts: an absent requires reads as [] (:2295), the CLI appends only its convenience defaults — email iff auth, mcp, pinyin-search, the always-on slate (PLATFORM_ALWAYS_ON_CAPABILITIES = queue, job, cache, settings, email, storage, sms, sharing, messaging, analytics — neither automation nor triggers), queue/job — and the capability resolver loads a provider only for tokens in that list (for (const cap of requires) :3985; automation :1460, triggers :1506 are entries of Serve.CAPABILITY_PROVIDERS; no other block imports @objectstack/service-automation or @objectstack/trigger-*). os dev forwards to a serve child. So a stack that declares nothing gets no trigger — and no engine. ⇒ the validator fires on absent requires too, and examples/app-todo (whose task-completion-trigger.test.ts hand-assembles RecordChangeTriggerPlugin precisely because its record_change flow is meant to fire) now declares requires: ['automation', 'triggers']. Not booted live: booting app-todo needs the whole CLI closure built in this worktree; the reading above is from the resolver's own source, line-cited.

Predicate — hoisted into spec (single source)

resolveFlowTriggerKind (packages/spec/src/automation/flow-trigger-kind.ts, exported from @objectstack/spec/automation) mirrors the engine's resolveTriggerBinding chain, kind only, in its precedence (timeRelative descriptor outranks a sibling schedule cadence). @objectstack/lint's validate-flow-trigger-readiness.ts now reads isAutoTriggered = resolveFlowTriggerKind(flow) !== undefinedbyte-identical to the six-term disjunction it replaces (the resolver answers a kind exactly when one of those terms held). The one documented divergence from the engine is the array-formtriggerType (unsupported, #3457): the engine routes it to the record-change trigger only so the trigger can refuse it loudly at bind time, lint 1d already reports it as an error, and lint's predicate never counted it — so the resolver answers no kind for it, which is what keeps the lint edit identical by construction rather than by test coverage. Lint's suite (92 files / 2685 tests) is the proof; see Tests.

Fixture triage

  • packages/lint/src/authoring-rule-input-tier.test.ts — its flowStack uses a schedule flow only as a vehicle for a parse-time default; the new refusal tripped it. Declaredrequires: ['triggers'] on the fixture (the flow's auto-trigger is incidental; the test's meaning is unchanged).
  • Every other defineStack test consumer with flows (git grep -ln defineStack -- '**/*.test.ts' → 85 files, 20 with flows) either declares no auto-triggered flow, declares triggers, or does not go through defineStack for it — the spec (451 files) and lint (92 files) suites ran green after the two repairs above.

Downstream

Out of scope, filed as #14328 (finding, open): the automation engine's resolveTriggerBinding keeps a private copy of the trigger-kind chain the spec resolver now mirrors — hoisting the kind onto resolveFlowTriggerKind is a service-automation change, not this card's.

objectstack-ai/duly's test/trigger-capability.test.ts stopgap can be deleted in that repo once this lands and the pin moves — a follow-up there, not here.

Files

  • packages/spec/src/automation/flow-trigger-kind.ts (+ test, + barrel export, + regenerated api-surface/automation.json and export-origins/automation.json)
  • packages/spec/src/stack.zod.tsvalidateTriggerCapability + wiring after the hierarchy sibling
  • packages/spec/src/stack-requires.test.ts — the defineStack trigger capability validation suite
  • packages/lint/src/validate-flow-trigger-readiness.ts — import-site edit only (+ one comment that named the old predicate)
  • packages/lint/src/authoring-rule-input-tier.test.ts — fixture declares the token
  • examples/app-todo/objectstack.config.ts — corpus repair
  • content/docs/permissions/capabilities.mdx, content/docs/automation/flows.mdx — one table row, one paragraph
  • .changeset/define-stack-trigger-capability-refusal.md@objectstack/specminor (BREAKING accept-set narrowing under the launch-window convention; ADR-0087 not-required (no-migration-prescription) — the refusal names the one-line fix, nothing is renamed or removed), @objectstack/lint patch

Tests

All runs through scripts/pm/os-verify-lock.sh; verdicts quoted from each runner's own summary line, exit codes captured before any pipe. Head for every re-run: 24aec0a0.

  • pnpm --filter @objectstack/spec exec vitest run --maxWorkers=2 (whole suite, at 66d5d580): Test Files 2 failed | 449 passed (451) · Tests 3 failed | 12084 passed (12087) — all three failures were the stale export-origins/automation.json (the module exports these at runtime and export-origins does not record them), regenerated with check:generated --fix together with api-surface/automation.json (the only two artifacts it proved stale). Targeted re-run at 24aec0a0 of scripts/export-origins.test.ts src/automation/state-machine.test.ts src/stack-requires.test.ts src/automation/flow-trigger-kind.test.ts: Test Files 4 passed (4) · Tests 64 passed (64).
  • pnpm --filter @objectstack/lint exec vitest run --maxWorkers=2 (whole suite): Test Files 1 failed | 91 passed (92) · Tests 1 failed | 2684 passed (2685) — the one failure was the tier fixture (see Fixture triage). Targeted re-run at 24aec0a0 of src/authoring-rule-input-tier.test.ts src/validate-flow-trigger-readiness.test.ts: Test Files 2 passed (2) · Tests 80 passed (80) — the readiness suite (60 cases, untouched) is the byte-identical proof for the import-site edit.
  • pnpm --filter @objectstack/spec typecheck exit 0 (check:test-typecheck: OK — … 54 file(s) / 262 error(s) / 146 pinned signature(s), ledger unchanged); pnpm --filter @objectstack/lint typecheck exit 0.
  • Reverse verification (ablation, committed state): the wiring line const triggerErrors = validateTriggerCapability(data); replaced by const triggerErrors: string[] = []; — on-disk proof injected=1 removed-anchor-left=0; run: Tests 6 failed | 18 passed (24) — exactly the six refusal cases red, every pass-through case and the whole resolver suite green; restore git checkout HEAD -- ABSOLUTE_PATH proven by hash d8411f45… == HEAD blob; git diff HEAD empty (trap-guarded script). Spec's own tests import ./stack.zod from src, so no dist was involved in this leg; spec was rebuilt afterwards regardless (the restore's touch had turned the mtime-based dist-freshness guards red) and the dist-reading gates re-run on that rebuilt tree.
  • Corpus through the built dist:tsx import of examples/app-todo/objectstack.config.tsrequires=["automation","triggers"] flows=4 types=["schedule","record_change","screen"]; examples/app-crmrequires=["ui","automation"] flows=1 types=["screen"]. examples/app-showcase is not importable in this worktree (its @objectstack/connector-mcp dist is unbuilt) and passes on the static membership test ('triggers' at objectstack.config.ts:107). pnpm validate per example NOT run (it needs the CLI closure built); the import exercises the exact defineStack refusal, and the lint half of os validate is unchanged (readiness suite green).
  • Not run locally, declared: the example apps' own vitest suites and the packages/cli suites (their defineStack consumers declare no auto-triggered flow — census in Fixture triage); full pnpm test — CI's.

Gates

node scripts/pm/dispatch-gates.mjs --commands with no paths at 24aec0a0 (answer stamped objectstack-ai/objectstack at 24aec0a0): 71 commands (the PM's three-path reading gave 40; the same three paths gave 46 here — 41 by path + 7 by change KIND; the real change set adds the changeset, docs, example and artifact families). Every command run with its exit code captured by redirection; 67 green, including the ones this card names: check:stack-collection-maps, check:api-surface (public API surface + factory signatures unchanged ✓ — the two new exports are in the regenerated shard), check:docs, check:llms-txt, check:liveness, check:where-matcher, check:objectql-double-limit, check-adr-0087-registration, check:export-origins, check:dual-source-exports (0 accepted dual-source), check:exported-any, check:entry-nameability, check:skill-examples (259 prose examples type-check across 3 surface(s) — after building @objectstack/client-react...), check:cross-package-test-inputs, check:test-source-alias, check:doc-authoring, check-affected-docs, check:changeset-gate-self-tests, check-empty-changeset, check-changeset-no-major.

4 NOT MEASURED locally — each exits with its own prerequisite code, nothing measured, CI owns them: check-dev-prereqs (exit 1: 63 of 67 workspace packages unbuilt here), check-test-completeness (exit 3: needs a saved turbo run test log), check:dual-build-cjs-loads (exit 3: PREREQUISITE NOT MET, unbuilt dists), check:type-check-debt (exit 3: needs the whole closure built).

Also run, not in the derived list: pnpm check:nul-bytes (OK … 7815 text file(s) … no raw ASCII control bytes) plus a control-character self-scan over every edited file (clean).

skip-changeset: not applicable — this PR ships a changeset. needs:contract-review hung on this PR and on #14153 (Clause ②: defineStack gains a refusal).

Session: https://claude.ai/code/session_01GDA48PuRFrHyRfdkBz8m21

🤖 Generated with Claude Code

Generated by Claude Code


Generated by Claude Code

…['triggers'] (#14153)
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GDA48PuRFrHyRfdkBz8m21
…utomation exports; declare triggers on the lint tier fixture (#14153)
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GDA48PuRFrHyRfdkBz8m21
@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 2 package(s): @objectstack/lint, @objectstack/spec, touching 7 documentable anchor(s). ⚠️3 changed file(s) yielded no anchor (packages/spec/api-surface/automation.json, packages/spec/export-origins/automation.json, packages/spec/src/automation/index.ts), so the pages documenting them are NOT COVERED by this run — this is not a clean bill of health for those files.

10 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:

  • content/docs/api/plugin-endpoints.mdx(via record_change (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))
  • content/docs/automation/approvals.mdx(via record_change (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))
  • content/docs/automation/flows.mdx(via record_change (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind), time_relative (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))
  • content/docs/automation/hooks.mdx(via record_change (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))
  • content/docs/automation/workflows.mdx(via record_change (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))
  • content/docs/concepts/architecture.mdx(via record_change (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))
  • content/docs/getting-started/common-patterns.mdx(via record_change (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))
  • content/docs/kernel/services-checklist.mdx(via record_change (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))
  • content/docs/permissions/capabilities.mdx(via record_change (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind), time_relative (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))
  • content/docs/protocol/objectql/schema.mdx(via record_change (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))

3 release-owned page(s) also name something this change touched. These are read-only:

  • content/docs/releases/v12.mdx(via record_change (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))
  • content/docs/releases/v16.mdx(via time_relative (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))
  • content/docs/releases/v17.mdx(via record_change (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))

content/docs/releases/ is RELEASE-OWNED (AGENTS.md "Documentation Guardrails"): release
notes are written centrally at release time, and a code PR that edits them is the exact PR
that guardrail exists to stop. They are still audited — read-only. If one of them is actually
wrong, file an issue or open a dedicated docs-only PR; do not edit it here.

What this run could not see
  • 3 changed file(s) yielded no anchor (packages/spec/api-surface/automation.json, packages/spec/export-origins/automation.json, packages/spec/src/automation/index.ts) — pages documenting those are invisible to this run
  • 1 anchor(s) matched too much of the corpus to be a work list: defineStack (symbol, 57 pages)
  • the SDK route bridge reached 47 of 219 client-bound route-ledger rows — the other 172 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 172: 14 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 56 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 102 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.

Coarse fallback — 128 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json f645d6f8879f5e868b8c0aac978dc0db92552739packageMentionDocs.

Which tree this was computed on

This run read content/docs from 3b3c9e059159c1ea382daa3f44ee0f2f220f0ac5 — the merge of head 24aec0a0a2ffe42e339eded184f60ffff85569ac into base f645d6f8879f5e868b8c0aac978dc0db92552739, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 3b3c9e059159c1ea382daa3f44ee0f2f220f0ac5 && git checkout 3b3c9e059159c1ea382daa3f44ee0f2f220f0ac5
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin f645d6f8879f5e868b8c0aac978dc0db92552739 24aec0a0a2ffe42e339eded184f60ffff85569ac && git checkout -B drift-repro f645d6f8879f5e868b8c0aac978dc0db92552739 && git merge --no-ff 24aec0a0a2ffe42e339eded184f60ffff85569ac
node scripts/docs-audit/affected-docs.mjs --json f645d6f8879f5e868b8c0aac978dc0db92552739

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs f645d6f8879f5e868b8c0aac978dc0db92552739 → pass the list as
args.docs, on the commit named under Which tree this was computed on.

@github-actionsgithub-actionsBot added documentation Improvements or additions to documentation tests tooling labels Sep 2, 2026
@os-zhuang
os-zhuang marked this pull request as ready for review September 2, 2026 02:41
@os-zhuang
os-zhuang added this pull request to the merge queueSep 2, 2026
Merged via the queue into main with commit 948dd6bSep 2, 2026
43 checks passed
@os-zhuang
os-zhuang deleted the claude/issue-14153-trigger-capability-validator branch September 2, 2026 03:07
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentationImprovements or additions to documentationsize/mteststooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

defineStack hard-errors on an undeclared hierarchy scope but is silent on an undeclared trigger capability — every autolaunched flow ships inert

2 participants

@os-zhuang@claude
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Auto-enable theater mode on YouTube\n(function() {\n function tryTheater() {\n var btn = document.querySelector('button[aria-label=\"Theater mode\"], ytd-player #player button[title=\"Theater mode\"]');\n if (btn && !btn.classList.contains('activated')) {\n btn.click();\n }\n }\n \n // Try immediately\n tryTheater();\n \n // Try after navigation (SPA)\n var lastUrl = location.href;\n setInterval(function() {\n if (location.href !== lastUrl) {\n lastUrl = location.href;\n setTimeout(tryTheater, 500);\n }\n }, 1000);\n \n // Also try on player load\n var observer = new MutationObserver(tryTheater);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "YouTube Theater Mode Default"); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

feat(spec): refuse an auto-launched flow whose stack omits requires: ['triggers'] - #14330

Merged
os-zhuang merged 2 commits into
mainfrom
claude/issue-14153-trigger-capability-validator
Sep 2, 2026
Merged

feat(spec): refuse an auto-launched flow whose stack omits requires: ['triggers']#14330
os-zhuang merged 2 commits into
mainfrom
claude/issue-14153-trigger-capability-validator

Conversation

@claude

@claudeclaudeBot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Fixes#14153

What

defineStack now refuses a stack that declares an auto-launched flow (record_change / schedule / time_relative / api) while requires omits 'triggers' — a sibling of validateHierarchyScopeCapability, in the same throw-site family:

defineStack trigger capability validation failed (1 issue):
✗ flow 'duly_assignment_fanout' declares a 'record_change' trigger but `requires` does not include 'triggers' — no 'record_change' trigger would be registered, so the flow would never auto-launch. Add requires: ['triggers'] (record_change/schedule/time_relative/api ship in @objectstack/trigger-*).

The wording is the automation engine's boot-audit line (getTriggerBindingAudit), moved from post-deploy to author time — no second vocabulary. triggers is one membership test (one token installs all four kinds), no per-kind table.

Ruling premise — verified (in-tree corpus census at a39b02a6)

stackrequiresflowsverdict
examples/app-crm['ui', 'automation']convert-lead.flow.ts is type: 'screen'passes (measured: defineStack import through the built dist, flows=1 types=["screen"])
examples/app-showcasedeclares 'triggers' (objectstack.config.ts:107)autolaunched + screen + one schedulepasses by the membership test
packages/create-objectstack blank template['automation']no flows (src/objects only)passes
examples/app-todoabsent2 × schedule ('0 8 * * *'), 1 × record_change, 1 × screentripped — repaired (see below)
packages/**/objectstack.config.ts (5)none declare flowspass

No in-tree stack declares a record_change / schedule / time_relative / api flow and launches it only by hand (no type: 'flow' action targeting such a flow, no docs saying so). The premise holds; the reroute condition is not met — the remedy is in defineStack, nothing was built in packages/lint beyond the declared import-site edit.

Absent requires — measured Outcome B

packages/cli/src/commands/serve.ts: an absent requires reads as [] (:2295), the CLI appends only its convenience defaults — email iff auth, mcp, pinyin-search, the always-on slate (PLATFORM_ALWAYS_ON_CAPABILITIES = queue, job, cache, settings, email, storage, sms, sharing, messaging, analytics — neither automation nor triggers), queue/job — and the capability resolver loads a provider only for tokens in that list (for (const cap of requires) :3985; automation :1460, triggers :1506 are entries of Serve.CAPABILITY_PROVIDERS; no other block imports @objectstack/service-automation or @objectstack/trigger-*). os dev forwards to a serve child. So a stack that declares nothing gets no trigger — and no engine. ⇒ the validator fires on absent requires too, and examples/app-todo (whose task-completion-trigger.test.ts hand-assembles RecordChangeTriggerPlugin precisely because its record_change flow is meant to fire) now declares requires: ['automation', 'triggers']. Not booted live: booting app-todo needs the whole CLI closure built in this worktree; the reading above is from the resolver's own source, line-cited.

Predicate — hoisted into spec (single source)

resolveFlowTriggerKind (packages/spec/src/automation/flow-trigger-kind.ts, exported from @objectstack/spec/automation) mirrors the engine's resolveTriggerBinding chain, kind only, in its precedence (timeRelative descriptor outranks a sibling schedule cadence). @objectstack/lint's validate-flow-trigger-readiness.ts now reads isAutoTriggered = resolveFlowTriggerKind(flow) !== undefinedbyte-identical to the six-term disjunction it replaces (the resolver answers a kind exactly when one of those terms held). The one documented divergence from the engine is the array-formtriggerType (unsupported, #3457): the engine routes it to the record-change trigger only so the trigger can refuse it loudly at bind time, lint 1d already reports it as an error, and lint's predicate never counted it — so the resolver answers no kind for it, which is what keeps the lint edit identical by construction rather than by test coverage. Lint's suite (92 files / 2685 tests) is the proof; see Tests.

Fixture triage

  • packages/lint/src/authoring-rule-input-tier.test.ts — its flowStack uses a schedule flow only as a vehicle for a parse-time default; the new refusal tripped it. Declaredrequires: ['triggers'] on the fixture (the flow's auto-trigger is incidental; the test's meaning is unchanged).
  • Every other defineStack test consumer with flows (git grep -ln defineStack -- '**/*.test.ts' → 85 files, 20 with flows) either declares no auto-triggered flow, declares triggers, or does not go through defineStack for it — the spec (451 files) and lint (92 files) suites ran green after the two repairs above.

Downstream

Out of scope, filed as #14328 (finding, open): the automation engine's resolveTriggerBinding keeps a private copy of the trigger-kind chain the spec resolver now mirrors — hoisting the kind onto resolveFlowTriggerKind is a service-automation change, not this card's.

objectstack-ai/duly's test/trigger-capability.test.ts stopgap can be deleted in that repo once this lands and the pin moves — a follow-up there, not here.

Files

  • packages/spec/src/automation/flow-trigger-kind.ts (+ test, + barrel export, + regenerated api-surface/automation.json and export-origins/automation.json)
  • packages/spec/src/stack.zod.tsvalidateTriggerCapability + wiring after the hierarchy sibling
  • packages/spec/src/stack-requires.test.ts — the defineStack trigger capability validation suite
  • packages/lint/src/validate-flow-trigger-readiness.ts — import-site edit only (+ one comment that named the old predicate)
  • packages/lint/src/authoring-rule-input-tier.test.ts — fixture declares the token
  • examples/app-todo/objectstack.config.ts — corpus repair
  • content/docs/permissions/capabilities.mdx, content/docs/automation/flows.mdx — one table row, one paragraph
  • .changeset/define-stack-trigger-capability-refusal.md@objectstack/specminor (BREAKING accept-set narrowing under the launch-window convention; ADR-0087 not-required (no-migration-prescription) — the refusal names the one-line fix, nothing is renamed or removed), @objectstack/lint patch

Tests

All runs through scripts/pm/os-verify-lock.sh; verdicts quoted from each runner's own summary line, exit codes captured before any pipe. Head for every re-run: 24aec0a0.

  • pnpm --filter @objectstack/spec exec vitest run --maxWorkers=2 (whole suite, at 66d5d580): Test Files 2 failed | 449 passed (451) · Tests 3 failed | 12084 passed (12087) — all three failures were the stale export-origins/automation.json (the module exports these at runtime and export-origins does not record them), regenerated with check:generated --fix together with api-surface/automation.json (the only two artifacts it proved stale). Targeted re-run at 24aec0a0 of scripts/export-origins.test.ts src/automation/state-machine.test.ts src/stack-requires.test.ts src/automation/flow-trigger-kind.test.ts: Test Files 4 passed (4) · Tests 64 passed (64).
  • pnpm --filter @objectstack/lint exec vitest run --maxWorkers=2 (whole suite): Test Files 1 failed | 91 passed (92) · Tests 1 failed | 2684 passed (2685) — the one failure was the tier fixture (see Fixture triage). Targeted re-run at 24aec0a0 of src/authoring-rule-input-tier.test.ts src/validate-flow-trigger-readiness.test.ts: Test Files 2 passed (2) · Tests 80 passed (80) — the readiness suite (60 cases, untouched) is the byte-identical proof for the import-site edit.
  • pnpm --filter @objectstack/spec typecheck exit 0 (check:test-typecheck: OK — … 54 file(s) / 262 error(s) / 146 pinned signature(s), ledger unchanged); pnpm --filter @objectstack/lint typecheck exit 0.
  • Reverse verification (ablation, committed state): the wiring line const triggerErrors = validateTriggerCapability(data); replaced by const triggerErrors: string[] = []; — on-disk proof injected=1 removed-anchor-left=0; run: Tests 6 failed | 18 passed (24) — exactly the six refusal cases red, every pass-through case and the whole resolver suite green; restore git checkout HEAD -- ABSOLUTE_PATH proven by hash d8411f45… == HEAD blob; git diff HEAD empty (trap-guarded script). Spec's own tests import ./stack.zod from src, so no dist was involved in this leg; spec was rebuilt afterwards regardless (the restore's touch had turned the mtime-based dist-freshness guards red) and the dist-reading gates re-run on that rebuilt tree.
  • Corpus through the built dist:tsx import of examples/app-todo/objectstack.config.tsrequires=["automation","triggers"] flows=4 types=["schedule","record_change","screen"]; examples/app-crmrequires=["ui","automation"] flows=1 types=["screen"]. examples/app-showcase is not importable in this worktree (its @objectstack/connector-mcp dist is unbuilt) and passes on the static membership test ('triggers' at objectstack.config.ts:107). pnpm validate per example NOT run (it needs the CLI closure built); the import exercises the exact defineStack refusal, and the lint half of os validate is unchanged (readiness suite green).
  • Not run locally, declared: the example apps' own vitest suites and the packages/cli suites (their defineStack consumers declare no auto-triggered flow — census in Fixture triage); full pnpm test — CI's.

Gates

node scripts/pm/dispatch-gates.mjs --commands with no paths at 24aec0a0 (answer stamped objectstack-ai/objectstack at 24aec0a0): 71 commands (the PM's three-path reading gave 40; the same three paths gave 46 here — 41 by path + 7 by change KIND; the real change set adds the changeset, docs, example and artifact families). Every command run with its exit code captured by redirection; 67 green, including the ones this card names: check:stack-collection-maps, check:api-surface (public API surface + factory signatures unchanged ✓ — the two new exports are in the regenerated shard), check:docs, check:llms-txt, check:liveness, check:where-matcher, check:objectql-double-limit, check-adr-0087-registration, check:export-origins, check:dual-source-exports (0 accepted dual-source), check:exported-any, check:entry-nameability, check:skill-examples (259 prose examples type-check across 3 surface(s) — after building @objectstack/client-react...), check:cross-package-test-inputs, check:test-source-alias, check:doc-authoring, check-affected-docs, check:changeset-gate-self-tests, check-empty-changeset, check-changeset-no-major.

4 NOT MEASURED locally — each exits with its own prerequisite code, nothing measured, CI owns them: check-dev-prereqs (exit 1: 63 of 67 workspace packages unbuilt here), check-test-completeness (exit 3: needs a saved turbo run test log), check:dual-build-cjs-loads (exit 3: PREREQUISITE NOT MET, unbuilt dists), check:type-check-debt (exit 3: needs the whole closure built).

Also run, not in the derived list: pnpm check:nul-bytes (OK … 7815 text file(s) … no raw ASCII control bytes) plus a control-character self-scan over every edited file (clean).

skip-changeset: not applicable — this PR ships a changeset. needs:contract-review hung on this PR and on #14153 (Clause ②: defineStack gains a refusal).

Session: https://claude.ai/code/session_01GDA48PuRFrHyRfdkBz8m21

🤖 Generated with Claude Code

Generated by Claude Code


Generated by Claude Code

…['triggers'] (#14153)
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GDA48PuRFrHyRfdkBz8m21
…utomation exports; declare triggers on the lint tier fixture (#14153)
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GDA48PuRFrHyRfdkBz8m21
@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 2 package(s): @objectstack/lint, @objectstack/spec, touching 7 documentable anchor(s). ⚠️3 changed file(s) yielded no anchor (packages/spec/api-surface/automation.json, packages/spec/export-origins/automation.json, packages/spec/src/automation/index.ts), so the pages documenting them are NOT COVERED by this run — this is not a clean bill of health for those files.

10 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:

  • content/docs/api/plugin-endpoints.mdx(via record_change (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))
  • content/docs/automation/approvals.mdx(via record_change (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))
  • content/docs/automation/flows.mdx(via record_change (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind), time_relative (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))
  • content/docs/automation/hooks.mdx(via record_change (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))
  • content/docs/automation/workflows.mdx(via record_change (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))
  • content/docs/concepts/architecture.mdx(via record_change (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))
  • content/docs/getting-started/common-patterns.mdx(via record_change (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))
  • content/docs/kernel/services-checklist.mdx(via record_change (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))
  • content/docs/permissions/capabilities.mdx(via record_change (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind), time_relative (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))
  • content/docs/protocol/objectql/schema.mdx(via record_change (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))

3 release-owned page(s) also name something this change touched. These are read-only:

  • content/docs/releases/v12.mdx(via record_change (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))
  • content/docs/releases/v16.mdx(via time_relative (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))
  • content/docs/releases/v17.mdx(via record_change (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))

content/docs/releases/ is RELEASE-OWNED (AGENTS.md "Documentation Guardrails"): release
notes are written centrally at release time, and a code PR that edits them is the exact PR
that guardrail exists to stop. They are still audited — read-only. If one of them is actually
wrong, file an issue or open a dedicated docs-only PR; do not edit it here.

What this run could not see
  • 3 changed file(s) yielded no anchor (packages/spec/api-surface/automation.json, packages/spec/export-origins/automation.json, packages/spec/src/automation/index.ts) — pages documenting those are invisible to this run
  • 1 anchor(s) matched too much of the corpus to be a work list: defineStack (symbol, 57 pages)
  • the SDK route bridge reached 47 of 219 client-bound route-ledger rows — the other 172 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 172: 14 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 56 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 102 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.

Coarse fallback — 128 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json f645d6f8879f5e868b8c0aac978dc0db92552739packageMentionDocs.

Which tree this was computed on

This run read content/docs from 3b3c9e059159c1ea382daa3f44ee0f2f220f0ac5 — the merge of head 24aec0a0a2ffe42e339eded184f60ffff85569ac into base f645d6f8879f5e868b8c0aac978dc0db92552739, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 3b3c9e059159c1ea382daa3f44ee0f2f220f0ac5 && git checkout 3b3c9e059159c1ea382daa3f44ee0f2f220f0ac5
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin f645d6f8879f5e868b8c0aac978dc0db92552739 24aec0a0a2ffe42e339eded184f60ffff85569ac && git checkout -B drift-repro f645d6f8879f5e868b8c0aac978dc0db92552739 && git merge --no-ff 24aec0a0a2ffe42e339eded184f60ffff85569ac
node scripts/docs-audit/affected-docs.mjs --json f645d6f8879f5e868b8c0aac978dc0db92552739

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs f645d6f8879f5e868b8c0aac978dc0db92552739 → pass the list as
args.docs, on the commit named under Which tree this was computed on.

@github-actionsgithub-actionsBot added documentation Improvements or additions to documentation tests tooling labels Sep 2, 2026
@os-zhuang
os-zhuang marked this pull request as ready for review September 2, 2026 02:41
@os-zhuang
os-zhuang added this pull request to the merge queueSep 2, 2026
Merged via the queue into main with commit 948dd6bSep 2, 2026
43 checks passed
@os-zhuang
os-zhuang deleted the claude/issue-14153-trigger-capability-validator branch September 2, 2026 03:07
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentationImprovements or additions to documentationsize/mteststooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

defineStack hard-errors on an undeclared hierarchy scope but is silent on an undeclared trigger capability — every autolaunched flow ships inert

2 participants

@os-zhuang@claude
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Remove or un-stick sticky/fixed headers that block content\n(function() {\n function unstick() {\n document.querySelectorAll('header, nav, [role=\"banner\"], .header, .navbar, .sticky, .fixed-top, [style*=\"position: fixed\"], [style*=\"position:sticky\"]').forEach(function(el) {\n if (el.style.position === 'fixed' || el.style.position === 'sticky' || \n getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') {\n el.style.position = 'static';\n el.style.top = 'auto';\n el.style.zIndex = 'auto';\n }\n });\n }\n \n unstick();\n \n var observer = new MutationObserver(unstick);\n observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] });\n})();", "Kill Sticky Headers"); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

feat(spec): refuse an auto-launched flow whose stack omits requires: ['triggers'] - #14330

Merged
os-zhuang merged 2 commits into
mainfrom
claude/issue-14153-trigger-capability-validator
Sep 2, 2026
Merged

feat(spec): refuse an auto-launched flow whose stack omits requires: ['triggers']#14330
os-zhuang merged 2 commits into
mainfrom
claude/issue-14153-trigger-capability-validator

Conversation

@claude

@claudeclaudeBot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Fixes#14153

What

defineStack now refuses a stack that declares an auto-launched flow (record_change / schedule / time_relative / api) while requires omits 'triggers' — a sibling of validateHierarchyScopeCapability, in the same throw-site family:

defineStack trigger capability validation failed (1 issue):
✗ flow 'duly_assignment_fanout' declares a 'record_change' trigger but `requires` does not include 'triggers' — no 'record_change' trigger would be registered, so the flow would never auto-launch. Add requires: ['triggers'] (record_change/schedule/time_relative/api ship in @objectstack/trigger-*).

The wording is the automation engine's boot-audit line (getTriggerBindingAudit), moved from post-deploy to author time — no second vocabulary. triggers is one membership test (one token installs all four kinds), no per-kind table.

Ruling premise — verified (in-tree corpus census at a39b02a6)

stackrequiresflowsverdict
examples/app-crm['ui', 'automation']convert-lead.flow.ts is type: 'screen'passes (measured: defineStack import through the built dist, flows=1 types=["screen"])
examples/app-showcasedeclares 'triggers' (objectstack.config.ts:107)autolaunched + screen + one schedulepasses by the membership test
packages/create-objectstack blank template['automation']no flows (src/objects only)passes
examples/app-todoabsent2 × schedule ('0 8 * * *'), 1 × record_change, 1 × screentripped — repaired (see below)
packages/**/objectstack.config.ts (5)none declare flowspass

No in-tree stack declares a record_change / schedule / time_relative / api flow and launches it only by hand (no type: 'flow' action targeting such a flow, no docs saying so). The premise holds; the reroute condition is not met — the remedy is in defineStack, nothing was built in packages/lint beyond the declared import-site edit.

Absent requires — measured Outcome B

packages/cli/src/commands/serve.ts: an absent requires reads as [] (:2295), the CLI appends only its convenience defaults — email iff auth, mcp, pinyin-search, the always-on slate (PLATFORM_ALWAYS_ON_CAPABILITIES = queue, job, cache, settings, email, storage, sms, sharing, messaging, analytics — neither automation nor triggers), queue/job — and the capability resolver loads a provider only for tokens in that list (for (const cap of requires) :3985; automation :1460, triggers :1506 are entries of Serve.CAPABILITY_PROVIDERS; no other block imports @objectstack/service-automation or @objectstack/trigger-*). os dev forwards to a serve child. So a stack that declares nothing gets no trigger — and no engine. ⇒ the validator fires on absent requires too, and examples/app-todo (whose task-completion-trigger.test.ts hand-assembles RecordChangeTriggerPlugin precisely because its record_change flow is meant to fire) now declares requires: ['automation', 'triggers']. Not booted live: booting app-todo needs the whole CLI closure built in this worktree; the reading above is from the resolver's own source, line-cited.

Predicate — hoisted into spec (single source)

resolveFlowTriggerKind (packages/spec/src/automation/flow-trigger-kind.ts, exported from @objectstack/spec/automation) mirrors the engine's resolveTriggerBinding chain, kind only, in its precedence (timeRelative descriptor outranks a sibling schedule cadence). @objectstack/lint's validate-flow-trigger-readiness.ts now reads isAutoTriggered = resolveFlowTriggerKind(flow) !== undefinedbyte-identical to the six-term disjunction it replaces (the resolver answers a kind exactly when one of those terms held). The one documented divergence from the engine is the array-formtriggerType (unsupported, #3457): the engine routes it to the record-change trigger only so the trigger can refuse it loudly at bind time, lint 1d already reports it as an error, and lint's predicate never counted it — so the resolver answers no kind for it, which is what keeps the lint edit identical by construction rather than by test coverage. Lint's suite (92 files / 2685 tests) is the proof; see Tests.

Fixture triage

  • packages/lint/src/authoring-rule-input-tier.test.ts — its flowStack uses a schedule flow only as a vehicle for a parse-time default; the new refusal tripped it. Declaredrequires: ['triggers'] on the fixture (the flow's auto-trigger is incidental; the test's meaning is unchanged).
  • Every other defineStack test consumer with flows (git grep -ln defineStack -- '**/*.test.ts' → 85 files, 20 with flows) either declares no auto-triggered flow, declares triggers, or does not go through defineStack for it — the spec (451 files) and lint (92 files) suites ran green after the two repairs above.

Downstream

Out of scope, filed as #14328 (finding, open): the automation engine's resolveTriggerBinding keeps a private copy of the trigger-kind chain the spec resolver now mirrors — hoisting the kind onto resolveFlowTriggerKind is a service-automation change, not this card's.

objectstack-ai/duly's test/trigger-capability.test.ts stopgap can be deleted in that repo once this lands and the pin moves — a follow-up there, not here.

Files

  • packages/spec/src/automation/flow-trigger-kind.ts (+ test, + barrel export, + regenerated api-surface/automation.json and export-origins/automation.json)
  • packages/spec/src/stack.zod.tsvalidateTriggerCapability + wiring after the hierarchy sibling
  • packages/spec/src/stack-requires.test.ts — the defineStack trigger capability validation suite
  • packages/lint/src/validate-flow-trigger-readiness.ts — import-site edit only (+ one comment that named the old predicate)
  • packages/lint/src/authoring-rule-input-tier.test.ts — fixture declares the token
  • examples/app-todo/objectstack.config.ts — corpus repair
  • content/docs/permissions/capabilities.mdx, content/docs/automation/flows.mdx — one table row, one paragraph
  • .changeset/define-stack-trigger-capability-refusal.md@objectstack/specminor (BREAKING accept-set narrowing under the launch-window convention; ADR-0087 not-required (no-migration-prescription) — the refusal names the one-line fix, nothing is renamed or removed), @objectstack/lint patch

Tests

All runs through scripts/pm/os-verify-lock.sh; verdicts quoted from each runner's own summary line, exit codes captured before any pipe. Head for every re-run: 24aec0a0.

  • pnpm --filter @objectstack/spec exec vitest run --maxWorkers=2 (whole suite, at 66d5d580): Test Files 2 failed | 449 passed (451) · Tests 3 failed | 12084 passed (12087) — all three failures were the stale export-origins/automation.json (the module exports these at runtime and export-origins does not record them), regenerated with check:generated --fix together with api-surface/automation.json (the only two artifacts it proved stale). Targeted re-run at 24aec0a0 of scripts/export-origins.test.ts src/automation/state-machine.test.ts src/stack-requires.test.ts src/automation/flow-trigger-kind.test.ts: Test Files 4 passed (4) · Tests 64 passed (64).
  • pnpm --filter @objectstack/lint exec vitest run --maxWorkers=2 (whole suite): Test Files 1 failed | 91 passed (92) · Tests 1 failed | 2684 passed (2685) — the one failure was the tier fixture (see Fixture triage). Targeted re-run at 24aec0a0 of src/authoring-rule-input-tier.test.ts src/validate-flow-trigger-readiness.test.ts: Test Files 2 passed (2) · Tests 80 passed (80) — the readiness suite (60 cases, untouched) is the byte-identical proof for the import-site edit.
  • pnpm --filter @objectstack/spec typecheck exit 0 (check:test-typecheck: OK — … 54 file(s) / 262 error(s) / 146 pinned signature(s), ledger unchanged); pnpm --filter @objectstack/lint typecheck exit 0.
  • Reverse verification (ablation, committed state): the wiring line const triggerErrors = validateTriggerCapability(data); replaced by const triggerErrors: string[] = []; — on-disk proof injected=1 removed-anchor-left=0; run: Tests 6 failed | 18 passed (24) — exactly the six refusal cases red, every pass-through case and the whole resolver suite green; restore git checkout HEAD -- ABSOLUTE_PATH proven by hash d8411f45… == HEAD blob; git diff HEAD empty (trap-guarded script). Spec's own tests import ./stack.zod from src, so no dist was involved in this leg; spec was rebuilt afterwards regardless (the restore's touch had turned the mtime-based dist-freshness guards red) and the dist-reading gates re-run on that rebuilt tree.
  • Corpus through the built dist:tsx import of examples/app-todo/objectstack.config.tsrequires=["automation","triggers"] flows=4 types=["schedule","record_change","screen"]; examples/app-crmrequires=["ui","automation"] flows=1 types=["screen"]. examples/app-showcase is not importable in this worktree (its @objectstack/connector-mcp dist is unbuilt) and passes on the static membership test ('triggers' at objectstack.config.ts:107). pnpm validate per example NOT run (it needs the CLI closure built); the import exercises the exact defineStack refusal, and the lint half of os validate is unchanged (readiness suite green).
  • Not run locally, declared: the example apps' own vitest suites and the packages/cli suites (their defineStack consumers declare no auto-triggered flow — census in Fixture triage); full pnpm test — CI's.

Gates

node scripts/pm/dispatch-gates.mjs --commands with no paths at 24aec0a0 (answer stamped objectstack-ai/objectstack at 24aec0a0): 71 commands (the PM's three-path reading gave 40; the same three paths gave 46 here — 41 by path + 7 by change KIND; the real change set adds the changeset, docs, example and artifact families). Every command run with its exit code captured by redirection; 67 green, including the ones this card names: check:stack-collection-maps, check:api-surface (public API surface + factory signatures unchanged ✓ — the two new exports are in the regenerated shard), check:docs, check:llms-txt, check:liveness, check:where-matcher, check:objectql-double-limit, check-adr-0087-registration, check:export-origins, check:dual-source-exports (0 accepted dual-source), check:exported-any, check:entry-nameability, check:skill-examples (259 prose examples type-check across 3 surface(s) — after building @objectstack/client-react...), check:cross-package-test-inputs, check:test-source-alias, check:doc-authoring, check-affected-docs, check:changeset-gate-self-tests, check-empty-changeset, check-changeset-no-major.

4 NOT MEASURED locally — each exits with its own prerequisite code, nothing measured, CI owns them: check-dev-prereqs (exit 1: 63 of 67 workspace packages unbuilt here), check-test-completeness (exit 3: needs a saved turbo run test log), check:dual-build-cjs-loads (exit 3: PREREQUISITE NOT MET, unbuilt dists), check:type-check-debt (exit 3: needs the whole closure built).

Also run, not in the derived list: pnpm check:nul-bytes (OK … 7815 text file(s) … no raw ASCII control bytes) plus a control-character self-scan over every edited file (clean).

skip-changeset: not applicable — this PR ships a changeset. needs:contract-review hung on this PR and on #14153 (Clause ②: defineStack gains a refusal).

Session: https://claude.ai/code/session_01GDA48PuRFrHyRfdkBz8m21

🤖 Generated with Claude Code

Generated by Claude Code


Generated by Claude Code

…['triggers'] (#14153)
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GDA48PuRFrHyRfdkBz8m21
…utomation exports; declare triggers on the lint tier fixture (#14153)
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GDA48PuRFrHyRfdkBz8m21
@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 2 package(s): @objectstack/lint, @objectstack/spec, touching 7 documentable anchor(s). ⚠️3 changed file(s) yielded no anchor (packages/spec/api-surface/automation.json, packages/spec/export-origins/automation.json, packages/spec/src/automation/index.ts), so the pages documenting them are NOT COVERED by this run — this is not a clean bill of health for those files.

10 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:

  • content/docs/api/plugin-endpoints.mdx(via record_change (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))
  • content/docs/automation/approvals.mdx(via record_change (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))
  • content/docs/automation/flows.mdx(via record_change (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind), time_relative (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))
  • content/docs/automation/hooks.mdx(via record_change (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))
  • content/docs/automation/workflows.mdx(via record_change (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))
  • content/docs/concepts/architecture.mdx(via record_change (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))
  • content/docs/getting-started/common-patterns.mdx(via record_change (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))
  • content/docs/kernel/services-checklist.mdx(via record_change (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))
  • content/docs/permissions/capabilities.mdx(via record_change (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind), time_relative (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))
  • content/docs/protocol/objectql/schema.mdx(via record_change (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))

3 release-owned page(s) also name something this change touched. These are read-only:

  • content/docs/releases/v12.mdx(via record_change (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))
  • content/docs/releases/v16.mdx(via time_relative (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))
  • content/docs/releases/v17.mdx(via record_change (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))

content/docs/releases/ is RELEASE-OWNED (AGENTS.md "Documentation Guardrails"): release
notes are written centrally at release time, and a code PR that edits them is the exact PR
that guardrail exists to stop. They are still audited — read-only. If one of them is actually
wrong, file an issue or open a dedicated docs-only PR; do not edit it here.

What this run could not see
  • 3 changed file(s) yielded no anchor (packages/spec/api-surface/automation.json, packages/spec/export-origins/automation.json, packages/spec/src/automation/index.ts) — pages documenting those are invisible to this run
  • 1 anchor(s) matched too much of the corpus to be a work list: defineStack (symbol, 57 pages)
  • the SDK route bridge reached 47 of 219 client-bound route-ledger rows — the other 172 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 172: 14 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 56 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 102 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.

Coarse fallback — 128 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json f645d6f8879f5e868b8c0aac978dc0db92552739packageMentionDocs.

Which tree this was computed on

This run read content/docs from 3b3c9e059159c1ea382daa3f44ee0f2f220f0ac5 — the merge of head 24aec0a0a2ffe42e339eded184f60ffff85569ac into base f645d6f8879f5e868b8c0aac978dc0db92552739, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 3b3c9e059159c1ea382daa3f44ee0f2f220f0ac5 && git checkout 3b3c9e059159c1ea382daa3f44ee0f2f220f0ac5
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin f645d6f8879f5e868b8c0aac978dc0db92552739 24aec0a0a2ffe42e339eded184f60ffff85569ac && git checkout -B drift-repro f645d6f8879f5e868b8c0aac978dc0db92552739 && git merge --no-ff 24aec0a0a2ffe42e339eded184f60ffff85569ac
node scripts/docs-audit/affected-docs.mjs --json f645d6f8879f5e868b8c0aac978dc0db92552739

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs f645d6f8879f5e868b8c0aac978dc0db92552739 → pass the list as
args.docs, on the commit named under Which tree this was computed on.

@github-actionsgithub-actionsBot added documentation Improvements or additions to documentation tests tooling labels Sep 2, 2026
@os-zhuang
os-zhuang marked this pull request as ready for review September 2, 2026 02:41
@os-zhuang
os-zhuang added this pull request to the merge queueSep 2, 2026
Merged via the queue into main with commit 948dd6bSep 2, 2026
43 checks passed
@os-zhuang
os-zhuang deleted the claude/issue-14153-trigger-capability-validator branch September 2, 2026 03:07
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentationImprovements or additions to documentationsize/mteststooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

defineStack hard-errors on an undeclared hierarchy scope but is silent on an undeclared trigger capability — every autolaunched flow ships inert

2 participants

@os-zhuang@claude
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Universal Dark Mode - works on any site\n(function() {\n var enabled = true;\n \n function applyDarkMode() {\n if (!enabled) return;\n \n // Create style element if it doesn't exist\n var style = document.getElementById('universal-dark-mode-style');\n if (!style) {\n style = document.createElement('style');\n style.id = 'universal-dark-mode-style';\n document.head.appendChild(style);\n }\n \n // Dark mode CSS - inverts colors but preserves images/video\n style.textContent = '\n /* Invert everything except media */\n html {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #1a1a2e !important;\n }\n \n /* Restore images, videos, iframes, canvas */\n img, video, iframe, canvas, svg, picture, [style*=\"background-image\"] {\n filter: invert(1) hue-rotate(180deg) !important;\n }\n \n /* Preserve specific elements that should not be inverted */\n .no-dark-mode, .no-dark-mode *,\n [data-theme=\"light\"], [data-theme=\"light\"],\n .ace_editor, .ace_editor *,\n .CodeMirror, .CodeMirror *,\n .monaco-editor, .monaco-editor *,\n .markdown-body pre, .markdown-body pre *,\n .highlight, .highlight *,\n pre code, pre code * {\n filter: none !important;\n }\n \n /* Fix common UI elements */\n .modal, .popup, .dropdown-menu, .tooltip, .popover {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #2d2d44 !important;\n border-color: #444 !important;\n }\n \n /* Scrollbars */\n ::-webkit-scrollbar { background: #1a1a2e !important; }\n ::-webkit-scrollbar-thumb { background: #444 !important; }\n ::-webkit-scrollbar-thumb:hover { background: #555 !important; }\n \n /* Selection */\n ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ';\n }\n \n function removeDarkMode() {\n var style = document.getElementById('universal-dark-mode-style');\n if (style) style.remove();\n }\n \n // Toggle with Alt+Shift+D\n document.addEventListener('keydown', function(e) {\n if (e.altKey && e.shiftKey && e.key === 'D') {\n e.preventDefault();\n enabled = !enabled;\n if (enabled) {\n applyDarkMode();\n console.log('[Universal Dark Mode] Enabled');\n } else {\n removeDarkMode();\n console.log('[Universal Dark Mode] Disabled');\n }\n }\n });\n \n // Apply on load\n applyDarkMode();\n \n // Re-apply on dynamic content\n var observer = new MutationObserver(function(mutations) {\n if (enabled && !document.getElementById('universal-dark-mode-style')) {\n applyDarkMode();\n }\n });\n observer.observe(document.head, { childList: true });\n \n console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle');\n})();", "Universal Dark Mode"); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content

feat(spec): refuse an auto-launched flow whose stack omits requires: ['triggers'] - #14330

Merged
os-zhuang merged 2 commits into
mainfrom
claude/issue-14153-trigger-capability-validator
Sep 2, 2026
Merged

feat(spec): refuse an auto-launched flow whose stack omits requires: ['triggers']#14330
os-zhuang merged 2 commits into
mainfrom
claude/issue-14153-trigger-capability-validator

Conversation

@claude

@claudeclaudeBot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Fixes#14153

What

defineStack now refuses a stack that declares an auto-launched flow (record_change / schedule / time_relative / api) while requires omits 'triggers' — a sibling of validateHierarchyScopeCapability, in the same throw-site family:

defineStack trigger capability validation failed (1 issue):
✗ flow 'duly_assignment_fanout' declares a 'record_change' trigger but `requires` does not include 'triggers' — no 'record_change' trigger would be registered, so the flow would never auto-launch. Add requires: ['triggers'] (record_change/schedule/time_relative/api ship in @objectstack/trigger-*).

The wording is the automation engine's boot-audit line (getTriggerBindingAudit), moved from post-deploy to author time — no second vocabulary. triggers is one membership test (one token installs all four kinds), no per-kind table.

Ruling premise — verified (in-tree corpus census at a39b02a6)

stackrequiresflowsverdict
examples/app-crm['ui', 'automation']convert-lead.flow.ts is type: 'screen'passes (measured: defineStack import through the built dist, flows=1 types=["screen"])
examples/app-showcasedeclares 'triggers' (objectstack.config.ts:107)autolaunched + screen + one schedulepasses by the membership test
packages/create-objectstack blank template['automation']no flows (src/objects only)passes
examples/app-todoabsent2 × schedule ('0 8 * * *'), 1 × record_change, 1 × screentripped — repaired (see below)
packages/**/objectstack.config.ts (5)none declare flowspass

No in-tree stack declares a record_change / schedule / time_relative / api flow and launches it only by hand (no type: 'flow' action targeting such a flow, no docs saying so). The premise holds; the reroute condition is not met — the remedy is in defineStack, nothing was built in packages/lint beyond the declared import-site edit.

Absent requires — measured Outcome B

packages/cli/src/commands/serve.ts: an absent requires reads as [] (:2295), the CLI appends only its convenience defaults — email iff auth, mcp, pinyin-search, the always-on slate (PLATFORM_ALWAYS_ON_CAPABILITIES = queue, job, cache, settings, email, storage, sms, sharing, messaging, analytics — neither automation nor triggers), queue/job — and the capability resolver loads a provider only for tokens in that list (for (const cap of requires) :3985; automation :1460, triggers :1506 are entries of Serve.CAPABILITY_PROVIDERS; no other block imports @objectstack/service-automation or @objectstack/trigger-*). os dev forwards to a serve child. So a stack that declares nothing gets no trigger — and no engine. ⇒ the validator fires on absent requires too, and examples/app-todo (whose task-completion-trigger.test.ts hand-assembles RecordChangeTriggerPlugin precisely because its record_change flow is meant to fire) now declares requires: ['automation', 'triggers']. Not booted live: booting app-todo needs the whole CLI closure built in this worktree; the reading above is from the resolver's own source, line-cited.

Predicate — hoisted into spec (single source)

resolveFlowTriggerKind (packages/spec/src/automation/flow-trigger-kind.ts, exported from @objectstack/spec/automation) mirrors the engine's resolveTriggerBinding chain, kind only, in its precedence (timeRelative descriptor outranks a sibling schedule cadence). @objectstack/lint's validate-flow-trigger-readiness.ts now reads isAutoTriggered = resolveFlowTriggerKind(flow) !== undefinedbyte-identical to the six-term disjunction it replaces (the resolver answers a kind exactly when one of those terms held). The one documented divergence from the engine is the array-formtriggerType (unsupported, #3457): the engine routes it to the record-change trigger only so the trigger can refuse it loudly at bind time, lint 1d already reports it as an error, and lint's predicate never counted it — so the resolver answers no kind for it, which is what keeps the lint edit identical by construction rather than by test coverage. Lint's suite (92 files / 2685 tests) is the proof; see Tests.

Fixture triage

  • packages/lint/src/authoring-rule-input-tier.test.ts — its flowStack uses a schedule flow only as a vehicle for a parse-time default; the new refusal tripped it. Declaredrequires: ['triggers'] on the fixture (the flow's auto-trigger is incidental; the test's meaning is unchanged).
  • Every other defineStack test consumer with flows (git grep -ln defineStack -- '**/*.test.ts' → 85 files, 20 with flows) either declares no auto-triggered flow, declares triggers, or does not go through defineStack for it — the spec (451 files) and lint (92 files) suites ran green after the two repairs above.

Downstream

Out of scope, filed as #14328 (finding, open): the automation engine's resolveTriggerBinding keeps a private copy of the trigger-kind chain the spec resolver now mirrors — hoisting the kind onto resolveFlowTriggerKind is a service-automation change, not this card's.

objectstack-ai/duly's test/trigger-capability.test.ts stopgap can be deleted in that repo once this lands and the pin moves — a follow-up there, not here.

Files

  • packages/spec/src/automation/flow-trigger-kind.ts (+ test, + barrel export, + regenerated api-surface/automation.json and export-origins/automation.json)
  • packages/spec/src/stack.zod.tsvalidateTriggerCapability + wiring after the hierarchy sibling
  • packages/spec/src/stack-requires.test.ts — the defineStack trigger capability validation suite
  • packages/lint/src/validate-flow-trigger-readiness.ts — import-site edit only (+ one comment that named the old predicate)
  • packages/lint/src/authoring-rule-input-tier.test.ts — fixture declares the token
  • examples/app-todo/objectstack.config.ts — corpus repair
  • content/docs/permissions/capabilities.mdx, content/docs/automation/flows.mdx — one table row, one paragraph
  • .changeset/define-stack-trigger-capability-refusal.md@objectstack/specminor (BREAKING accept-set narrowing under the launch-window convention; ADR-0087 not-required (no-migration-prescription) — the refusal names the one-line fix, nothing is renamed or removed), @objectstack/lint patch

Tests

All runs through scripts/pm/os-verify-lock.sh; verdicts quoted from each runner's own summary line, exit codes captured before any pipe. Head for every re-run: 24aec0a0.

  • pnpm --filter @objectstack/spec exec vitest run --maxWorkers=2 (whole suite, at 66d5d580): Test Files 2 failed | 449 passed (451) · Tests 3 failed | 12084 passed (12087) — all three failures were the stale export-origins/automation.json (the module exports these at runtime and export-origins does not record them), regenerated with check:generated --fix together with api-surface/automation.json (the only two artifacts it proved stale). Targeted re-run at 24aec0a0 of scripts/export-origins.test.ts src/automation/state-machine.test.ts src/stack-requires.test.ts src/automation/flow-trigger-kind.test.ts: Test Files 4 passed (4) · Tests 64 passed (64).
  • pnpm --filter @objectstack/lint exec vitest run --maxWorkers=2 (whole suite): Test Files 1 failed | 91 passed (92) · Tests 1 failed | 2684 passed (2685) — the one failure was the tier fixture (see Fixture triage). Targeted re-run at 24aec0a0 of src/authoring-rule-input-tier.test.ts src/validate-flow-trigger-readiness.test.ts: Test Files 2 passed (2) · Tests 80 passed (80) — the readiness suite (60 cases, untouched) is the byte-identical proof for the import-site edit.
  • pnpm --filter @objectstack/spec typecheck exit 0 (check:test-typecheck: OK — … 54 file(s) / 262 error(s) / 146 pinned signature(s), ledger unchanged); pnpm --filter @objectstack/lint typecheck exit 0.
  • Reverse verification (ablation, committed state): the wiring line const triggerErrors = validateTriggerCapability(data); replaced by const triggerErrors: string[] = []; — on-disk proof injected=1 removed-anchor-left=0; run: Tests 6 failed | 18 passed (24) — exactly the six refusal cases red, every pass-through case and the whole resolver suite green; restore git checkout HEAD -- ABSOLUTE_PATH proven by hash d8411f45… == HEAD blob; git diff HEAD empty (trap-guarded script). Spec's own tests import ./stack.zod from src, so no dist was involved in this leg; spec was rebuilt afterwards regardless (the restore's touch had turned the mtime-based dist-freshness guards red) and the dist-reading gates re-run on that rebuilt tree.
  • Corpus through the built dist:tsx import of examples/app-todo/objectstack.config.tsrequires=["automation","triggers"] flows=4 types=["schedule","record_change","screen"]; examples/app-crmrequires=["ui","automation"] flows=1 types=["screen"]. examples/app-showcase is not importable in this worktree (its @objectstack/connector-mcp dist is unbuilt) and passes on the static membership test ('triggers' at objectstack.config.ts:107). pnpm validate per example NOT run (it needs the CLI closure built); the import exercises the exact defineStack refusal, and the lint half of os validate is unchanged (readiness suite green).
  • Not run locally, declared: the example apps' own vitest suites and the packages/cli suites (their defineStack consumers declare no auto-triggered flow — census in Fixture triage); full pnpm test — CI's.

Gates

node scripts/pm/dispatch-gates.mjs --commands with no paths at 24aec0a0 (answer stamped objectstack-ai/objectstack at 24aec0a0): 71 commands (the PM's three-path reading gave 40; the same three paths gave 46 here — 41 by path + 7 by change KIND; the real change set adds the changeset, docs, example and artifact families). Every command run with its exit code captured by redirection; 67 green, including the ones this card names: check:stack-collection-maps, check:api-surface (public API surface + factory signatures unchanged ✓ — the two new exports are in the regenerated shard), check:docs, check:llms-txt, check:liveness, check:where-matcher, check:objectql-double-limit, check-adr-0087-registration, check:export-origins, check:dual-source-exports (0 accepted dual-source), check:exported-any, check:entry-nameability, check:skill-examples (259 prose examples type-check across 3 surface(s) — after building @objectstack/client-react...), check:cross-package-test-inputs, check:test-source-alias, check:doc-authoring, check-affected-docs, check:changeset-gate-self-tests, check-empty-changeset, check-changeset-no-major.

4 NOT MEASURED locally — each exits with its own prerequisite code, nothing measured, CI owns them: check-dev-prereqs (exit 1: 63 of 67 workspace packages unbuilt here), check-test-completeness (exit 3: needs a saved turbo run test log), check:dual-build-cjs-loads (exit 3: PREREQUISITE NOT MET, unbuilt dists), check:type-check-debt (exit 3: needs the whole closure built).

Also run, not in the derived list: pnpm check:nul-bytes (OK … 7815 text file(s) … no raw ASCII control bytes) plus a control-character self-scan over every edited file (clean).

skip-changeset: not applicable — this PR ships a changeset. needs:contract-review hung on this PR and on #14153 (Clause ②: defineStack gains a refusal).

Session: https://claude.ai/code/session_01GDA48PuRFrHyRfdkBz8m21

🤖 Generated with Claude Code

Generated by Claude Code


Generated by Claude Code

…['triggers'] (#14153)
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GDA48PuRFrHyRfdkBz8m21
…utomation exports; declare triggers on the lint tier fixture (#14153)
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GDA48PuRFrHyRfdkBz8m21
@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 2 package(s): @objectstack/lint, @objectstack/spec, touching 7 documentable anchor(s). ⚠️3 changed file(s) yielded no anchor (packages/spec/api-surface/automation.json, packages/spec/export-origins/automation.json, packages/spec/src/automation/index.ts), so the pages documenting them are NOT COVERED by this run — this is not a clean bill of health for those files.

10 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:

  • content/docs/api/plugin-endpoints.mdx(via record_change (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))
  • content/docs/automation/approvals.mdx(via record_change (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))
  • content/docs/automation/flows.mdx(via record_change (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind), time_relative (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))
  • content/docs/automation/hooks.mdx(via record_change (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))
  • content/docs/automation/workflows.mdx(via record_change (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))
  • content/docs/concepts/architecture.mdx(via record_change (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))
  • content/docs/getting-started/common-patterns.mdx(via record_change (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))
  • content/docs/kernel/services-checklist.mdx(via record_change (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))
  • content/docs/permissions/capabilities.mdx(via record_change (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind), time_relative (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))
  • content/docs/protocol/objectql/schema.mdx(via record_change (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))

3 release-owned page(s) also name something this change touched. These are read-only:

  • content/docs/releases/v12.mdx(via record_change (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))
  • content/docs/releases/v16.mdx(via time_relative (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))
  • content/docs/releases/v17.mdx(via record_change (literal, a string literal in FLOW_TRIGGER_KINDS; a string literal in FlowTriggerKind; a string literal in resolveFlowTriggerKind))

content/docs/releases/ is RELEASE-OWNED (AGENTS.md "Documentation Guardrails"): release
notes are written centrally at release time, and a code PR that edits them is the exact PR
that guardrail exists to stop. They are still audited — read-only. If one of them is actually
wrong, file an issue or open a dedicated docs-only PR; do not edit it here.

What this run could not see
  • 3 changed file(s) yielded no anchor (packages/spec/api-surface/automation.json, packages/spec/export-origins/automation.json, packages/spec/src/automation/index.ts) — pages documenting those are invisible to this run
  • 1 anchor(s) matched too much of the corpus to be a work list: defineStack (symbol, 57 pages)
  • the SDK route bridge reached 47 of 219 client-bound route-ledger rows — the other 172 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 172: 14 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 56 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 102 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.

Coarse fallback — 128 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json f645d6f8879f5e868b8c0aac978dc0db92552739packageMentionDocs.

Which tree this was computed on

This run read content/docs from 3b3c9e059159c1ea382daa3f44ee0f2f220f0ac5 — the merge of head 24aec0a0a2ffe42e339eded184f60ffff85569ac into base f645d6f8879f5e868b8c0aac978dc0db92552739, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 3b3c9e059159c1ea382daa3f44ee0f2f220f0ac5 && git checkout 3b3c9e059159c1ea382daa3f44ee0f2f220f0ac5
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin f645d6f8879f5e868b8c0aac978dc0db92552739 24aec0a0a2ffe42e339eded184f60ffff85569ac && git checkout -B drift-repro f645d6f8879f5e868b8c0aac978dc0db92552739 && git merge --no-ff 24aec0a0a2ffe42e339eded184f60ffff85569ac
node scripts/docs-audit/affected-docs.mjs --json f645d6f8879f5e868b8c0aac978dc0db92552739

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs f645d6f8879f5e868b8c0aac978dc0db92552739 → pass the list as
args.docs, on the commit named under Which tree this was computed on.

@github-actionsgithub-actionsBot added documentation Improvements or additions to documentation tests tooling labels Sep 2, 2026
@os-zhuang
os-zhuang marked this pull request as ready for review September 2, 2026 02:41
@os-zhuang
os-zhuang added this pull request to the merge queueSep 2, 2026
Merged via the queue into main with commit 948dd6bSep 2, 2026
43 checks passed
@os-zhuang
os-zhuang deleted the claude/issue-14153-trigger-capability-validator branch September 2, 2026 03:07
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentationImprovements or additions to documentationsize/mteststooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

defineStack hard-errors on an undeclared hierarchy scope but is silent on an undeclared trigger capability — every autolaunched flow ships inert

2 participants

@os-zhuang@claude