Repository navigation
Annotate parameters in triage, cursor, Pi child and transcript modules - #2757
Merged
Merged
Conversation
Give declared types to 289 of the 299 unannotated parameters in selected_triage, cursor_owner, native_child, native_input_record, transcripts, notification_assignment and proven_source_coverage, with return types on the same functions. src/agent_comms drops from 2452 to 2163 unannotated parameters on this branch. Declarations corrected where the existing one was wrong: - PiSessionChild.start_command takes argv: tuple[str, ...], the type AttachedChild.start and NativePiRpcLaunch.argv declare (was tuple[str, str]). - NativeInputExecution.historical_proof returns HistoricalNativeInput | None; the triage member returns a triage proof, and the caller collects into list[HistoricalNativeInput] (was FullHistoricalNativeInput | None). - TranscriptCursor.mark_read takes reads: TranscriptReadState, viewer: str in every member (one member declared both as object). - CoverageInput.candidate, build and injected_for declare their types, so callers no longer see an inferred None. - Raise-only invalid_store consumers return NoReturn. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
trissim
marked this pull request as ready for review
October 23, 2026 11:36
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
|
debt-src at 9cee346, every finding: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Batch 2 of the parameter-annotation order: the worst files in
src/agent_commsthat no open PR touches. Each parameter gets its declared type, and the same functions get return types. NoAny,object,cast,# type: ignoreor Protocol is added (git diff -U0 | grep -E '^\+.*(\bobject\b|\bAny\b|cast\(|type: ignore|Protocol)'returns nothing).Files: selected_triage, cursor_owner, native_child, native_input_record, transcripts, notification_assignment, plus proven_source_coverage, which holds the
CoverageInputdeclarations whose missing types made cursor_owner's callers seeNone. The files of #2744, #2748, #2749, #2751, #2603, #2556 and #2469 were excluded (pi_payloads, external_transcript, turn_context and field_codec among them).Counts (AST count of unannotated parameters, excluding self/cls)
src/agent_comms(origin/main 252e32b vs this head)Per file after: selected_triage 5, native_input_record 3, native_child 1, notification_assignment 1, the rest 0. Every return-less function in the batch now has a return type, except the nested
columnhelper in_decode_row(see stops).Method
The same pyright call-site probe as batch 1, two rounds (299 → 97), then a hand pass on the rest and on every new pyright error. Overrides with no return annotation take the one their base declares (same-file bases only).
Declarations corrected
PiSessionChild.start_command(argv: tuple[str, ...]): it saidtuple[str, str], butAttachedChild.start(child_process.py:1531) andNativePiRpcLaunch.argv(native_pi.py:396) both declaretuple[str, ...].NativeInputExecution.historical_proof(3 definitions) returnsHistoricalNativeInput | None. It saidFullHistoricalNativeInput | Nonealthough the triage member returns a triage proof, and the caller collects intolist[HistoricalNativeInput](historical_native_inputs.py:163).TranscriptCursor.mark_readtakesreads: TranscriptReadState, viewer: strin all four members.UnreadTranscriptCursordeclared both asobject.CoverageInput.candidate/build/injected_for(proven_source_coverage.py) declare their types. The abstractcandidatestub had none, so pyright inferredNonefor everypublishcaller.PiSessionChild.request/send/send_fencedtakecommand: PiCommand, the declared parent ofOpen,OpenHistory,Resume,CompactDurable,Prompt... (pi_commands.py:73).invalid_storeconsumers in transcripts and notification_assignment always raise, so they returnNoReturn.Dead code
None. A zero-caller sweep over src, tests and tools flagged
TranscriptCursor.same_positionandcovers_incoming(transcripts.py:90, :108), but Toad calls both (toad/transcript_filter.py,toad/widgets/committed_presentation.py), so they stay. Thecontent_*methods are reached through@projected.Stops: left unannotated because the declaration is missing
historical_proof(**source): a keyword bag forwarded into the*HistoricalNativeInput(**source)constructors (IMPL-7). The fields have no declared record.start_command(**state): the same bag, forwarded into thePiSessionChilddataclass fields.RecordedTriageText.encode(value): the baseTextRepresentation[V].encodedeclaresvalue: object(field_codec.py:1268), notV, so the override cannot narrow it. field_codec.py belongs to Ratchet erased types and replace 106 explicit Any uses #2744._decode_row(row)and its nestedcolumn: the baseTypedRow._decode_rowdeclaresrow: sqlite3.Row | tuple[object, ...](typed_table.py:584), which this order may not write.Exposed defects: new pyright errors where a correct annotation reveals an existing gap
pyright on
src/agent_comms, keyed by (file, rule, message): 16 new and 11 gone. The new ones:**self.execution.binding_fields()spreadsdict[str, NativeColumn]into theNativeRuntimeInputconstructor, so every keyword parameter seesNativeColumn. That is an IMPL-7 parameter bag; the execution's columns need a declared record.request()returnsPiResponseData, and callers read.summary,.first_kept_entry_id,.tokens_beforeand.outcomefrom subclasses.PiCommanddoes not declare its response type, so a command cannot say which data it answers with.store.session.boundary(...).boundaryexists only onNativeCoordinationSession(coordination_session.py:121), whileCoordination.sessionis declaredCoordinationSession.InputDisplay(user.input_id, None), whereMessageEntry.input_idisstr | NoneandInputDisplayrequiresstr.RecordedTranscriptReadIdentity.resolve_sourcereceiveshistorical_source: str | None, the shared family signature, though a recorded identity always has one. A None stands for "live" (IDEN-3).Proof
PYTHONPATH=src .venv/bin/python -Iimports all seven modules: OK, after merging origin/main 252e32b.python -m compileall -qon the seven files: clean.Assumed:
ruff check --select I001 --fixand rangedruff formattouched only these seven files; this reordered proven_source_coverage's existing out-of-order import block.refactor-auditsubmodule was initialised locally only to importagent_comms.pinned_audit; no submodule change is committed.same_position/covers_incomingwas checked in the local toad-wt worktrees, not on Toad's main branch.🤖 Generated with Claude Code