--- name: dataminer-apps-debug-issues description: Use when the user says something is broken, not working, has a bug, or behaves unexpectedly. Open the running app in a browser and use Playwright to inspect console logs, network requests, and WebSocket frames to find the cause yourself before asking the user. license: LicenseRef-Skyline-Agent-Marketplace user-invocable: true metadata: updated: 2026-09-11 version: 1.0 --- > **Skill reference notice:** This skill refers to additional skills that are not included in this distribution: `dataminer-browser-automation`, `dataminer-qaops`. If the task needs one, report the missing prerequisite and obtain it or explicitly narrow the task; do not claim the unsupported route is complete. > - `dataminer-browser-automation`: Optional authenticated live-browser capture; ordinary mocked frontend debugging does not require it. > - `dataminer-qaops`: Optional real-system verification route, separate from local frontend diagnosis. # Debug in the browser When the user reports an issue, reproduce and diagnose it yourself before asking questions. ## Pick the host first The app may run locally or on a remote DataMiner system. Figure out the right URL before debugging: - **Local dev server**. Run `npm run dev` and use the URL it prints (e.g. `http://localhost:5173`). - **Remote / cloud host** — the user has no local system, or points you at a hosted system. Use the URL they give you (e.g. `https://my-system-skyline.on.dataminer.services/`). If you don't have it, ask the user for the exact app URL. Use whichever URL applies everywhere this skill says ``. Remote hosts are served over HTTPS, so make sure the URL scheme matches. ## Steps 1. Determine the app URL (see [Pick the host first](#pick-the-host-first)). For local debugging, make sure the dev server is running (`npm run dev`); start it if needed and note the URL it prints. For a remote host, use the URL the user provides. 2. For a remote DataMiner host, check for the reusable saved sign-in **before opening a Playwright/MCP page**. If it is absent, use the visible headed `dm-login.mjs` flow in `dataminer-browser-automation`; do not ask the user to sign in through browser automation. 3. Once the saved state exists and is configured, open the page with `open_browser_page`. If it redirects to the DataMiner sign-in page, the session has expired → **see [Authenticate](#authenticate) below before going any further.** 4. Use `run_playwright_code` to attach listeners, then trigger the broken flow. 5. Read what came back, find the mistake, fix it, re-check. --- ## Authenticate For a remote DataMiner host, do this as a preflight before opening the page. If a configured state later redirects to login, do it immediately before reading source code or continuing analysis. Check the current URL of the shared browser page: - If it contains `/auth/login` or any other sign-in path → the app has redirected to the DataMiner login page. - **First, check for a saved sign-in.** If a Playwright storage-state file exists (default `~/.copilot/playwright-auth/dataminer-storage-state.json`), the browser can be started with it and no manual step is needed — load the `dataminer-browser-automation` skill, which owns that setup, then come straight back here to continue debugging. - If there is no saved sign-in (or it has expired), stop using the current browser for authentication. Load `dataminer-browser-automation` and run its `dm-login.mjs` flow, which opens a visible headed browser window. Send this message to the user: > A visible browser window has opened for DataMiner sign-in. Please sign in **in that window** and tick "Keep me signed in" if appropriate. Do not enter credentials in chat or in a shared, hidden, or headless automation browser. I'll continue after the saved sign-in is ready. The script saves a storage state outside repositories, prunes it to DataMiner-only cookies, and restricts it to the current user. Only after it completes may you start or resume headless/MCP automation with that state. Rules: - **Never ask the user to sign in in the shared, hidden, or headless browser.** User interaction happens only in `dm-login.mjs`'s visible headed browser window. - Never ask for, type, print, or log credentials. Never commit or print the storage-state bearer cookies. - Wait for the user to complete the visible-browser sign-in before doing anything else. - Never skip this step --- ## Playwright snippet to capture everything ```js const logs = []; page.on('console', m => logs.push(`[console.${m.type()}] ${m.text()}`)); page.on('pageerror', e => logs.push(`[pageerror] ${e.message}`)); page.on('requestfailed', r => logs.push(`[reqfail] ${r.url()} ${r.failure()?.errorText}`)); page.on('response', r => { if (!r.ok()) logs.push(`[http ${r.status()}] ${r.url()}`); }); page.on('websocket', ws => { logs.push(`[ws open] ${ws.url()}`); ws.on('framesent', f => logs.push(`[ws >>] ${f.payload}`)); ws.on('framereceived', f => logs.push(`[ws <<] ${f.payload}`)); }); await page.goto(''); // local: http://localhost:5173 — or the remote/cloud URL; confirm the real host/port first // trigger the broken action here, e.g. await page.click('text=Facilities'); await page.waitForTimeout(2000); return logs.join('\n'); ``` --- ## Pick what to listen for - **Blank screen / crash** → `console` + `pageerror`. - **Data not loading** → `response` (non-2xx) + `requestfailed`. - **GQI / live data wrong** → `websocket` frames (sent query + received rows). - **Wrong UI state** → `read_page` / `screenshot_page` to inspect the DOM. --- ## Rules Inspect first, conclude from real evidence, then fix. Only ask the user if the cause genuinely can't be observed (e.g. needs their credentials or a manual action). ## Related Skills | Task | Skill | |------|-------| | Reusable DataMiner sign-in for headless Playwright, plus screenshot conventions | `dataminer-browser-automation` | | Building or restyling the UI once the bug is understood | `dataminer-apps-frontend` | | Verifying behavior on a real DataMiner with automated tests instead of the browser | `dataminer-qaops` |