summaryrefslogtreecommitdiff
path: root/plugins/code-modernization/tests/fixtures
diff options
context:
space:
mode:
authorMorgan Lunt <morganl@anthropic.com>2026-09-24 20:52:27 -0700
committerMorgan Lunt <morganl@anthropic.com>2026-09-24 20:52:27 -0700
commit51b1ae9e20486d62b839ed9f37e1cfc7d55bf85c (patch)
treeeb31cc4964d84b4a82b8032452739fe1e9b37d3f /plugins/code-modernization/tests/fixtures
parent5b8ec4b30f45b5e8b4c8a6efd63719730cf1a5ad (diff)
code-modernization: make the live pane work below 144 columns and show the proof
Found by exercising the pane against the real outputs of finished runs: - Below 144 columns the engine holds an unasked pane back; the pane ignored that, so it drew no pane, no show bar, and the panel command "hid" a pane that was never there. - A symlinked legacy/<name> lists as another kind of entry, so the source link that preflight now creates was never recognized as a system. - Uplift and reimagine next steps were placeholders with no button. - The refresh debounce was starved while agents ran, so the map froze. - Hostile lines in the brief, rules and baseline could take seconds to match; lines are now capped. The rule-review ledger is validated on read and merged on save, and keeps a reviewer's note. - A baseline with no row read as "the baseline had 0"; one-module baseline totals now count as that module's row. New: a verdict chip with words on every built module, a verify-first next step, and a readable palette that follows the terminal theme. 140 engine tests pass and the type check is clean.
Diffstat (limited to 'plugins/code-modernization/tests/fixtures')
-rw-r--r--plugins/code-modernization/tests/fixtures/stacks.ts22
-rw-r--r--plugins/code-modernization/tests/fixtures/world.ts34
2 files changed, 43 insertions, 13 deletions
diff --git a/plugins/code-modernization/tests/fixtures/stacks.ts b/plugins/code-modernization/tests/fixtures/stacks.ts
index 15f60e21..9de66e02 100644
--- a/plugins/code-modernization/tests/fixtures/stacks.ts
+++ b/plugins/code-modernization/tests/fixtures/stacks.ts
@@ -8,7 +8,12 @@ import type { ReaderFs } from '../../hooks/reader/fs'
*/
/** A file tree in memory, read the way the reader reads `$.fs`. */
-export function memoryFs(files: Readonly<Record<string, string>>, mtimes: Readonly<Record<string, number>> = {}): ReaderFs {
+export function memoryFs(
+ files: Readonly<Record<string, string>>,
+ mtimes: Readonly<Record<string, number>> = {},
+ /** Paths that are symbolic links to a directory: listed as `other`, as the engine lists a link; `stat` says `dir`. */
+ links: readonly string[] = [],
+): ReaderFs {
const dirs = new Set<string>([''])
for (const path of Object.keys(files)) {
@@ -61,11 +66,16 @@ export function memoryFs(files: Readonly<Record<string, string>>, mtimes: Readon
names.set(name, rest.includes('/') ? 'dir' : 'file')
}
- return [...names.entries()].sort().map(([name, kind]) => ({
- name,
- kind,
- size: kind === 'file' ? (files[dir === '' ? name : `${dir}/${name}`]?.length ?? 0) : 0,
- }))
+ return [...names.entries()].sort().map(([name, kind]) => {
+ const isLink = links.includes(dir === '' ? name : `${dir}/${name}`)
+
+ return {
+ name,
+ kind: isLink ? ('other' as const) : kind,
+ size: kind === 'file' ? (files[dir === '' ? name : `${dir}/${name}`]?.length ?? 0) : 0,
+ isLink,
+ }
+ })
},
}
}
diff --git a/plugins/code-modernization/tests/fixtures/world.ts b/plugins/code-modernization/tests/fixtures/world.ts
index 076c7879..43b8d154 100644
--- a/plugins/code-modernization/tests/fixtures/world.ts
+++ b/plugins/code-modernization/tests/fixtures/world.ts
@@ -15,6 +15,8 @@ export type World = {
statuses: (string | undefined)[]
blits: number
invalidations: number
+ /** How many of the next opens the engine holds back undrawn (unasked, on a terminal too narrow to dock a pane). */
+ unplaced: number
fills: string[]
commands: string[]
aborted: string[]
@@ -29,7 +31,13 @@ export const CWD = '/work'
const relOf = (path: string) => (path.startsWith(`${CWD}/`) ? path.slice(CWD.length + 1) : path.replace(/^\.\//, ''))
/** Seats the in-memory world beneath the plugin. */
-export function worldOf(on: On, files: Readonly<Record<string, string>>, env: Readonly<Record<string, string>> = {}): World {
+export function worldOf(
+ on: On,
+ files: Readonly<Record<string, string>>,
+ env: Readonly<Record<string, string>> = {},
+ /** Paths (relative to the working directory) that are symbolic links to a directory: the engine lists a link as `other`. */
+ links: readonly string[] = [],
+): World {
let tick = 1_000
const world: World = {
@@ -43,6 +51,7 @@ export function worldOf(on: On, files: Readonly<Record<string, string>>, env: Re
statuses: [],
blits: 0,
invalidations: 0,
+ unplaced: 0,
fills: [],
commands: [],
aborted: [],
@@ -99,11 +108,16 @@ export function worldOf(on: On, files: Readonly<Record<string, string>>, env: Re
}
return {
- value: [...names.entries()].sort().map(([name, kind]) => ({
- name,
- kind,
- size: kind === 'file' ? (world.files.get(`${dir}/${name}`)?.length ?? 0) : 0,
- })),
+ value: [...names.entries()].sort().map(([name, kind]) => {
+ const isLink = links.includes(dir === '' ? name : `${dir}/${name}`)
+
+ return {
+ name,
+ kind: isLink ? ('other' as const) : kind,
+ size: kind === 'file' ? (world.files.get(`${dir}/${name}`)?.length ?? 0) : 0,
+ isLink,
+ }
+ }),
}
})
@@ -127,7 +141,13 @@ export function worldOf(on: On, files: Readonly<Record<string, string>>, env: Re
on('ui.open', ($, e) => {
world.opened.push({ id: e.id, focus: e.focus === true })
- return { value: undefined }
+ if (world.unplaced > 0) {
+ world.unplaced -= 1
+
+ return { value: { isPlaced: false, reason: 'unasked below 144 columns (120 now): press the pane\'s button or type /modernize-panel' } } as never
+ }
+
+ return { value: { isPlaced: true } } as never
})
on('ui.close', ($, e) => {