Skip to content

Commit fa41e1d

Browse files
Strip spec references and process labels from docstrings (#169)
* Strip spec refs from observability docstrings * Strip spec refs from otel observer docstrings * Strip spec refs from llm docstrings * Strip spec refs from prompts docstrings * Strip spec refs from checkpoint docstrings * Strip spec refs from graph (builder/errors/events/pb) docstrings * Strip spec refs from graph (fan_out/observer/compiled) docstrings * Strip spec refs from conformance test docstrings * Strip spec refs from test_observability docstrings * Strip remaining spec ref from test_checkpoint docstring * Strip spec refs from small unit test docstrings * Strip spec refs from checkpoint/fan-out unit docstrings * Strip spec refs from otel observer unit docstrings * Strip phase/PR process labels from docstrings and comments Remove opaque development-history tags (PR-C, PR-B, Phase 6.0/6.1) and rephrase the "Phase N scope/deferred" mentions to preserve their covered-vs-deferred meaning without the process vocabulary. Rename the langfuse resume test's internal "Phase 1/2/3" step labels to "Step" to avoid confusion with build phases. Leaves the harness skip registry untouched: its DIRECTIVE_PHASE dict maps directives to phase integers as functional data, and its comments document that live mapping. Fixture-number references are kept throughout (concrete in-repo identifiers, not spec refs). * Rephrase residual spec-authority citations in docstrings The first sweep stripped structured spec references (section markers, proposal numbers, versions) but left prose that still cited the spec as the authority for a rule ("The spec defines/permits/mandates", "spec-mandated", "spec-normative", "per spec"). State the behavior directly, or move the basis to a nearby comment where load-bearing. Structural mentions are kept: the spec/ conformance directories, the spec parameter in the harness, spec-version reads, and descriptions of what the conformance suite covers.
1 parent be2c502 commit fa41e1d

65 files changed

Lines changed: 770 additions & 776 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/openarmature/checkpoint/backends/memory.py

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -19,24 +19,26 @@
1919

2020
@dataclass(frozen=True)
2121
class FanOutInternalSaveBatching:
22-
"""Per-Checkpointer-instance configuration for §10.11.4 fan-out
23-
internal save batching.
22+
"""Per-Checkpointer-instance configuration for fan-out internal
23+
save batching.
2424
2525
Applies ONLY to fan-out instance internal saves. Outermost-graph,
2626
subgraph-internal, and fan-out node completion saves remain
27-
synchronous per §10.3.
27+
synchronous.
2828
2929
- ``flush_every``: flush the buffer every N buffered saves. ``0``
3030
/ negative means batching is disabled (every save flushes
3131
immediately). The buffered save count resets at each flush.
3232
33-
Buffered-but-unflushed saves are LOST on crash per §10.11.4;
34-
on resume, instances whose completed state was buffered-only
35-
revert to ``in_flight`` / ``not_started`` and re-run. The §10.11.1
36-
reducer correctness holds because their contributions hadn't
37-
durably committed.
33+
Buffered-but-unflushed saves are LOST on crash; on resume,
34+
instances whose completed state was buffered-only revert to
35+
``in_flight`` / ``not_started`` and re-run. Reducer correctness
36+
holds because their contributions hadn't durably committed.
3837
"""
3938

39+
# Spec pipeline-utilities §10.11.4 (fan-out internal save batching);
40+
# §10.3 synchronous saves; §10.11.1 reducer correctness.
41+
4042
flush_every: int = 0
4143

4244

@@ -53,23 +55,22 @@ class InMemoryCheckpointer:
5355
from :meth:`load`; no serialization round-trip. (This is the
5456
feature: tests can assert on the saved state's identity.)
5557
56-
**State-migration eligibility:** none. Per spec §10.12.1, a
57-
backend supports migration only when it can expose a structural
58-
intermediate form of the loaded state independent of the current
58+
**State-migration eligibility:** none. A backend supports
59+
migration only when it can expose a structural intermediate form
60+
of the loaded state independent of the current
5961
state class. This backend holds live typed instances by
6062
reference, so a version mismatch on resume raises
6163
``CheckpointRecordInvalid`` rather than consulting the
6264
migration registry.
6365
64-
**Fan-out internal save batching** (per spec §10.11.4): optional
65-
via the ``fan_out_internal_save_batching`` constructor parameter.
66+
**Fan-out internal save batching**: optional via the
67+
``fan_out_internal_save_batching`` constructor parameter.
6668
Default is no batching (every save flushes immediately). When
6769
enabled, fan-out instance internal saves buffer in memory and
6870
flush every ``flush_every`` saves. Outermost-graph,
6971
subgraph-internal, and fan-out node completion saves bypass the
7072
buffer entirely (they remain synchronous). On crash, buffered
71-
saves are lost — by design, per §10.11.4's documented cost
72-
trade-off.
73+
saves are lost — by design, a documented cost trade-off.
7374
"""
7475

7576
# Per spec §10.12.1: in-memory storage holds live typed-state
@@ -104,8 +105,8 @@ async def save(self, invocation_id: str, record: CheckpointRecord) -> None:
104105
previous record for the same id. Not durable across process
105106
restarts.
106107
107-
Per §10.11.4: outermost-graph, subgraph-internal, and
108-
fan-out node completion saves are synchronous regardless of
108+
Outermost-graph, subgraph-internal, and fan-out node
109+
completion saves are synchronous regardless of
109110
the batching configuration. The engine routes fan-out
110111
instance internal saves through :meth:`save_fan_out_internal`
111112
instead; this method bypasses the buffer.
@@ -121,8 +122,8 @@ async def save(self, invocation_id: str, record: CheckpointRecord) -> None:
121122
self._records[invocation_id] = record
122123

123124
async def save_fan_out_internal(self, invocation_id: str, record: CheckpointRecord) -> None:
124-
"""Buffer a fan-out instance internal save under the §10.11.4
125-
batching policy. When batching is disabled (default), behaves
125+
"""Buffer a fan-out instance internal save under the batching
126+
policy. When batching is disabled (default), behaves
126127
identically to :meth:`save` — every save is synchronously
127128
durable. When ``flush_every`` is positive, the save is
128129
buffered; the buffer flushes when the count reaches the
@@ -142,10 +143,10 @@ async def save_fan_out_in_flight_failure(
142143
invocation_id: str,
143144
record: CheckpointRecord,
144145
) -> None:
145-
"""Buffer an "instance failed mid-execution" save under §10.11.4
146-
batching. The failure save records the in_flight state of an
147-
instance whose terminal inner node raised; this save closes the
148-
in_flight observability gap (per §10.11) for instances whose
146+
"""Buffer an "instance failed mid-execution" save under the
147+
batching policy. The failure save records the in_flight state
148+
of an instance whose terminal inner node raised; this save
149+
closes the in_flight observability gap for instances whose
149150
subgraphs have no sibling-completed save to piggyback on.
150151
151152
Under batching, this save buffers BUT does NOT count toward
@@ -184,8 +185,8 @@ def _flush_invocation_buffer_locked(self, invocation_id: str) -> None:
184185

185186
async def load(self, invocation_id: str) -> CheckpointRecord | None:
186187
"""Return the saved record for ``invocation_id`` or ``None``
187-
if nothing has been saved under that id. Per §10.11.4:
188-
buffered-but-unflushed fan-out internal saves are NOT visible
188+
if nothing has been saved under that id. Buffered-but-unflushed
189+
fan-out internal saves are NOT visible
189190
to ``load`` — that's the crash-loses-buffered contract. To
190191
simulate a crash before the buffer flushes, drop the
191192
Checkpointer reference; the buffer is in-memory only.

src/openarmature/checkpoint/backends/sqlite.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,8 +281,8 @@ def _decode(self, blob: bytes, recorded_mode: str, invocation_id: str) -> Any:
281281

282282
async def save(self, invocation_id: str, record: CheckpointRecord) -> None:
283283
"""Upsert ``record`` under ``invocation_id``. The state,
284-
completed positions, parent-state stack, and (per proposal 0009)
285-
per-fan-out-node progress are serialized via the configured
284+
completed positions, parent-state stack, and per-fan-out-node
285+
progress are serialized via the configured
286286
:class:`SerializationMode` and written in a single statement.
287287
Writes are durable on return (WAL mode, per-write fsync at the
288288
SQLite layer)."""

src/openarmature/checkpoint/errors.py

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,13 @@ class CheckpointRecordInvalid(CheckpointError):
6060
"""Raised when ``Checkpointer.load(X)`` returns a record whose
6161
schema is incompatible with the current graph: state shape
6262
mismatch, missing required fields, OR a post-migration state
63-
that fails to deserialize against the current state class (per
64-
spec §10.12.4). Non-transient.
63+
that fails to deserialize against the current state class.
64+
Non-transient.
6565
6666
Note: raw ``schema_version`` mismatches no longer route here.
6767
They now flow through ``CheckpointStateMigrationMissing`` (no
6868
chain registered) or ``CheckpointStateMigrationFailed`` (chain
69-
application raised) per spec §10.10's three-way category
70-
distinction.
69+
application raised) — a three-way category distinction.
7170
"""
7271

7372
category = "checkpoint_record_invalid"
@@ -80,8 +79,8 @@ def __init__(self, invocation_id: str, message: str) -> None:
8079
class CheckpointStateMigrationMissing(CheckpointError):
8180
"""Raised on resume when the saved record's ``schema_version``
8281
does not match the current state class's ``schema_version`` AND
83-
no chain of registered migrations bridges the two. Non-transient
84-
per spec §10.10; the user MUST register a migration (or pin
82+
no chain of registered migrations bridges the two. Non-transient;
83+
the user MUST register a migration (or pin
8584
their state to the saved version) for the resume to succeed.
8685
8786
Carries the saved-from / current-to versions and a description
@@ -112,18 +111,16 @@ def __init__(
112111

113112

114113
class CheckpointStateMigrationChainAmbiguous(CheckpointError):
115-
"""Raised when the registered migration graph is ambiguous per
116-
spec §10.10 / §10.12 (proposal 0018, spec v0.16.0):
114+
"""Raised when the registered migration graph is ambiguous:
117115
118-
- Duplicate-pair case (§10.12.1): two migrations register with the
119-
same ``(from_version, to_version)`` pair. Raised at registration
116+
- Duplicate-pair case: two migrations register with the same
117+
``(from_version, to_version)`` pair. Raised at registration
120118
time so the user sees the ambiguity before any resume attempt.
121-
- Multi-shortest-path case (§10.12.2): the registered migration
122-
graph has multiple distinct shortest paths between the saved
123-
and current versions (e.g., a diamond ``v1→v2→v4`` + ``v1→v3→v4``).
124-
Spec accepts either compile-time detection (recommended) or
125-
load-time detection (this impl runs the check inside BFS at
126-
resume time).
119+
- Multi-shortest-path case: the registered migration graph has
120+
multiple distinct shortest paths between the saved and current
121+
versions (e.g., a diamond ``v1→v2→v4`` + ``v1→v3→v4``). Either
122+
compile-time detection (recommended) or load-time detection is
123+
acceptable (this impl runs the check inside BFS at resume time).
127124
128125
Non-transient: retrying without changing the migration graph
129126
will not succeed. Carries ``from_version`` / ``to_version`` when
@@ -149,7 +146,7 @@ def __init__(
149146

150147
class CheckpointStateMigrationFailed(CheckpointError):
151148
"""Raised on resume when a registered migration function raises
152-
during chain application (per spec §10.12.2). The migration's
149+
during chain application. The migration's
153150
exception is preserved as ``__cause__``. Non-transient by
154151
default: a buggy migration is deterministic, so retrying
155152
without changing the migration code will not succeed.

src/openarmature/checkpoint/migration.py

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
"""State migration types and registry.
22
3-
Realizes pipeline-utilities §10.12 (proposal 0014). A
4-
``StateMigration`` describes one edge in the migration graph;
3+
A ``StateMigration`` describes one edge in the migration graph;
54
``MigrationRegistry`` holds the ordered set and resolves chains
65
via BFS. Ambiguity (duplicate ``(from, to)`` pairs OR multiple
76
distinct shortest paths between the same source/sink) is a
8-
configuration-style error per §10.12.1 / §10.12.2.
7+
configuration-style error.
98
"""
9+
# Realizes pipeline-utilities §10.12 (proposal 0014).
1010

1111
from __future__ import annotations
1212

@@ -29,9 +29,9 @@ class StateMigration:
2929
chain (or for final deserialization into the current state class).
3030
3131
Migrations MUST be pure: deterministic, no I/O, no implicit
32-
state. The framework does not police purity per spec §10.12.2
33-
("the contract is documented, not policed"); violating it
34-
risks non-deterministic resume.
32+
state. The framework does not police purity (the contract is
33+
documented, not policed); violating it risks non-deterministic
34+
resume.
3535
"""
3636

3737
from_version: str
@@ -46,15 +46,14 @@ class MigrationRegistry:
4646
4747
- Two migrations with the same ``from_version`` AND
4848
``to_version`` raise ``CheckpointStateMigrationChainAmbiguous``
49-
directly per spec §10.10 (proposal 0018) so the canonical
50-
category surfaces at the registration boundary without any
51-
wrapping by the builder.
49+
directly so the canonical category surfaces at the registration
50+
boundary without any wrapping by the builder.
5251
- Two migrations with the same ``from_version`` and different
5352
``to_version`` are permitted (branched migration graph;
5453
chain resolution picks a path or raises ambiguity if multiple
5554
shortest paths exist).
5655
57-
Resolution-time semantics (per §10.12.2):
56+
Resolution-time semantics:
5857
5958
- BFS from ``record.schema_version`` to
6059
``current.schema_version``. BFS naturally finds the shortest
@@ -133,8 +132,7 @@ def resolve_chain(
133132
134133
Raises ``CheckpointStateMigrationChainAmbiguous`` if
135134
multiple distinct shortest paths exist between
136-
``from_version`` and ``to_version`` (ambiguous chain per
137-
spec §10.10 / §10.12.2; proposal 0018 / spec v0.16.0).
135+
``from_version`` and ``to_version`` (an ambiguous chain).
138136
Same canonical category as the duplicate-pair detection
139137
in ``register``; one type for chain ambiguity regardless
140138
of when it surfaces.

src/openarmature/checkpoint/protocol.py

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,13 @@
2323
produce records in the shipping version (atomic-restart contract).
2424
2525
``CheckpointRecord.schema_version`` carries the user-facing
26-
state-schema identifier per spec §10.2 (proposal 0014 repurposes
27-
the field from the original backend-internal record-shape role).
28-
The framework reads ``type(state).schema_version`` at save time;
29-
on load, version mismatches route through the migration registry
30-
(per §10.12) rather than a strict equality check.
26+
state-schema identifier. The framework reads
27+
``type(state).schema_version`` at save time; on load, version
28+
mismatches route through the migration registry rather than a strict
29+
equality check.
3130
"""
31+
# Spec pipeline-utilities §10.2 (proposal 0014): schema_version is the
32+
# state-schema identifier; §10.12 migration registry on mismatch.
3233

3334
from __future__ import annotations
3435

@@ -98,23 +99,23 @@ class FanOutInstanceProgress:
9899
correctness contract: an instance marked ``completed`` MUST have
99100
its contribution recorded into the accumulator AND that
100101
contribution MUST be reflected in ``result``. Reducer composition
101-
rules (§10.11.1) depend on this exactly-once guarantee.
102+
rules depend on this exactly-once guarantee.
102103
- ``result``: for ``completed`` instances, the durable contribution
103104
to the fan-out accumulator (a success value for the
104105
``target_field`` bucket, or under ``collect`` error policy an
105106
error entry for the ``errors_field`` bucket). Typed per the
106107
parent state schema's ``target_field`` / ``errors_field``
107-
(representation is implementation-defined per §10.11; Python
108-
stores as ``Any`` since dynamic typing absorbs the variance).
108+
(representation is implementation-defined; Python stores as
109+
``Any`` since dynamic typing absorbs the variance).
109110
Unused for ``in_flight`` and ``not_started``.
110111
- ``result_is_error``: boolean discriminator for ``completed``
111112
entries — ``True`` when the contribution is a ``collect``-mode
112113
error entry that rolls forward into ``errors_field``, ``False``
113114
when the contribution is a success value that rolls forward
114115
into ``target_field``. MUST be ``False`` for ``in_flight`` and
115116
``not_started`` (the value of ``result`` is ignored for those).
116-
Per proposal 0027 (spec v0.21.0): implementations MUST consult
117-
this field on resume rather than inferring routing from
117+
Implementations MUST consult this field on resume rather than
118+
inferring routing from
118119
``result``'s shape — heuristic inspection would misclassify
119120
user state values that happen to match the engine's
120121
error-record shape.
@@ -148,7 +149,7 @@ class FanOutProgress:
148149
the fan-out (empty for outermost-graph fan-outs). Disambiguates
149150
fan-outs of the same name in different nested-subgraph contexts.
150151
- ``instance_count``: the resolved instance count for this fan-out
151-
(per pipeline-utilities §9 count or items_field mode).
152+
(count or items_field mode).
152153
- ``instances``: a tuple of per-instance entries indexed by
153154
``fan_out_index`` (``instances[i]`` is the entry for
154155
``fan_out_index=i``). Length equals ``instance_count``.
@@ -167,7 +168,7 @@ class CheckpointRecord:
167168
168169
Frozen: backends MUST treat the record as immutable. The engine
169170
builds a fresh record per ``completed`` event rather than mutating
170-
a shared one. The ``fan_out_progress`` field (per §10.11) carries
171+
a shared one. The ``fan_out_progress`` field carries
171172
per-fan-out-node entries when one or more fan-outs are in flight
172173
at save time; an empty tuple means no fan-out progress to record.
173174
"""
@@ -234,8 +235,8 @@ class Checkpointer(Protocol):
234235
plain dict, JSON tree, or similar) that is independent of the
235236
current state class. JSON-encoded backends naturally satisfy
236237
this; backends that store live typed state instances or use
237-
class-bound serialization (pickle) cannot. Per spec §10.12.1,
238-
backends that cannot expose the intermediate MUST raise
238+
class-bound serialization (pickle) cannot. Backends that cannot
239+
expose the intermediate MUST raise
239240
``CheckpointRecordInvalid`` on version mismatch even when
240241
migrations are registered; the registry has no chance to bridge.
241242

src/openarmature/graph/builder.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -306,11 +306,11 @@ def add_parallel_branches_node(
306306
errors_field: str | None = None,
307307
middleware: Iterable[Middleware] | None = None,
308308
) -> Self:
309-
"""Register a parallel-branches node per pipeline-utilities §11.
309+
"""Register a parallel-branches node.
310310
311311
``branches`` is a mapping from non-empty branch name to a
312312
:class:`BranchSpec`. Insertion order is preserved and is
313-
the dispatch + merge order per §11.8.
313+
the dispatch + merge order.
314314
315315
Validates at registration:
316316
@@ -397,7 +397,7 @@ def with_state_migration(
397397
to_version: str,
398398
migrate: Callable[[Any], Any],
399399
) -> Self:
400-
"""Register one state migration per pipeline-utilities §10.12.
400+
"""Register one state migration.
401401
402402
On resume, when the saved record's ``schema_version`` does not
403403
match the current state class's ``schema_version``, the engine
@@ -406,15 +406,14 @@ def with_state_migration(
406406
``parent_states``) before deserialization.
407407
408408
Migrations MUST be pure: deterministic, no I/O, no implicit
409-
state. The framework does not police purity (per §10.12.2),
410-
but violating it risks non-deterministic resume.
409+
state. The framework does not police purity, but violating it
410+
risks non-deterministic resume.
411411
412412
Raises ``CheckpointStateMigrationChainAmbiguous`` at
413413
registration if the ``(from_version, to_version)`` pair is
414-
already registered (per spec §10.10 / §10.12.1; proposal
415-
0018 / spec v0.16.0). Also raises ``ValueError`` if
414+
already registered. Also raises ``ValueError`` if
416415
``to_version`` is the empty-string sentinel (the un-declared
417-
marker per §10.2 is not a valid chain target).
416+
marker is not a valid chain target).
418417
"""
419418
self._migration_registry.register(
420419
StateMigration(

0 commit comments

Comments
 (0)