๐ช๐ถ๐ฟ๐ถ๐ป๐ด ๐๐ต๐ฒ ๐๐๐ฎ๐ฟ๐ฑ๐ฟ๐ฎ๐ถ๐น๐
Everything I built for the last five weeks lived on one machine. The tests passed locally, but they meant nothing once another person touched the code.
Issue #6 changes that. I moved the entire specification stack to a GitHub Actions pipeline. Now, a broken contract or a failing scenario cannot reach the main branch. The pipeline is the guardrail.
The setup took ninety minutes. It included two unplanned lessons.
Lesson 1: Never start CI with a known failure.
Before writing any pipeline code, I ran the full test suite to set a baseline. I found a failure from a previous session. A test was failing because of an intentional bad spec.
The instinct was to skip it or ignore it. I did not. If you start continuous integration with a red light, your team learns to ignore red lights.
I fixed the baseline by adding backward-compat aliases to the response. This kept both the good specs and the bad specs passing against the same endpoint. I kept the integrity of the system intact before adding automation.
Lesson 2: The gap between local and remote environments.
The pipeline failed initially with an error: Address already in use.
The AI agent, Claude Code, had written a step to start mock servers in the YAML file. This worked locally because nothing else was competing for those ports. In the CI environment, the Python test fixtures were also trying to start those same servers.
The agent could not see this conflict. It could reason about the code, but it could not observe the actual CI run. It only saw local success.
I diagnosed the log and removed the redundant YAML steps. The fix was not a workaround. It was removing a duplicate layer of responsibility.
The Result
The pipeline now follows a strict dependency order:
- test
- pact-consumer
- pact-verify
- can-i-deploy
Each job only runs if the previous one passes. If Gherkin breaks, Pact never runs. If the consumer tests fail, verification never runs.
Most importantly, the division of labor works:
- Gherkin proves the system does the right thing.
- Pact proves the contracts do not drift.
A breaking change in a payment status field now triggers a failure in the Pact layer. The merge is blocked. The guardrail works.
The real work is not writing the YAML. The real work is the discipline of not skipping fixes and not blaming the environment when things break.
Source: https://dev.to/diyaburman/wiring-the-guardrails-19i
Optional learning community: https://t.me/GyaanSetuAi