fix(sandbox): stop the seed retrying non-idempotent writes
`up` intermittently failed with "expected 6 messages, found 12". Creating messages is not idempotent, and the SDK retries on 429/500/502/503/504 as well as on timeouts, so a write that commits and then errors on the way back is replayed and the fixture is seeded twice. The window is the cold api that cmd_seed has just restarted to apply migrations. The seed now runs with max_retries=0. The sandbox is local and always seeds from a cleared database, so a transient failure should stop and be re-run rather than be papered over into a silently doubled fixture -- and the doubling is not silent by luck alone: the message-count assertion is what caught it. Verified: three consecutive down/up cycles from clean volumes, 6 posted and 6 verified each time.
This commit is contained in:
parent
1536f4c446
commit
98fc68a3f3
|
|
@ -146,7 +146,21 @@ def main() -> int:
|
|||
base_url = os.environ.get("SANDBOX_BASE_URL", "http://127.0.0.1:18000")
|
||||
workspace_id = fixture["workspace"]
|
||||
|
||||
honcho = Honcho(base_url=base_url, workspace_id=workspace_id, api_key="sandbox")
|
||||
honcho = Honcho(
|
||||
base_url=base_url,
|
||||
workspace_id=workspace_id,
|
||||
api_key="sandbox",
|
||||
# No retries. Creating messages is not idempotent, and the SDK retries on
|
||||
# 429/500/502/503/504 as well as timeouts, so a write that commits and then
|
||||
# errors on the way back gets replayed -- seeding the fixture twice. That
|
||||
# was observed as "expected 6 messages, found 12" on a cold api, right
|
||||
# after cmd_seed restarts it.
|
||||
#
|
||||
# The sandbox is local and `up` always seeds from a cleared database, so a
|
||||
# transient failure here should stop and be re-run, not be papered over
|
||||
# into a silently doubled fixture.
|
||||
max_retries=0,
|
||||
)
|
||||
peers = {spec["id"]: honcho.peer(spec["id"]) for spec in fixture["peers"]}
|
||||
session = honcho.session(fixture["session"])
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue