refactor(client): typed helpers + from_url to kill ~40 casts#304
Draft
tildesrc wants to merge 2 commits into
Draft
refactor(client): typed helpers + from_url to kill ~40 casts#304tildesrc wants to merge 2 commits into
tildesrc wants to merge 2 commits into
Conversation
Add nine private typed helpers (_get_obj, _get_list, _get_str_list, _get_str_field, _put_obj, _post_obj, _post_list, _delete_obj, _patch_obj) so every cast lives inside a helper. Public methods become single clean lines with no cast. The two intentional exceptions are list_tasks_versioned (hand-parses the version header) and get_runner (404 branch). Also: - list_tasks() delegates to list_tasks_versioned()[0] to remove the duplicate GET /tasks call. - TaskServiceClient.from_url(url) classmethod collapses the seven httpx.Client(base_url=...) construction sites across container/, sessionservice/, and terminal/ — and removes the now-redundant _make_client / _default_client private factories. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
tildesrc
force-pushed
the
panopticon/client-typed-helpers
branch
from
July 13, 2026 04:00
addd624 to
0e6c2c1
Compare
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.
Summary
_get_obj,_get_list,_get_str_list,_get_str_field,_put_obj,_post_obj,_post_list,_delete_obj,_patch_obj) toTaskServiceClientso allcast()calls are consolidated inside helpers; every public method becomes a single clean line.list_tasks()delegates tolist_tasks_versioned()[0], removing the duplicateGET /taskscall.TaskServiceClient.from_url(url)classmethod collapses sevenhttpx.Client(base_url=...)construction sites acrosscontainer/,sessionservice/, andterminal/, and removes the now-redundant_make_client/_default_clientprivate factories.The two intentional
cast()holdouts outside the helpers:list_tasks_versioned(hand-parses theX-Tasks-Versionheader) andget_runner(404 branch).Plan:
panopticon://tasks/bcd956ad89954e4eb7b6043c6ea4af78/artifacts/plan.md🤖 Generated with Claude Code