summaryrefslogtreecommitdiff
path: root/plugins/code-modernization/tests/register.test.ts
diff options
context:
space:
mode:
authorMorgan Lunt <morganl@anthropic.com>2026-09-24 21:07:24 -0700
committerMorgan Lunt <morganl@anthropic.com>2026-09-24 21:07:24 -0700
commitcaac6735d95bddeb8c8bbe3ddc9d6c01787fc8e1 (patch)
tree132ff3f8b1404f56f5dd2051ff1c2761064b746c /plugins/code-modernization/tests/register.test.ts
parentd6af0c04d89ad7b0c75e21b8ae7f15585e805b08 (diff)
code-modernization: pane wording, attention items and docs that match the code
The pane's button reads "put in prompt" (it never runs the command), the refresh button is gone (the pane already refreshes after writes, at turn end and every 20 seconds while idle), the summary line fits a 120-column bar, and the next-step reasons are short enough to read. A P0 rule under discussion is listed under Attention ("the build waits"), and a module that is not proven shows its first reason there. In an uplift, finished modules list before merely edited ones. hooks/README.md now names every button and label as the code does, documents the plugin's /code-modernization:modernize-review command (which writes the same ledger for people without the pane) and how it differs from the pane's own /modernize-review, and says which pictures use sample text. 141 engine tests pass and the type check is clean.
Diffstat (limited to 'plugins/code-modernization/tests/register.test.ts')
-rw-r--r--plugins/code-modernization/tests/register.test.ts25
1 files changed, 24 insertions, 1 deletions
diff --git a/plugins/code-modernization/tests/register.test.ts b/plugins/code-modernization/tests/register.test.ts
index 2eef3fa2..e1dbce63 100644
--- a/plugins/code-modernization/tests/register.test.ts
+++ b/plugins/code-modernization/tests/register.test.ts
@@ -162,6 +162,8 @@ describe('start and pane', () => {
expect(textOf(tree), 'no by-hand tag on a step the pane does itself').not.toContain('(by hand)')
expect(labels).toContain('sign the brief')
expect(labels, 'nothing to paste into the prompt').not.toContain('put in prompt')
+ expect(labels, 'the pane reads the disk by itself (after a write, at the end of a turn, and while idle): no manual refresh').not.toContain('refresh')
+ expect(labels).toEqual(['hide', 'sign the brief', 'review rules'])
await $.ui.press({ plugin: NAME, key: 'sign' })
expect(world.opened.at(-1)).toEqual({ id: 'modernize-sign', focus: true })
@@ -503,6 +505,27 @@ describe('review deck', () => {
expect(page).toContain('| R-99 | Wrong |')
})
+ test('a P0 rule sent to discussion, or marked wrong, is said in the pane: the build commands wait on it', async ($, on) => {
+ const file = (reviews: Record<string, unknown>) => JSON.stringify({ system: 'billing', version: 1, reviews })
+ const world = worldOf(on, { ...FULL, 'analysis/billing/RULE_REVIEWS.json': file({ 'P0-001': { verdict: 'discuss', at: '2026-09-16', note: 'ask Finance' } }) })
+
+ mock.clock(on)
+ await $.session.start(SESSION)
+
+ const first = textOf(await $.ui.render(PANE))
+
+ expect(first).toContain('1 high-priority rule under discussion: the build waits')
+ expect(first).not.toContain('marked wrong')
+
+ world.put('analysis/billing/RULE_REVIEWS.json', file({ 'P0-001': { verdict: 'discuss', at: '2026-09-16' }, 'P0-002': { verdict: 'wrong', at: '2026-09-16' } }))
+ await $.command.run(command('modernize-panel', 'json'))
+
+ const second = textOf(await $.ui.render(PANE))
+
+ expect(second).toContain('1 high-priority rule under discussion')
+ expect(second).toContain('1 rule marked wrong by a reviewer: no test is built on it')
+ })
+
test('close hands the band back', async ($, on) => {
worldOf(on, FULL)
mock.clock(on)
@@ -574,7 +597,7 @@ describe('prompt context', () => {
const first = await $.prompt.submit({ text: 'hello', wait: false, origin: { kind: 'composer' } })
const second = await $.prompt.submit({ text: 'again', wait: false, origin: { kind: 'composer' } })
- expect((first.context ?? []).join(' ')).toContain('billing: analysis 5/5 steps done · brief approved · 1 of 3 modules reviewed')
+ expect((first.context ?? []).join(' ')).toContain('billing: analysis 5/5 · brief approved · 1/3 modules reviewed')
expect(second.context, 'unchanged: not attached again').toBe(undefined)
})
})