Merged
Conversation
…an API surface - Remove 93 unused imports/variables across all test and production files - Move _parse_timestamp to utils/time_utils.py as public parse_timestamp - Move _sanitize_filename to utils/export.py as public sanitize_filename - Add type annotations to sanitize_numeric, _normalize_datetime, parse_timestamp - Replace bloated Args/Returns docstrings with concise single-line docstrings - Extract _export_with_logging helper to deduplicate export boilerplate - Delete dead get_current_active_user (redundant with get_current_user) - Add typed SignupResponse schema replacing untyped dict response - Fix compute_realized_pnl docstring to match pnl_is_set semantics - Rename FilterParams.types to trade_types (with alias for backward compat) - Fix silent error swallow in fetch_market_details - Convert run_api.py/run_gui.py dependency checks to importlib.util.find_spec - Add .desloppify/ to .gitignore https://claude.ai/code/session_01GsZ8qwDvTX3Z8knHfKgnpQ
… test
1. run_gui.py: Restore special tkinter handling in dependency check.
importlib.util.find_spec('tkinter') returns None on Linux systems
with system-installed tkinter (C extension), even though the module
is importable. Reverted to __import__ for tkinter specifically.
2. tests/static_patterns/test_imports.py: Restore all module imports in
test_all_modules_import_together. The desloppify commit removed them,
leaving the circular import detection test as just "assert True".
https://claude.ai/code/session_01AJkJyGzyutD8YjR3cbq2Np
1. pnl_calculator.py: FIFO calculator used trade.price (market reference) instead of trade.cost/trade.shares (actual cost basis) for both buy queue entries and sell revenue. This ignored fees and caused incorrect PnL for providers where cost != price*shares (notably Kalshi). 2. gui.py: Temp file leak when json.dump fails — tmp_path was assigned after json.dump, so NameError in finally block masked the real error and leaked the temp file. Moved tmp_path assignment before json.dump. 3. gui.py: _fetch_in_progress flag permanently stuck if root.after() fails (user closes GUI during API fetch). Added try/except around root.after in the error path to reset the flag. 4. pro.py: Cumulative PnL chart used float accumulation, violating the project invariant (CLAUDE.md: use Decimal loop for PnL accumulation). Switched to Decimal accumulator matching pnl.py and enhanced.py. 5. data_tools.py: Guard clauses called error_result() directly inside @safe_tool handlers, bypassing the decorator's error handling. Changed to raise ValueError, letting @safe_tool handle it consistently. https://claude.ai/code/session_01AJkJyGzyutD8YjR3cbq2Np
_apply_position_pnl now skips trades with pnl_is_set=True, enforcing CLAUDE.md invariant #2 ("Never overwrite pnl_is_set=True trades"). Currently all Kalshi trades start with pnl_is_set=False so this is preventive, but it protects against future changes that might call this method on trades that already have provider-set PnL. https://claude.ai/code/session_01AJkJyGzyutD8YjR3cbq2Np
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.
No description provided.