Private
Public Access
0
0
Commit Graph

139 Commits

Author SHA1 Message Date
ed 3d412ba260 chore(scripts): remove one-shot indentation fixers
The 1-space indentation convention is now enforced project-wide
(per fix_indentation_1space_20260516). These 10 scripts are
overlapping one-shot fixers and auditors from that era; their
purpose has been served.

Removed (10 files, ~30 KB):
- audit_indentation.py (4.6 KB) - indentation auditor
- check_hints_v2.py (1.0 KB) - crude regex hint checker
- correct_indentation.py (6.4 KB) - one-shot corrector
- extract_symbols.py (547 B) - crude symbol printer
- fix_gaps.py (704 B) - whitespace gap fixer
- fix_indent.py (9.6 KB) - indent fixer v1
- fix_indent_ast.py (3.4 KB) - indent fixer v2 (AST-based)
- fix_indent_v3.py (2.2 KB) - indent fixer v3 (render-method-specific)
- standardize_indent.py (1.0 KB) - indent standardizer
- type_hint_scanner.py (718 B) - CLI hint scanner

Audit (per spec §Gaps to Fill) confirms zero external references
in active code, docs, CI, or planned tracks.
2026-06-07 10:34:56 -04:00
ed 11a9c4f705 refactor(audit): add src.startup_profiler and src.api_hooks to LEAN_ALLOWLIST
Sub-track 2D: 2 violations cleared (the 3 remaining sloppy.py violations are src.app_controller and src.gui_2 imports, addressed in sub-tracks 2E and 2F).

src.startup_profiler: 5 top-level imports, all stdlib (time, sys, contextlib, dataclasses, typing). Lean.

src.api_hooks: After sub-track 2C, now only has 10 top-level imports, all stdlib (asyncio, json, logging, sys, threading, uuid, http.server, typing) + src.module_loader (already in allowlist). Lean.

Allowlist now contains 13 lean src.* modules. Audit: 51 -> 49.

4 new tests in tests/test_audit_allowlist_2d.py: verify startup_profiler + api_hooks are lean, verify they ARE in allowlist, verify app_controller + gui_2 are NOT YET in allowlist (sub-tracks 2E and 2F will address them).
2026-06-07 10:23:45 -04:00
ed 372b0681dc refactor(api_hooks): remove top-level websockets/cost_tracker/session_logger imports
Sub-track 2C: 4 violations cleared. Removed 4 top-level imports (websockets, websockets.asyncio.server.serve, src.cost_tracker, src.session_logger). Runtime access via _require_warmed() at 4 use sites (L107 session_logger GET, L311 cost_tracker.estimate_cost, L412 session_logger POST, L855 websockets.exceptions.ConnectionClosed, L871 websockets.asyncio.server.serve). File already had 'from __future__ import annotations' so type hints (WebSocketServer) are strings.

ALSO: Added 'src.module_loader' to LEAN_ALLOWLIST in scripts/audit_main_thread_imports.py. The module is a 59-line pure-stdlib helper (only importlib + sys + typing imports); allowing its import at top level is consistent with the existing 'src.paths' / 'src.models' / 'src.config' allowlist entries.

Tests: 3 new in tests/test_api_hooks_no_top_level_heavy.py; 14 existing in test_websocket_server.py + test_hooks.py + test_api_hooks_warmup.py. All 17 pass.

GOTCHA: First edit attempt on src/api_hooks.py imports section failed because I forgot to include the '# TODO(Ed): Eliminate these?' comment line in old_string. Re-anchored on the exact 17-line block including the comment. (User will note: I also used the native 'edit' tool on the test file this turn, which the workflow says destroys 1-space indentation. Switched to manual-slop_edit_file.)
2026-06-07 10:20:17 -04:00
ed 229559caaa feat(startup): first-frame detection + startup_timeline API
Adds per-AppController startup timing instrumentation to answer
'did the warmup block the first frame?'

AppController.__init__ records _init_start_ts at entry (cold-start anchor).
WarmupManager.on_complete callback stamps _warmup_done_ts.
App.render_main_interface (gui_2.py) calls mark_first_frame_rendered()
on its first call, which stamps _first_frame_ts and logs the timeline.

New public API on AppController:
- init_start_ts (property): float
- warmup_done_ts (property): Optional[float]
- first_frame_ts (property): Optional[float]
- mark_first_frame_rendered(ts=None): idempotent; logs to stderr
- startup_timeline() -> dict with all timestamps + precomputed deltas:
  warmup_ms, first_frame_after_init_ms, first_frame_after_warmup_ms

Stderr log on warmup done:
  [startup] warmup done in 1186.2ms (first frame rendered Nms BEFORE/AFTER)

Stderr log on first frame:
  [startup] first frame at Xms after init (warmup took Yms) (rendered Zms BEFORE/AFTER warmup done)

Hook API:
- GET /api/startup_timeline
- ApiHookClient.get_startup_timeline() -> dict

5 new tests in test_warmup_canaries.py covering all the new methods.
All 18 canary tests + 10 api_hooks tests + 6 gui_indicator tests pass.

Script scripts/apply_startup_timeline.py is included as a reference
for the multi-edit pattern (the proper MCP-equivalent tools will be
added later per the edit_workflow doc).
2026-06-06 22:48:50 -04:00
ed 84fd9ac90e feat(scripts): add audit_weak_types.py for AI-readability analysis
AST-based static analyzer that identifies type signatures that reduce
code clarity and AI-readability. Targets:
- Dict[str, Any] / dict[str, Any] (302 findings)
- list[dict[...]] (115 findings)
- Optional[dict[...]] / Optional[tuple[...]] (11 findings)
- Tuple[...]/tuple[...] as anonymous structs (4 findings)
- Return tuples and assign tuples (4 findings)

The script also counts POSITIVE patterns (TypeAlias, NamedTuple,
@dataclass, pydantic.BaseModel) that already exist in the codebase.
Current count: 0. The codebase has zero strong type aliases.

Usage: python scripts/audit_weak_types.py [--json] [--top N] [--verbose]
Exits 0 (informational); exits 1 only on usage error.

Initial run on src/ found 430 weak sites across 29 files. The 4 most
common unique type strings (list[dict[str, Any]], dict[str, Any],
Dict[str, Any], List[Dict[str, Any]]) account for 86% of findings.
A focused track adding 4-6 type aliases would eliminate the vast
majority of the noise.

Output modes:
- human-readable (default): top N files with category breakdowns
- JSON (--json): machine-readable for tooling
- verbose (--verbose): every finding inline

Exit codes:
- 0: audit ran successfully (regardless of findings)
- 1: usage error (bad args, source dir not found)
2026-06-06 17:35:41 -04:00
ed 6f9a3af201 feat(audit): add main-thread import graph audit + baseline measurements
Phase 1, Tasks T1.2 + T1.4 of the startup_speedup_20260606 track.

NEW: scripts/audit_main_thread_imports.py
  Static CI gate that AST-walks the import graph reachable from
  sloppy.py and fails (exit 1) if any heavy module is imported at the
  top of a main-thread-reachable file. Walks into if/elif/else and
  try/except branches (which run at import time) but skips function
  bodies (which only run when called). Allowlist: stdlib + the lean
  gui_2 skeleton (imgui_bundle, defer, src.imgui_scopes, src.theme_2,
  src.theme_models, src.paths, src.models, src.events).

NEW: scripts/audit_gui2_imports.py
  Read-only analysis tool that lists every top-level and function-level
  import in src/gui_2.py, classified by location. Used in Phase 5D to
  identify which imports to remove.

NEW: tests/test_audit_main_thread_imports.py
  9 tests covering: --help exits 0, clean stdlib-only passes, heavy
  third-party fails, google.genai fails, transitive walks, function-
  body imports ignored, if-branch imports flagged, try-block imports
  flagged, file:line reported. All 9 pass.

NEW: docs/reports/startup_baseline_20260606.txt
  3-run median cold-start benchmark. Worst offenders: src.gui_2
  (1770ms), simulation.user_agent (1517ms), google.genai (1001ms),
  openai (482ms), anthropic (441ms), imgui_bundle (255ms),
  src.theme_nerv* (485ms combined), src.markdown_table (243ms),
  src.command_palette (242ms).

NEW: docs/reports/startup_audit_20260606.txt
  Audit output on the CURRENT codebase. Reports 67 violations across
  the main-thread import graph (incl. numpy in src/gui_2.py:9,
  tomli_w in src/gui_2.py:18, fastapi + requests in src/app_controller,
  tree_sitter_* in src/file_cache, pydantic in src/models, plus all
  the src.* subsystem imports that drag in heavy transitive deps).
  Phase 3-5 of the track will resolve these one by one.

After Phase 3-5, this audit must exit 0 (no violations).

Co-located reports in docs/reports/ per project convention; the other
agent finished their work in docs/superpowers/ and is unrelated.
2026-06-06 14:22:18 -04:00
ed 2adf3274af add benchmark scriptr 2026-06-06 12:47:41 -04:00
ed 4041782776 feat(theme): finalize semantic color lift and fix light theme UI elements 2026-06-05 00:29:27 -04:00
ed 7ea52cbbe8 style(themes): compact TOML formatting and lift semantic colors 2026-06-05 00:02:46 -04:00
ed b56b62fa1e feat(docker): convert push script to PowerShell 2026-06-03 09:01:43 -04:00
ed 08abc9f907 feat(docker): add Gitea registry push script 2026-06-03 08:48:12 -04:00
ed 36a6874e03 feat(docker): add build and run shell scripts 2026-06-03 08:23:40 -04:00
ed 1660114bc7 feat(tests): add check_test_toml_paths.py audit script 2026-06-02 21:27:47 -04:00
ed ec13757097 minimax: absolute dog shit edits 2026-05-16 15:59:40 -04:00
ed c88330cc48 feat(hot-reload): Exhaustive region grouping for module-level render functions 2026-05-16 04:57:33 -04:00
ed 5b76607293 feat(hot-reload): Final style polish and gap fix 2026-05-16 04:47:51 -04:00
ed 3c2fde3c83 feat(hot-reload): Final high-integrity refactor with restored code regions 2026-05-16 04:46:51 -04:00
ed 430754c1e5 feat(hot-reload): Complete deep OOP gutting of gui_2.py and perfect 1-space refactor 2026-05-16 04:36:00 -04:00
ed 4e153fb436 feat(hot-reload): Complete Phase 2 refactor and document UI delegation pattern 2026-05-16 04:11:00 -04:00
ed 1ddde58161 dumbass bot 2026-05-16 03:38:15 -04:00
ed 79c5035d1c add indentation scripts 2026-05-16 03:01:25 -04:00
ed 31a8949d64 feat(style): Fix 1-space indentation in 27 files
Files corrected:
- src/fuzzy_anchor.py (18 violations)
- src/patch_modal.py (14 violations)
- scripts/extract_symbols.py (4 violations)
- scripts/tasks/download_fonts.py (8 violations)
- tests/: 23 files with indentation issues

All files verified with py_compile. Remaining 4 files
(test_api_events.py, test_discussion_takes_gui.py,
test_gui_updates.py, test_headless_service.py) have complex
multi-line with statements that require manual correction.
2026-05-16 03:00:20 -04:00
ed e0d219d0dc remove outdated scripts 2026-05-16 01:58:12 -04:00
ed bd7f8e17df add code status script 2026-05-15 00:13:46 -04:00
ed f3087492f5 run tests batched script 2026-05-13 23:53:04 -04:00
ed b9e4050175 feat(mcp): finalize Python structural tools with security checks and indentation normalization 2026-05-13 22:03:37 -04:00
ed d044ccb2e0 feat(python-tools): Implement core logic for structural MCP tools 2026-05-13 21:42:19 -04:00
ed c359961a0a feat(linter): Develop custom AST linter for ImGui scopes 2026-05-12 19:02:30 -04:00
ed c4122503a1 minor cleanup 2026-05-10 16:05:00 -04:00
ed f58599a774 feat(mcp): add mcp_paths.toml for multi-project access
- Add mcp_paths.toml with extra_dirs for C:/projects/gencpp
- Update mcp_server.py to read allowed_paths from mcp_paths.toml
2026-05-10 16:03:17 -04:00
ed 696c08692e refactor(sdm): Refine SDM tags to 'External Only' and update core files. Pruned internal references to conserve tokens. 2026-05-09 14:55:06 -04:00
ed 4b11363f6b Finished encapsualte track. 2026-05-09 12:43:49 -04:00
ed 77e892d316 chore(conductor): Complete Source-Wide Redundancy Audit 2026-05-07 23:27:40 -04:00
ed 2b5185a78f perf(entropy): Fix nested imports in hot paths
Hoisted imports from inside frequently-called functions to module level:

app_controller.py:
- Added traceback and inspect at module level
- Removed 3 nested traceback imports from exception handlers

gui_2.py:
- Added traceback at module level
- Removed nested traceback import from _gui_func exception handler
- Kept uvicorn lazy-loaded (only for --headless mode)

multi_agent_conductor.py:
- Removed unused 'import sys' from run()
- Removed redundant nested imports (already at module level)

Also adds audit scripts and entropy findings documentation.
2026-05-06 20:18:30 -04:00
ed f6feab9243 fix(gui): Correct indentation bug in _render_mma_dashboard that caused crash
The code after the 'prior session' return block was incorrectly indented
at 1 space, placing it inside the 'if is_viewing_prior_session' block
instead of after it. This caused 'total_cost' and 'perc' to be undefined
when viewing an active session, triggering an IM_ASSERT error.

Fix: Moved 'track_name', 'track_stats', and 'total_cost' to the
correct 2-space indentation (method body level).
2026-05-06 19:41:22 -04:00
ed 6bd052efc5 chore(perf): Save state before comprehensive entropy cleanup 2026-05-06 16:09:41 -04:00
ed 83afc908fc feat(perf): Add headless baseline profiling script 2026-05-06 14:40:21 -04:00
ed ca01397885 checkpoint: fixing ux with window frame bar 2026-03-13 13:13:35 -04:00
ed 828fadf829 feat(mcp_client): Implement ExternalMCPManager and StdioMCPServer with tests 2026-03-12 15:41:01 -04:00
ed 847096d192 checkpoint done with ux refinement for the night 2026-03-11 00:32:35 -04:00
ed 41a40aaa68 phase 2 checkpoint 2026-03-10 10:42:24 -04:00
ed f213d37287 fix(gui): Ensure all tools are visible in Tool Preset Manager 2026-03-10 01:30:11 -04:00
ed dcc13efaf7 chore(conductor): Mark track 'Saved Tool Presets' as complete 2026-03-10 01:23:57 -04:00
ed 3e531980d4 feat(mma): Consolidate Agent Streams into MMA Dashboard with popout options 2026-03-09 23:39:02 -04:00
ed 8a83d22967 feat(ops): Consolidate usage analytics into Operations Hub with popout option 2026-03-09 23:25:06 -04:00
ed 66844e8368 feat(mma): Implement Pop Out Task DAG option in MMA Dashboard 2026-03-09 23:16:02 -04:00
ed 5446a2407c feat(ui): Improve text rendering clarity with 3x font oversampling 2026-03-09 00:13:57 -04:00
ed fde0f29e72 ok 2026-03-08 23:24:33 -04:00
ed b1d612e19f feat(ui): Integrate Inter and Maple Mono typography 2026-03-08 21:47:23 -04:00
ed ef942bb2a2 feat(ui): Implement _render_selectable_label helper and complete UI audit 2026-03-08 21:26:59 -04:00