Skip to content

Commit c0e3a07

Browse files
committed
chore: second cleanup pass — vacuous diff reverts + last archeology
Net -32 LOC across 13 files. No behavioral changes, no test count delta — 2841 focused tests + 4789 full sweep still pass. Three parallel cleanup lanes worked the branch diff against main with a focus on vacuous diffs (renames without semantic change, reflowed messages with identical meaning, function extractions that did not aid testing). Dataplane substrate test_smoke.py: test_method_stubs_raise_notimplemented renamed to test_public_methods_callable (the old name asserted a stub-era NotImplementedError that the body no longer checked; the body comment explicitly contradicted the name). Module docstring reflow archeology trimmed in test_no_silent_broad_except, test_models, test_ids. Two back-references stripped from test_transition_state ("WATCH/MULTI/EXEC path", "Compat fields for non-coordinator readers"). ClaimState docstring no longer names the migration-bus consumer (zero in-tree references). make_actor_id soft-deprecation hint removed. Migrated callers Four vacuous renames reverted: - mutation_operator.py: kwargs->positional flip on record_outcome restored to kwargs (no readability benefit from positional). - utils/trackers/__init__.py: four docstring rewordings ("Build" -> "Initialize", "fans out writes" -> "writes to multiple backends") rolled back. - redis_program_storage.py: __all__ inline-to-three-line reformat rolled back. - locking.py: re-ordered attribute initialisations restored. Dispatch-shape audit across the 5 dataplane-dispatch sites confirmed uniform; no helper introduced. Tests + run.py + configs No edits needed. run.py / pyproject.toml / config YAMLs already pass the vacuous-diff test post first cleanup pass — every surviving comment describes present behaviour or load-bearing WHY. TID251 per-file-ignores all verified live against current import sites (zero stale entries).
1 parent d5364ba commit c0e3a07

13 files changed

Lines changed: 33 additions & 65 deletions

File tree

gigaevo/database/redis/locking.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,11 @@ def __init__(
6262
self._config = config
6363
self._dataplane = dataplane
6464

65+
self._token: str | None = None
66+
self._renewal_task: asyncio.Task[None] | None = None
6567
self._instance_id = (
6668
f"{socket.gethostname()}:{os.getpid()}:{uuid.uuid4().hex[:8]}"
6769
)
68-
self._token: str | None = None
69-
self._renewal_task: asyncio.Task[None] | None = None
7070

7171
# SHA cache for the dataplane-less path; ignored when a
7272
# dataplane is wired (its LuaRegistry owns the cache).

gigaevo/database/redis_program_storage.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,7 @@
3232

3333
T = TypeVar("T")
3434

35-
__all__ = [
36-
"RedisProgramStorage",
37-
"RedisProgramStorageConfig",
38-
]
35+
__all__ = ["RedisProgramStorageConfig", "RedisProgramStorage"]
3936

4037
# Constants
4138
MGET_CHUNK_SIZE = 1024

gigaevo/dataplane/errors.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ class CanonicalEncodingError(_StructuredError):
341341

342342

343343
def all_error_types() -> tuple[type[DataPlaneError], ...]:
344-
"""Tuple of every concrete error class. Used for exhaustive matching tests."""
344+
"""Tuple of every concrete error class, for exhaustive-match checks."""
345345
return (
346346
StartupError,
347347
ShutdownError,

gigaevo/dataplane/ids.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,8 @@
5050
def _validate_identity_part(field_name: str, value: str) -> None:
5151
"""Reject control bytes, separators, and bidirectional overrides.
5252
53-
Used by :class:`ActorIdentity` so a wire value carrying a hostile
54-
payload (NUL, CR/LF, ANSI ESC, RLO) cannot pass type-check and reach
55-
a log line, Redis key, or Postgres column verbatim.
53+
Hostile payloads (NUL, CR/LF, ANSI ESC, RLO) must not pass type-check
54+
and reach a log line, Redis key, or Postgres column verbatim.
5655
"""
5756
if not value:
5857
raise ValueError(f"ActorIdentity.{field_name} is empty")
@@ -157,9 +156,7 @@ def parse(cls, actor_id: ActorId | str) -> ActorIdentity:
157156

158157

159158
def make_actor_id(run_id: RunId, worker_id: WorkerId) -> ActorId:
160-
"""Compose an :data:`ActorId` from its parts (wrapper over
161-
:meth:`ActorIdentity.pack`; new code should prefer the dataclass).
162-
"""
159+
"""Compose an :data:`ActorId` from its parts via :meth:`ActorIdentity.pack`."""
163160
return ActorIdentity(run_id=run_id, worker_id=worker_id).pack()
164161

165162

gigaevo/dataplane/tests/test_ids.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
NewType aliases are compile-time only — indistinguishable from their
44
base types at runtime. The meaningful runtime tests are for the
55
:class:`ActorIdentity` round-trip and the :func:`make_script_name`
6-
validator; :func:`make_actor_id` is kept as a thin wrapper for
7-
existing call sites.
6+
validator.
87
"""
98

109
from __future__ import annotations

gigaevo/dataplane/tests/test_models.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,7 @@ class Opaque:
101101

102102

103103
class TestFreshnessShape:
104-
"""The discriminated freshness type is structurally pinned.
105-
106-
These tests document the shape contract so a contributor cannot
107-
silently rename a variant or add a fourth alternative without
108-
breaking them — the union is the load-bearing thing.
109-
"""
104+
"""The discriminated freshness type is structurally pinned."""
110105

111106
def test_eventual_constructs(self) -> None:
112107
f = FreshnessEventual()

gigaevo/dataplane/tests/test_no_silent_broad_except.py

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,6 @@
88
when the source line carries an explicit ``# noqa: BLE001`` marker
99
acknowledging the breadth. Every such site must therefore declare
1010
itself a reviewer-visible boundary.
11-
12-
The dataplane is the layer that converts internal failures into typed
13-
``Result[T, E]`` returns. A broad ``except`` without an annotation is
14-
the shape of a bug that re-emerges as soon as the next contributor
15-
copies the surrounding function without noticing it. This test makes
16-
the discipline mechanical: a new broad ``except`` lands red, gets a
17-
marker (or gets narrowed), then lands green.
1811
"""
1912

2013
from __future__ import annotations
@@ -30,8 +23,6 @@ def _python_files() -> list[Path]:
3023
"""Every ``.py`` under the dataplane package except the test tree."""
3124
out: list[Path] = []
3225
for path in _DATAPLANE_ROOT.rglob("*.py"):
33-
# Skip this file and its siblings — the discipline applies to
34-
# production code only.
3526
if "tests" in path.parts:
3627
continue
3728
out.append(path)
@@ -116,11 +107,7 @@ def test_broad_except_requires_noqa_marker() -> None:
116107

117108

118109
def _scan_source(source: str) -> list[tuple[int, str]]:
119-
"""Run the same checks against an in-memory source; return offenders.
120-
121-
Used by the self-tests to verify the discipline fires on known-bad
122-
constructs without writing temporary files to the dataplane tree.
123-
"""
110+
"""Run the same checks against an in-memory source; return offenders."""
124111
out: list[tuple[int, str]] = []
125112
lines = source.splitlines()
126113
tree = ast.parse(source)

gigaevo/dataplane/tests/test_smoke.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,12 @@ async def test_dataplane_startup_against_invalid_url_raises_typed() -> None:
6363
assert not coord.started
6464

6565

66-
def test_method_stubs_raise_notimplemented() -> None:
67-
"""Method bodies are stubs awaiting follow-up work; verify they fail loudly."""
66+
def test_public_methods_callable() -> None:
67+
"""Smoke-check: every public DataPlane method resolves to a callable.
68+
69+
Bodies are exercised by their dedicated test_*.py modules against fakeredis.
70+
"""
6871
coord = dp.DataPlane("redis://localhost:6379/0", key_prefix="smoke")
69-
# Each method raises NotImplementedError when called; we don't await
70-
# the coroutines (they raise as soon as they're called because the
71-
# raise lives in the function body, not after an await).
72-
# Every public DataPlane method is now implemented. Verify the
73-
# surface is callable as a smoke check — bodies are exercised by
74-
# their dedicated test_*.py modules against fakeredis.
7572
public_methods = [
7673
"transition_program_state",
7774
"transition_program_state_batch",

gigaevo/dataplane/tests/test_transition_state.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -248,13 +248,10 @@ async def test_status_event_emitted(self, coord: dp.DataPlane) -> None:
248248
events = await pool.xrange("test:status_events") # type: ignore[misc]
249249
assert len(events) >= 1
250250
_, last_fields = events[-1]
251-
# dp-native fields.
252251
assert last_fields["pid"] == "p-12"
253252
assert last_fields["from"] == "QUEUED"
254253
assert last_fields["to"] == "RUNNING"
255-
# Legacy fields, emitted alongside so pre-coordinator readers
256-
# observe the same wire shape they did on the WATCH/MULTI/EXEC
257-
# path.
254+
# Compat fields for non-coordinator readers.
258255
assert last_fields["id"] == "p-12"
259256
assert last_fields["status"] == "RUNNING"
260257
assert last_fields["event"] == "transition"

gigaevo/dataplane/transitions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class ProgramState(StrEnum):
5252

5353

5454
class ClaimState(StrEnum):
55-
"""Migration-bus / task-claim lifecycle."""
55+
"""Task-claim lifecycle."""
5656

5757
UNCLAIMED = "UNCLAIMED"
5858
CLAIMED = "CLAIMED"

0 commit comments

Comments
 (0)