fix(runtime): return the declarative job handler's JobRunOutcome so a degraded run is recorded - #14711

Merged
os-trump merged 3 commits into
mainfrom
claude/issue-14256-declarative-job-outcome
Sep 2, 2026
Merged

fix(runtime): return the declarative job handler's JobRunOutcome so a degraded run is recorded#14711
os-trump merged 3 commits into
mainfrom
claude/issue-14256-declarative-job-outcome

Conversation

@os-trump

Copy link
Copy Markdown
Collaborator

Fixes#14256

AppPlugin's declarative-job registration block handed IJobService.schedule a
block-bodied arrow that awaited the bundle handler and returned nothing, so the wrapper
resolved undefined whatever the handler resolved. JobHandler has been declared as
resolving either void or a JobRunOutcome since #6617, and all three shipped adapters
(cron-job-adapter, interval-job-adapter, db-job-adapter) map a resolved
{ outcome: 'degraded', reason } onto a run status distinct from success — they simply
never received the value on this path. The reporter's probe, driven through an
IJobService typed only at the contract:

HANDLER RESOLVED: {"outcome":"degraded","reason":"STORE_UNAVAILABLE"}
WRAPPER RESOLVED: undefined

So a declarative job that ran to completion while its work did not happen (store
unavailable, zero rows matched) was recorded as success with reason dropped, and the
three-outcome table in content/docs/automation/jobs.mdx — the page whose whole subject
is the declarative door — was false on exactly that door. The imperative route (a handler
registered straight on IJobService.schedule) was unaffected throughout; the wrapper is
the whole defect. Per the card, the page is deliberately left alone: the code is the
honest repair.

The change

packages/runtime/src/app-plugin.tsreturn await handler(jobContext); in place of
the discarding await, with a comment naming why the value is load-bearing. That is the
whole production diff.

The deliverable: the regression test

packages/runtime/src/app-plugin.job-degraded-outcome.test.ts (6 cases) pins the
consequence, not the repair. It boots a real ObjectQL engine over the migrated
sqlite :memory: backend carrying the realsys_job / sys_job_run declarations,
registers the job through AppPlugin from a defineStack-shaped bundle, and runs it the
way the scheduler does — DbJobAdapter.trigger, never a direct handler call. Every
primary assertion reads the persisted cell:

  • sys_job_run.status asserted not to be success first (the card's own wording, and
    the contract's), then to be degraded, with the reason in error;
  • the mirror onto sys_job.last_status / last_error, with failure_count flat —
    degraded is not a failure and never retries;
  • the same through the { handler, effect } function form.

Kept in packages/runtime rather than packages/services/service-job: the defect is in
AppPlugin, and @objectstack/service-job is already a devDependency of
@objectstack/runtime and is aliased to source by that package's vitest.config.ts, so
the recording adapter is reachable from the package that owns the bug. Driving the real
engine (rather than a recording double) also proves the status the adapter writes is a
value the enforced sys_job_run.statusField.select vocabulary accepts, and it adds no
engine double to the check:engine-double-contract ledger.

Two in-suite controls keep the assertion honest, plus one corroborating middle term:

  • imperative route — the same degraded handler registered straight on
    IJobService.schedule records degraded with no AppPlugin in the path. Green before
    this change and green after, so a red on the declarative cases localises to the wrapper
    rather than to DbJobAdapter or the sys_job_run write;
  • additivity — a handler resolving nothing still lands success, which is also what
    rules out the rig writing degraded unconditionally;
  • middle term — the wrapper handed to a contract-typed recording IJobService
    resolves the handler's outcome. Corroboration only: on its own it would re-state the
    repair rather than pin its consequence.

The rig deliberately installs no expected-read-refusal capture: measured on the red
run, every read in the file carries isSystem, the tenancy probe never fires, and neither
refusal channel emits a frame — a capture nothing provokes would assert a mute.

Red-first, with the mutation and the restore both proven

Ablation run from the committed state, as one script holding the shared verify lock, with
a trap … EXIT INT TERM on an absolute path:

HEAD blob for packages/runtime/src/app-plugin.ts: 76c425968283051117c01f9cd07e115de8945491
PRECONDITION: packages/runtime/dist absent => the pin's relative './app-plugin.js' import
resolves to SOURCE; no rebuild leg applies
REMOVED TEXT 'return await handler(jobContext);' : 1 -> 0
INJECTED TEXT bare 'await handler(jobContext);' : 0 -> 1
blob after mutation: 82098e0cc683fca2864d63aefd1b73c019bce3f6
MUTATION CONFIRMED ON DISK
ABLATION VITEST EXIT: 1
Test Files 1 failed (1)
Tests 4 failed | 2 passed (6)
x lands `sys_job_run.status` distinct from `success`, with the reason in `error`
x mirrors onto `sys_job.last_status` and leaves `failure_count` flat
x carries the outcome for the `{ handler, effect }` function form too
x the middle term: the wrapper AppPlugin hands `schedule` resolves the handler's outcome
blob after restore : 76c425968283051117c01f9cd07e115de8945491
RESTORE CONFIRMED: blob identical to HEAD, git diff HEAD empty, git status clean
ABLATION VERDICT: RED as required

The mutation is proven by content — the removed text counted to zero and the injected
text counted to one, separately — never by an editor's exit code; the restore is proven by
blob identity against the HEAD blob plus an empty git diff HEAD and a clean
git status --porcelain. The split is the part that matters: the four cases that go red
are the declarative ones, while both controls stay green under the same mutation. No
rebuild leg applies — the mutated file is imported relatively by the pin, so vitest reads
source, and packages/runtime/dist was absent at the time (asserted in the run above).

Green after the fix: Test Files 1 passed (1) · Tests 6 passed (6).

Verification

Everything below ran on the final tree, git rev-parse --short HEAD = 0f4a80ee47, after
merging origin/main and re-deriving.

  • Gate union derived with
    node scripts/pm/dispatch-gates.mjs --repo objectstack-ai/objectstack --commands. The
    first derivation reported a stale tree, so origin/main was merged, the install and the
    dependency closure refreshed, and it was re-derived on the merged tree — 36 commands,
    the same list. Each ran with its exit captured before any pipe
    (cmd > log 2>&1; EXIT=$?): 32 exit 0.
  • 4 are NOT MEASURED, quoted in their own words, and reported as neither a pass nor a
    red: check-test-completeness — "There is no local log to hand it, so the local reading
    for this gate is NOT MEASURED"; check-half-states — "Nothing was swept … it is no
    reading at all" (this session's repo-scoped REST reads answer 403);
    check:dual-build-cjs-loads — "PREREQUISITE NOT MET — this gate reads built output, and
    some package has no dist/"; check:type-check-debt — "PREREQUISITE NOT MET … 26
    workspace dependenc(ies) of the ledgered packages have no built type entry point on
    disk". All four want a full-workspace build, which CI performs.
  • Package test tier: pnpm --filter @objectstack/runtime test
    Test Files 210 passed (210) · Tests 3085 passed (3085), VERDICT command-exit 0 from
    the shared verify lock.
  • Package typecheck: pnpm --filter @objectstack/runtime typecheck — exit 0. ⚠️ Read
    narrowly: that script is tsc --noEmit over a tsconfig.json that excludes
    **/*.test.ts, so it covers app-plugin.ts and says nothing about the new test
    file. Confirmed with --listFiles: app-plugin.ts present, the test file absent.
    Compiled separately under the package's own options with tests included, the new file
    reports zero errors (the package's pre-existing test-layer errors are the subject of
    the standing finding [finding] packages/runtime type-checks none of its 208 test files — tsconfig excludes **/*.test.ts and no test-typecheck wiring exists #14504 and are untouched here).
  • Lint — a DECLARED NARROWING. Whole-repo pnpm lint was attempted through the shared
    verify lock three times and returned exit 99 (queue-timeout, "never acquired") every
    time, holder pid 2524 from another dev's run, held 755s at the last attempt — so it is
    NOT MEASURED locally, and CI's Lint & Repo Gates runs the farm regardless. What was
    measured instead, with the three things a narrowing owes:
    1. the population is read from ESLint's own configuration (calculateConfigForFile
      plus isPathIgnored over every tracked file, no rule executed): 5,749 files, and
      both changed TS files are members;
    2. the narrowed run's file count comes from --format json:
      eslint --no-inline-config --format json on the two changed TS files reports
      2 files, 0 errors, 0 warnings, exit 0;
    3. the config is not type-awareeslint.config.mjs states it in its own words,
      "no parserOptions.project, no typed @typescript-eslint rules" — so this diff
      cannot move the verdict on any file it does not contain. The changeset .md is
      outside the population by ESLint's own config, not by assumption.

Scope

packages/runtime/src/app-plugin.ts plus its new pin and the changeset — three files,
nothing else. content/docs/automation/jobs.mdx, content/docs/releases/**, docs/adr/**
and the other governed surfaces are untouched, and none of the packages/runtime files
fenced as held by other in-flight branches was edited.

⛔ Draft on purpose: the PM seat lands it. Not flipped ready, no auto-merge.

🤖 Generated with Claude Code

https://claude.ai/code/session_016yfqQh2dBgPAymYd7xipza

Generated by Claude Code


Generated by Claude Code

Red-first: this regression test fails against the discarding `await` in
AppPlugin's declarative-job wrapper. A declarative job resolving
`{ outcome: 'degraded', reason }` must land a `sys_job_run.status` distinct
from `success`, driven through the real `DbJobAdapter` over a real ObjectQL
engine carrying the real `sys_job` / `sys_job_run` declarations.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016yfqQh2dBgPAymYd7xipza
)
AppPlugin's declarative-job wrapper awaited the bundle handler inside a
block-bodied arrow and returned nothing, so it was a `Promise<void>` whatever
the handler resolved. #6617's third outcome was therefore unreachable from
`defineJob`: a job that ran to completion while its work did not happen was
recorded as `success` with `reason` dropped, while all three shipped adapters
map a resolved `{ outcome: 'degraded' }` onto a run status distinct from it.
Also drops the read-refusal capture from the new pin's rig: measured on the red
run, no path in that file provokes the tenancy probe, and a capture nothing
provokes asserts a mute.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016yfqQh2dBgPAymYd7xipza
@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

Nothing in this diff resolved to a documentable surface (no symbol, route or SDK anchor derived from 1 changed package(s)), so this run has no opinion about the docs.

What this run could not see
  • 1 name(s) were too generic to anchor anything (single lowercase words)
  • 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 — 24 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 b474c38c8db0dd64572d0a076d94ade39d594c09packageMentionDocs.

@github-actionsgithub-actionsBot added documentation Improvements or additions to documentation tests tooling labels Sep 2, 2026
@os-trump
os-trump marked this pull request as ready for review September 2, 2026 20:15
@os-trump
os-trump added this pull request to the merge queueSep 2, 2026
Merged via the queue into main with commit e755295Sep 2, 2026
35 checks passed
@os-trump
os-trump deleted the claude/issue-14256-declarative-job-outcome branch September 2, 2026 21:14
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.

AppPlugin's declarative-job wrapper discards the handler's JobRunOutcome, so defineJob cannot report a degraded run

2 participants

@os-trump@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

fix(runtime): return the declarative job handler's JobRunOutcome so a degraded run is recorded - #14711

Merged
os-trump merged 3 commits into
mainfrom
claude/issue-14256-declarative-job-outcome
Sep 2, 2026
Merged

fix(runtime): return the declarative job handler's JobRunOutcome so a degraded run is recorded#14711
os-trump merged 3 commits into
mainfrom
claude/issue-14256-declarative-job-outcome

Conversation

@os-trump

Copy link
Copy Markdown
Collaborator

Fixes#14256

AppPlugin's declarative-job registration block handed IJobService.schedule a
block-bodied arrow that awaited the bundle handler and returned nothing, so the wrapper
resolved undefined whatever the handler resolved. JobHandler has been declared as
resolving either void or a JobRunOutcome since #6617, and all three shipped adapters
(cron-job-adapter, interval-job-adapter, db-job-adapter) map a resolved
{ outcome: 'degraded', reason } onto a run status distinct from success — they simply
never received the value on this path. The reporter's probe, driven through an
IJobService typed only at the contract:

HANDLER RESOLVED: {"outcome":"degraded","reason":"STORE_UNAVAILABLE"}
WRAPPER RESOLVED: undefined

So a declarative job that ran to completion while its work did not happen (store
unavailable, zero rows matched) was recorded as success with reason dropped, and the
three-outcome table in content/docs/automation/jobs.mdx — the page whose whole subject
is the declarative door — was false on exactly that door. The imperative route (a handler
registered straight on IJobService.schedule) was unaffected throughout; the wrapper is
the whole defect. Per the card, the page is deliberately left alone: the code is the
honest repair.

The change

packages/runtime/src/app-plugin.tsreturn await handler(jobContext); in place of
the discarding await, with a comment naming why the value is load-bearing. That is the
whole production diff.

The deliverable: the regression test

packages/runtime/src/app-plugin.job-degraded-outcome.test.ts (6 cases) pins the
consequence, not the repair. It boots a real ObjectQL engine over the migrated
sqlite :memory: backend carrying the realsys_job / sys_job_run declarations,
registers the job through AppPlugin from a defineStack-shaped bundle, and runs it the
way the scheduler does — DbJobAdapter.trigger, never a direct handler call. Every
primary assertion reads the persisted cell:

  • sys_job_run.status asserted not to be success first (the card's own wording, and
    the contract's), then to be degraded, with the reason in error;
  • the mirror onto sys_job.last_status / last_error, with failure_count flat —
    degraded is not a failure and never retries;
  • the same through the { handler, effect } function form.

Kept in packages/runtime rather than packages/services/service-job: the defect is in
AppPlugin, and @objectstack/service-job is already a devDependency of
@objectstack/runtime and is aliased to source by that package's vitest.config.ts, so
the recording adapter is reachable from the package that owns the bug. Driving the real
engine (rather than a recording double) also proves the status the adapter writes is a
value the enforced sys_job_run.statusField.select vocabulary accepts, and it adds no
engine double to the check:engine-double-contract ledger.

Two in-suite controls keep the assertion honest, plus one corroborating middle term:

  • imperative route — the same degraded handler registered straight on
    IJobService.schedule records degraded with no AppPlugin in the path. Green before
    this change and green after, so a red on the declarative cases localises to the wrapper
    rather than to DbJobAdapter or the sys_job_run write;
  • additivity — a handler resolving nothing still lands success, which is also what
    rules out the rig writing degraded unconditionally;
  • middle term — the wrapper handed to a contract-typed recording IJobService
    resolves the handler's outcome. Corroboration only: on its own it would re-state the
    repair rather than pin its consequence.

The rig deliberately installs no expected-read-refusal capture: measured on the red
run, every read in the file carries isSystem, the tenancy probe never fires, and neither
refusal channel emits a frame — a capture nothing provokes would assert a mute.

Red-first, with the mutation and the restore both proven

Ablation run from the committed state, as one script holding the shared verify lock, with
a trap … EXIT INT TERM on an absolute path:

HEAD blob for packages/runtime/src/app-plugin.ts: 76c425968283051117c01f9cd07e115de8945491
PRECONDITION: packages/runtime/dist absent => the pin's relative './app-plugin.js' import
resolves to SOURCE; no rebuild leg applies
REMOVED TEXT 'return await handler(jobContext);' : 1 -> 0
INJECTED TEXT bare 'await handler(jobContext);' : 0 -> 1
blob after mutation: 82098e0cc683fca2864d63aefd1b73c019bce3f6
MUTATION CONFIRMED ON DISK
ABLATION VITEST EXIT: 1
Test Files 1 failed (1)
Tests 4 failed | 2 passed (6)
x lands `sys_job_run.status` distinct from `success`, with the reason in `error`
x mirrors onto `sys_job.last_status` and leaves `failure_count` flat
x carries the outcome for the `{ handler, effect }` function form too
x the middle term: the wrapper AppPlugin hands `schedule` resolves the handler's outcome
blob after restore : 76c425968283051117c01f9cd07e115de8945491
RESTORE CONFIRMED: blob identical to HEAD, git diff HEAD empty, git status clean
ABLATION VERDICT: RED as required

The mutation is proven by content — the removed text counted to zero and the injected
text counted to one, separately — never by an editor's exit code; the restore is proven by
blob identity against the HEAD blob plus an empty git diff HEAD and a clean
git status --porcelain. The split is the part that matters: the four cases that go red
are the declarative ones, while both controls stay green under the same mutation. No
rebuild leg applies — the mutated file is imported relatively by the pin, so vitest reads
source, and packages/runtime/dist was absent at the time (asserted in the run above).

Green after the fix: Test Files 1 passed (1) · Tests 6 passed (6).

Verification

Everything below ran on the final tree, git rev-parse --short HEAD = 0f4a80ee47, after
merging origin/main and re-deriving.

  • Gate union derived with
    node scripts/pm/dispatch-gates.mjs --repo objectstack-ai/objectstack --commands. The
    first derivation reported a stale tree, so origin/main was merged, the install and the
    dependency closure refreshed, and it was re-derived on the merged tree — 36 commands,
    the same list. Each ran with its exit captured before any pipe
    (cmd > log 2>&1; EXIT=$?): 32 exit 0.
  • 4 are NOT MEASURED, quoted in their own words, and reported as neither a pass nor a
    red: check-test-completeness — "There is no local log to hand it, so the local reading
    for this gate is NOT MEASURED"; check-half-states — "Nothing was swept … it is no
    reading at all" (this session's repo-scoped REST reads answer 403);
    check:dual-build-cjs-loads — "PREREQUISITE NOT MET — this gate reads built output, and
    some package has no dist/"; check:type-check-debt — "PREREQUISITE NOT MET … 26
    workspace dependenc(ies) of the ledgered packages have no built type entry point on
    disk". All four want a full-workspace build, which CI performs.
  • Package test tier: pnpm --filter @objectstack/runtime test
    Test Files 210 passed (210) · Tests 3085 passed (3085), VERDICT command-exit 0 from
    the shared verify lock.
  • Package typecheck: pnpm --filter @objectstack/runtime typecheck — exit 0. ⚠️ Read
    narrowly: that script is tsc --noEmit over a tsconfig.json that excludes
    **/*.test.ts, so it covers app-plugin.ts and says nothing about the new test
    file. Confirmed with --listFiles: app-plugin.ts present, the test file absent.
    Compiled separately under the package's own options with tests included, the new file
    reports zero errors (the package's pre-existing test-layer errors are the subject of
    the standing finding [finding] packages/runtime type-checks none of its 208 test files — tsconfig excludes **/*.test.ts and no test-typecheck wiring exists #14504 and are untouched here).
  • Lint — a DECLARED NARROWING. Whole-repo pnpm lint was attempted through the shared
    verify lock three times and returned exit 99 (queue-timeout, "never acquired") every
    time, holder pid 2524 from another dev's run, held 755s at the last attempt — so it is
    NOT MEASURED locally, and CI's Lint & Repo Gates runs the farm regardless. What was
    measured instead, with the three things a narrowing owes:
    1. the population is read from ESLint's own configuration (calculateConfigForFile
      plus isPathIgnored over every tracked file, no rule executed): 5,749 files, and
      both changed TS files are members;
    2. the narrowed run's file count comes from --format json:
      eslint --no-inline-config --format json on the two changed TS files reports
      2 files, 0 errors, 0 warnings, exit 0;
    3. the config is not type-awareeslint.config.mjs states it in its own words,
      "no parserOptions.project, no typed @typescript-eslint rules" — so this diff
      cannot move the verdict on any file it does not contain. The changeset .md is
      outside the population by ESLint's own config, not by assumption.

Scope

packages/runtime/src/app-plugin.ts plus its new pin and the changeset — three files,
nothing else. content/docs/automation/jobs.mdx, content/docs/releases/**, docs/adr/**
and the other governed surfaces are untouched, and none of the packages/runtime files
fenced as held by other in-flight branches was edited.

⛔ Draft on purpose: the PM seat lands it. Not flipped ready, no auto-merge.

🤖 Generated with Claude Code

https://claude.ai/code/session_016yfqQh2dBgPAymYd7xipza

Generated by Claude Code


Generated by Claude Code

Red-first: this regression test fails against the discarding `await` in
AppPlugin's declarative-job wrapper. A declarative job resolving
`{ outcome: 'degraded', reason }` must land a `sys_job_run.status` distinct
from `success`, driven through the real `DbJobAdapter` over a real ObjectQL
engine carrying the real `sys_job` / `sys_job_run` declarations.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016yfqQh2dBgPAymYd7xipza
)
AppPlugin's declarative-job wrapper awaited the bundle handler inside a
block-bodied arrow and returned nothing, so it was a `Promise<void>` whatever
the handler resolved. #6617's third outcome was therefore unreachable from
`defineJob`: a job that ran to completion while its work did not happen was
recorded as `success` with `reason` dropped, while all three shipped adapters
map a resolved `{ outcome: 'degraded' }` onto a run status distinct from it.
Also drops the read-refusal capture from the new pin's rig: measured on the red
run, no path in that file provokes the tenancy probe, and a capture nothing
provokes asserts a mute.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016yfqQh2dBgPAymYd7xipza
@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

Nothing in this diff resolved to a documentable surface (no symbol, route or SDK anchor derived from 1 changed package(s)), so this run has no opinion about the docs.

What this run could not see
  • 1 name(s) were too generic to anchor anything (single lowercase words)
  • 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 — 24 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 b474c38c8db0dd64572d0a076d94ade39d594c09packageMentionDocs.

@github-actionsgithub-actionsBot added documentation Improvements or additions to documentation tests tooling labels Sep 2, 2026
@os-trump
os-trump marked this pull request as ready for review September 2, 2026 20:15
@os-trump
os-trump added this pull request to the merge queueSep 2, 2026
Merged via the queue into main with commit e755295Sep 2, 2026
35 checks passed
@os-trump
os-trump deleted the claude/issue-14256-declarative-job-outcome branch September 2, 2026 21:14
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.

AppPlugin's declarative-job wrapper discards the handler's JobRunOutcome, so defineJob cannot report a degraded run

2 participants

@os-trump@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

fix(runtime): return the declarative job handler's JobRunOutcome so a degraded run is recorded - #14711

Merged
os-trump merged 3 commits into
mainfrom
claude/issue-14256-declarative-job-outcome
Sep 2, 2026
Merged

fix(runtime): return the declarative job handler's JobRunOutcome so a degraded run is recorded#14711
os-trump merged 3 commits into
mainfrom
claude/issue-14256-declarative-job-outcome

Conversation

@os-trump

Copy link
Copy Markdown
Collaborator

Fixes#14256

AppPlugin's declarative-job registration block handed IJobService.schedule a
block-bodied arrow that awaited the bundle handler and returned nothing, so the wrapper
resolved undefined whatever the handler resolved. JobHandler has been declared as
resolving either void or a JobRunOutcome since #6617, and all three shipped adapters
(cron-job-adapter, interval-job-adapter, db-job-adapter) map a resolved
{ outcome: 'degraded', reason } onto a run status distinct from success — they simply
never received the value on this path. The reporter's probe, driven through an
IJobService typed only at the contract:

HANDLER RESOLVED: {"outcome":"degraded","reason":"STORE_UNAVAILABLE"}
WRAPPER RESOLVED: undefined

So a declarative job that ran to completion while its work did not happen (store
unavailable, zero rows matched) was recorded as success with reason dropped, and the
three-outcome table in content/docs/automation/jobs.mdx — the page whose whole subject
is the declarative door — was false on exactly that door. The imperative route (a handler
registered straight on IJobService.schedule) was unaffected throughout; the wrapper is
the whole defect. Per the card, the page is deliberately left alone: the code is the
honest repair.

The change

packages/runtime/src/app-plugin.tsreturn await handler(jobContext); in place of
the discarding await, with a comment naming why the value is load-bearing. That is the
whole production diff.

The deliverable: the regression test

packages/runtime/src/app-plugin.job-degraded-outcome.test.ts (6 cases) pins the
consequence, not the repair. It boots a real ObjectQL engine over the migrated
sqlite :memory: backend carrying the realsys_job / sys_job_run declarations,
registers the job through AppPlugin from a defineStack-shaped bundle, and runs it the
way the scheduler does — DbJobAdapter.trigger, never a direct handler call. Every
primary assertion reads the persisted cell:

  • sys_job_run.status asserted not to be success first (the card's own wording, and
    the contract's), then to be degraded, with the reason in error;
  • the mirror onto sys_job.last_status / last_error, with failure_count flat —
    degraded is not a failure and never retries;
  • the same through the { handler, effect } function form.

Kept in packages/runtime rather than packages/services/service-job: the defect is in
AppPlugin, and @objectstack/service-job is already a devDependency of
@objectstack/runtime and is aliased to source by that package's vitest.config.ts, so
the recording adapter is reachable from the package that owns the bug. Driving the real
engine (rather than a recording double) also proves the status the adapter writes is a
value the enforced sys_job_run.statusField.select vocabulary accepts, and it adds no
engine double to the check:engine-double-contract ledger.

Two in-suite controls keep the assertion honest, plus one corroborating middle term:

  • imperative route — the same degraded handler registered straight on
    IJobService.schedule records degraded with no AppPlugin in the path. Green before
    this change and green after, so a red on the declarative cases localises to the wrapper
    rather than to DbJobAdapter or the sys_job_run write;
  • additivity — a handler resolving nothing still lands success, which is also what
    rules out the rig writing degraded unconditionally;
  • middle term — the wrapper handed to a contract-typed recording IJobService
    resolves the handler's outcome. Corroboration only: on its own it would re-state the
    repair rather than pin its consequence.

The rig deliberately installs no expected-read-refusal capture: measured on the red
run, every read in the file carries isSystem, the tenancy probe never fires, and neither
refusal channel emits a frame — a capture nothing provokes would assert a mute.

Red-first, with the mutation and the restore both proven

Ablation run from the committed state, as one script holding the shared verify lock, with
a trap … EXIT INT TERM on an absolute path:

HEAD blob for packages/runtime/src/app-plugin.ts: 76c425968283051117c01f9cd07e115de8945491
PRECONDITION: packages/runtime/dist absent => the pin's relative './app-plugin.js' import
resolves to SOURCE; no rebuild leg applies
REMOVED TEXT 'return await handler(jobContext);' : 1 -> 0
INJECTED TEXT bare 'await handler(jobContext);' : 0 -> 1
blob after mutation: 82098e0cc683fca2864d63aefd1b73c019bce3f6
MUTATION CONFIRMED ON DISK
ABLATION VITEST EXIT: 1
Test Files 1 failed (1)
Tests 4 failed | 2 passed (6)
x lands `sys_job_run.status` distinct from `success`, with the reason in `error`
x mirrors onto `sys_job.last_status` and leaves `failure_count` flat
x carries the outcome for the `{ handler, effect }` function form too
x the middle term: the wrapper AppPlugin hands `schedule` resolves the handler's outcome
blob after restore : 76c425968283051117c01f9cd07e115de8945491
RESTORE CONFIRMED: blob identical to HEAD, git diff HEAD empty, git status clean
ABLATION VERDICT: RED as required

The mutation is proven by content — the removed text counted to zero and the injected
text counted to one, separately — never by an editor's exit code; the restore is proven by
blob identity against the HEAD blob plus an empty git diff HEAD and a clean
git status --porcelain. The split is the part that matters: the four cases that go red
are the declarative ones, while both controls stay green under the same mutation. No
rebuild leg applies — the mutated file is imported relatively by the pin, so vitest reads
source, and packages/runtime/dist was absent at the time (asserted in the run above).

Green after the fix: Test Files 1 passed (1) · Tests 6 passed (6).

Verification

Everything below ran on the final tree, git rev-parse --short HEAD = 0f4a80ee47, after
merging origin/main and re-deriving.

  • Gate union derived with
    node scripts/pm/dispatch-gates.mjs --repo objectstack-ai/objectstack --commands. The
    first derivation reported a stale tree, so origin/main was merged, the install and the
    dependency closure refreshed, and it was re-derived on the merged tree — 36 commands,
    the same list. Each ran with its exit captured before any pipe
    (cmd > log 2>&1; EXIT=$?): 32 exit 0.
  • 4 are NOT MEASURED, quoted in their own words, and reported as neither a pass nor a
    red: check-test-completeness — "There is no local log to hand it, so the local reading
    for this gate is NOT MEASURED"; check-half-states — "Nothing was swept … it is no
    reading at all" (this session's repo-scoped REST reads answer 403);
    check:dual-build-cjs-loads — "PREREQUISITE NOT MET — this gate reads built output, and
    some package has no dist/"; check:type-check-debt — "PREREQUISITE NOT MET … 26
    workspace dependenc(ies) of the ledgered packages have no built type entry point on
    disk". All four want a full-workspace build, which CI performs.
  • Package test tier: pnpm --filter @objectstack/runtime test
    Test Files 210 passed (210) · Tests 3085 passed (3085), VERDICT command-exit 0 from
    the shared verify lock.
  • Package typecheck: pnpm --filter @objectstack/runtime typecheck — exit 0. ⚠️ Read
    narrowly: that script is tsc --noEmit over a tsconfig.json that excludes
    **/*.test.ts, so it covers app-plugin.ts and says nothing about the new test
    file. Confirmed with --listFiles: app-plugin.ts present, the test file absent.
    Compiled separately under the package's own options with tests included, the new file
    reports zero errors (the package's pre-existing test-layer errors are the subject of
    the standing finding [finding] packages/runtime type-checks none of its 208 test files — tsconfig excludes **/*.test.ts and no test-typecheck wiring exists #14504 and are untouched here).
  • Lint — a DECLARED NARROWING. Whole-repo pnpm lint was attempted through the shared
    verify lock three times and returned exit 99 (queue-timeout, "never acquired") every
    time, holder pid 2524 from another dev's run, held 755s at the last attempt — so it is
    NOT MEASURED locally, and CI's Lint & Repo Gates runs the farm regardless. What was
    measured instead, with the three things a narrowing owes:
    1. the population is read from ESLint's own configuration (calculateConfigForFile
      plus isPathIgnored over every tracked file, no rule executed): 5,749 files, and
      both changed TS files are members;
    2. the narrowed run's file count comes from --format json:
      eslint --no-inline-config --format json on the two changed TS files reports
      2 files, 0 errors, 0 warnings, exit 0;
    3. the config is not type-awareeslint.config.mjs states it in its own words,
      "no parserOptions.project, no typed @typescript-eslint rules" — so this diff
      cannot move the verdict on any file it does not contain. The changeset .md is
      outside the population by ESLint's own config, not by assumption.

Scope

packages/runtime/src/app-plugin.ts plus its new pin and the changeset — three files,
nothing else. content/docs/automation/jobs.mdx, content/docs/releases/**, docs/adr/**
and the other governed surfaces are untouched, and none of the packages/runtime files
fenced as held by other in-flight branches was edited.

⛔ Draft on purpose: the PM seat lands it. Not flipped ready, no auto-merge.

🤖 Generated with Claude Code

https://claude.ai/code/session_016yfqQh2dBgPAymYd7xipza

Generated by Claude Code


Generated by Claude Code

Red-first: this regression test fails against the discarding `await` in
AppPlugin's declarative-job wrapper. A declarative job resolving
`{ outcome: 'degraded', reason }` must land a `sys_job_run.status` distinct
from `success`, driven through the real `DbJobAdapter` over a real ObjectQL
engine carrying the real `sys_job` / `sys_job_run` declarations.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016yfqQh2dBgPAymYd7xipza
)
AppPlugin's declarative-job wrapper awaited the bundle handler inside a
block-bodied arrow and returned nothing, so it was a `Promise<void>` whatever
the handler resolved. #6617's third outcome was therefore unreachable from
`defineJob`: a job that ran to completion while its work did not happen was
recorded as `success` with `reason` dropped, while all three shipped adapters
map a resolved `{ outcome: 'degraded' }` onto a run status distinct from it.
Also drops the read-refusal capture from the new pin's rig: measured on the red
run, no path in that file provokes the tenancy probe, and a capture nothing
provokes asserts a mute.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016yfqQh2dBgPAymYd7xipza
@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

Nothing in this diff resolved to a documentable surface (no symbol, route or SDK anchor derived from 1 changed package(s)), so this run has no opinion about the docs.

What this run could not see
  • 1 name(s) were too generic to anchor anything (single lowercase words)
  • 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 — 24 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 b474c38c8db0dd64572d0a076d94ade39d594c09packageMentionDocs.

@github-actionsgithub-actionsBot added documentation Improvements or additions to documentation tests tooling labels Sep 2, 2026
@os-trump
os-trump marked this pull request as ready for review September 2, 2026 20:15
@os-trump
os-trump added this pull request to the merge queueSep 2, 2026
Merged via the queue into main with commit e755295Sep 2, 2026
35 checks passed
@os-trump
os-trump deleted the claude/issue-14256-declarative-job-outcome branch September 2, 2026 21:14
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.

AppPlugin's declarative-job wrapper discards the handler's JobRunOutcome, so defineJob cannot report a degraded run

2 participants

@os-trump@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

fix(runtime): return the declarative job handler's JobRunOutcome so a degraded run is recorded - #14711

Merged
os-trump merged 3 commits into
mainfrom
claude/issue-14256-declarative-job-outcome
Sep 2, 2026
Merged

fix(runtime): return the declarative job handler's JobRunOutcome so a degraded run is recorded#14711
os-trump merged 3 commits into
mainfrom
claude/issue-14256-declarative-job-outcome

Conversation

@os-trump

Copy link
Copy Markdown
Collaborator

Fixes#14256

AppPlugin's declarative-job registration block handed IJobService.schedule a
block-bodied arrow that awaited the bundle handler and returned nothing, so the wrapper
resolved undefined whatever the handler resolved. JobHandler has been declared as
resolving either void or a JobRunOutcome since #6617, and all three shipped adapters
(cron-job-adapter, interval-job-adapter, db-job-adapter) map a resolved
{ outcome: 'degraded', reason } onto a run status distinct from success — they simply
never received the value on this path. The reporter's probe, driven through an
IJobService typed only at the contract:

HANDLER RESOLVED: {"outcome":"degraded","reason":"STORE_UNAVAILABLE"}
WRAPPER RESOLVED: undefined

So a declarative job that ran to completion while its work did not happen (store
unavailable, zero rows matched) was recorded as success with reason dropped, and the
three-outcome table in content/docs/automation/jobs.mdx — the page whose whole subject
is the declarative door — was false on exactly that door. The imperative route (a handler
registered straight on IJobService.schedule) was unaffected throughout; the wrapper is
the whole defect. Per the card, the page is deliberately left alone: the code is the
honest repair.

The change

packages/runtime/src/app-plugin.tsreturn await handler(jobContext); in place of
the discarding await, with a comment naming why the value is load-bearing. That is the
whole production diff.

The deliverable: the regression test

packages/runtime/src/app-plugin.job-degraded-outcome.test.ts (6 cases) pins the
consequence, not the repair. It boots a real ObjectQL engine over the migrated
sqlite :memory: backend carrying the realsys_job / sys_job_run declarations,
registers the job through AppPlugin from a defineStack-shaped bundle, and runs it the
way the scheduler does — DbJobAdapter.trigger, never a direct handler call. Every
primary assertion reads the persisted cell:

  • sys_job_run.status asserted not to be success first (the card's own wording, and
    the contract's), then to be degraded, with the reason in error;
  • the mirror onto sys_job.last_status / last_error, with failure_count flat —
    degraded is not a failure and never retries;
  • the same through the { handler, effect } function form.

Kept in packages/runtime rather than packages/services/service-job: the defect is in
AppPlugin, and @objectstack/service-job is already a devDependency of
@objectstack/runtime and is aliased to source by that package's vitest.config.ts, so
the recording adapter is reachable from the package that owns the bug. Driving the real
engine (rather than a recording double) also proves the status the adapter writes is a
value the enforced sys_job_run.statusField.select vocabulary accepts, and it adds no
engine double to the check:engine-double-contract ledger.

Two in-suite controls keep the assertion honest, plus one corroborating middle term:

  • imperative route — the same degraded handler registered straight on
    IJobService.schedule records degraded with no AppPlugin in the path. Green before
    this change and green after, so a red on the declarative cases localises to the wrapper
    rather than to DbJobAdapter or the sys_job_run write;
  • additivity — a handler resolving nothing still lands success, which is also what
    rules out the rig writing degraded unconditionally;
  • middle term — the wrapper handed to a contract-typed recording IJobService
    resolves the handler's outcome. Corroboration only: on its own it would re-state the
    repair rather than pin its consequence.

The rig deliberately installs no expected-read-refusal capture: measured on the red
run, every read in the file carries isSystem, the tenancy probe never fires, and neither
refusal channel emits a frame — a capture nothing provokes would assert a mute.

Red-first, with the mutation and the restore both proven

Ablation run from the committed state, as one script holding the shared verify lock, with
a trap … EXIT INT TERM on an absolute path:

HEAD blob for packages/runtime/src/app-plugin.ts: 76c425968283051117c01f9cd07e115de8945491
PRECONDITION: packages/runtime/dist absent => the pin's relative './app-plugin.js' import
resolves to SOURCE; no rebuild leg applies
REMOVED TEXT 'return await handler(jobContext);' : 1 -> 0
INJECTED TEXT bare 'await handler(jobContext);' : 0 -> 1
blob after mutation: 82098e0cc683fca2864d63aefd1b73c019bce3f6
MUTATION CONFIRMED ON DISK
ABLATION VITEST EXIT: 1
Test Files 1 failed (1)
Tests 4 failed | 2 passed (6)
x lands `sys_job_run.status` distinct from `success`, with the reason in `error`
x mirrors onto `sys_job.last_status` and leaves `failure_count` flat
x carries the outcome for the `{ handler, effect }` function form too
x the middle term: the wrapper AppPlugin hands `schedule` resolves the handler's outcome
blob after restore : 76c425968283051117c01f9cd07e115de8945491
RESTORE CONFIRMED: blob identical to HEAD, git diff HEAD empty, git status clean
ABLATION VERDICT: RED as required

The mutation is proven by content — the removed text counted to zero and the injected
text counted to one, separately — never by an editor's exit code; the restore is proven by
blob identity against the HEAD blob plus an empty git diff HEAD and a clean
git status --porcelain. The split is the part that matters: the four cases that go red
are the declarative ones, while both controls stay green under the same mutation. No
rebuild leg applies — the mutated file is imported relatively by the pin, so vitest reads
source, and packages/runtime/dist was absent at the time (asserted in the run above).

Green after the fix: Test Files 1 passed (1) · Tests 6 passed (6).

Verification

Everything below ran on the final tree, git rev-parse --short HEAD = 0f4a80ee47, after
merging origin/main and re-deriving.

  • Gate union derived with
    node scripts/pm/dispatch-gates.mjs --repo objectstack-ai/objectstack --commands. The
    first derivation reported a stale tree, so origin/main was merged, the install and the
    dependency closure refreshed, and it was re-derived on the merged tree — 36 commands,
    the same list. Each ran with its exit captured before any pipe
    (cmd > log 2>&1; EXIT=$?): 32 exit 0.
  • 4 are NOT MEASURED, quoted in their own words, and reported as neither a pass nor a
    red: check-test-completeness — "There is no local log to hand it, so the local reading
    for this gate is NOT MEASURED"; check-half-states — "Nothing was swept … it is no
    reading at all" (this session's repo-scoped REST reads answer 403);
    check:dual-build-cjs-loads — "PREREQUISITE NOT MET — this gate reads built output, and
    some package has no dist/"; check:type-check-debt — "PREREQUISITE NOT MET … 26
    workspace dependenc(ies) of the ledgered packages have no built type entry point on
    disk". All four want a full-workspace build, which CI performs.
  • Package test tier: pnpm --filter @objectstack/runtime test
    Test Files 210 passed (210) · Tests 3085 passed (3085), VERDICT command-exit 0 from
    the shared verify lock.
  • Package typecheck: pnpm --filter @objectstack/runtime typecheck — exit 0. ⚠️ Read
    narrowly: that script is tsc --noEmit over a tsconfig.json that excludes
    **/*.test.ts, so it covers app-plugin.ts and says nothing about the new test
    file. Confirmed with --listFiles: app-plugin.ts present, the test file absent.
    Compiled separately under the package's own options with tests included, the new file
    reports zero errors (the package's pre-existing test-layer errors are the subject of
    the standing finding [finding] packages/runtime type-checks none of its 208 test files — tsconfig excludes **/*.test.ts and no test-typecheck wiring exists #14504 and are untouched here).
  • Lint — a DECLARED NARROWING. Whole-repo pnpm lint was attempted through the shared
    verify lock three times and returned exit 99 (queue-timeout, "never acquired") every
    time, holder pid 2524 from another dev's run, held 755s at the last attempt — so it is
    NOT MEASURED locally, and CI's Lint & Repo Gates runs the farm regardless. What was
    measured instead, with the three things a narrowing owes:
    1. the population is read from ESLint's own configuration (calculateConfigForFile
      plus isPathIgnored over every tracked file, no rule executed): 5,749 files, and
      both changed TS files are members;
    2. the narrowed run's file count comes from --format json:
      eslint --no-inline-config --format json on the two changed TS files reports
      2 files, 0 errors, 0 warnings, exit 0;
    3. the config is not type-awareeslint.config.mjs states it in its own words,
      "no parserOptions.project, no typed @typescript-eslint rules" — so this diff
      cannot move the verdict on any file it does not contain. The changeset .md is
      outside the population by ESLint's own config, not by assumption.

Scope

packages/runtime/src/app-plugin.ts plus its new pin and the changeset — three files,
nothing else. content/docs/automation/jobs.mdx, content/docs/releases/**, docs/adr/**
and the other governed surfaces are untouched, and none of the packages/runtime files
fenced as held by other in-flight branches was edited.

⛔ Draft on purpose: the PM seat lands it. Not flipped ready, no auto-merge.

🤖 Generated with Claude Code

https://claude.ai/code/session_016yfqQh2dBgPAymYd7xipza

Generated by Claude Code


Generated by Claude Code

Red-first: this regression test fails against the discarding `await` in
AppPlugin's declarative-job wrapper. A declarative job resolving
`{ outcome: 'degraded', reason }` must land a `sys_job_run.status` distinct
from `success`, driven through the real `DbJobAdapter` over a real ObjectQL
engine carrying the real `sys_job` / `sys_job_run` declarations.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016yfqQh2dBgPAymYd7xipza
)
AppPlugin's declarative-job wrapper awaited the bundle handler inside a
block-bodied arrow and returned nothing, so it was a `Promise<void>` whatever
the handler resolved. #6617's third outcome was therefore unreachable from
`defineJob`: a job that ran to completion while its work did not happen was
recorded as `success` with `reason` dropped, while all three shipped adapters
map a resolved `{ outcome: 'degraded' }` onto a run status distinct from it.
Also drops the read-refusal capture from the new pin's rig: measured on the red
run, no path in that file provokes the tenancy probe, and a capture nothing
provokes asserts a mute.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016yfqQh2dBgPAymYd7xipza
@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

Nothing in this diff resolved to a documentable surface (no symbol, route or SDK anchor derived from 1 changed package(s)), so this run has no opinion about the docs.

What this run could not see
  • 1 name(s) were too generic to anchor anything (single lowercase words)
  • 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 — 24 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 b474c38c8db0dd64572d0a076d94ade39d594c09packageMentionDocs.

@github-actionsgithub-actionsBot added documentation Improvements or additions to documentation tests tooling labels Sep 2, 2026
@os-trump
os-trump marked this pull request as ready for review September 2, 2026 20:15
@os-trump
os-trump added this pull request to the merge queueSep 2, 2026
Merged via the queue into main with commit e755295Sep 2, 2026
35 checks passed
@os-trump
os-trump deleted the claude/issue-14256-declarative-job-outcome branch September 2, 2026 21:14
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.

AppPlugin's declarative-job wrapper discards the handler's JobRunOutcome, so defineJob cannot report a degraded run

2 participants

@os-trump@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

fix(runtime): return the declarative job handler's JobRunOutcome so a degraded run is recorded - #14711

Merged
os-trump merged 3 commits into
mainfrom
claude/issue-14256-declarative-job-outcome
Sep 2, 2026
Merged

fix(runtime): return the declarative job handler's JobRunOutcome so a degraded run is recorded#14711
os-trump merged 3 commits into
mainfrom
claude/issue-14256-declarative-job-outcome

Conversation

@os-trump

Copy link
Copy Markdown
Collaborator

Fixes#14256

AppPlugin's declarative-job registration block handed IJobService.schedule a
block-bodied arrow that awaited the bundle handler and returned nothing, so the wrapper
resolved undefined whatever the handler resolved. JobHandler has been declared as
resolving either void or a JobRunOutcome since #6617, and all three shipped adapters
(cron-job-adapter, interval-job-adapter, db-job-adapter) map a resolved
{ outcome: 'degraded', reason } onto a run status distinct from success — they simply
never received the value on this path. The reporter's probe, driven through an
IJobService typed only at the contract:

HANDLER RESOLVED: {"outcome":"degraded","reason":"STORE_UNAVAILABLE"}
WRAPPER RESOLVED: undefined

So a declarative job that ran to completion while its work did not happen (store
unavailable, zero rows matched) was recorded as success with reason dropped, and the
three-outcome table in content/docs/automation/jobs.mdx — the page whose whole subject
is the declarative door — was false on exactly that door. The imperative route (a handler
registered straight on IJobService.schedule) was unaffected throughout; the wrapper is
the whole defect. Per the card, the page is deliberately left alone: the code is the
honest repair.

The change

packages/runtime/src/app-plugin.tsreturn await handler(jobContext); in place of
the discarding await, with a comment naming why the value is load-bearing. That is the
whole production diff.

The deliverable: the regression test

packages/runtime/src/app-plugin.job-degraded-outcome.test.ts (6 cases) pins the
consequence, not the repair. It boots a real ObjectQL engine over the migrated
sqlite :memory: backend carrying the realsys_job / sys_job_run declarations,
registers the job through AppPlugin from a defineStack-shaped bundle, and runs it the
way the scheduler does — DbJobAdapter.trigger, never a direct handler call. Every
primary assertion reads the persisted cell:

  • sys_job_run.status asserted not to be success first (the card's own wording, and
    the contract's), then to be degraded, with the reason in error;
  • the mirror onto sys_job.last_status / last_error, with failure_count flat —
    degraded is not a failure and never retries;
  • the same through the { handler, effect } function form.

Kept in packages/runtime rather than packages/services/service-job: the defect is in
AppPlugin, and @objectstack/service-job is already a devDependency of
@objectstack/runtime and is aliased to source by that package's vitest.config.ts, so
the recording adapter is reachable from the package that owns the bug. Driving the real
engine (rather than a recording double) also proves the status the adapter writes is a
value the enforced sys_job_run.statusField.select vocabulary accepts, and it adds no
engine double to the check:engine-double-contract ledger.

Two in-suite controls keep the assertion honest, plus one corroborating middle term:

  • imperative route — the same degraded handler registered straight on
    IJobService.schedule records degraded with no AppPlugin in the path. Green before
    this change and green after, so a red on the declarative cases localises to the wrapper
    rather than to DbJobAdapter or the sys_job_run write;
  • additivity — a handler resolving nothing still lands success, which is also what
    rules out the rig writing degraded unconditionally;
  • middle term — the wrapper handed to a contract-typed recording IJobService
    resolves the handler's outcome. Corroboration only: on its own it would re-state the
    repair rather than pin its consequence.

The rig deliberately installs no expected-read-refusal capture: measured on the red
run, every read in the file carries isSystem, the tenancy probe never fires, and neither
refusal channel emits a frame — a capture nothing provokes would assert a mute.

Red-first, with the mutation and the restore both proven

Ablation run from the committed state, as one script holding the shared verify lock, with
a trap … EXIT INT TERM on an absolute path:

HEAD blob for packages/runtime/src/app-plugin.ts: 76c425968283051117c01f9cd07e115de8945491
PRECONDITION: packages/runtime/dist absent => the pin's relative './app-plugin.js' import
resolves to SOURCE; no rebuild leg applies
REMOVED TEXT 'return await handler(jobContext);' : 1 -> 0
INJECTED TEXT bare 'await handler(jobContext);' : 0 -> 1
blob after mutation: 82098e0cc683fca2864d63aefd1b73c019bce3f6
MUTATION CONFIRMED ON DISK
ABLATION VITEST EXIT: 1
Test Files 1 failed (1)
Tests 4 failed | 2 passed (6)
x lands `sys_job_run.status` distinct from `success`, with the reason in `error`
x mirrors onto `sys_job.last_status` and leaves `failure_count` flat
x carries the outcome for the `{ handler, effect }` function form too
x the middle term: the wrapper AppPlugin hands `schedule` resolves the handler's outcome
blob after restore : 76c425968283051117c01f9cd07e115de8945491
RESTORE CONFIRMED: blob identical to HEAD, git diff HEAD empty, git status clean
ABLATION VERDICT: RED as required

The mutation is proven by content — the removed text counted to zero and the injected
text counted to one, separately — never by an editor's exit code; the restore is proven by
blob identity against the HEAD blob plus an empty git diff HEAD and a clean
git status --porcelain. The split is the part that matters: the four cases that go red
are the declarative ones, while both controls stay green under the same mutation. No
rebuild leg applies — the mutated file is imported relatively by the pin, so vitest reads
source, and packages/runtime/dist was absent at the time (asserted in the run above).

Green after the fix: Test Files 1 passed (1) · Tests 6 passed (6).

Verification

Everything below ran on the final tree, git rev-parse --short HEAD = 0f4a80ee47, after
merging origin/main and re-deriving.

  • Gate union derived with
    node scripts/pm/dispatch-gates.mjs --repo objectstack-ai/objectstack --commands. The
    first derivation reported a stale tree, so origin/main was merged, the install and the
    dependency closure refreshed, and it was re-derived on the merged tree — 36 commands,
    the same list. Each ran with its exit captured before any pipe
    (cmd > log 2>&1; EXIT=$?): 32 exit 0.
  • 4 are NOT MEASURED, quoted in their own words, and reported as neither a pass nor a
    red: check-test-completeness — "There is no local log to hand it, so the local reading
    for this gate is NOT MEASURED"; check-half-states — "Nothing was swept … it is no
    reading at all" (this session's repo-scoped REST reads answer 403);
    check:dual-build-cjs-loads — "PREREQUISITE NOT MET — this gate reads built output, and
    some package has no dist/"; check:type-check-debt — "PREREQUISITE NOT MET … 26
    workspace dependenc(ies) of the ledgered packages have no built type entry point on
    disk". All four want a full-workspace build, which CI performs.
  • Package test tier: pnpm --filter @objectstack/runtime test
    Test Files 210 passed (210) · Tests 3085 passed (3085), VERDICT command-exit 0 from
    the shared verify lock.
  • Package typecheck: pnpm --filter @objectstack/runtime typecheck — exit 0. ⚠️ Read
    narrowly: that script is tsc --noEmit over a tsconfig.json that excludes
    **/*.test.ts, so it covers app-plugin.ts and says nothing about the new test
    file. Confirmed with --listFiles: app-plugin.ts present, the test file absent.
    Compiled separately under the package's own options with tests included, the new file
    reports zero errors (the package's pre-existing test-layer errors are the subject of
    the standing finding [finding] packages/runtime type-checks none of its 208 test files — tsconfig excludes **/*.test.ts and no test-typecheck wiring exists #14504 and are untouched here).
  • Lint — a DECLARED NARROWING. Whole-repo pnpm lint was attempted through the shared
    verify lock three times and returned exit 99 (queue-timeout, "never acquired") every
    time, holder pid 2524 from another dev's run, held 755s at the last attempt — so it is
    NOT MEASURED locally, and CI's Lint & Repo Gates runs the farm regardless. What was
    measured instead, with the three things a narrowing owes:
    1. the population is read from ESLint's own configuration (calculateConfigForFile
      plus isPathIgnored over every tracked file, no rule executed): 5,749 files, and
      both changed TS files are members;
    2. the narrowed run's file count comes from --format json:
      eslint --no-inline-config --format json on the two changed TS files reports
      2 files, 0 errors, 0 warnings, exit 0;
    3. the config is not type-awareeslint.config.mjs states it in its own words,
      "no parserOptions.project, no typed @typescript-eslint rules" — so this diff
      cannot move the verdict on any file it does not contain. The changeset .md is
      outside the population by ESLint's own config, not by assumption.

Scope

packages/runtime/src/app-plugin.ts plus its new pin and the changeset — three files,
nothing else. content/docs/automation/jobs.mdx, content/docs/releases/**, docs/adr/**
and the other governed surfaces are untouched, and none of the packages/runtime files
fenced as held by other in-flight branches was edited.

⛔ Draft on purpose: the PM seat lands it. Not flipped ready, no auto-merge.

🤖 Generated with Claude Code

https://claude.ai/code/session_016yfqQh2dBgPAymYd7xipza

Generated by Claude Code


Generated by Claude Code

Red-first: this regression test fails against the discarding `await` in
AppPlugin's declarative-job wrapper. A declarative job resolving
`{ outcome: 'degraded', reason }` must land a `sys_job_run.status` distinct
from `success`, driven through the real `DbJobAdapter` over a real ObjectQL
engine carrying the real `sys_job` / `sys_job_run` declarations.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016yfqQh2dBgPAymYd7xipza
)
AppPlugin's declarative-job wrapper awaited the bundle handler inside a
block-bodied arrow and returned nothing, so it was a `Promise<void>` whatever
the handler resolved. #6617's third outcome was therefore unreachable from
`defineJob`: a job that ran to completion while its work did not happen was
recorded as `success` with `reason` dropped, while all three shipped adapters
map a resolved `{ outcome: 'degraded' }` onto a run status distinct from it.
Also drops the read-refusal capture from the new pin's rig: measured on the red
run, no path in that file provokes the tenancy probe, and a capture nothing
provokes asserts a mute.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016yfqQh2dBgPAymYd7xipza
@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

Nothing in this diff resolved to a documentable surface (no symbol, route or SDK anchor derived from 1 changed package(s)), so this run has no opinion about the docs.

What this run could not see
  • 1 name(s) were too generic to anchor anything (single lowercase words)
  • 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 — 24 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 b474c38c8db0dd64572d0a076d94ade39d594c09packageMentionDocs.

@github-actionsgithub-actionsBot added documentation Improvements or additions to documentation tests tooling labels Sep 2, 2026
@os-trump
os-trump marked this pull request as ready for review September 2, 2026 20:15
@os-trump
os-trump added this pull request to the merge queueSep 2, 2026
Merged via the queue into main with commit e755295Sep 2, 2026
35 checks passed
@os-trump
os-trump deleted the claude/issue-14256-declarative-job-outcome branch September 2, 2026 21:14
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.

AppPlugin's declarative-job wrapper discards the handler's JobRunOutcome, so defineJob cannot report a degraded run

2 participants

@os-trump@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

fix(runtime): return the declarative job handler's JobRunOutcome so a degraded run is recorded - #14711

Merged
os-trump merged 3 commits into
mainfrom
claude/issue-14256-declarative-job-outcome
Sep 2, 2026
Merged

fix(runtime): return the declarative job handler's JobRunOutcome so a degraded run is recorded#14711
os-trump merged 3 commits into
mainfrom
claude/issue-14256-declarative-job-outcome

Conversation

@os-trump

Copy link
Copy Markdown
Collaborator

Fixes#14256

AppPlugin's declarative-job registration block handed IJobService.schedule a
block-bodied arrow that awaited the bundle handler and returned nothing, so the wrapper
resolved undefined whatever the handler resolved. JobHandler has been declared as
resolving either void or a JobRunOutcome since #6617, and all three shipped adapters
(cron-job-adapter, interval-job-adapter, db-job-adapter) map a resolved
{ outcome: 'degraded', reason } onto a run status distinct from success — they simply
never received the value on this path. The reporter's probe, driven through an
IJobService typed only at the contract:

HANDLER RESOLVED: {"outcome":"degraded","reason":"STORE_UNAVAILABLE"}
WRAPPER RESOLVED: undefined

So a declarative job that ran to completion while its work did not happen (store
unavailable, zero rows matched) was recorded as success with reason dropped, and the
three-outcome table in content/docs/automation/jobs.mdx — the page whose whole subject
is the declarative door — was false on exactly that door. The imperative route (a handler
registered straight on IJobService.schedule) was unaffected throughout; the wrapper is
the whole defect. Per the card, the page is deliberately left alone: the code is the
honest repair.

The change

packages/runtime/src/app-plugin.tsreturn await handler(jobContext); in place of
the discarding await, with a comment naming why the value is load-bearing. That is the
whole production diff.

The deliverable: the regression test

packages/runtime/src/app-plugin.job-degraded-outcome.test.ts (6 cases) pins the
consequence, not the repair. It boots a real ObjectQL engine over the migrated
sqlite :memory: backend carrying the realsys_job / sys_job_run declarations,
registers the job through AppPlugin from a defineStack-shaped bundle, and runs it the
way the scheduler does — DbJobAdapter.trigger, never a direct handler call. Every
primary assertion reads the persisted cell:

  • sys_job_run.status asserted not to be success first (the card's own wording, and
    the contract's), then to be degraded, with the reason in error;
  • the mirror onto sys_job.last_status / last_error, with failure_count flat —
    degraded is not a failure and never retries;
  • the same through the { handler, effect } function form.

Kept in packages/runtime rather than packages/services/service-job: the defect is in
AppPlugin, and @objectstack/service-job is already a devDependency of
@objectstack/runtime and is aliased to source by that package's vitest.config.ts, so
the recording adapter is reachable from the package that owns the bug. Driving the real
engine (rather than a recording double) also proves the status the adapter writes is a
value the enforced sys_job_run.statusField.select vocabulary accepts, and it adds no
engine double to the check:engine-double-contract ledger.

Two in-suite controls keep the assertion honest, plus one corroborating middle term:

  • imperative route — the same degraded handler registered straight on
    IJobService.schedule records degraded with no AppPlugin in the path. Green before
    this change and green after, so a red on the declarative cases localises to the wrapper
    rather than to DbJobAdapter or the sys_job_run write;
  • additivity — a handler resolving nothing still lands success, which is also what
    rules out the rig writing degraded unconditionally;
  • middle term — the wrapper handed to a contract-typed recording IJobService
    resolves the handler's outcome. Corroboration only: on its own it would re-state the
    repair rather than pin its consequence.

The rig deliberately installs no expected-read-refusal capture: measured on the red
run, every read in the file carries isSystem, the tenancy probe never fires, and neither
refusal channel emits a frame — a capture nothing provokes would assert a mute.

Red-first, with the mutation and the restore both proven

Ablation run from the committed state, as one script holding the shared verify lock, with
a trap … EXIT INT TERM on an absolute path:

HEAD blob for packages/runtime/src/app-plugin.ts: 76c425968283051117c01f9cd07e115de8945491
PRECONDITION: packages/runtime/dist absent => the pin's relative './app-plugin.js' import
resolves to SOURCE; no rebuild leg applies
REMOVED TEXT 'return await handler(jobContext);' : 1 -> 0
INJECTED TEXT bare 'await handler(jobContext);' : 0 -> 1
blob after mutation: 82098e0cc683fca2864d63aefd1b73c019bce3f6
MUTATION CONFIRMED ON DISK
ABLATION VITEST EXIT: 1
Test Files 1 failed (1)
Tests 4 failed | 2 passed (6)
x lands `sys_job_run.status` distinct from `success`, with the reason in `error`
x mirrors onto `sys_job.last_status` and leaves `failure_count` flat
x carries the outcome for the `{ handler, effect }` function form too
x the middle term: the wrapper AppPlugin hands `schedule` resolves the handler's outcome
blob after restore : 76c425968283051117c01f9cd07e115de8945491
RESTORE CONFIRMED: blob identical to HEAD, git diff HEAD empty, git status clean
ABLATION VERDICT: RED as required

The mutation is proven by content — the removed text counted to zero and the injected
text counted to one, separately — never by an editor's exit code; the restore is proven by
blob identity against the HEAD blob plus an empty git diff HEAD and a clean
git status --porcelain. The split is the part that matters: the four cases that go red
are the declarative ones, while both controls stay green under the same mutation. No
rebuild leg applies — the mutated file is imported relatively by the pin, so vitest reads
source, and packages/runtime/dist was absent at the time (asserted in the run above).

Green after the fix: Test Files 1 passed (1) · Tests 6 passed (6).

Verification

Everything below ran on the final tree, git rev-parse --short HEAD = 0f4a80ee47, after
merging origin/main and re-deriving.

  • Gate union derived with
    node scripts/pm/dispatch-gates.mjs --repo objectstack-ai/objectstack --commands. The
    first derivation reported a stale tree, so origin/main was merged, the install and the
    dependency closure refreshed, and it was re-derived on the merged tree — 36 commands,
    the same list. Each ran with its exit captured before any pipe
    (cmd > log 2>&1; EXIT=$?): 32 exit 0.
  • 4 are NOT MEASURED, quoted in their own words, and reported as neither a pass nor a
    red: check-test-completeness — "There is no local log to hand it, so the local reading
    for this gate is NOT MEASURED"; check-half-states — "Nothing was swept … it is no
    reading at all" (this session's repo-scoped REST reads answer 403);
    check:dual-build-cjs-loads — "PREREQUISITE NOT MET — this gate reads built output, and
    some package has no dist/"; check:type-check-debt — "PREREQUISITE NOT MET … 26
    workspace dependenc(ies) of the ledgered packages have no built type entry point on
    disk". All four want a full-workspace build, which CI performs.
  • Package test tier: pnpm --filter @objectstack/runtime test
    Test Files 210 passed (210) · Tests 3085 passed (3085), VERDICT command-exit 0 from
    the shared verify lock.
  • Package typecheck: pnpm --filter @objectstack/runtime typecheck — exit 0. ⚠️ Read
    narrowly: that script is tsc --noEmit over a tsconfig.json that excludes
    **/*.test.ts, so it covers app-plugin.ts and says nothing about the new test
    file. Confirmed with --listFiles: app-plugin.ts present, the test file absent.
    Compiled separately under the package's own options with tests included, the new file
    reports zero errors (the package's pre-existing test-layer errors are the subject of
    the standing finding [finding] packages/runtime type-checks none of its 208 test files — tsconfig excludes **/*.test.ts and no test-typecheck wiring exists #14504 and are untouched here).
  • Lint — a DECLARED NARROWING. Whole-repo pnpm lint was attempted through the shared
    verify lock three times and returned exit 99 (queue-timeout, "never acquired") every
    time, holder pid 2524 from another dev's run, held 755s at the last attempt — so it is
    NOT MEASURED locally, and CI's Lint & Repo Gates runs the farm regardless. What was
    measured instead, with the three things a narrowing owes:
    1. the population is read from ESLint's own configuration (calculateConfigForFile
      plus isPathIgnored over every tracked file, no rule executed): 5,749 files, and
      both changed TS files are members;
    2. the narrowed run's file count comes from --format json:
      eslint --no-inline-config --format json on the two changed TS files reports
      2 files, 0 errors, 0 warnings, exit 0;
    3. the config is not type-awareeslint.config.mjs states it in its own words,
      "no parserOptions.project, no typed @typescript-eslint rules" — so this diff
      cannot move the verdict on any file it does not contain. The changeset .md is
      outside the population by ESLint's own config, not by assumption.

Scope

packages/runtime/src/app-plugin.ts plus its new pin and the changeset — three files,
nothing else. content/docs/automation/jobs.mdx, content/docs/releases/**, docs/adr/**
and the other governed surfaces are untouched, and none of the packages/runtime files
fenced as held by other in-flight branches was edited.

⛔ Draft on purpose: the PM seat lands it. Not flipped ready, no auto-merge.

🤖 Generated with Claude Code

https://claude.ai/code/session_016yfqQh2dBgPAymYd7xipza

Generated by Claude Code


Generated by Claude Code

Red-first: this regression test fails against the discarding `await` in
AppPlugin's declarative-job wrapper. A declarative job resolving
`{ outcome: 'degraded', reason }` must land a `sys_job_run.status` distinct
from `success`, driven through the real `DbJobAdapter` over a real ObjectQL
engine carrying the real `sys_job` / `sys_job_run` declarations.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016yfqQh2dBgPAymYd7xipza
)
AppPlugin's declarative-job wrapper awaited the bundle handler inside a
block-bodied arrow and returned nothing, so it was a `Promise<void>` whatever
the handler resolved. #6617's third outcome was therefore unreachable from
`defineJob`: a job that ran to completion while its work did not happen was
recorded as `success` with `reason` dropped, while all three shipped adapters
map a resolved `{ outcome: 'degraded' }` onto a run status distinct from it.
Also drops the read-refusal capture from the new pin's rig: measured on the red
run, no path in that file provokes the tenancy probe, and a capture nothing
provokes asserts a mute.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016yfqQh2dBgPAymYd7xipza
@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

Nothing in this diff resolved to a documentable surface (no symbol, route or SDK anchor derived from 1 changed package(s)), so this run has no opinion about the docs.

What this run could not see
  • 1 name(s) were too generic to anchor anything (single lowercase words)
  • 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 — 24 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 b474c38c8db0dd64572d0a076d94ade39d594c09packageMentionDocs.

@github-actionsgithub-actionsBot added documentation Improvements or additions to documentation tests tooling labels Sep 2, 2026
@os-trump
os-trump marked this pull request as ready for review September 2, 2026 20:15
@os-trump
os-trump added this pull request to the merge queueSep 2, 2026
Merged via the queue into main with commit e755295Sep 2, 2026
35 checks passed
@os-trump
os-trump deleted the claude/issue-14256-declarative-job-outcome branch September 2, 2026 21:14
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.

AppPlugin's declarative-job wrapper discards the handler's JobRunOutcome, so defineJob cannot report a degraded run

2 participants

@os-trump@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

fix(runtime): return the declarative job handler's JobRunOutcome so a degraded run is recorded - #14711

Merged
os-trump merged 3 commits into
mainfrom
claude/issue-14256-declarative-job-outcome
Sep 2, 2026
Merged

fix(runtime): return the declarative job handler's JobRunOutcome so a degraded run is recorded#14711
os-trump merged 3 commits into
mainfrom
claude/issue-14256-declarative-job-outcome

Conversation

@os-trump

Copy link
Copy Markdown
Collaborator

Fixes#14256

AppPlugin's declarative-job registration block handed IJobService.schedule a
block-bodied arrow that awaited the bundle handler and returned nothing, so the wrapper
resolved undefined whatever the handler resolved. JobHandler has been declared as
resolving either void or a JobRunOutcome since #6617, and all three shipped adapters
(cron-job-adapter, interval-job-adapter, db-job-adapter) map a resolved
{ outcome: 'degraded', reason } onto a run status distinct from success — they simply
never received the value on this path. The reporter's probe, driven through an
IJobService typed only at the contract:

HANDLER RESOLVED: {"outcome":"degraded","reason":"STORE_UNAVAILABLE"}
WRAPPER RESOLVED: undefined

So a declarative job that ran to completion while its work did not happen (store
unavailable, zero rows matched) was recorded as success with reason dropped, and the
three-outcome table in content/docs/automation/jobs.mdx — the page whose whole subject
is the declarative door — was false on exactly that door. The imperative route (a handler
registered straight on IJobService.schedule) was unaffected throughout; the wrapper is
the whole defect. Per the card, the page is deliberately left alone: the code is the
honest repair.

The change

packages/runtime/src/app-plugin.tsreturn await handler(jobContext); in place of
the discarding await, with a comment naming why the value is load-bearing. That is the
whole production diff.

The deliverable: the regression test

packages/runtime/src/app-plugin.job-degraded-outcome.test.ts (6 cases) pins the
consequence, not the repair. It boots a real ObjectQL engine over the migrated
sqlite :memory: backend carrying the realsys_job / sys_job_run declarations,
registers the job through AppPlugin from a defineStack-shaped bundle, and runs it the
way the scheduler does — DbJobAdapter.trigger, never a direct handler call. Every
primary assertion reads the persisted cell:

  • sys_job_run.status asserted not to be success first (the card's own wording, and
    the contract's), then to be degraded, with the reason in error;
  • the mirror onto sys_job.last_status / last_error, with failure_count flat —
    degraded is not a failure and never retries;
  • the same through the { handler, effect } function form.

Kept in packages/runtime rather than packages/services/service-job: the defect is in
AppPlugin, and @objectstack/service-job is already a devDependency of
@objectstack/runtime and is aliased to source by that package's vitest.config.ts, so
the recording adapter is reachable from the package that owns the bug. Driving the real
engine (rather than a recording double) also proves the status the adapter writes is a
value the enforced sys_job_run.statusField.select vocabulary accepts, and it adds no
engine double to the check:engine-double-contract ledger.

Two in-suite controls keep the assertion honest, plus one corroborating middle term:

  • imperative route — the same degraded handler registered straight on
    IJobService.schedule records degraded with no AppPlugin in the path. Green before
    this change and green after, so a red on the declarative cases localises to the wrapper
    rather than to DbJobAdapter or the sys_job_run write;
  • additivity — a handler resolving nothing still lands success, which is also what
    rules out the rig writing degraded unconditionally;
  • middle term — the wrapper handed to a contract-typed recording IJobService
    resolves the handler's outcome. Corroboration only: on its own it would re-state the
    repair rather than pin its consequence.

The rig deliberately installs no expected-read-refusal capture: measured on the red
run, every read in the file carries isSystem, the tenancy probe never fires, and neither
refusal channel emits a frame — a capture nothing provokes would assert a mute.

Red-first, with the mutation and the restore both proven

Ablation run from the committed state, as one script holding the shared verify lock, with
a trap … EXIT INT TERM on an absolute path:

HEAD blob for packages/runtime/src/app-plugin.ts: 76c425968283051117c01f9cd07e115de8945491
PRECONDITION: packages/runtime/dist absent => the pin's relative './app-plugin.js' import
resolves to SOURCE; no rebuild leg applies
REMOVED TEXT 'return await handler(jobContext);' : 1 -> 0
INJECTED TEXT bare 'await handler(jobContext);' : 0 -> 1
blob after mutation: 82098e0cc683fca2864d63aefd1b73c019bce3f6
MUTATION CONFIRMED ON DISK
ABLATION VITEST EXIT: 1
Test Files 1 failed (1)
Tests 4 failed | 2 passed (6)
x lands `sys_job_run.status` distinct from `success`, with the reason in `error`
x mirrors onto `sys_job.last_status` and leaves `failure_count` flat
x carries the outcome for the `{ handler, effect }` function form too
x the middle term: the wrapper AppPlugin hands `schedule` resolves the handler's outcome
blob after restore : 76c425968283051117c01f9cd07e115de8945491
RESTORE CONFIRMED: blob identical to HEAD, git diff HEAD empty, git status clean
ABLATION VERDICT: RED as required

The mutation is proven by content — the removed text counted to zero and the injected
text counted to one, separately — never by an editor's exit code; the restore is proven by
blob identity against the HEAD blob plus an empty git diff HEAD and a clean
git status --porcelain. The split is the part that matters: the four cases that go red
are the declarative ones, while both controls stay green under the same mutation. No
rebuild leg applies — the mutated file is imported relatively by the pin, so vitest reads
source, and packages/runtime/dist was absent at the time (asserted in the run above).

Green after the fix: Test Files 1 passed (1) · Tests 6 passed (6).

Verification

Everything below ran on the final tree, git rev-parse --short HEAD = 0f4a80ee47, after
merging origin/main and re-deriving.

  • Gate union derived with
    node scripts/pm/dispatch-gates.mjs --repo objectstack-ai/objectstack --commands. The
    first derivation reported a stale tree, so origin/main was merged, the install and the
    dependency closure refreshed, and it was re-derived on the merged tree — 36 commands,
    the same list. Each ran with its exit captured before any pipe
    (cmd > log 2>&1; EXIT=$?): 32 exit 0.
  • 4 are NOT MEASURED, quoted in their own words, and reported as neither a pass nor a
    red: check-test-completeness — "There is no local log to hand it, so the local reading
    for this gate is NOT MEASURED"; check-half-states — "Nothing was swept … it is no
    reading at all" (this session's repo-scoped REST reads answer 403);
    check:dual-build-cjs-loads — "PREREQUISITE NOT MET — this gate reads built output, and
    some package has no dist/"; check:type-check-debt — "PREREQUISITE NOT MET … 26
    workspace dependenc(ies) of the ledgered packages have no built type entry point on
    disk". All four want a full-workspace build, which CI performs.
  • Package test tier: pnpm --filter @objectstack/runtime test
    Test Files 210 passed (210) · Tests 3085 passed (3085), VERDICT command-exit 0 from
    the shared verify lock.
  • Package typecheck: pnpm --filter @objectstack/runtime typecheck — exit 0. ⚠️ Read
    narrowly: that script is tsc --noEmit over a tsconfig.json that excludes
    **/*.test.ts, so it covers app-plugin.ts and says nothing about the new test
    file. Confirmed with --listFiles: app-plugin.ts present, the test file absent.
    Compiled separately under the package's own options with tests included, the new file
    reports zero errors (the package's pre-existing test-layer errors are the subject of
    the standing finding [finding] packages/runtime type-checks none of its 208 test files — tsconfig excludes **/*.test.ts and no test-typecheck wiring exists #14504 and are untouched here).
  • Lint — a DECLARED NARROWING. Whole-repo pnpm lint was attempted through the shared
    verify lock three times and returned exit 99 (queue-timeout, "never acquired") every
    time, holder pid 2524 from another dev's run, held 755s at the last attempt — so it is
    NOT MEASURED locally, and CI's Lint & Repo Gates runs the farm regardless. What was
    measured instead, with the three things a narrowing owes:
    1. the population is read from ESLint's own configuration (calculateConfigForFile
      plus isPathIgnored over every tracked file, no rule executed): 5,749 files, and
      both changed TS files are members;
    2. the narrowed run's file count comes from --format json:
      eslint --no-inline-config --format json on the two changed TS files reports
      2 files, 0 errors, 0 warnings, exit 0;
    3. the config is not type-awareeslint.config.mjs states it in its own words,
      "no parserOptions.project, no typed @typescript-eslint rules" — so this diff
      cannot move the verdict on any file it does not contain. The changeset .md is
      outside the population by ESLint's own config, not by assumption.

Scope

packages/runtime/src/app-plugin.ts plus its new pin and the changeset — three files,
nothing else. content/docs/automation/jobs.mdx, content/docs/releases/**, docs/adr/**
and the other governed surfaces are untouched, and none of the packages/runtime files
fenced as held by other in-flight branches was edited.

⛔ Draft on purpose: the PM seat lands it. Not flipped ready, no auto-merge.

🤖 Generated with Claude Code

https://claude.ai/code/session_016yfqQh2dBgPAymYd7xipza

Generated by Claude Code


Generated by Claude Code

Red-first: this regression test fails against the discarding `await` in
AppPlugin's declarative-job wrapper. A declarative job resolving
`{ outcome: 'degraded', reason }` must land a `sys_job_run.status` distinct
from `success`, driven through the real `DbJobAdapter` over a real ObjectQL
engine carrying the real `sys_job` / `sys_job_run` declarations.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016yfqQh2dBgPAymYd7xipza
)
AppPlugin's declarative-job wrapper awaited the bundle handler inside a
block-bodied arrow and returned nothing, so it was a `Promise<void>` whatever
the handler resolved. #6617's third outcome was therefore unreachable from
`defineJob`: a job that ran to completion while its work did not happen was
recorded as `success` with `reason` dropped, while all three shipped adapters
map a resolved `{ outcome: 'degraded' }` onto a run status distinct from it.
Also drops the read-refusal capture from the new pin's rig: measured on the red
run, no path in that file provokes the tenancy probe, and a capture nothing
provokes asserts a mute.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016yfqQh2dBgPAymYd7xipza
@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

Nothing in this diff resolved to a documentable surface (no symbol, route or SDK anchor derived from 1 changed package(s)), so this run has no opinion about the docs.

What this run could not see
  • 1 name(s) were too generic to anchor anything (single lowercase words)
  • 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 — 24 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 b474c38c8db0dd64572d0a076d94ade39d594c09packageMentionDocs.

@github-actionsgithub-actionsBot added documentation Improvements or additions to documentation tests tooling labels Sep 2, 2026
@os-trump
os-trump marked this pull request as ready for review September 2, 2026 20:15
@os-trump
os-trump added this pull request to the merge queueSep 2, 2026
Merged via the queue into main with commit e755295Sep 2, 2026
35 checks passed
@os-trump
os-trump deleted the claude/issue-14256-declarative-job-outcome branch September 2, 2026 21:14
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.

AppPlugin's declarative-job wrapper discards the handler's JobRunOutcome, so defineJob cannot report a degraded run

2 participants

@os-trump@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

fix(runtime): return the declarative job handler's JobRunOutcome so a degraded run is recorded - #14711

Merged
os-trump merged 3 commits into
mainfrom
claude/issue-14256-declarative-job-outcome
Sep 2, 2026
Merged

fix(runtime): return the declarative job handler's JobRunOutcome so a degraded run is recorded#14711
os-trump merged 3 commits into
mainfrom
claude/issue-14256-declarative-job-outcome

Conversation

@os-trump

Copy link
Copy Markdown
Collaborator

Fixes#14256

AppPlugin's declarative-job registration block handed IJobService.schedule a
block-bodied arrow that awaited the bundle handler and returned nothing, so the wrapper
resolved undefined whatever the handler resolved. JobHandler has been declared as
resolving either void or a JobRunOutcome since #6617, and all three shipped adapters
(cron-job-adapter, interval-job-adapter, db-job-adapter) map a resolved
{ outcome: 'degraded', reason } onto a run status distinct from success — they simply
never received the value on this path. The reporter's probe, driven through an
IJobService typed only at the contract:

HANDLER RESOLVED: {"outcome":"degraded","reason":"STORE_UNAVAILABLE"}
WRAPPER RESOLVED: undefined

So a declarative job that ran to completion while its work did not happen (store
unavailable, zero rows matched) was recorded as success with reason dropped, and the
three-outcome table in content/docs/automation/jobs.mdx — the page whose whole subject
is the declarative door — was false on exactly that door. The imperative route (a handler
registered straight on IJobService.schedule) was unaffected throughout; the wrapper is
the whole defect. Per the card, the page is deliberately left alone: the code is the
honest repair.

The change

packages/runtime/src/app-plugin.tsreturn await handler(jobContext); in place of
the discarding await, with a comment naming why the value is load-bearing. That is the
whole production diff.

The deliverable: the regression test

packages/runtime/src/app-plugin.job-degraded-outcome.test.ts (6 cases) pins the
consequence, not the repair. It boots a real ObjectQL engine over the migrated
sqlite :memory: backend carrying the realsys_job / sys_job_run declarations,
registers the job through AppPlugin from a defineStack-shaped bundle, and runs it the
way the scheduler does — DbJobAdapter.trigger, never a direct handler call. Every
primary assertion reads the persisted cell:

  • sys_job_run.status asserted not to be success first (the card's own wording, and
    the contract's), then to be degraded, with the reason in error;
  • the mirror onto sys_job.last_status / last_error, with failure_count flat —
    degraded is not a failure and never retries;
  • the same through the { handler, effect } function form.

Kept in packages/runtime rather than packages/services/service-job: the defect is in
AppPlugin, and @objectstack/service-job is already a devDependency of
@objectstack/runtime and is aliased to source by that package's vitest.config.ts, so
the recording adapter is reachable from the package that owns the bug. Driving the real
engine (rather than a recording double) also proves the status the adapter writes is a
value the enforced sys_job_run.statusField.select vocabulary accepts, and it adds no
engine double to the check:engine-double-contract ledger.

Two in-suite controls keep the assertion honest, plus one corroborating middle term:

  • imperative route — the same degraded handler registered straight on
    IJobService.schedule records degraded with no AppPlugin in the path. Green before
    this change and green after, so a red on the declarative cases localises to the wrapper
    rather than to DbJobAdapter or the sys_job_run write;
  • additivity — a handler resolving nothing still lands success, which is also what
    rules out the rig writing degraded unconditionally;
  • middle term — the wrapper handed to a contract-typed recording IJobService
    resolves the handler's outcome. Corroboration only: on its own it would re-state the
    repair rather than pin its consequence.

The rig deliberately installs no expected-read-refusal capture: measured on the red
run, every read in the file carries isSystem, the tenancy probe never fires, and neither
refusal channel emits a frame — a capture nothing provokes would assert a mute.

Red-first, with the mutation and the restore both proven

Ablation run from the committed state, as one script holding the shared verify lock, with
a trap … EXIT INT TERM on an absolute path:

HEAD blob for packages/runtime/src/app-plugin.ts: 76c425968283051117c01f9cd07e115de8945491
PRECONDITION: packages/runtime/dist absent => the pin's relative './app-plugin.js' import
resolves to SOURCE; no rebuild leg applies
REMOVED TEXT 'return await handler(jobContext);' : 1 -> 0
INJECTED TEXT bare 'await handler(jobContext);' : 0 -> 1
blob after mutation: 82098e0cc683fca2864d63aefd1b73c019bce3f6
MUTATION CONFIRMED ON DISK
ABLATION VITEST EXIT: 1
Test Files 1 failed (1)
Tests 4 failed | 2 passed (6)
x lands `sys_job_run.status` distinct from `success`, with the reason in `error`
x mirrors onto `sys_job.last_status` and leaves `failure_count` flat
x carries the outcome for the `{ handler, effect }` function form too
x the middle term: the wrapper AppPlugin hands `schedule` resolves the handler's outcome
blob after restore : 76c425968283051117c01f9cd07e115de8945491
RESTORE CONFIRMED: blob identical to HEAD, git diff HEAD empty, git status clean
ABLATION VERDICT: RED as required

The mutation is proven by content — the removed text counted to zero and the injected
text counted to one, separately — never by an editor's exit code; the restore is proven by
blob identity against the HEAD blob plus an empty git diff HEAD and a clean
git status --porcelain. The split is the part that matters: the four cases that go red
are the declarative ones, while both controls stay green under the same mutation. No
rebuild leg applies — the mutated file is imported relatively by the pin, so vitest reads
source, and packages/runtime/dist was absent at the time (asserted in the run above).

Green after the fix: Test Files 1 passed (1) · Tests 6 passed (6).

Verification

Everything below ran on the final tree, git rev-parse --short HEAD = 0f4a80ee47, after
merging origin/main and re-deriving.

  • Gate union derived with
    node scripts/pm/dispatch-gates.mjs --repo objectstack-ai/objectstack --commands. The
    first derivation reported a stale tree, so origin/main was merged, the install and the
    dependency closure refreshed, and it was re-derived on the merged tree — 36 commands,
    the same list. Each ran with its exit captured before any pipe
    (cmd > log 2>&1; EXIT=$?): 32 exit 0.
  • 4 are NOT MEASURED, quoted in their own words, and reported as neither a pass nor a
    red: check-test-completeness — "There is no local log to hand it, so the local reading
    for this gate is NOT MEASURED"; check-half-states — "Nothing was swept … it is no
    reading at all" (this session's repo-scoped REST reads answer 403);
    check:dual-build-cjs-loads — "PREREQUISITE NOT MET — this gate reads built output, and
    some package has no dist/"; check:type-check-debt — "PREREQUISITE NOT MET … 26
    workspace dependenc(ies) of the ledgered packages have no built type entry point on
    disk". All four want a full-workspace build, which CI performs.
  • Package test tier: pnpm --filter @objectstack/runtime test
    Test Files 210 passed (210) · Tests 3085 passed (3085), VERDICT command-exit 0 from
    the shared verify lock.
  • Package typecheck: pnpm --filter @objectstack/runtime typecheck — exit 0. ⚠️ Read
    narrowly: that script is tsc --noEmit over a tsconfig.json that excludes
    **/*.test.ts, so it covers app-plugin.ts and says nothing about the new test
    file. Confirmed with --listFiles: app-plugin.ts present, the test file absent.
    Compiled separately under the package's own options with tests included, the new file
    reports zero errors (the package's pre-existing test-layer errors are the subject of
    the standing finding [finding] packages/runtime type-checks none of its 208 test files — tsconfig excludes **/*.test.ts and no test-typecheck wiring exists #14504 and are untouched here).
  • Lint — a DECLARED NARROWING. Whole-repo pnpm lint was attempted through the shared
    verify lock three times and returned exit 99 (queue-timeout, "never acquired") every
    time, holder pid 2524 from another dev's run, held 755s at the last attempt — so it is
    NOT MEASURED locally, and CI's Lint & Repo Gates runs the farm regardless. What was
    measured instead, with the three things a narrowing owes:
    1. the population is read from ESLint's own configuration (calculateConfigForFile
      plus isPathIgnored over every tracked file, no rule executed): 5,749 files, and
      both changed TS files are members;
    2. the narrowed run's file count comes from --format json:
      eslint --no-inline-config --format json on the two changed TS files reports
      2 files, 0 errors, 0 warnings, exit 0;
    3. the config is not type-awareeslint.config.mjs states it in its own words,
      "no parserOptions.project, no typed @typescript-eslint rules" — so this diff
      cannot move the verdict on any file it does not contain. The changeset .md is
      outside the population by ESLint's own config, not by assumption.

Scope

packages/runtime/src/app-plugin.ts plus its new pin and the changeset — three files,
nothing else. content/docs/automation/jobs.mdx, content/docs/releases/**, docs/adr/**
and the other governed surfaces are untouched, and none of the packages/runtime files
fenced as held by other in-flight branches was edited.

⛔ Draft on purpose: the PM seat lands it. Not flipped ready, no auto-merge.

🤖 Generated with Claude Code

https://claude.ai/code/session_016yfqQh2dBgPAymYd7xipza

Generated by Claude Code


Generated by Claude Code

Red-first: this regression test fails against the discarding `await` in
AppPlugin's declarative-job wrapper. A declarative job resolving
`{ outcome: 'degraded', reason }` must land a `sys_job_run.status` distinct
from `success`, driven through the real `DbJobAdapter` over a real ObjectQL
engine carrying the real `sys_job` / `sys_job_run` declarations.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016yfqQh2dBgPAymYd7xipza
)
AppPlugin's declarative-job wrapper awaited the bundle handler inside a
block-bodied arrow and returned nothing, so it was a `Promise<void>` whatever
the handler resolved. #6617's third outcome was therefore unreachable from
`defineJob`: a job that ran to completion while its work did not happen was
recorded as `success` with `reason` dropped, while all three shipped adapters
map a resolved `{ outcome: 'degraded' }` onto a run status distinct from it.
Also drops the read-refusal capture from the new pin's rig: measured on the red
run, no path in that file provokes the tenancy probe, and a capture nothing
provokes asserts a mute.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016yfqQh2dBgPAymYd7xipza
@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

Nothing in this diff resolved to a documentable surface (no symbol, route or SDK anchor derived from 1 changed package(s)), so this run has no opinion about the docs.

What this run could not see
  • 1 name(s) were too generic to anchor anything (single lowercase words)
  • 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 — 24 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 b474c38c8db0dd64572d0a076d94ade39d594c09packageMentionDocs.

@github-actionsgithub-actionsBot added documentation Improvements or additions to documentation tests tooling labels Sep 2, 2026
@os-trump
os-trump marked this pull request as ready for review September 2, 2026 20:15
@os-trump
os-trump added this pull request to the merge queueSep 2, 2026
Merged via the queue into main with commit e755295Sep 2, 2026
35 checks passed
@os-trump
os-trump deleted the claude/issue-14256-declarative-job-outcome branch September 2, 2026 21:14
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.

AppPlugin's declarative-job wrapper discards the handler's JobRunOutcome, so defineJob cannot report a degraded run

2 participants

@os-trump@claude