Simplify: dedupe small helpers across the codebase#257
Merged
Conversation
A codebase-wide simplification pass, factoring genuine duplication into shared helpers without behavior change: - core/config: a single `_profile()` accessor backs get_profile_env/ get_profile_email/get_account_id (was three identical load-and-read bodies). - app/mediafile: add `transcript_id()` and `existing_output()` and route the caption/dub/clip copies of `str(getattr(transcript, "id", ""))` and the caption/dub `_existing_output` URL-guard through them. - code_agent: a shared `claude_config_root()` replaces the duplicated CLAUDE_CONFIG_DIR constant + `~/.claude` resolution in skills and memory. - code_agent/render: drop `make_approver`, a pure identity wrapper — the command passes its `_confirm` (already an Approver) straight through. - agent_cascade/tui: `_TuiRenderer._dispatch` and `LiveAgentApp._safely` were byte-identical UI-thread hops; both now delegate to one module-level `_call_on_ui_thread()`. - commands/account: `balance` reuses `_format_dollars` instead of re-inlining the dollar format. Existing tests are re-pointed at the shared helpers; the full gate (patch-coverage, mutation, escape-hatch) passes. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0168ddZzSJ7Ra4DvUd88orS5
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.
A codebase-wide simplification pass, factoring genuine duplication into
shared helpers without behavior change:
_profile()accessor backs get_profile_env/get_profile_email/get_account_id (was three identical load-and-read bodies).
transcript_id()andexisting_output()and route thecaption/dub/clip copies of
str(getattr(transcript, "id", ""))and thecaption/dub
_existing_outputURL-guard through them.claude_config_root()replaces the duplicatedCLAUDE_CONFIG_DIR constant +
~/.clauderesolution in skills and memory.make_approver, a pure identity wrapper — thecommand passes its
_confirm(already an Approver) straight through._TuiRenderer._dispatchandLiveAgentApp._safelywerebyte-identical UI-thread hops; both now delegate to one module-level
_call_on_ui_thread().balancereuses_format_dollarsinstead of re-inliningthe dollar format.
Existing tests are re-pointed at the shared helpers; the full gate
(patch-coverage, mutation, escape-hatch) passes.
Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_0168ddZzSJ7Ra4DvUd88orS5