On this page4 sections
The new test is green, and the client is still wrong. In this hypothetical example, the client should report “queued” only after a dependency accepts work. An assistant changes the client and writes a test whose mock always returns acceptance. The test passes even if the client ignores that response entirely.
Release engineering keeps the full requirement attached to the versioned package being tested: tell the caller whether work was accepted or rejected. A success-path result belongs to that case alone. The package still needs evidence for the other outcome before a reviewer can accept the broader claim.
The package that generated code and tests belong to
Record the source revision, dependencies and build configuration that produced the artifact. Generated code and tests can use the same review and build process as other changes. If an assistant edits the package after validation, that changed package needs the process again rather than inheriting the earlier result.
Within the process, useful assistance includes explaining a diff, finding a related incident and suggesting a failure case. References to code and evidence let a reviewer check consequential claims. A risk summary should also identify what it cannot assess, such as an undocumented downstream consumer, so the reviewer knows where the available information ends.
Here is the missing interaction in a dependency-free Python fixture. Save it as release_claim_demo.py and run python3 release_claim_demo.py. The response values are synthetic; this checks the client’s decision, not an external service.
from unittest.mock import Mock
def client(send):
send()
return "queued" # Bug: the dependency result is ignored.
accepted = Mock(return_value={"status": 202})
assert client(accepted) == "queued" # The success-only test passes.
rejected = Mock(return_value={"status": 403})
assert client(rejected) != "queued" # This assertion exposes the bug.
The final assertion should fail. The first test established only that an accepting mock is followed by “queued.” Because the broken client says “queued” whatever it receives, that test cannot distinguish the bug from correct behavior. Supply rejection and the two implementations finally have to behave differently. Python’s mock documentation explains how to supply that response; deciding which response exposes the defect remains the important test-design choice.
A correction must inspect the returned status and raise or return the documented rejection outcome when it is not accepted. Re-run both cases after that change, keeping the rejection expectation fixed. The added test now distinguishes a client that checks acceptance from one that declares success unconditionally.
Here is a complete correction for the synthetic contract. Run it separately from the deliberately failing fixture above. It accepts only status 202, and the test checks that status 403 takes the rejection path:
from unittest.mock import Mock
def corrected_client(send):
result = send()
if result["status"] != 202:
raise ValueError("Submission was not accepted")
return "queued"
assert corrected_client(Mock(return_value={"status": 202})) == "queued"
try:
corrected_client(Mock(return_value={"status": 403}))
except ValueError:
pass
else:
raise AssertionError("A rejected submission was reported as queued")
print("Both contract checks passed")The tests now observe a difference the broken client could not produce: the accepted response returns a value, while the rejected response raises the expected exception. This demonstrates the tiny fixture’s contract, not the behavior of an external dependency. The real client may require additional status or response validation.
The release policy supplies acceptance criteria for the exact artifact and identifies who may approve an exception. That lets the assistant suggest ways to meet the criteria while the release owner asks whether observed results support the behavior this package claims to deliver.
Read diagram description
Conceptual release path. AI can suggest tests, while the pipeline records which artifact was built and tested. Promotion remains tied to the release policy and observed results. Diagram labels: Proposed change: Versioned source and build inputs; Test suggestions: Review AI-generated cases; Built artifact + test results: Preserve identity through the pipeline; Promotion check: Apply policy to this artifact and its evidence.
Check the dependency contract outside the mock
The real dependency may not share the fixture’s response contract. A hypothetical API could put rejection inside a successful transport response, making a status-only check wrong. Test the actual interaction through supported contract tests or a permitted environment; another generated success mock would simply preserve the assumption. This is a contract difference to investigate, not a claim about a particular API.
Canary behavior can expose a mocked-away failure
A canary compares the candidate with an appropriate baseline under representative traffic. Choose user-facing signals, minimum evidence, observation interval and stop conditions before the rollout so the outcome remains interpretable. An anomaly model can add observations, but independent checks keep it from being the sole judge of a change it helped recommend.
For the submission client, compare the caller’s reported “queued” outcomes with the dependency’s accepted submissions. A mismatch is a reason to stop promotion and investigate the exact candidate, even if its isolated tests passed. A canary may receive no rejected submissions during its observation window; that absence cannot replace the deliberate rejection check performed before rollout.
Independence does not require duplicating all engineering effort. Focus it on consequential assumptions, user behavior, and rollback constraints rather than demanding two implementations of every minor check.
Rollback also needs a compatibility plan. Reverting application code may leave a database migration, external side effect or configuration change in place. The canary deployment guide explains why controlling candidate traffic and recovering state are separate parts of the release decision.
Defects, review effort and recovery work
Track human review effort, meaningful defects found before release, rollout failures and recovery work. A shorter pipeline may reflect removed busywork or an effective check that was skipped. The surrounding outcomes distinguish those explanations and reveal whether the assistance improved the release process.
Record model and prompt changes that influence decisions, and review failures and overrides without assuming every disagreement proves one side wrong. A human reviewer may have relevant information outside the model's inputs; the review should establish what each decision used.
The rejection case mattered because the broken client could not fake the required behavior. That is useful work for an assistant throughout a release: find the case that separates the intended behavior from a convincing imitation. Keep that case tied to the package, interface checks and rollout evidence. A green result then means something specific about the thing you are about to ship.
Sources & context
Sources linked in this article. Read alongside the author’s analysis; a citation does not independently verify a publisher’s claims.
- mock documentationdocs.python.org
