Private
Public Access
0
0

conductor(checkpoint): Fix markdown_helper.py for imgui-bundle >=1.92.801 complete

This commit is contained in:
2026-06-03 00:54:07 -04:00
parent b306f8f609
commit 6ce119dffe
2 changed files with 29 additions and 17 deletions
+4
View File
@@ -354,3 +354,7 @@ This file tracks all major tracks for the project. Each track has its own detail
- [x] **Track: Clean Install Test** `[checkpoint: d14ae3b]`
*Link: [./tracks/clean_install_test_20260603/](./tracks/clean_install_test_20260603/), Spec: [./../../docs/superpowers/specs/2026-06-02-clean-install-test-design.md](./../../docs/superpowers/specs/2026-06-02-clean-install-test-design.md), Plan: [./../../docs/superpowers/plans/2026-06-02-clean-install-test.md](./../../docs/superpowers/plans/2026-06-02-clean-install-test.md)*
*Goal: Add opt-in pytest test (`RUN_CLEAN_INSTALL_TEST=1`) that clones the repo to tmp_path, runs `uv sync`, launches `sloppy.py --enable-test-hooks`, verifies Hook API responds. Catches "works on my machine" failures. Added `clean_install` marker to `pyproject.toml`. Created `tests/test_clean_install.py` (114 lines, uses `urllib.request` from stdlib per tech-stack.md dependency minimalism rule - deviation from plan). Skipped by default. Marked with `@pytest.mark.clean_install`.*
- [x] **Track: Fix markdown_helper.py for imgui-bundle >=1.92.801** `[checkpoint: 7a34edf]`
*Link: [./tracks/markdown_helper_language_api_compat_20260603/](./tracks/markdown_helper_language_api_compat_20260603/)*
*Goal: First thing the clean install test caught. `ed.TextEditor.LanguageDefinitionId` enum was removed in `imgui-bundle>=1.92.801`. Replaced with version-compat shim helpers `_get_language_id(name)` and `_set_editor_language(editor, lang_obj)` that detect the API at runtime (1.92.5 enum vs 1.92.801+ factory). Also added parallel `_editor_lang_cache` to track current language tag per editor (robust to API name differences like "C++" vs "cpp"). Verified: test passes in opt-in mode (1.92.801), shim still works in local 1.92.5 env, follow-up commit `b306f8f` corrected test URL `/api/mma_status` -> `/api/gui/mma_status` (actual endpoint per `src/api_hooks.py:181`).*
@@ -1,24 +1,32 @@
# Implementation Plan: Fix markdown_helper.py for imgui-bundle >=1.92.801
## Phase 1: Red - Confirm bug
## Phase 1: Red - Confirm bug [checkpoint: pre-existing 7a34edf]
- [x] Task 1.1: Run `tests/test_clean_install.py` in opt-in mode (RUN_CLEAN_INSTALL_TEST=1) - confirm AttributeError on TextEditor.LanguageDefinitionId
- [x] Task 1.2: Capture full traceback for git note
## Phase 2: Green - Apply version-compat shim
- [ ] Task 2.1: Add module-level `_get_language_id(name)` helper to markdown_helper.py
- [ ] Task 2.2: Add module-level `_set_editor_language(editor, lang_obj)` helper
- [ ] Task 2.3: Add module-level `_get_editor_language_name(editor)` helper
- [ ] Task 2.4: Replace `_lang_map` initialization to use `_get_language_id(...)`
- [ ] Task 2.5: Replace lines 128, 134, 135, 136 with shim calls
- [ ] Task 2.6: Handle the "none" fallback case (return None, skip set call)
- [ ] Task 2.7: Syntax check (ast.parse)
## Phase 2: Green - Apply version-compat shim [checkpoint: 7a34edf]
- [x] Task 2.1: Add module-level `_get_language_id(name)` helper to markdown_helper.py
- [x] Task 2.2: Add module-level `_set_editor_language(editor, lang_obj)` helper
- [x] Task 2.3: Replace `_lang_map` initialization to use `_get_language_id(...)`
- [x] Task 2.4: Replace set/get language calls with shim calls
- [x] Task 2.5: Add parallel `_editor_lang_cache` to track current language tag per editor
- [x] Task 2.6: Handle the "none" fallback case (return None, skip set call)
- [x] Task 2.7: Syntax check (ast.parse)
## Phase 3: Verify
- [ ] Task 3.1: Run `tests/test_clean_install.py` in opt-in mode - should pass (1 passed, clone+sync+launch+hook API)
- [ ] Task 3.2: Run local markdown-related tests (if any) to ensure no regression in 1.92.5 env
- [ ] Task 3.3: Import test for the new helpers (both APIs should work)
## Phase 3: Verify [checkpoint: 7a34edf]
- [x] Task 3.1: Run `tests/test_clean_install.py` in opt-in mode - 1 passed in 16.56s
- [x] Task 3.2: Shim import test in local 1.92.5 env - works
- [x] Task 3.3: Shim import test in cloned 1.92.801 env - works (no AttributeError)
## Phase 4: Commit
- [ ] Task 4.1: Atomic commit with descriptive message
- [ ] Task 4.2: Git note with root cause analysis
- [ ] Task 4.3: Update tracks.md to register this fix track
## Phase 4: Test URL fix [checkpoint: b306f8f]
- [x] Task 4.1: Test still failed with 404 on /api/mma_status
- [x] Task 4.2: Searched actual endpoints in src/api_hooks.py
- [x] Task 4.3: Correct URL is /api/gui/mma_status (line 181)
- [x] Task 4.4: Updated test, re-ran, PASSED
## Phase 5: Commit + Register
- [x] Task 5.1: Atomic commit (7a34edf) with descriptive message + git note
- [x] Task 5.2: Atomic commit (b306f8f) for test URL fix + git note
- [x] Task 5.3: Update tracks.md to register this fix track
- [ ] Task 5.4: conductor(checkpoint) commit
- [ ] Task 5.5: Clean up demo dir + stale log files