Skip to content

build(repo): vendor upstream statelyai/xstate at 2146ae26 as a read-only subtree - #25

Merged
kiro-systemf[bot] merged 146 commits into
mainfrom
xs/upstream-subtree
Oct 7, 2026
Merged

kiro-systemf[bot] merged 146 commits into
mainfrom
xs/upstream-subtree

Conversation

@systemfsoftware-maker

@systemfsoftware-maker systemfsoftware-maker commented Oct 7, 2026 •

Copy link
Copy Markdown
Collaborator

Layer 3 of the xstate stack, on #14. This is the bottom layer of the PR 3 (oracle lane) work: the upstream XState suite enters the repository as a read-only subtree. Kiro's ruling (cycle 20, cycle 21) withdraws KTD1's flake input. Per that ruling this layer is the subtree, its read-only exclusions, and the pin test below.

What changes

  • repos/xstate-upstream is git subtree add --prefix=repos/xstate-upstream --squash https://github.com/statelyai/xstate.git 2146ae26ebfc7e6a624b3a1f237f9e6ddc30b9f5. History stays one squashed commit (c90c370), and its git-subtree-split: 2146ae26… trailer is the pin. The whole upstream tree comes in, with no hand-pruning.
  • subtrees.toml registers it next to constitution and worktrunk-scripts.
    • The branch is next, the branch the pin comes from. statelyai/xstate's default branch main has diverged from 2146ae26; next contains it.
    • The entry records commit = "2146ae26ebfc7e6a624b3a1f237f9e6ddc30b9f5" and that commit's tree, tree = "a8e63ffb6821f3ed1cd157bf7d6c9ef97ef2f5c0".
    • The description says what is true at this layer: "Upstream XState at 2146ae26, vendored for the oracle lane; the git-subtree-split trailer is the pin".
  • scripts/upstream-subtree-pin.test.ts is an ordinary test in the scripts suite (test:scripts, the CI test leg). It fails when:
    • git rev-parse HEAD:repos/xstate-upstream differs from the recorded tree;
    • the working tree changes anything under the subtree;
    • the squash commit's git-subtree-split: trailer differs from the recorded commit;
    • the clone is shallow, so that trailer can't be reached (it fails by name).
  • Wiring for the pin test:
    • test:scripts may run git.
    • Its turbo inputs include subtrees.toml and repos/xstate-upstream/**, so an edit there reruns the suite instead of hitting the cache.
  • .github/workflows/ci.yml: the test leg checks out with fetch-depth: "0" so the trailer is reachable; the other legs keep depth 1. CONST-W3: this is an evaluator surface, edited on its owner's (Kiro's) ruling.
  • commitlint.config.ts ignores git subtree's own commits by their formats.
    • A squash commit is ignored when it carries both git-subtree-dir: and git-subtree-split: trailers.
    • A git subtree add merge is ignored when its whole message is Merge commit '<40-hex>' as '<prefix>'. That message carries no trailer, and it is what failed "lint PR commits" before (6e516c4).
    • The old substring rule is gone. It let any message mentioning git-subtree-dir: skip the lint.
    • CONST-W3: this is an evaluator surface, edited on Kiro's ruling.
  • Merges of build(repo): bring in the xstate fork packages with their history #14 carry the layers below, including main's chore: bump @effect/tsgo to ^0.50.0 #27 (@effect/tsgo ^0.50.0) and chore(deps): bump nixpkgs from 4975466 to c59305b #5/chore(deps): bump comment-checker from 00cc6a6 to 3bfedd8 #6.

Not in this layer, by ruling: packages/upstream-family.json, the @systemfsoftware/upstream-manifest guard and --report in check:ci, and deleting the in-tree verbatim copies. Those come in the next layer (KTD3 + guard), which deletes the copies and adds the guard together, so no head grades a family nothing runs.

Known gap in @systemfsoftware/upstream-manifest, which this PR does not change: for inPlace records it checks only that the record's commit equals the subtree's git-subtree-split trailer and that each file is tracked and executed. It never compares the subtree's bytes with the pinned commit. The pin test above covers that here.

Merge with a merge commit, not a squash, so the subtree-split trailer survives on main.

Read-only: what keeps every tool off repos/xstate-upstream

Tool How repos/ is excluded Proof
dprint (the only root-wide glob) "repos/**" in dprint.json excludes, already present for repos/constitution Sabotage: removing that exclude makes dprint check exit 20, flagging 1150 upstream files; restored, it exits 0
oxlint, lint:tsgo, typecheck, attw run per workspace member (packages/*); repos/ is not a member pnpm gate:tasks: 33/33
vitest each package's own include test counts identical to #14: xstate 2421 (+29 skipped, 3 todo), xstate-effect 137, xstate-react 141, xstate-store 300, xstate-store-react 24, xstate-test 486
stryker plan (release gate) plans only workspace members with a mutation script discoverMembers('.') from scripts/stryker-plan-gate.ts returns exactly the six packages/xstate*
commitlint git subtree's own squash and add-merge commits are ignored by their exact formats (above) add merge and trailered squash pass; a squash without trailers, a prose mention of git-subtree-dir:, and a short-sha merge all fail

Read-only enforcement is the pin test: any byte under repos/xstate-upstream that differs from statelyai/xstate's 2146ae26 tree fails test:scripts.

Verified locally (sandboxed dev shell, TURBO_CONCURRENCY=4)

  • pnpm bootstrap 0 · pnpm format:check 0 · pnpm gate:tasks 33/33 · pnpm gate:dist 12/12 · pnpm test:sandbox 3 passed (13 steps) · commitlint over the PR range 0
  • test:scripts through turbo in the sandbox: 11 passed, including both pin tests
  • Pin test sabotage, in a throwaway clone:
Case Exit
baseline 0
one-byte uncommitted edit under the subtree 1
the same edit committed 1
wrong recorded commit 1
restored 0
--depth 1 clone 1, "a shallow clone cannot reach the squash commit that vendors repos/xstate-upstream"

Six packages of statelyai/xstate branch `next` at
2146ae26ebfc7e6a624b3a1f237f9e6ddc30b9f5 (MIT, Copyright (c) 2015 David
Khourshid) are copied unchanged under packages/xstate/, as owned members
(REPO-O1). Upstream is a reference, never a merge source.

- packages/core -> packages/xstate/xstate
- packages/xstate-effect -> packages/xstate/xstate-effect
- packages/xstate-test -> packages/xstate/xstate-test
- packages/xstate-react -> packages/xstate/xstate-react
- packages/xstate-store -> packages/xstate/xstate-store
- packages/xstate-store-react -> packages/xstate/xstate-store-react

Identity: every copied src/ and test/ tree object equals the upstream tree
object at the pin (git write-tree --prefix vs git rev-parse <pin>:<dir>),
except xstate-store/test, which differs only by the excluded files below.

Excluded (build configuration, or tests of bindings this repo does not fork):
- packages/{core,xstate-effect,xstate-test,xstate-react,xstate-store,xstate-store-react}/vitest.config.mts
- packages/xstate-store/vitest.config.vue.mts, vitest.config.solid.mts
- packages/xstate-store/test/{vue.test.ts,UseActor.vue,UseActorRef.vue,UseSelector.vue} (imports @xstate/vue)
- packages/core/{actors,durable,fsm,graph,validation}/package.json (preconstruct entrypoint stubs)
- packages/core/.gitignore, packages/xstate-store-react/tsconfig.json

Added: the repository's root MIT LICENSE in xstate-effect and
xstate-store-react, which upstream ships without a package LICENSE.

Declared bypass (CONST-W3): committed with --no-verify. The pre-commit hook
runs dprint fmt over staged files, which would rewrite upstream sources and
break the tree identity above. The commit message was checked with
`pnpm exec commitlint`. Formatting lands as the next, separate commit; the
dprint check gate runs on the pull request head.
Gate: `./bin/dprint check` (check:local, check:static). The verbatim import
in the previous commit keeps upstream's formatting so its tree identity holds;
this commit is the formatter's output over packages/xstate/** and nothing else.
The six imported packages become workspace members under
`@systemfsoftware/*` names through the `packages/xstate/*` glob (plan U2).

- Manifests: MIT, upstream's versions, workspace dependencies and catalog
  versions; tsdown builds every upstream subpath, each with its own API
  Extractor report. Scripts: build, typecheck, test, lint:tsgo, attw,
  api:check, api:update. No lint and no mutation script until each package's
  rewrite layer (plan KTD2, KTD10).
- Vitest configs carry upstream's per-package settings at the pin (globals,
  environment, includes, resolve conditions) on the shared config.
- Core's and xstate-react's tests pin zod 3.25.76, the version upstream's
  lockfile resolves for them; xstate-test, xstate-store and
  xstate-store-react pin zod 4.6.5.
- Core's bin/xstate.js is removed: it only ran `npx @xstate/codemod`, and
  the codemod is not forked.
- packages/xstate/AGENTS.md records the pin, the members, what is not forked
  and why, and the family's leaf rules. Every README carries the fork clause.

Adding workspace members re-resolves the `catalog:stryker`
`latest` specifiers, which moves @systemfsoftware/stryker-js 14.0.0 to 15.0.1

Plan docs/plans/2026-10-05-2317-feat-xstate-v6-fork-plan.md (U2)
… guard

Kiro ruled option 1 for L1 of the xstate fork plan. Declared bypass
(CONST-W3): rule KTD8 of @systemfsoftware/vitest (the guard refuses a case
registered with vitest's own it); case: the upstream statelyai/xstate tests
imported verbatim in df92a9ad3f, which are the oracle and are never edited;
removal point: plan U4 (L2) deletes the in-tree tests, the manifests and
these exemption entries together

- vitest-config's guard exemption table names one project per xstate
  package, `upstream-verbatim`. Its include is exactly the files that
  package's upstream-tests.json lists, never a folder glob.
- scripts/guards/check-upstream-test-manifest.ts (run by guard:projects in
  gate:tasks and gate:local) fails when a manifest names a file the import
  commit did not bring in or lists a file the tree no longer holds, so a
  list can only shrink. Each manifest records its reason and removal point.

Evidence (sabotage, reverted)
- An added own test under the guard: "this test was registered with
  vitest's it; import it from @systemfsoftware/vitest"
- A copy of an upstream test under a name not on the list: red
- test/new.test.ts appended to a manifest: the guard exits 1 with "not an
  imported upstream test still in the tree"
…s them

Each xstate package's vitest config splits its tests into the guard-exempt
`upstream-verbatim` project (the files its upstream-tests.json lists, with
upstream's globals) and the guarded `own` project for every other test file.
Environment, resolve conditions and inlined deps follow upstream's
per-package config at 2146ae26. xstate-store and xstate-store-react keep
upstream's include scope (test/ and src/), so xstate-store's
src/select.test.ts stays unrun, as upstream leaves it

Also restores upstream's `#is-development` imports map in xstate and
xstate-react, which the U2 manifests dropped; core's sources import it
- tsdown names each package's root entry `index`, so its generated exports
  map the root subpath `.`; package.json exports are tsdown's output
  (REPO-S4), and the API Extractor reports read dist/index.d.ts
- The vitest configs alias upstream's package names (`xstate`,
  `xstate/<subpath>`, `@xstate/<name>` and subpaths) to the fork's
  `@systemfsoftware/*` packages, so the verbatim upstream tests run against
  the fork without being edited. The shared config's own alias is kept
… xstate

Gate-forced repairs in the imported sources (plan U3), no behaviour change

- Module specifiers in import, export and declare-module statements move
  from `xstate` and `@xstate/<name>` to the fork's `@systemfsoftware/*`
  names (72 sites in 48 files). `Symbol.for` brand keys such as
  '@xstate/effect/action' and runtime message text keep upstream's strings
- tsdown (rolldown) refuses a value import of a type-only export
  (MISSING_EXPORT at src/assert.ts, src/createActor.ts, ...). Those imports
  are marked `type`, applied mechanically by oxlint's
  typescript/consistent-type-imports fixer over non-test sources only
…t off them

Kiro ruled verbatim means verbatim. The dprint commit 6c22c870d had
reformatted the 212 upstream test files the manifests list; this commit
restores exactly those files to their content at the import commit
df92a9ad3f (git restore --source, no history rewrite)

Declared bypass (CONST-W3), beside the test-guard exemption: rule, the
dprint check gate; case, the same 212 verbatim upstream test files, which
are the oracle and are never edited; removal point, plan U4 (L2) deletes
the files, the manifests and these excludes together

- dprint.json excludes list exactly those files, written from the
  manifests by scripts/guards/check-upstream-test-manifest.ts --write, never
  a folder glob
- The guard now also fails when dprint.json excludes a path under
  packages/xstate that no manifest lists, or misses one a manifest lists, so
  the excludes shrink with the manifests

Evidence
- git diff df92a9ad3f -- <listed files> is empty
- ./bin/dprint check exits 0
- Sabotage, reverted: excluding packages/xstate/xstate/src/index.ts makes the
  guard print "excluded but not listed" and exit 1
… examples

Gate-forced repairs (plan U3), ruled by Kiro

- xstate-test: Effect 4.0.1 removed `Schema.toArbitrary`; Schema arbitraries
  now run on Effect's own engine (effect/Arbitrary), not fast-check.
  `fromEffectSchema` draws a fast-check integer as the seed and samples one
  value with `Arbitrary.sampleEffect`, so a run replays from fast-check's
  seed. A failing generated value does not shrink
- xstate-test: the U3 specifier rename had rewritten a runtime message
  string; it names '@xstate/test/effect-schema' again, as upstream's
  schema.test.ts asserts
- xstate-test, xstate-store, xstate-store-react: zod 4.4.3, the version
  upstream's lockfile resolves (4.6.5 changed partialRecord key generation)
- core: test/typeStates.test.ts imports type names from
  src/typestates.types.ts with a plain import. Upstream's esbuild elided that
  import; the repo's tsconfig sets verbatimModuleSyntax, so vite's oxc
  transform keeps it, the module loads, and its module-scope example call to
  `declare function accept` throws "accept is not defined". The examples are
  now `satisfies` expressions, which type-check the same way and emit no call
…erbatim

Kiro ruled both ports. Each port is the pinned upstream file with only the
named cases changed, between port markers. The manifest records the
upstream path, its blob at the import commit, the reason and the line span
of each case. The drift check fails if a line outside a marked case
changes, or if the pinned upstream blob differs from the recorded one.

- xstate-test test/engine/propertySuite.port.test.ts. Toolchain cause:
  the test-runner API. Vitest 5 refuses a suite declared inside a running
  test. The case "describeTestSuite (vitest globals) > runs the generated
  fixtures" now declares the suite at file scope with the vitest globals,
  so each generated fixture is its own case.
- xstate test/serialization.conformance.v6.port.test.ts. Toolchain cause:
  printer text (oxc vs esbuild). The cause was probed on the file itself.
  esbuild 0.28.2 prints "(_) => void 0" with two-space indentation, which
  matches upstream's snapshots. oxc (rolldown binding 1.2.9, vite 8's
  transformer) prints "(_) => undefined" with tabs, which matches what the
  fork received. The two cases now assert that each `@code` equals
  String(fn) of the same inline function.

Proofs, each reverted afterwards. Editing propertySuite line 12 makes the
guard exit 1 at :12. Editing serialization line 184 (between the two
cases) or line 135 makes it exit 1. A wrong recorded blob makes it exit 1.
The guard selftest passes 9 cases. Both ports pass: 14 and 10 tests
Kiro ruled each retirement. The manifests record the upstream path, the
reason and the replacement, and the drift check keeps every retired file
out of the tree and out of the dprint excludes.

- xstate test/declarations.test.ts drives the TypeScript 6 compiler API,
  and the repo compiles with TypeScript 7 only. The replacement is
  tests/declaration-emit.test.ts, which emits the same fixtures with the
  TypeScript 7 tsc and asserts no diagnostics, the size bounds, one
  readonly c0 and p0 member, names from the entry point only, and a
  consumer that compiles against the emitted declaration. Two cases pass.
  The diagnostics case is red: TypeScript 7 reports type errors in four
  upstream fixtures, which the U3 typecheck repairs fix.
- xstate-effect src/lint.test.ts and xstate-react test/lint.test.ts run
  upstream's root oxlint plugins, which are not forked. Their fixtures go
  too. The replacement is the repo's own lint gate over the package
  sources.

Every upstream-verbatim suite passes: xstate 2417 with 29 skipped and 3
todo, xstate-effect 135, xstate-test 478, xstate-react 141
…sion

The package manifests set "type": "module", so the TypeScript 7 build
and its nodenext resolution read the sources as ESM. Upstream mixed
extensionless specifiers with .ts ones. Under ESM, TS2835 refuses the
extensionless ones and TS5097 refuses the .ts ones without
allowImportingTsExtensions. An unresolved module types as any, so every
type core reached through one collapsed to any. That any is what made
the event-descriptor validator build a string index of "Event type
'${any}' is not declared" and reject the declared GO, and what
implicitly typed the invoke input callbacks as any.

All 477 relative specifiers in the 135 non-test source files of the six
packages now name the .js file or /index.js directory entry, which is
the repo's convention. Verbatim upstream tests are not touched.

In core, TS2835 and TS5097 go from 218 to 0, and the declaration-emit
replacement's diagnostics case passes. The other two cases also had
probe bugs, fixed here: the name probe now imports every referenced
name from the entry point instead of aliasing generics without their
arguments, and the consumer now resolves the parent only through its
emitted .d.ts, with the parent source removed. All six packages' suites
pass: xstate 2420 with 29 skipped and 3 todo, xstate-effect 135,
xstate-test 478, xstate-react 141, xstate-store 294, xstate-store-react
24. Removing InferEvents from the entry point turns the name case red
Gate-forced repairs (plan U3). The repo's TypeScript 7 config enables
exactOptionalPropertyTypes, noUncheckedIndexedAccess and
noPropertyAccessFromIndexSignature, which upstream never compiled with.
tsc -p tsconfig.app.json in packages/xstate/xstate went from 289 errors
to 0, across 37 source files, and runtime behaviour is unchanged.

- Index-signature reads use bracket access (TS4111).
- Indexed reads are narrowed by an existing invariant or an explicit
  check that throws what upstream would have thrown. No new non-null
  assertion, any cast or suppression comment is added.
- Optional members a value really leaves undefined declare
  `| undefined`. This affects 22 public types, among them StateSchema,
  StateConfig, ActorOptions, Observer, LogicConfig, SetupSchemas and
  SetupStateSchema. Upstream compiled without exactOptionalPropertyTypes,
  where `?:` already accepted undefined, so each change keeps what a
  consumer could already pass and narrows nothing.

vitest run --bail=0 in the package still reports 145 files and 2420
passed, 29 skipped and 3 todo
…am's options

Kiro ruled that the verbatim tests are typechecked and never skipped.
Each package gets a second test project, tsconfig.upstream-test.json,
which its tsc -b solution now references. The project is generated by
scripts/guards/check-upstream-test-manifest.ts --write, and the check
fails when the generated file and the tree differ.

- Its compilerOptions are upstream's root tsconfig.json at 2146ae26,
  vendored byte-for-byte as packages/xstate/upstream-tsconfig.json. The
  check recomputes that file's git blob and refuses anything other than
  upstream's 312be9e.
- Each change on top of upstream's options is listed with its reason in
  the package's upstream-tests.json under typecheck.additions:
  - noEmit, composite, emitDeclarationOnly, outDir and tsBuildInfoFile,
    because a tsc -b reference must emit.
  - customConditions, so @systemfsoftware/* imports resolve to source.
  - paths for xstate and @xstate/*, generated from the packages' source
    exports.
  - types, adding node, which vitest 5's globals no longer bring in.
  - module preserve with bundler resolution. The fork's packages are
    type: module, so nodenext would read upstream's extensionless test
    imports as ESM.
- Its include lists exactly the verbatim test files, every port, the
  upstream helper files under test/ that they import, and the src JSON
  files they read. tsconfig.test.json excludes the same list, so every
  file is in exactly one of the two projects.
- A third port, xstate-store test/atom.port.test.ts, handles vitest 5
  typing an untyped vi.fn() as Mock<Constructable | Procedure>. Inside
  its one marked case, the inline mock is now typed
  vi.fn<(value: number) => void>().

All six upstream-test projects report 0 errors under TypeScript 7.0.2
(tsc -p tsconfig.upstream-test.json --noEmit). Each of these sabotages,
reverted afterwards, makes the check exit 1: turning off strict in a
generated project, editing the vendored tsconfig, leaving a verbatim
file in the repo test project, and editing the atom port outside its
case. Reverting the port's vi.fn typing brings back TS2769. Debt: the
whole upstream-test project is one entry, removed when layer 2 ports the
tests to the repo's style and its include list is empty
…'s strict flags

Gate-forced repairs (plan U3), done the same way as core. Every count
below is `tsc -p tsconfig.app.json` errors, from before to after:
xstate-effect 11 to 0, xstate-test 171 to 0, xstate-react 6 to 0,
xstate-store 31 to 0, and xstate-store-react 26 to 0 (all of
xstate-store-react's came from xstate-store).

- Index-signature reads use bracket access.
- Indexed reads are narrowed or destructured.
- Callbacks that fall through now return explicitly.
- ModelTestFailure.cause is marked override.
- xstate-test's two node-reading modules reference node types, since
  the tsconfig preset does not include them automatically.
- Optional members a value really leaves undefined declare
  `| undefined`. In xstate-store that covers Store.schemas,
  StoreLogic.eventTypes and schemas, and StoreValidationError.eventType.
  In xstate-test it covers the engine's replay, fixture, exploration,
  suite and linearizability records. These widen and never narrow:
  upstream compiled without exactOptionalPropertyTypes, so `?:` already
  accepted undefined.

No runtime behaviour changes. tsc -b in each of the six packages, from
a clean cache and including the new upstream-test projects, exits 0
with no errors. Under effect 4.0.1 the suites report xstate 2420 passed,
29 skipped and 3 todo, xstate-effect 135, xstate-test 478, xstate-react
141, xstate-store 294 and xstate-store-react 24
…n test

- Commits the API Extractor report for every entry point of the six
  packages (20 reports, written by pnpm api:update). The build's
  api:check compares against them, and the published-surface comparison
  in the plan starts from them.
- Adds publishConfig.provenance to the six manifests, which gritlint's
  npm-provenance rule requires of every non-private package.
- Adds tests to core's tsconfig.test.json include, so the TypeScript 7
  declaration-emit test is typechecked. guard:projects found it in no
  project
API Extractor's api:check fails on any warning, and upstream's comments
raised 43 across four packages: ambiguous links to overloaded or merged
declarations, links to names an entry point does not export,
multi-line code spans, bare braces and angle brackets, and dotted
@PARAM names. Overloads are linked by index, as in (createMachine:1).
Names an entry point cannot link become code spans. Spans are reflowed
onto one line. Only comments change, and five API reports regenerate.
api:check now passes in all six packages
Write every conditional operand as an explicit comparison so the rule sees a
boolean type instead of a truthiness test. lint:tsgo reports 75
strictBooleanExpressions diagnostics before this commit and 0 after
Give the schema-record map callback a concise body, since its block only
returned an array. lint:tsgo reports 1 unnecessaryArrowBlock diagnostic before
this commit and 0 after
Give ActorScope's service key and the three tagged errors' Data.TaggedError
keys the package-and-path form the rule expects. The error classes keep their
historical short `_tag` and `name` so the published contract and upstream tag
assertions hold. lint:tsgo reports 4 deterministicKeys diagnostics before and 0
after
Rethrow a listener's exception on a microtask instead of a macrotask timer,
so the failure still surfaces asynchronously without the global timer the
rule rejects. lint:tsgo reports 1 globalTimers diagnostic before and 0 after
Settle the hosted-effect promise through Effect.callback and Effect.runPromise
instead of constructing one by hand, so a failure still rejects with the
squashed cause. lint:tsgo reports 1 newPromise diagnostic before and 0 after
Run the durable transition through Effect.exit and read the thrown value from
the cause, instead of a try/catch inside the Effect generator. lint:tsgo
reports 1 tryCatchInEffectGen diagnostic before and 0 after
Call a wrapped action through a typed view that names the hosted shape, so
neither the call nor the narrowed result carries any or unknown error and
requirements channels. lint:tsgo reports 2 anyUnknownInErrorContext
diagnostics before and 0 after
Host each fromEffect Effect through startHostedEffect, which now carries the
requirements channel and runs it against the actor's own context, instead of
asserting the channel away. lint:tsgo reports 3 unsafeEffectTypeAssertion
diagnostics before this commit and 0 after
Stop exporting the internal host helpers and safeCall, exposing them through
one internals object, and name waitFor's narrowing predicate so both of its
call styles describe one shape. Regenerate the API reports. lint:tsgo
reports 10 missingPipeableSignature diagnostics before and 0 after
Give each cross-module helper (withEffectHost, createEffectHost, bindEffectHost,
startHostedEffect, runHostedEffect, relayToParent, safeCall) a data-first and
data-last form with Function.dual, and export the waitFor predicate from the
entry point. lint:tsgo reports 0 diagnostics before and after
The gate is pnpm --filter @systemfsoftware/xstate-test lint:tsgo
effect(globalTimers) drops from 1 to 0
PropertyTest's drain yields its macrotask turn through Effect.sleep(0) rather than the global setTimeout
The gate is pnpm --filter @systemfsoftware/xstate-test lint:tsgo
effect(newPromise) drops from 3 to 0
The outcome registry, the drain turn and the page-settle microtask yield run through Effect.callback
The gate is pnpm --filter @systemfsoftware/xstate-test lint:tsgo
effect(globalConsole) drops from 2 to 0
The printed reports log through Effect.log with a console logger that keeps their verbatim output
@systemfsoftware-maker systemfsoftware-maker changed the title xs/upstream subtree build(repo): vendor upstream statelyai/xstate at 2146ae26 as a read-only subtree Oct 7, 2026
@systemfsoftware-maker
systemfsoftware-maker marked this pull request as ready for review October 7, 2026 04:41
Kiro ruling on Review13PredicateR2 P0: #13's gates run attw, so #13 needs the attw CLI #14 already builds. This ports #14's 317b179: arethetypeswrong-cli 4.2.0 is built from the released tag d43a8020, and effect-cell-types 7.0.0 from its release tag 4cf0f770 for the attw install alone. The catalog entry points at file:.sfs-deps/arethetypeswrong-cli-4.2.0.tgz, so no @systemfsoftware/* package comes from the registry

nix/attw/pnpm-lock.yaml carries the effect-cell-types 7.0.0 integrity #14 measured after 13349a7 moved the build into the sandbox (sha512-ongebnJP…), not the pre-sandbox value 317b179 recorded

(cherry picked from commit 317b179)
Kiro ruling on Review13PredicateR2 P0: #13's gate:tasks runs #14's set, lint lint:tsgo typecheck typecheck:node test test:scripts attw, the lint leg runs lint:tsgo and the dist leg runs attw after build, as #14's cb678a7 does

packages/starter is the only member, so it takes the lint:tsgo and attw scripts and their devDependencies. attw found that its exports name dist/index.js while tsdown emitted dist/index.mjs and index.d.mts, a NoResolution under node16-esm and bundler. tsdown now emits .js and .d.ts, the files the exports already name. attw runs with --profile esm-only: the package ships no CommonJS, so node10 and node16-cjs resolution do not apply, and an export naming a file the build did not emit still fails

CONST-W3: this changes packages/starter, which the predicate's clause 5 holds unchanged, because the ruling requires attw to execute against packages/starter and pass

The root lockfile takes the two devDependencies and the workspace deps hash moves with it
Kiro ruling on Review13PredicateR2 P1: the guard that refuses an @systemfsoftware/* package resolved from registry.npmjs.org ran only in nix run .#<instance>-lock, never in CI. The root task //#assert-local-sfs runs it on pnpm-lock.yaml and every nix/*/pnpm-lock.yaml, and //#test:scripts depends on it, so the test leg's pnpm test and check:ci's gate:tasks both run it with no new job, workflow or env switch. It keeps turbo's default output logs, so the CI log names the task and the files it read

scripts/assert-local-sfs.test.ts runs the guard on a lockfile fixture resolving @systemfsoftware/effect-cell-types@12.0.0 from the registry, which must fail and name the line, and on every committed lockfile, which must pass. test:scripts takes --allow-run=awk for it, and its turbo inputs take the lockfiles and the guard so a lockfile change reruns it
…gates into the packages

Brings #13's fixes for Kiro's ruling on Review13PredicateR2. The attw from-source instances, the gate:tasks set and the lint:tsgo task were already here from 317b179 and cb678a7, so the packages' side of flake.nix, pnpm-workspace.yaml and pnpm-lock.yaml stands. packages/starter stays deleted, as f61708f left it. The //#assert-local-sfs task and scripts/assert-local-sfs.test.ts arrive new and run on this branch's four committed lockfiles
…eam subtree layer

Brings the //#assert-local-sfs task and scripts/assert-local-sfs.test.ts from #13 through #14. The guard reads pnpm-lock.yaml and nix/*/pnpm-lock.yaml only, so the upstream lockfiles under repos/xstate-upstream stay outside it
main's #24 drops the macOS check:ci leg from CI and #26 drops the darwin systems from the flake, nix/dprint.nix and nix/comment-checker-sandbox.nix. The scaffold's flake keeps its lib binding and takes main's two Linux systems. #13 had no CI run on 59f3b22 because the flake.nix conflict left the pull request dirty
…ackages

Brings main's #24 and #26 through #13: no macOS CI leg and Linux-only flake systems
… the upstream subtree layer

Brings main's #24 and #26 through #13 and #14: no macOS CI leg and Linux-only flake systems
…ffold

Brings main's #27, which conflicted in pnpm-workspace.yaml and pnpm-lock.yaml.
The catalog takes #27's "@effect/tsgo": ^0.50.0 and keeps the scaffold's other pins.
minimumReleaseAgeExclude keeps the scaffold's "@effect/*" entry, which already
covers the @effect/tsgo platform packages #27 lists one by one. The registry
@systemfsoftware/* entries main lists are not taken, because the scaffold
resolves those from local tarballs.

pnpm install --lockfile-only re-resolved pnpm-lock.yaml to 0.50.0. The
workspace deps hash was re-measured sandboxed and confirmed with
nix-build --check
… the packages

Brings main's #27 through #13. The catalog takes "@effect/tsgo": ^0.50.0 and
keeps the packages' "@microsoft/api-extractor" pin. pnpm install --lockfile-only
re-resolved pnpm-lock.yaml, and the workspace deps hash was re-measured
sandboxed and confirmed with nix-build --check
…p into the upstream subtree layer

Brings main's #27 through #13 and #14, with the re-resolved lockfile and the re-measured workspace deps hash
…n the scripts suite

Kiro ruling on the #25 review, finding 3 and B.1: the read-only subtree was enforced only by review, and the upstream-manifest guard never compares an in-place subtree's bytes with its pin.
subtrees.toml now records the xstate-upstream entry's upstream commit 2146ae26ebfc7e6a624b3a1f237f9e6ddc30b9f5 and that commit's tree a8e63ff.
scripts/upstream-subtree-pin.test.ts fails when HEAD:repos/xstate-upstream is a different tree, when the working tree changes anything under the subtree, or when the squash commit's git-subtree-split trailer names a different commit.
test:scripts may run git, and its turbo inputs include subtrees.toml and the subtree, so an edit there reruns the suite instead of hitting the cache.

Finding 1: the description now says what is true at this layer, that the subtree is vendored for the oracle lane and the trailer is the pin
…tlint

Kiro ruling on #25: lint PR commits failed on 6e516c4, the "Merge commit '<sha>' as 'repos/xstate-upstream'" that git subtree add writes. That header carries no type and no subject.
The ignore list now matches git subtree's own formats exactly. It covers a squash commit that carries both the git-subtree-dir and git-subtree-split trailers, and an add merge whose whole message is "Merge commit '<40-hex>' as '<prefix>'".
The old rule ignored any message starting with "Squashed '" or mentioning git-subtree-dir: anywhere, so an authored commit could opt out of the lint. That rule is removed; the squash match now requires both trailers on their own lines

CONST-W3: commitlint.config.ts is an evaluator surface (AGENTS.md Boundaries, CONST-E9). It is edited here on the operator's explicit ruling, not on the maker's own judgment
…s into the scaffold

Brings main's #5 (nixpkgs 4975466 to c59305b) and #6 (comment-checker 00cc6a6 to 3bfedd8). Both conflicted in flake.lock.
flake.lock keeps the scaffold's lock and re-locks only comment-checker, to 3bfedd8, together with that input's own rust-overlay.
nixpkgs stays at the scaffold's aa48d34. That pin is newer than c59305b, so it already covers #5's bump, and it carries the lake1 toolchain (pnpm 12.9.0, Node 24) the scaffold was pinned for in 6e30cfb.
pnpm-lock.yaml is unchanged, so the workspace deps hash is unchanged; workspace-tarballs builds sandboxed
Brings main's #5 and #6 through #13: comment-checker re-locked to 3bfedd8 and nixpkgs kept at aa48d34, with pnpm-lock.yaml and the workspace deps hash unchanged
…railer is reachable

Kiro ruling on #25: actions/checkout clones at depth 1, so the squash commit c90c370 that carries repos/xstate-upstream's git-subtree-split trailer is not in the clone. scripts/upstream-subtree-pin.test.ts refuses a shallow clone by name, so the test leg was bound to fail.
The test leg now sets fetch-depth "0" through its matrix entry, and the other legs keep depth 1. The value is a string because a numeric 0 is falsy in the || fallback

CONST-W3: .github/workflows/ci.yml is an evaluator surface (AGENTS.md Boundaries, CONST-E9). It is edited here on the explicit ruling of its owner (Kiro), not on the maker's own judgment
… upstream subtree layer

Brings main's #5 and #6 through #13 and #14: comment-checker re-locked to 3bfedd8 and nixpkgs kept at aa48d34
#13 landed on main as the squash commit 27107a0, so main no longer shares the scaffold's commits with this branch and the pull request went dirty.
27107a0's tree is byte-identical to xs/scaffold's head 5417a60, and 5417a60 is already an ancestor here. The merge therefore keeps this branch's tree unchanged (strategy ours): every line main brings is already present through the scaffold's own commits
…pstream subtree layer

Brings main's squash commit 27107a0 for #13 through #14, so this layer shares main's history. The tree is unchanged
…ages

Brings main's #28 (squash 928d17c): both Deno planner steps in release-gate.yml declare jsr.io and registry.npmjs.org, and sandbox-proofs/release-gate-planner.test.ts runs those steps on exactly the hosts the workflow declares
… into the upstream subtree layer

Brings main's #28 through #14: the release-gate planner steps declare jsr.io and registry.npmjs.org, and test:sandbox runs them on exactly those hosts
…ages

Brings main's #29 and #30 (ff44090) into #14. The release-gate mutation step passes GITHUB_ACTIONS through the sandbox, and release-gate.test.ts derives that list from stryker-js's main-CI guard
Kiro ruling on the #14 ce-code-review, finding 1 (P0): the dprint exclude packages/*/{test,src}/**/*.test.{ts,tsx} silently exempted every future test in any package from the formatter.

dprint.json now lists the exact files from packages/*/upstream-tests.json: the 206 verbatim upstream test files plus the 3 *.port.test.ts ports, 209 paths. Today the old glob matched those same 209 files, so nothing is reformatted and dprint check passes; any test added under packages/ from now on is formatted unless a manifest lists it.

scripts/dprint-upstream-excludes.test.ts runs in test:scripts. The first test fails if an exclude under packages/ is a glob, or is neither a manifest path nor a file whose git blob is a manifest's recorded typecheck blob (packages/upstream-tsconfig.json), or if a manifest path is not excluded. The second fails if any exclude, including a root-level pattern, matches a package test the manifests do not list. turbo's test:scripts inputs gain dprint.json, the manifests and the package test files so the cache cannot replay a stale pass.

As a sabotage proof on a throwaway copy, each of these makes the suite fail: re-adding the old glob, packages/xstate/test/*.test.ts, a hand-written test path, a non-manifest source file, a directory, dropping one manifest file, **/*.test.ts, **/tests/** and **/*Precedence*

CONST-W3: dprint.json is a judgment surface (START-1) and the test is a new check. Both change on the explicit ruling of their owner (Kiro), not on the maker's own judgment
…s into the upstream subtree layer

Brings #14's 42d0000 (dprint excludes the manifest-listed upstream tests only, checked by scripts/dprint-upstream-excludes.test.ts) and its merge of main's #29 and #30. turbo.json's test:scripts inputs keep both sides: this layer's subtrees.toml and repos/xstate-upstream/** and the packages layer's dprint.json, manifests and package test files
Base automatically changed from xs/packages to main October 7, 2026 08:58
#14 landed on main as the squash commit 9f01956, so main no longer shares the packages layer's commits with this branch and the PR went dirty. 9f01956's tree is byte-identical to the packages head 42d0000, and 42d0000 is already an ancestor here. The merge therefore keeps this branch's tree unchanged (strategy ours); every line main brings is already present through the packages layer's own commits
@kiro-systemf
kiro-systemf Bot merged commit 0face2a into main Oct 7, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant