#Compose methods
Turn the greeting into a small group-welcome method. A coordinator calls the existing greeting once per name and collects its messages. The greeting stays independently callable.
This exercise teaches the composition boundary without an Agent or external effects. For a useful application, the contact importer applies the same boundary to reading, mapping, checking, and export.
#Before you start
Use the approved hello-jig project from Run your first Flow.
Run commands from its root directory.
No additional library or Agent account is required.
#1. Create a coordinator
This creates editable source without installing, approving, or running anything.
The generated package declares its own FLOW SDK dependency.
If jig.ts uses explicit membership, add flows/welcome-group to its flows list.
The first tutorial uses discovery, which already includes it.
Replace flows/welcome-group/FLOW.meta.json:
uses declares the greeting slot: the dependency this method can call.
The empty declaration is an anonymous interface requiring an explicit project selection.
It grants no authority and selects no implementation by itself.
Replace flows/welcome-group/FLOW.ts:
Each operationId identifies one child call within this invocation.
Awaiting calls in sequence makes the order explicit.
The coordinator checks each complete result before using its output.
A non-done outcome returns unchanged, and execution failures propagate.
#2. Select the greeting
A Binding is project configuration for one Flow and its dependencies.
Create bindings/welcome-group.ts:
The Binding selects the exact greeting behind the slot. The coordinator imports no child implementation and performs no runtime discovery. Review resolves the relation and retains it with the accepted revision.
#3. Review and run
Inspect both methods and their selected route before approval.
The resolution flag permits dependency preparation, with the same network conditions as before.
Run selects binding:welcome-group because this Binding owns the explicit child route.
Running flow:flows/welcome-group does not borrow that route.
After the first tutorial's greeting change, expect:
The greeting remains usable on its own:
Your application client can call the coordinator by selecting binding:welcome-group and supplying an array.
Its execution, outcome, and cleanup checks still apply.
Use an intentional new task record for that separate invocation.
#Change one useful behavior
Change the greeting text in flows/hello/FLOW.ts.
Review that change and run the group again.
Every group message uses the new accepted greeting without changing the coordinator.
A shared interface allows replacement but does not guarantee equal behavior. An Agent-backed greeting could use the same calling boundary with different powers, costs, and answer quality. The operator must configure and review those differences.
#Test a scoped route
Create a kitchen workflow that assigns four weekend shifts across three cooks. It gives each shift to the available cook with the fewest assignments so far.
Use a supported host and approve the revision at the prompt. The flag permits dependency resolution before approval.
The first Run assigns two shifts to Ada and one each to Bea and Cal.
The second returns needs-cover with Saturday lunch open and the other shifts staffed.
Use those same fixtures in Explorer.
The Bun tests call installed Jig and check the application result and inline call evidence.
They require complete coverage and verify one call to choose-cook per staffed shift.
Try reversing the order of available cooks for Saturday breakfast and predict the roster before running it.
#Test callers in your application
Start each test configuration from a disposable copy of an application revision and its locks. Keep the real callers and their Binding selections in that copy. Select deterministic Flows for external collaborators, such as model-backed reviewers. Keep production credentials and grants out of the test project. If a slot names a contract, supply the same contract with each test implementation. Review the test project before running it.
Exercise each affected entrypoint and at least one neighboring route that should keep its behavior. For resumption, use an input that makes the application return a continuation at a known boundary. Pass that continuation to the next Run. Test direct invocation when callers share the same Binding. Run the same assertions against a disposable copy with a deliberately broader selection to check that they detect the regression.
Record what each check establishes.
jig inspect --flow --topology --all --approved --jsonshows configured destinations.- The live application map can show observed requests and outcomes. The map reports any observation limits.
- Check the command exit, root execution status, and expected domain outcome. If the application forwards child evidence, assert the exact values it received.
- Use
--record-calls --jsonfor observed child calls. Require complete coverage before asserting absence. - For file results, use
--outwith a fresh directory. Usejig inspect --resultto verify the packet. Compare the relevant files with your expected output.
#Get focused feedback on a route change
Run one changed entrypoint and one that should keep its behavior before you
run the full suite. For example, make a disposable copy of the project/
directory in the publishing fixture.
Save "resumed" as fixtures/manuscript.json and commit it with your test
project. From that project, prepare its lock with bun install --lockfile-only,
then inspect and approve the initial project with jig review.
Give the offer sample its own post-edit reviewer and check the working diff.
Check that the offer selects the new producer and the book still selects the
shared producer. Run jig review and approve the intended revision before
running these two cases with the same fixture.
Check for successful execution and outcome done on both Runs. Open
files/review/report.json in each packet. The offer's Epilogue review
should be specialist with decision revise. The book's Epilogue review
should be standard with decision accept. Both whole-manuscript reviews
should stay standard.
Require complete coverage before checking these exact retained calls.
In the fixture's producer source, the whole-book operation uses review for both whole-manuscript handoffs.
Equivalent reviewers can produce identical files.
Check each caller, slot, target, state, and outcome in the saved evidence.
Run your full native suite for the other entrypoints and cases before accepting the change.
The publishing fixture's README gives the commands for its standalone suite.
#Watch invalid input stop
Expect execution failure rather than a successful empty group. Validation happens before the first child call. The coordinator also rejects more than three names and names longer than 80 characters.
If a child fails later, the coordinator does not invent a successful result or repeat that call. Earlier completed effects are not rolled back. This example only produces messages, so it has no external changes to undo. Ctrl-C requests cancellation of owned work. Follow Troubleshooting when execution or cleanup is uncertain.
#Apply the boundary to real work
Keep each method responsible for one useful input and result. Compose it through a declared slot, check the outcome, and pass only the data its task needs. Application code owns decisions based on those results.
- Preview contacts with interchangeable code, Agent, and mixed mappers.
- Handle a disputed charge by checking an Agent proposal against supplied records and policy.
- Design a project when settings, powers, and shared methods need distinct owners.
- Design reusable Flows for portable method boundaries.