From 09184398cf4487a6a2ac3353060037c427306a48 Mon Sep 17 00:00:00 2001 From: shakibuzzaman Date: Mon, 9 Nov 2026 18:33:15 +0600 Subject: [PATCH] Improve the inspector and dashboard for QA Add one-tap test conditions on the phone and the web, and a failed request count on the floating button. Simplify the phone inspector: request and response bodies at a glance, an easier mock editor, sockets grouped by connection, and plain labels. Fix the Failed chip and sharing exports. Bring the web dashboard in line: Network opens on Body with labelled actions, a simpler mock dialog, a connection strip for WebSockets, Copy for bug report, and device details in the header. The UNREDACTED stamp now shows only when redaction is on. --- CHANGELOG.md | 29 ++ docs/COMPOSER_AND_MOCKS.md | 2 +- docs/SECURITY_AND_REDACTION.md | 4 +- docs/THREAT_MODEL.md | 4 +- sdk/full/src/main/AndroidManifest.xml | 10 +- .../kotlin/io/devconsole/CaptureTimeline.kt | 2 + .../io/devconsole/DevConsoleFileProvider.kt | 7 +- .../devconsole/FailedRequestBadgeDrawable.kt | 65 +++ .../io/devconsole/FailedRequestCounter.kt | 36 ++ .../io/devconsole/OpenTriggerController.kt | 50 ++- .../io/devconsole/PlatformFacadeProvider.kt | 1 + .../DevConsoleFileProviderManifestTest.kt | 33 ++ .../io/devconsole/FailedRequestCounterTest.kt | 105 +++++ .../devconsole/OpenTriggerControllerTest.kt | 51 +++ .../resources/devconsole-web/dashboard.css | 53 ++- .../resources/devconsole-web/dashboard.js | 410 ++++++++++++------ .../main/resources/devconsole-web/index.html | 86 ++-- .../server/ktor/DashboardAssetsTest.kt | 4 +- sdk/ui-compose/api/ui-compose.api | 26 +- .../ui/compose/DevConsoleActivity.kt | 7 + .../devconsole/ui/compose/DevConsoleTheme.kt | 2 +- .../ui/compose/DevConsoleWorkspace.kt | 1 + .../ui/compose/InspectorBuildSummary.kt | 41 ++ .../ui/compose/InspectorControlScreen.kt | 58 ++- .../ui/compose/InspectorDataScreen.kt | 6 +- .../ui/compose/InspectorListComponents.kt | 17 + .../ui/compose/InspectorMockRuleEditor.kt | 120 ++--- .../ui/compose/InspectorMockRuleForm.kt | 23 + .../ui/compose/InspectorMoreScreen.kt | 62 +-- .../ui/compose/InspectorNetworkSnippets.kt | 28 ++ .../ui/compose/InspectorObserveDetail.kt | 103 ++++- .../compose/InspectorObserveDetailPanels.kt | 1 - .../ui/compose/InspectorObserveFormat.kt | 3 +- .../ui/compose/InspectorObserveFrameDetail.kt | 41 +- .../ui/compose/InspectorObserveNetDetail.kt | 105 +++-- .../ui/compose/InspectorObserveScreen.kt | 20 +- .../ui/compose/InspectorObserveSignals.kt | 135 +++--- .../ui/compose/InspectorObserveTrafficTab.kt | 143 +++++- .../ui/compose/InspectorScreenshotFormat.kt | 13 +- .../ui/compose/InspectorSocketComposer.kt | 4 +- .../ui/compose/InspectorTestConditions.kt | 106 +++++ .../ui/compose/InspectorViewModel.kt | 19 +- .../ui/compose/SocketConnectionGroup.kt | 43 ++ .../ui/compose/InspectorMockRuleEditorTest.kt | 41 ++ .../InspectorObserveNetDetailLayoutTest.kt | 75 ++++ .../ui/compose/InspectorQaEvidenceTest.kt | 94 ++++ .../ui/compose/InspectorSocketGroupingTest.kt | 59 +++ .../ui/compose/InspectorTestConditionsTest.kt | 153 +++++++ 48 files changed, 2041 insertions(+), 460 deletions(-) create mode 100644 sdk/full/src/main/kotlin/io/devconsole/FailedRequestBadgeDrawable.kt create mode 100644 sdk/full/src/main/kotlin/io/devconsole/FailedRequestCounter.kt create mode 100644 sdk/full/src/test/kotlin/io/devconsole/DevConsoleFileProviderManifestTest.kt create mode 100644 sdk/full/src/test/kotlin/io/devconsole/FailedRequestCounterTest.kt create mode 100644 sdk/ui-compose/src/main/kotlin/io/devconsole/ui/compose/InspectorBuildSummary.kt create mode 100644 sdk/ui-compose/src/main/kotlin/io/devconsole/ui/compose/InspectorTestConditions.kt create mode 100644 sdk/ui-compose/src/main/kotlin/io/devconsole/ui/compose/SocketConnectionGroup.kt create mode 100644 sdk/ui-compose/src/test/kotlin/io/devconsole/ui/compose/InspectorObserveNetDetailLayoutTest.kt create mode 100644 sdk/ui-compose/src/test/kotlin/io/devconsole/ui/compose/InspectorQaEvidenceTest.kt create mode 100644 sdk/ui-compose/src/test/kotlin/io/devconsole/ui/compose/InspectorSocketGroupingTest.kt create mode 100644 sdk/ui-compose/src/test/kotlin/io/devconsole/ui/compose/InspectorTestConditionsTest.kt diff --git a/CHANGELOG.md b/CHANGELOG.md index 2dc8671..e61ad6f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,16 @@ joined this list.) ### Added +- **Test conditions.** Control on the phone and Mocks on the web have one-tap Slow network, No + connection, Timeouts, Server errors and Signed out for every request. Setting one on either + surface shows on the other. A condition lasts until it is turned off or the app restarts, and + Traffic and Network say when one is on, with a one-tap Turn off. +- **Copy for bug report on the web.** A network request copies as method, URL, result, time, build + and both bodies, ready to paste into a ticket. +- **WebSockets on the web list each connection first.** A strip above the messages shows every + connection, whether it is connected, and how many messages went each way. Click one to filter. +- **The floating button counts failed requests.** It uses the same rule as the Traffic "Failed" + filter, ignores mocked responses, and clears when the inspector opens. - **Composer can run a request on your computer, not just the phone.** A new `devconsole-agent` (`tools/composer-agent`, JDK 17+, macOS/Linux/Windows) connects to the device and appears under Composer -> **Run on**. Use it for APIs only the computer can reach (localhost, VPN, private IPs) @@ -47,8 +57,27 @@ Nothing this plugin does should ever be the reason a release cannot be built. Ev from one release APK build that the plugin stopped for reasons that had nothing to do with whether the DevConsole runtime leaked. +### Changed + +- **The web Network detail opens on Body, with request and response together.** Mock, Resend, Copy + for bug report and Flag are labelled buttons instead of unlabelled icons and a "..." menu. Rows + show the host on a second line, and a Failed filter matches the phone. +- **Mock rules are simpler to write on the web.** The dialog asks for method, path, what to do and + the response, with status presets. Rule name, scheme, host and the rest are under Advanced + options. A blank path now warns that it matches every request. +- **WebSockets on the web speak plainly.** Sent and Received replace RECV and SENT, messages replace + frames, and opcodes are gone. +- **The web header names the build and device.** It shows the package, version, device model and + Android version, and Copy for bug report adds a Device line. +- **Plainer web labels.** Timeline levels read Debug, Info, Warning and Error. Composer has Send + request and Refresh list. +- **The UNREDACTED stamp only shows when redaction is on.** Redaction is off by default, so the + stamp would otherwise sit on every screenshot. The export manifest still records the field. + ### Fixed +- **Share and exports open the share sheet again.** Broken since 1.2.4: the provider lacked the + paths meta-data the static `FileProvider.getUriForFile` reads, and the error was swallowed. - **Socket frames recorded before (or without) `onOpen` are no longer thrown away.** The store silently dropped any frame whose `connectionId` it did not know, so a host driving `SocketRecorder` by hand that called `onMessage` without first calling `onCreated`/`onOpen` got an diff --git a/docs/COMPOSER_AND_MOCKS.md b/docs/COMPOSER_AND_MOCKS.md index d99892d..876356c 100644 --- a/docs/COMPOSER_AND_MOCKS.md +++ b/docs/COMPOSER_AND_MOCKS.md @@ -35,7 +35,7 @@ If a request is refused, the result panel says why: |------|---------|-----| | `COMPOSER_DISABLED` (404) | Composer is off in the app | `composerEnabled(true)` | | `COMPOSER_HOST_REJECTED` (403) | Host not in `composerAllowedHosts`, **or** the phone refuses it because it resolves to a private/VPN/localhost address | Add the host to the allowlist; for private addresses use "Run on" a computer | -| `AGENT_UNAVAILABLE` (409) | The chosen computer disconnected | Restart `devconsole-agent`, press *Refresh Run On* | +| `AGENT_UNAVAILABLE` (409) | The chosen computer disconnected | Restart `devconsole-agent`, press *Refresh list* | | `AGENT_TIMEOUT` (504) | The computer accepted the request but never answered | Check the agent terminal | | `EXECUTION_FAILED` (502) | The target could not be reached; `detail` has the reason | Check URL, DNS, TLS | diff --git a/docs/SECURITY_AND_REDACTION.md b/docs/SECURITY_AND_REDACTION.md index 1dde3db..999bab2 100644 --- a/docs/SECURITY_AND_REDACTION.md +++ b/docs/SECURITY_AND_REDACTION.md @@ -156,7 +156,9 @@ collapsed to two. ## The UNREDACTED badge The dashboard badges an attachment **UNREDACTED** wherever it appears — the evidence tray, timeline/ -crash detail, the export manifest — whenever its `redactionApplicability` is `NOT_APPLICABLE`. That +crash detail, the export manifest — whenever redaction is on and its `redactionApplicability` is `NOT_APPLICABLE`. With redaction off, +which is the default, every capture is raw, so the dashboard leaves the badge out; the export +manifest still records the field. That field is read from **stored data**, not inferred client-side. Earlier in this feature's development the badge was inferred from "is this a screenshot," which was correct at the time and would have silently stopped being correct the moment anything else was ever stored as `NOT_APPLICABLE` — exactly the kind diff --git a/docs/THREAT_MODEL.md b/docs/THREAT_MODEL.md index e7140a1..65c5061 100644 --- a/docs/THREAT_MODEL.md +++ b/docs/THREAT_MODEL.md @@ -102,8 +102,8 @@ Because of that, several design decisions in this feature are deliberately unfor `NOT_APPLICABLE` — only content types redaction genuinely cannot reach (like a screenshot's PNG bytes) may claim it. The field travels with the attachment everywhere it's read back (`GET /api/v1/attachments/{id}`'s response header, the evidence tray's item JSON, the export - manifest), so a screenshot is labelled **UNREDACTED** wherever it surfaces rather than looking - identical to a redacted text body next to it. See + manifest), so with redaction on a screenshot is labelled **UNREDACTED** wherever it surfaces rather + than looking identical to a redacted text body next to it. See [SECURITY_AND_REDACTION.md](SECURITY_AND_REDACTION.md#redactionapplicability-and-the-storage-boundary) for the exact mechanics. - **The evidence bundle contains screenshots as-is.** A flagged `SCREENSHOT` evidence item's attachment diff --git a/sdk/full/src/main/AndroidManifest.xml b/sdk/full/src/main/AndroidManifest.xml index 89422bf..072f26a 100644 --- a/sdk/full/src/main/AndroidManifest.xml +++ b/sdk/full/src/main/AndroidManifest.xml @@ -28,13 +28,17 @@ file is always inside a root that inspector already permits browsing. The name is an SDK-specific subclass on purpose: the merger keys providers by android:name, so naming androidx.core.content.FileProvider here collided with every host that declares its own - (see DevConsoleFileProvider). That subclass hands FileProvider the paths resource - itself, so this declaration needs no meta-data child to collide over either. --> + (see DevConsoleFileProvider). The meta-data is what the static getUriForFile reads, and + it sits under this uniquely named node, so it cannot collide with a host's. --> + android:grantUriPermissions="true"> + +