The Factory Writes the Flow: A Software Factory for MuleSoft, Spring Boot, and Angular
My last post turned the lights off on a blog pipeline. A blog is forgiving. Code that moves money is not. Adam Jacob's definition of a software factory, black-box tests, a committed architecture, adversarial reviews, and fixing the machine instead of the output, applied to Mule flows, DataWeave, Spring Boot, and Angular, and the three stages from my assistant to a team's shared factory.
Contents
A blog is a forgiving product. Code that moves money is not.
In my last post I described the dark factory that produces this blog, and I said the levels of autonomy were never about the model, only about the gates. A fair reader could answer: sure, for prose. A bad paragraph costs you some pride. A bad DataWeave mapping costs somebody their rent.
So this post is the harder version. Same thesis, different floor. The product is an integration layer: Mule flows and DataWeave in the middle, Spring Boot services behind them, an Angular front end on top. And the best framework I have found for building a factory around that stack comes from Adam Jacob, who helped give us the word “DevOps” and now runs Swamp Club, in a Syntax episode bluntly titled “WTF is a Software Factory?” (opens in new tab)
I am going to take his ideas, strip out the product, and show what each one looks like in code on this stack. The domain is a made-up one: a transfers API that debits one account, credits another, and refuses to overdraw.
A factory is not a bag of skills
Jacob’s definition is the cleanest I have heard. Take your software development lifecycle and hand as much of it as possible to agents: everything except the inputs, the outputs, and a few checkpoints. That includes the unglamorous parts, keeping the system stable, keeping it aligned with the architecture, keeping regressions out. Not just generating code.
Then he says the thing that separates a factory from a demo. “Here’s my bag of skills and I do my best” is not a factory. The structure is what makes it safe to trust.
He also names the failure everyone has already lived through. Keep your old SDLC, crank the velocity with thousand-line pull requests nobody understands, and you get what he calls a slop factory. When someone offers to make that faster, the right answer is no. His way out sounds backwards: “more AI, not less,” plus more automation and more structure, until the problem becomes systems design.
The first structural move is to reverse the loop. In most agent setups the model drives: it reads the skill, re-derives the process, and burns frontier tokens reinventing the same for-loop every run. In a factory, a deterministic pipeline drives and calls the model only when it needs judgment, through typed inputs and outputs. On this stack that pipeline already exists. It is Maven, the MUnit runner, Gradle, the Angular CLI, and your CI stages. The model fills specific steps, and because the steps are typed, the judgment provider is swappable, a point I made about Jev and typed decisions.
Trust comes from the outside: black-box tests
The idea from the episode I would put first is the least fashionable one. Jacob’s team revived something he had not done since about 2000: large, comprehensive black-box acceptance suites. Continuous delivery killed them, he argues, because writing them by hand tripled every engineer’s effort for a marginal gain. Agents flip that math. And once no human sits in the middle of the loop, outside-in proof that the product still does what it promised is the only kind of trust that scales.
On a Mule application, that means testing the API the way a consumer calls it, not mocking every processor inside the flow. Here is the flow the factory is allowed to change:
<flow name="post:\transfers:application\json:transfers-api-config">
<ee:transform doc:name="To ledger posting">
<ee:message>
<ee:set-payload resource="dw/to-ledger-posting.dwl"/>
</ee:message>
</ee:transform>
<flow-ref name="ledger-system-api-post-posting"/>
<error-handler>
<on-error-propagate type="LEDGER:INSUFFICIENT_FUNDS">
<set-variable variableName="httpStatus" value="422"/>
<ee:transform doc:name="Problem response">
<ee:message>
<ee:set-payload><![CDATA[%dw 2.0
output application/json
---
{ code: "INSUFFICIENT_FUNDS", message: "Transfer exceeds available balance" }]]></ee:set-payload>
</ee:message>
</ee:transform>
</on-error-propagate>
</error-handler>
</flow>
And here is the test the factory is not allowed to change. It starts the real HTTP listener and calls the API from outside:
<munit:test name="overdraft-transfer-is-rejected-with-422">
<munit:enable-flow-sources>
<munit:enable-flow-source value="transfers-api-main"/>
</munit:enable-flow-sources>
<munit:execution>
<http:request method="POST" config-ref="transfers-api-client" path="/api/transfers">
<http:headers>#[{ "Idempotency-Key": "t-overdraft-1" }]</http:headers>
<http:body>#[output application/json --- {
fromAccount: "ACC-001", toAccount: "ACC-002", amount: 1000000
}]</http:body>
<http:response-validator>
<http:success-status-code-validator values="100..599"/>
</http:response-validator>
</http:request>
</munit:execution>
<munit:validation>
<munit-tools:assert-that expression="#[attributes.statusCode]"
is="#[MunitTools::equalTo(422)]"/>
<munit-tools:assert-that expression="#[payload.code]"
is="#[MunitTools::equalTo('INSUFFICIENT_FUNDS')]"/>
</munit:validation>
</munit:test>
The system API behind it runs against a stub of the ledger, a small behavioral clone that knows how to say “insufficient funds.” The test does not care how the flow is wired inside. The agent can refactor the transform, split the flow, or reroute errors, and the only question is whether the contract still holds.
The Spring Boot side gets the same treatment, with a real database in a container and a real HTTP call:
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@Testcontainers
class TransferAcceptanceTest {
@Container
@ServiceConnection
static PostgreSQLContainer<?> db = new PostgreSQLContainer<>("postgres:16");
@LocalServerPort
int port;
@Test
void overdraftIsRejectedWith422() {
given().port(port)
.contentType(ContentType.JSON)
.header("Idempotency-Key", "t-overdraft-1")
.body("""
{"fromAccount": "ACC-001", "toAccount": "ACC-002", "amount": 1000000}
""")
.when().post("/api/transfers")
.then().statusCode(422)
.body("code", equalTo("INSUFFICIENT_FUNDS"));
}
}
I keep these suites outside the agent’s write path. The factory can read them and must pass them, but a change that edits an acceptance test goes to a human. That is the same idea StrongDM used with hidden scenarios, at a budget a normal team can afford: the review did not disappear, it moved somewhere the agent cannot game.
What about unit tests?
Jacob is openly unsure. He mentions a ThoughtWorks finding that pushing agents to do TDD made things worse, and says he would not be shocked if his team deleted its unit tests as an experiment. The primary source is more measured. Birgitta Böckeler’s experiment on TDD inside the agent loop (opens in new tab) found “no clearly discernable difference” in quality between TDD and non-TDD agent workflows, and at least three times the tokens for TDD.
My position on this stack: keep unit tests where they encode real domain rules (the overdraft check in the domain model, a DataWeave rounding function), and stop asking the agent to write tests first as ritual. The black-box suite is the contract. Unit tests are the agent’s own scaffolding, and I treat them that way.
Architecture the agent has already read
For decades engineers mocked “architecture astronauts.” Jacob’s argument is that agents end the joke. Left alone, an agent picks whatever feels right in the moment, which is why vibe-coded systems get worse with every feature. You need an architecture vocabulary the agent already knows, and his pick is domain-driven design, because “your agent’s already read the book about domain-driven design.” Say “anti-corruption layer” and it knows what you mean.
That vocabulary maps cleanly onto an integration stack. In API-led connectivity, the experience, process, and system layers already behave like bounded contexts. The system API that fronts a ledger is an anti-corruption layer with a different name. The factory’s job is to keep each layer speaking its own language and translating at the edges, and the edge in Mule is DataWeave.
So the transforms carry types, and the types are guardrails the agent cannot talk its way around:
%dw 2.0
output application/json
type TransferRequest = {
fromAccount: String,
toAccount: String,
amount: Number,
currency?: String
}
type LedgerPosting = {
debitAccount: String,
creditAccount: String,
amountMinor: Number,
currency: String,
idempotencyKey: String
}
var req: TransferRequest = payload
---
{
debitAccount: req.fromAccount,
creditAccount: req.toAccount,
amountMinor: round(req.amount * 100),
currency: req.currency default "USD",
idempotencyKey: attributes.headers."idempotency-key"
} as LedgerPosting
The request type is the process layer’s language. The posting type is the ledger’s. The transform is the only place the two meet, and if the agent drops a field or changes a shape, the script fails before any test runs.
On the Spring Boot side, the architecture is written as tests the build enforces. ArchUnit (opens in new tab) turns “the domain stays pure” and “the ledger is only reached through its anti-corruption layer” into rules:
@AnalyzeClasses(packages = "com.example.transfers")
class ArchitectureTest {
@ArchTest
static final ArchRule domainStaysPure = noClasses()
.that().resideInAPackage("..domain..")
.should().dependOnClassesThat()
.resideInAnyPackage("..adapter..", "org.springframework..");
@ArchTest
static final ArchRule ledgerOnlyThroughAcl = classes()
.that().resideInAPackage("..adapter.ledger.client..")
.should().onlyBeAccessed()
.byAnyPackage("..adapter.ledger..");
}
Then I write the same rules down in prose, as a review skill the agent reads before it writes and a reviewer agent checks after. Jacob’s advice is to show the agent one good example in your codebase and it will reuse the pattern. In my experience that is exactly right, and it is why the first bounded context deserves the most human care. Everything after it is a copy. I made the larger version of this argument in Architecture Is the Prompt: the architecture you write down is the context the agent works inside.
Adversarial reviews, chosen per change
Some requirements are not architecture. Accessibility is the classic one, and it is where Jacob’s adversarial review skills come in: a reviewer whose only job is to find a specific class of failure and send the work back. He says his product is the first thing he has ever shipped with a perfect Lighthouse score, because an adversarial skill will not let it drop.
On the Angular side, I do not trust a skill alone for this. The skill explains intent. The gate is code. A Playwright spec with axe fails the build on any automatically detectable WCAG A or AA violation:
import { test, expect } from '@playwright/test';
import AxeBuilder from '@axe-core/playwright';
test('transfer form has no detectable WCAG A/AA violations', async ({ page }) => {
await page.goto('/transfers/new');
const results = await new AxeBuilder({ page })
.withTags(['wcag2a', 'wcag2aa', 'wcag21a', 'wcag21aa'])
.analyze();
expect(results.violations).toEqual([]);
});
And Lighthouse CI (opens in new tab) holds the score as a budget, not a hope:
{
"ci": {
"assert": {
"assertions": {
"categories:accessibility": ["error", { "minScore": 1 }],
"categories:performance": ["error", { "minScore": 0.9 }]
}
}
}
}
Running every review on every change is waste, and Jacob’s fix is to let a cheap decision model pick which reviews a change needs. I go one step more deterministic first. Paths decide the obvious cases, and the model only judges the ambiguous ones:
# factory/reviews.yaml
reviews:
architecture:
when: ["services/**/*.java", "mule/src/main/mule/**", "mule/src/main/resources/dw/**"]
skill: review-architecture
contract:
when: ["**/api/*.raml", "**/api/*.yaml"]
skill: review-contract
accessibility:
when: ["web/src/**/*.html", "web/src/**/*.scss", "web/src/**/*.ts"]
skill: review-a11y
ambiguous:
decide: judgment-step # typed verdict: which reviews, with confidence
A change that only touches a DataWeave script never wakes the accessibility reviewer. A change to a shared Angular component always does.
Fix the machine, not the output
Here is the line from the episode I have taped to the metaphorical monitor: “You’ve stopped building the thing you wanted and you’ve started building the machine that builds the thing you wanted. But you’re still engineering.”
When a class of error gets through, the wrong conclusion is that the robots are dumb. The right question is how to change the factory so that class is caught next time. If the agent ships a transform that silently defaults a missing currency, the fix is not a sterner prompt. It is a typed field that is no longer optional, a black-box case that sends a request without it, and one sentence in the architecture skill explaining why. The error class closes for good.

Image description
Three stages of a software factory: first my assistant, one human supervising one agent; then every engineer running a local agent with shared skills; then a central factory holding skills, gates, black-box tests, and history, with local agents pulling standards down and pushing evidence back up in both directions
From my assistant to a team’s factory
None of this starts as a platform. It starts as one person and one agent.
Stage one: my assistant, under my supervision. This is where I build and break the factory. The skills, the review rules, the black-box suites, and the path map all live in a repository, and I watch every run. I am at Level 4 here: I write the specs and the gates, and I read the evidence. Most of what I learn at this stage is which gates were missing.
Stage two: every engineer gets their own. The factory definition is just files in git, so it copies. Each engineer runs a local agent with the same skills and the same gates against their own work. This is where the factory meets taste it did not grow up with, and where most of the new gates come from, because ten people find ten new ways to be wrong.
Stage three: a central factory, with two-way traffic. The local agents connect to a shared environment that holds the canonical skills, the review rules, the acceptance suites, the stubs and twins of downstream systems, and the run history. The traffic goes both directions. Standards flow down: when the architecture skill changes, every local agent picks it up. Evidence flows up: every run reports which gates passed, and when an engineer’s local agent catches a new class of error, the gate that caught it is proposed back to the center, reviewed, and shipped to everyone.
This is where both sides of the enterprise argument meet. Engineers want speed and autonomy: an agent on their own machine, their own context, no ticket to open before they can work. The institution needs control: identity on every agent, attribution on every change, a record of which gates ran, and determinism about what reached production. Treated as opposites, those become a standoff. The central factory reconciles them. It is the control plane that makes it safe to let every local agent run fast, because the gates, the evidence, and the history live in one place someone can inspect.
Jacob is candid that no organization has finished this transition. “I’ve seen people who have started. I have seen no one who has finished.” He borrows kaikaku (opens in new tab) from lean manufacturing, the radical redesign you do when a new technology moves the bottleneck, and his playbook is small: give five people one real slice of the business, let them break the planning rules, and make them show proof in code. That matches stage two to stage three exactly. You do not roll out a factory. You grow one from a slice that already works.
What I have not solved
The economics are real. Black-box suites, twins of downstream systems, and adversarial reviewers all cost compute, and a factory that spends more than the engineers it frees is not a factory. It is a hobby.
Agents still write much of the scaffolding that tests agents. Keeping the acceptance suites under human ownership helps, but it does not make the problem go away.
And the most important line in the episode is a humbling one. Asked whether the AI labs have figured this out, Jacob says: “They’re not better at it than we are.” No model knows how your ledger behaves, which of your system APIs lies about its error codes, or why a field that looks optional never is. The factory does not know either, until you teach it. That teaching is the job now.
Build the black-box suite first
If you take one step this quarter, make it the outside-in suite for one API. Real HTTP, real containers, stubbed downstreams, and a rule that the agent cannot edit it. Everything else in the factory, the architecture skill, the typed transforms, the adversarial reviewers, the central environment, gets safer once that suite exists, because it is what lets you refactor without fear.
Then teach the factory your architecture, one bounded context at a time. Then turn the lights off on that one lane and watch the record.
If this was useful, read I’m Building the Dark Factory, and I Love It for the five levels and why they are gated by verification, and Architecture Is the Prompt for why the architecture you write down becomes the agent’s working context.
Find me on X @orestesgarcia (opens in new tab) or LinkedIn (opens in new tab).
Get the next field note.
Regulated AI, architecture and platform economics — in your inbox as they publish.