use uv to run test, more fixes

This commit is contained in:
2026-07-07 23:43:48 +08:00
parent f7d6a51220
commit 268483577e
16 changed files with 705 additions and 127 deletions

27
PLAN.md
View File

@@ -357,7 +357,7 @@ All introspection tools below call `session->ensureConnected(timeoutMs)` first;
### Implementation status (updated — see "Known issues / Blocked" section for details on the sub-model population blocker)
**Working end-to-end (verified via stdio MCP smoke test against a live probe):**
**Working end-to-end (verified via full test suite — 26/26 tests passing, 2026-07-07):**
-`connectProbe(host?, port?)` / `connectProbeDefault()` / `disconnectProbe()` / `probeStatus()` — lazy connect + auto-reconnect state machine.
-`listQuickWindows()` / `selectQuickWindow(index)` — window navigation.
-`listScenegraphNodes()` — returns real QSGNode tree with signal-driven `primeAndWait()`.
@@ -369,13 +369,25 @@ All introspection tools below call `session->ensureConnected(timeoutMs)` first;
-`getMaterialShaders(address)` — reads `shaderModel`. Returns "no shaders" for nodes without materials.
-`getShaderSource(row)` — async path via `MaterialExtensionInterface` proxy. Works end-to-end when shaderModel has data.
-`getMaterialProperties(address)` — reads `materialPropertyModel`. Returns "no material properties" for nodes without materials.
-`selectQuickItem(address)` — selects a QML item via `SelectionModelClient` for `QuickItemModel.selection`. Returns item property data.
-`getItemProperties(address)` — reads `AggregatedPropertyModel` for a selected QML item. Returns 4-column model (name/value/type/class) with nested property groups.
-**Connection tests** (5/5): tools listed, disconnected status, connect+disconnect, reconnect, reconnect after disconnect.
-**Navigation tests** (7/7): list windows, select window, list items, list scenegraph nodes, scenegraph has geometry nodes.
-**Item property tests** (6/6): tools listed, select item, get properties, has position, has visual properties, has property groups.
-**SceneGraph tests** (8/8): select node, get vertices, get adjacency, get shaders, get material properties, set render mode, set slow mode.
**Not yet implemented:**
-`grabTexture(objectId)``TextureExtension` async image grab. Not started.
### Known issues / Blocked
**RESOLVED — Sub-models now populate correctly after SG node selection (2026-07-07).**
**All known blockers resolved as of 2026-07-07.**
**RESOLVED — Item property model lazy-fetch causes `Loading...` data (2026-07-07).**
`RemoteModel::data()` returns `"Loading..."` on the first call and queues an async fetch. The data only arrives after the event loop processes the server reply. The fix adds a polling loop in `getItemProperties()` that repeatedly calls `data()` and runs the event loop until non-`"Loading..."` data arrives (5s timeout). Similarly, grouped properties (background, contentItem, etc.) require explicit `rowCount()` triggering + event loop processing + `hasChildren()` check because `RemoteModel::rowCount(parent)` returns 0 until the child count response arrives asynchronously.
The `primeAndWait()` approach was abandoned for the property model because it triggers a GammaRay `RemoteModel` use-after-free crash (`typeinfo name for QSharedMemory` RTTI corruption). The polling approach avoids this by using only single-cell `data()` calls and short event loop iterations instead of deep recursive tree traversal.
The fix was NOT a code change but a sequencing fix in `ensureNodeSelected()`:
@@ -401,6 +413,7 @@ The fix was NOT a code change but a sequencing fix in `ensureNodeSelected()`:
All items from the original blocker resolved. Remaining minor issues:
- `listScenegraphNodes` first-call fill stability — first call may show "Loading..." for deep nodes (RemoteModel lazy-fetch behavior); second call returns the full tree. The `primeAndWait()` loop handles this transparently, but single-call would be nicer.
- `walkItemChildren` `flagsToJson` uses hardcoded flag bit values (1,2,4,8,16,32,64) — fragile if GammaRay's `ItemFlags` enum changes. Should read from `common/quickitemmodelroles.h` if it were installed.
- Full test suite takes ~8 minutes due to probe start/stop overhead and 500-1500ms settle delays per tool call. Could be optimized with module-scoped bridge fixtures and shared probe process.
## Step 7: Launch and run
@@ -539,9 +552,9 @@ cmake --build build
## Next steps
1. **Test `getShaderSource` async path end-to-end** — needs a QML app with real shaders (current test app uses software renderer where GeometryNodes have `nullptr` geometry).
2. **Test geometry/material tools against a QML app with real QSGGeometry data** — current test app `relayout.qml` uses software renderer so `hasGeometry: false` and empty sub-models are correct behavior.
3. **Implement `grabTexture(objectId)`**`TextureExtension` async image grab via `RemoteViewInterface` `TransferImage`. Follows the `MaterialExtensionInterface` proxy pattern.
4. **Fix `listScenegraphNodes` first-call fill stability** — single-call instead of caller needing a second call.
5. **Pin qtmcp `GIT_TAG`** to a specific commit/tag for reproducibility (currently tracks `main`).
1. **Optimize test suite runtime** — share bridge across tests or reduce settle delays to bring ~8min down to ~2-3min.
2. **Test `getShaderSource` async path end-to-end** — needs a QML app with real shaders (current test app uses software renderer where GeometryNodes have `nullptr` geometry).
3. **Test geometry/material tools against a QML app with real QSGGeometry data** — current test app `relayout.qml` uses software renderer so `hasGeometry: false` and empty sub-models are correct behavior.
4. **Implement `grabTexture(objectId)`**`TextureExtension` async image grab via `RemoteViewInterface` `TransferImage`. Follows the `MaterialExtensionInterface` proxy pattern.
5. **Fix `listScenegraphNodes` first-call fill stability** — single-call instead of caller needing a second call.
6. **Build `--connect` startup flag integration** with systemd service for auto-attach during development.