-
Notifications
You must be signed in to change notification settings - Fork 2
Hub display fixes: complete run ids + humanized durations, [hidden] guard, hero dedup (#491, #492, #493) #508
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+426
−5
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
12c3b42
Alerts: complete run ids + humanized durations in alert copy (#491)
richardsongunde 6870c6b
Command Center: hero rationale never repeats the headline (#493)
richardsongunde 502c5c5
Hub styles: global [hidden] guard — the attribute always wins (#492)
richardsongunde 5b211aa
Review fixes: named time-conversion and timeout constants
richardsongunde File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,136 @@ | ||
| /** | ||
| * #492 — with a run scoped, the Run Workspace "Select one run" empty prompt | ||
| * | ||
| * must actually disappear — the `hidden` attribute was defeated by the | ||
| * class's own `display:grid` (author styles beat the UA [hidden] rule). | ||
| * | ||
| * Same harness as dashboard-96: real server on an ephemeral port, canonical | ||
| * fixtures, real Chromium via playwright-core; skips cleanly with no browser. | ||
| * | ||
| * owner: RStack developed by Richardson Gunde | ||
| */ | ||
|
|
||
| /* global document, window */ | ||
|
|
||
| import test from 'node:test'; | ||
| import assert from 'node:assert/strict'; | ||
| import { spawn } from 'node:child_process'; | ||
| import { mkdtempSync, rmSync } from 'node:fs'; | ||
| import { tmpdir } from 'node:os'; | ||
| import { join, dirname } from 'node:path'; | ||
| import { fileURLToPath } from 'node:url'; | ||
| import { createRequire } from 'node:module'; | ||
|
|
||
| import { fixtureReadyRun, fixtureBlockedRun } from '../helpers/dashboard-fixtures.js'; | ||
|
|
||
| const require = createRequire(import.meta.url); | ||
| const HERE = dirname(fileURLToPath(import.meta.url)); | ||
| const SERVER_PATH = join(HERE, '..', '..', 'src', 'observability', 'dashboard', 'server.js'); | ||
|
|
||
| let chromium = null; | ||
| try { ({ chromium } = require('playwright-core')); } catch { /* dep absent */ } | ||
|
|
||
| // Named per the repo's magic-number convention (PR #490). | ||
| const SERVER_BOOT_TIMEOUT_MS = 15_000; | ||
| const STATE_LOAD_TIMEOUT_MS = 10_000; | ||
|
|
||
| function startServer(root) { | ||
| return new Promise((resolvePromise, rejectPromise) => { | ||
| const child = spawn(process.execPath, [SERVER_PATH, '--port', '0', '--no-browser', '--project', root], { | ||
| cwd: root, | ||
| env: { | ||
| ...process.env, | ||
| RSTACK_APPROVAL_TOKEN: undefined, | ||
| RSTACK_DASHBOARD_READ_TOKEN: undefined, | ||
| RSTACK_TLS_CERT: undefined, | ||
| RSTACK_TLS_KEY: undefined, | ||
| RSTACK_BUSINESS_PORT: undefined, | ||
| RSTACK_PROJECT_ROOT: undefined, | ||
| RSTACK_NO_BROWSER: '1', | ||
| RSTACK_REGISTRY_DIR: join(root, '.registry'), | ||
| }, | ||
| stdio: ['ignore', 'pipe', 'pipe'], | ||
| }); | ||
| let out = ''; | ||
| let settled = false; | ||
| const timer = setTimeout(() => { | ||
| if (!settled) { settled = true; child.kill('SIGKILL'); rejectPromise(new Error(`server did not boot\n${out}`)); } | ||
| }, SERVER_BOOT_TIMEOUT_MS); | ||
| child.stdout.on('data', (chunk) => { | ||
|
qodo-code-review[bot] marked this conversation as resolved.
|
||
| out += chunk; | ||
| const match = out.match(/Dashboard: http:\/\/localhost:(\d+)/); | ||
| if (match && !settled) { | ||
| settled = true; | ||
| clearTimeout(timer); | ||
| resolvePromise({ baseUrl: `http://127.0.0.1:${match[1]}`, stop: () => child.kill('SIGKILL') }); | ||
| } | ||
| }); | ||
| child.stderr.on('data', (chunk) => { out += chunk; }); | ||
| child.on('exit', () => { if (!settled) { settled = true; clearTimeout(timer); rejectPromise(new Error(`server exited\n${out}`)); } }); | ||
| }); | ||
| } | ||
|
|
||
| let browser = null; | ||
| test.before(async () => { | ||
| if (!chromium) return; | ||
| try { browser = await chromium.launch({ headless: true }); } catch { browser = null; } | ||
| }); | ||
| test.after(async () => { if (browser) await browser.close(); }); | ||
|
|
||
| function browserTest(name, seed, body) { | ||
| test(name, async (t) => { | ||
| if (!browser) { t.skip('Chromium not installed — run `npx playwright-core install chromium`'); return; } | ||
| const root = mkdtempSync(join(tmpdir(), 'rstack-browser-display-')); | ||
| let server = null; | ||
| const context = await browser.newContext(); | ||
| const page = await context.newPage(); | ||
| const pageErrors = []; | ||
| page.on('pageerror', (err) => pageErrors.push(String(err))); | ||
| try { | ||
| await seed(root); | ||
| server = await startServer(root); | ||
| await body({ page, server, t }); | ||
| assert.deepEqual(pageErrors, [], 'no uncaught page errors'); | ||
| } finally { | ||
| await context.close(); | ||
| if (server) server.stop(); | ||
| rmSync(root, { recursive: true, force: true }); | ||
| } | ||
| }); | ||
| } | ||
|
|
||
| const seedRichProject = async (root) => { await fixtureReadyRun(root); await fixtureBlockedRun(root); }; | ||
|
|
||
| async function gotoDashboard(page, server) { | ||
| await page.goto(server.baseUrl, { waitUntil: 'networkidle' }); | ||
| await page.waitForFunction(() => window.STATE != null, null, { timeout: STATE_LOAD_TIMEOUT_MS }); | ||
| } | ||
|
|
||
| browserTest('scoping a run hides the Run Workspace empty prompt for real (#492)', seedRichProject, async ({ page, server }) => { | ||
| await gotoDashboard(page, server); | ||
| await page.evaluate(() => { | ||
| const buttons = [...document.querySelectorAll('nav button[data-page="run-workspace"]')]; | ||
| (buttons.find((b) => b.offsetParent !== null) || buttons[0]).click(); | ||
| }); | ||
| // Scope to the first concrete run via the topbar select (the real user path). | ||
| await page.selectOption('#scope-run', { index: 1 }); | ||
| await page.waitForFunction(() => { | ||
| const content = document.getElementById('run-workspace-content'); | ||
| return content && !content.hidden; | ||
| }, null, { timeout: 5000 }); | ||
|
|
||
| const visibility = await page.evaluate(() => { | ||
| const rect = (el) => el ? el.getBoundingClientRect() : null; | ||
| const empty = document.getElementById('run-workspace-empty'); | ||
| const emptyRect = rect(empty); | ||
| return { | ||
| emptyHiddenAttr: Boolean(empty && empty.hidden), | ||
| emptyVisiblyRendered: Boolean(emptyRect && emptyRect.height > 0 && emptyRect.width > 0), | ||
| contentVisible: Boolean(document.getElementById('run-workspace-content') && !document.getElementById('run-workspace-content').hidden), | ||
| }; | ||
| }); | ||
| assert.equal(visibility.contentVisible, true, 'the scoped workspace is open'); | ||
| assert.equal(visibility.emptyHiddenAttr, true, 'the empty prompt carries the hidden attribute'); | ||
| assert.equal(visibility.emptyVisiblyRendered, false, | ||
| 'the hidden empty prompt takes no space — [hidden] must not be defeated by the class display rule'); | ||
| }); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,124 @@ | ||
| /** | ||
| * #493 — the Command Center hero must never render the same sentence as | ||
| * | ||
| * both headline and rationale. | ||
| * | ||
| * Same harness as dashboard-96: real server on an ephemeral port, canonical | ||
| * fixtures, real Chromium via playwright-core; skips cleanly with no browser. | ||
| * | ||
| * owner: RStack developed by Richardson Gunde | ||
| */ | ||
|
|
||
| /* global document, window */ | ||
|
|
||
| import test from 'node:test'; | ||
| import assert from 'node:assert/strict'; | ||
| import { spawn } from 'node:child_process'; | ||
| import { mkdtempSync, rmSync } from 'node:fs'; | ||
| import { tmpdir } from 'node:os'; | ||
| import { join, dirname } from 'node:path'; | ||
| import { fileURLToPath } from 'node:url'; | ||
| import { createRequire } from 'node:module'; | ||
|
|
||
| import { fixtureReadyRun, fixtureBlockedRun } from '../helpers/dashboard-fixtures.js'; | ||
|
|
||
| const require = createRequire(import.meta.url); | ||
| const HERE = dirname(fileURLToPath(import.meta.url)); | ||
| const SERVER_PATH = join(HERE, '..', '..', 'src', 'observability', 'dashboard', 'server.js'); | ||
|
|
||
| let chromium = null; | ||
| try { ({ chromium } = require('playwright-core')); } catch { /* dep absent */ } | ||
|
|
||
| // Named per the repo's magic-number convention (PR #490). | ||
| const SERVER_BOOT_TIMEOUT_MS = 15_000; | ||
| const STATE_LOAD_TIMEOUT_MS = 10_000; | ||
|
|
||
| function startServer(root) { | ||
| return new Promise((resolvePromise, rejectPromise) => { | ||
| const child = spawn(process.execPath, [SERVER_PATH, '--port', '0', '--no-browser', '--project', root], { | ||
| cwd: root, | ||
| env: { | ||
| ...process.env, | ||
| RSTACK_APPROVAL_TOKEN: undefined, | ||
| RSTACK_DASHBOARD_READ_TOKEN: undefined, | ||
| RSTACK_TLS_CERT: undefined, | ||
| RSTACK_TLS_KEY: undefined, | ||
| RSTACK_BUSINESS_PORT: undefined, | ||
| RSTACK_PROJECT_ROOT: undefined, | ||
| RSTACK_NO_BROWSER: '1', | ||
| RSTACK_REGISTRY_DIR: join(root, '.registry'), | ||
| }, | ||
| stdio: ['ignore', 'pipe', 'pipe'], | ||
| }); | ||
| let out = ''; | ||
| let settled = false; | ||
| const timer = setTimeout(() => { | ||
| if (!settled) { settled = true; child.kill('SIGKILL'); rejectPromise(new Error(`server did not boot\n${out}`)); } | ||
| }, SERVER_BOOT_TIMEOUT_MS); | ||
| child.stdout.on('data', (chunk) => { | ||
| out += chunk; | ||
| const match = out.match(/Dashboard: http:\/\/localhost:(\d+)/); | ||
| if (match && !settled) { | ||
| settled = true; | ||
| clearTimeout(timer); | ||
| resolvePromise({ baseUrl: `http://127.0.0.1:${match[1]}`, stop: () => child.kill('SIGKILL') }); | ||
| } | ||
| }); | ||
| child.stderr.on('data', (chunk) => { out += chunk; }); | ||
| child.on('exit', () => { if (!settled) { settled = true; clearTimeout(timer); rejectPromise(new Error(`server exited\n${out}`)); } }); | ||
| }); | ||
| } | ||
|
|
||
| let browser = null; | ||
| test.before(async () => { | ||
| if (!chromium) return; | ||
| try { browser = await chromium.launch({ headless: true }); } catch { browser = null; } | ||
| }); | ||
| test.after(async () => { if (browser) await browser.close(); }); | ||
|
|
||
| function browserTest(name, seed, body) { | ||
| test(name, async (t) => { | ||
| if (!browser) { t.skip('Chromium not installed — run `npx playwright-core install chromium`'); return; } | ||
| const root = mkdtempSync(join(tmpdir(), 'rstack-browser-display-')); | ||
| let server = null; | ||
| const context = await browser.newContext(); | ||
| const page = await context.newPage(); | ||
| const pageErrors = []; | ||
| page.on('pageerror', (err) => pageErrors.push(String(err))); | ||
| try { | ||
| await seed(root); | ||
| server = await startServer(root); | ||
| await body({ page, server, t }); | ||
| assert.deepEqual(pageErrors, [], 'no uncaught page errors'); | ||
| } finally { | ||
| await context.close(); | ||
| if (server) server.stop(); | ||
| rmSync(root, { recursive: true, force: true }); | ||
| } | ||
| }); | ||
| } | ||
|
|
||
| const seedRichProject = async (root) => { await fixtureReadyRun(root); await fixtureBlockedRun(root); }; | ||
|
|
||
| async function gotoDashboard(page, server) { | ||
| await page.goto(server.baseUrl, { waitUntil: 'networkidle' }); | ||
| await page.waitForFunction(() => window.STATE != null, null, { timeout: STATE_LOAD_TIMEOUT_MS }); | ||
| } | ||
|
|
||
| browserTest('the Command Center hero never repeats its headline as the rationale (#493)', seedRichProject, async ({ page, server }) => { | ||
| await gotoDashboard(page, server); | ||
| const hero = await page.evaluate(() => { | ||
| const norm = (el) => (el ? el.textContent.replace(/\s+/g, ' ').trim() : ''); | ||
| const rationale = document.getElementById('overview-rationale'); | ||
| return { | ||
| title: norm(document.getElementById('overview-outcome-title')), | ||
| rationale: norm(rationale), | ||
| rationaleHidden: Boolean(rationale && rationale.hidden), | ||
| }; | ||
| }); | ||
| assert.ok(hero.title.length > 0, 'the hero has a headline'); | ||
| if (!hero.rationaleHidden && hero.rationale.length > 0) { | ||
| assert.notEqual(hero.rationale, hero.title, | ||
| 'a visible rationale must say something the headline does not'); | ||
| } | ||
| }); |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3. Regression tests lack attribution fields
📜 Skill insight⚙ MaintainabilityAgent Prompt
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools