Skip to content

Commit 545757a

Browse files
committed
docs(spec): say a composed job counts per place reached; state the residual pair now refused
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01J8VVAkQeShvvgjVb5MsbLn
1 parent eb167c5 commit 545757a

4 files changed

Lines changed: 21 additions & 14 deletions

File tree

‎.changeset/compose-stacks-job-name-across-packages.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ Skills-docs: none — no skill teaches declaring one job name in two packages of
1313
**BREAKING** accept-set narrowing, shipped as `minor`.
1414

1515
- **Refused now, at composition (`STACK_CROSS_REFERENCE_INVALID`, 422), once the result carries `packages[]`.** One job name enabled in two package bodies, or in a package body and the residual (a top-level job no body declares: under `composeStacks(stacks, { manifest: 'preserve' })` an input with no `manifest`; under `'first'`, `'last'` or an index any top-level job beside an input that is itself a multi-package artifact). The boot's job binder schedules every job of an artifact by its bare name, whichever package declares it, and refuses a name two enabled jobs share, so none of them was scheduled (`NOT SCHEDULED` at `error`); the install-local door already refused such a package. The finding names every enabled job of the name: `Job 'crm_nightly' is declared enabled twice across the packages of one composed artifact: 'com.example.sales' (stack #0) jobs[0] and 'com.example.billing' (stack #1) jobs[0]. …`, a residual job marked `(the top level, outside every package body)`.
16-
- **Read as the binder reads it.** Enabled jobs only, by name; the residual is counted beyond the package bodies' flattened copies, never by content. Two residual jobs of one name stay the one-package finding (`Job 'NAME' is declared twice in \`jobs\``), as before.
16+
- **Read as the binder reads it.** Enabled jobs only, by name; each job counted once per place it is reached, so one job object that two inputs carry (a built stack shared by two compositions, or passed twice) is two jobs, as the binder binds both; the residual is counted beyond the package bodies' flattened copies, never by content.
17+
- **Also refused now: the residual's own pair beside a body job of that name.** Two residual jobs of one name are the one-package finding (`Job 'NAME' is declared twice in \`jobs\``), as before when no package body carries the name. When a body does carry it, the pair used to be read as that body's copies and composed; it is refused now, with the one-package wording, which counts a disabled job too. So is one job object reached twice in one holder.
1718
- **Unchanged.** A disabled twin composes (a disabled job is scheduled by nothing). A body job's own flattened copy is not a second job. Distinct job names compose. A flat composition (no `packages[]`) is one package and keeps its own finding.
1819
- **Installed artifacts.** An artifact built before this keeps loading; the binder still refuses the name at boot, naming every holder.
1920

‎packages/runtime/src/app-artifact-handlers.ts‎

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1393,14 +1393,16 @@ function describeJobRunForm(job: unknown): string {
13931393
* The holders the refusal names are every body declaring the name, and — when the artifact holds more jobs
13941394
* of the name than its bodies declare (the residual's own: a top-level job of an input with no `manifest`) —
13951395
* the artifact's top level outside every package body, as {@link jobNameRefusal} names it; an artifact
1396-
* without `packages[]` is its app's alone.
1397-
*
1398-
* `composeStacks` refuses the same set by the same reading (enabled jobs only, by name, the residual by count
1399-
* beyond the bodies' copies), so an artifact it built never reaches this refusal. This stays the backstop for
1400-
* an artifact no composition built: hand-written, or built before composition judged a shared job name. The refusal's
1401-
* `candidates` are every declaring body as a `package`, then the residual as `{ kind: 'residual', ownerId }`
1402-
* (the artifact's id), or the app itself for an artifact without `packages[]`. Each job is named by
1403-
* its run form. Counted by name, never by content: a conversion replays a body under its own version window.
1396+
* without `packages[]` is its app's alone. The refusal's `candidates` are every declaring body as a
1397+
* `package`, then the residual as `{ kind: 'residual', ownerId }` (the artifact's id), or the app itself for
1398+
* an artifact without `packages[]`. Each job is named by its run form. Counted by name, never by content: a
1399+
* conversion replays a body under its own version window.
1400+
*
1401+
* `composeStacks` refuses the same names by the same reading (enabled jobs only, by name, each job counted
1402+
* per place it is reached — one job object two bodies carry is two jobs here — and the residual by count
1403+
* beyond the bodies' copies), so a composition does not build an artifact this refuses. This stays the
1404+
* backstop for an artifact no composition built: hand-written, or built before composition judged a shared
1405+
* job name.
14041406
*
14051407
* A disabled job is scheduled by nothing, so it collides with nothing and is not counted: its enabled twin
14061408
* keeps the run-time attribution refusal {@link jobDeclaringPackages} gives it.

‎packages/spec/src/migrations/entries/semantic/18.compose-stacks-job-name-across-packages-refused.ts‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ export const entry: SemanticMigration = {
1717
+ "body and the residual (a top-level job no body declares: under manifest 'preserve' an input with no manifest, "
1818
+ "under 'first', 'last' or an index any top-level job beside an input that is itself a multi-package artifact). "
1919
+ 'Before this release the pair composed: two bodies were never read against each other, and a residual job '
20-
+ "sharing a body job's name was read as that body's copy.",
20+
+ "sharing a body job's name was read as that body's copy. Also refused now: two residual jobs of one name beside "
21+
+ 'a package body job of that name (the one-package finding, a disabled job counted too; before, both were read '
22+
+ "as that body's copies), and one job object a composition reaches twice (a built stack shared by two "
23+
+ 'compositions, or passed twice), counted per place as the binder binds each copy.',
2124
replacement:
2225
'Give each job its own name across the composed artifact, or disable all but one of the jobs that share a name '
2326
+ '(enabled: false). A disabled job is scheduled by nothing, so a disabled twin still composes.',
@@ -31,6 +34,7 @@ export const entry: SemanticMigration = {
3134
+ 'binder still refuses the name at boot.',
3235
acceptanceCriteria:
3336
'objectstack validate and objectstack build load the composed stack without a STACK_CROSS_REFERENCE_INVALID '
34-
+ 'finding "Job \'NAME\' is declared enabled twice across the packages of one composed artifact", and the boot '
35-
+ 'log carries no NOT SCHEDULED error for a job name.',
37+
+ 'finding "Job \'NAME\' is declared enabled twice across the packages of one composed artifact" or "Job \'NAME\' '
38+
+ 'is declared twice in jobs", and the boot log carries no NOT SCHEDULED error for a job name: composition counts '
39+
+ 'each job once per place it is reached, as the binder binds it.',
3640
};

‎packages/spec/src/stack.zod.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3885,8 +3885,8 @@ function composedJobDeclarations(
38853885
* judge at composition, over {@link composedJobDeclarations}, so a composition
38863886
* never builds an artifact whose boot silently schedules none of the name.
38873887
* Its reading is the binder's: enabled jobs only (a disabled job is scheduled
3888-
* by nothing, so a disabled twin composes), counted by name, the residual by
3889-
* count beyond the bodies' copies. Cross-package reuse of a name (ADR-0048
3888+
* by nothing, so a disabled twin composes), counted by name and per place
3889+
* reached, the residual by count beyond the bodies' copies. Cross-package reuse of a name (ADR-0048
38903890
* §3.4) does not reach jobs: nothing resolves a bare job name to a package.
38913891
*
38923892
* Only names that span two holders: two jobs of one name in one holder are

0 commit comments

Comments
 (0)