Skip to content

Replay harness Phase 0A: the storage fake rejects kwargs the real GCS Blob accepts #12186

Closed

Description

@abunet

What

backend/testing/replay_harness_phase0a/apps.py defines a filesystem stand-in for
google.cloud.storage. Its _LocalBlob methods take only the positional argument:

def upload_from_filename(self, filename: str) -> None: ...
def upload_from_string(self, data: str | bytes) -> None: ...
def download_to_filename(self, filename: str) -> None: ...

The real google.cloud.storage.Blob accepts more than that — upload_from_filename(filename, content_type=...) is part of its published API. Any code path that passes content_type therefore
dies inside the harness with a bare TypeError, surfacing as an unrelated-looking failure:

ERROR routers.sync: event=sync_dispatch outcome=staging_failed lane=fresh exception_type=TypeError
POST /v2/sync-local-files ... 503 Service Unavailable
{"code":"sync_dispatch_unavailable","detail":"Sync dispatch is temporarily unavailable; ..."}

All three Phase 0A scenarios (base, mutant-unguarded, mutant-guarded) report
FEASIBILITY OUTCOME: BLOCKED, and nothing in the output points at the fake.

Why this looks like an oversight rather than a decision

The file's own comment at line 48 says it is a "copy of sync_cloud_tasks_stack pattern, not import".
The original it names — backend/testing/sync_cloud_tasks_stack/storage.py, backing the blocking
gauntlet — already tolerates the extra arguments on all three methods:

def upload_from_filename(self, filename: str, *_args: Any, **_kwargs: Any) -> None: ...
def download_to_filename(self, filename: str, *_args: Any, **_kwargs: Any) -> None: ...
def upload_from_string(self, data: bytes | str, content_type: str | None = None, *_args, **_kwargs) -> None: ...

The copy dropped that tolerance.

Impact

Today upload_syncing_temporal_file calls the blob with no keyword, so main is green — this is
latent, not broken. It becomes a wrong-looking failure the moment any staging caller passes
content_type, which the real API invites. The failure mode is the expensive kind: a 503 from the
sync router, three scenarios down, and a TypeError with no argument name in the log.

Suggested fix

Make the Phase 0A fake match the sibling it was copied from — *_args: Any, **_kwargs: Any on the
three methods. Verified locally: with that one change the harness goes from
FEASIBILITY OUTCOME: BLOCKED to GREEN/BOUNDED on all three scenarios, against a caller that passes
content_type.

Happy to open the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions