Repository navigation
refactor(machines,tooling): give the state machines their own folder - #98
Merged
Merged
Conversation
…/dotnet The engine, its persistence and testing packages and their three test projects leave Trax.Effect for a folder of their own. Everything .NET sits under dotnet/ so the folder can hold the other languages beside it; the guards that enumerate each folder's src/ and tests/ also look there. Names are unchanged in this commit.
…conformance/ Trax.Api.StateMachine becomes Trax.StateMachine/ts; @traxsharp/state-machine keeps its name. The conformance kit, the shared machines/ corpus and the runner (run.mjs, kit.mjs, node builtins only) move to Trax.StateMachine/conformance, beside the engines rather than inside one. The C# tests that run or read the TypeScript engine are marked CrossEngine, so CI can run them apart from the C#-only suite.
…achine Trax.Effect.StateMachine, .Persistence and .Testing become Trax.StateMachine, .Persistence and .Testing, with their namespaces and test projects. The new ids have no release on nuget.org yet, so package validation is off for them until their first one, and the old ids' CompatibilitySuppressions go. Shipped migrations keep the old names in their comments.
…ateMachine Trax.StateMachine gets its own Tests.Meta with the folder-agnostic guards and the three public API baselines, which leave Effect's. Every folder's DependencyDirectionTests gains the Trax.StateMachine family between Effect and Mediator, so an Effect project that references a machine project, or a machine project that references the mediator, fails the build; both are pinned as cases.
Trax.StateMachine has no folder job. Its C# solution, its TypeScript engine and the cross-engine checks are three suites with their own paths: state-machine-dotnet runs for dotnet/ and the kit, state-machine-ts for ts/ and the kit, and state-machine-conformance, the C# CrossEngine tests plus the kit through the TypeScript engine, for anything in the folder. A change to one language no longer rebuilds the other, and none of them reruns Trax.Effect. A suite marked checks makes the folder job's checks itself, and the release, the Dependabot lockfile workflow and the coverage upload include suites.
…he move effect/0013, 0017 and 0022 move to Trax.StateMachine/docs/adr as 0001 to 0003, with the tests that are their exemplars. Trax.StateMachine gets its AGENTS.md, by language, merged from the TypeScript engine's and Effect's machine rows; the root AGENTS.md gains the folder, the chain and the suites. The central ADRs that bind every folder, and the machine ones, are tagged statemachine. The READMEs, the packages reference, the repository layout page and the site's package list gain the folder, and a migration guide covers the renamed ids.
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Contributor
|
This PR is included in version 1.68.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The state machines get a folder of their own, laid out by language
Background
A Trax machine is a multi-step flow (a checkout, a form) whose state the server stores and
whose transitions it applies. It has two engines that must give the same answer for every trigger:
the C# one, which the server runs and which is the source of truth, and a TypeScript twin, which a
browser runs to predict what the server will do. A conformance kit (shared machines, fixtures,
canonical-wire vectors, refusal codes, the IR's JSON Schema) and a runner that sends every case to
an engine hold the two together.
Until now the C# engine (
Trax.Effect.StateMachine,.Persistence,.Testingand their threetest projects) lived inside
Trax.Effect/, and the TypeScript engine, with the kit, lived in atop-level folder named
Trax.Api.StateMachine/after the place it was first used. CI decides whatto run by top-level folder: a folder runs when it, or a folder upstream of it, changed.
Problem
Example
One commit that changes only
Trax.StateMachine/ts/src/index.ts, run through.github/scripts/ci-changes.sh pull_request:Trax.Api.StateMachine/src/index.ts)state-machine-dotnetis not selected)state-machinejobstate-machine-tssuitestate-machine-conformancesuiteA change only under
dotnet/selectsstate-machine-dotnetandstate-machine-conformanceandnot
state-machine-ts. A change toconformance/selects all three. Folders downstream(Mediator and below) still run for any change in the folder, since detection is per top-level
folder.
How this solves it
dotnet/is laid out like every other .NET folder, so the Meta guards that find their folder byits
.slnxwork unchanged. The runner andkit.mjsuse only node's own modules and now sit inconformance/with the corpus, so the C# tests read and spawn them without reaching intots/.flowchart LR Core["Trax.Core"] --> Effect["Trax.Effect"] Effect --> SM["Trax.StateMachine"] SM --> Med["Trax.Mediator"] Med --> Sch["Trax.Scheduler"] Sch --> Api["Trax.Api"] Sch --> Cli["Trax.Cli"] Api --> Samples["Trax.Samples"] Cli --> Samples classDef trains fill:#22c55e,stroke:#15803d,color:#000 classDef machines fill:#a855f7,stroke:#7e22ce,color:#fff classDef dispatch fill:#f97316,stroke:#c2410c,color:#000 classDef surface fill:#3b82f6,stroke:#1d4ed8,color:#fff classDef tooling fill:#334155,stroke:#0f172a,color:#fff class Core,Effect trains class SM machines class Med,Sch dispatch class Api surface class Cli,Samples toolingWarning
Renamed package ids. A consumer swaps
Trax.Effect.StateMachine*forTrax.StateMachine*and the
usings with it (Trax.Docs/migration-guides/trax-statemachine-packages.md). This PRis a
refactor:and publishes nothing; the new ids first ship with the next release, and theold ones are deprecated on nuget.org after that. The book's
Directory.Packages.propsstillpins 1.61.0, which the new ids will never have; in the repository a project reference replaces
it, and the pin moves to the first release that carries them.
Architectural hinges
Trax.StateMachine/AGENTS.md: the folder's layout by language, its decisions, and whichCI suite runs for which path. Read this first.
.github/ci/packages.json(theTrax.StateMachinerow and the threestate-machine-*suites): where the "a TypeScript change does not rebuild C#" rule is decided, by paths.
.github/workflows/ci.yml(suitejob): thechecks,pack,coverageandconformancesteps a suite can now take on, so a whole solution can stand in for a folder job.Trax.StateMachine/dotnet/tests/Trax.StateMachine.Tests/Helpers/FixturePaths.cs(
FixturePaths): how the C# tests findconformance/machinesand the TypeScript engine; itthrows rather than skipping when they are missing.
Trax.StateMachine/dotnet/tests/Trax.StateMachine.Tests.Meta/Tests/DependencyDirectionTests.cs:the chain with the new family, identical in every folder's Meta project.