Skip to content

fix(#823): render /assess output via CLI subcommand instead of hand-drawn ASCII - #824

Merged
admarble merged 5 commits into
mainfrom
feature/823-fix-assess-dashboard-silently-replaced-by-pros
Jul 27, 2026
Merged

admarble merged 5 commits into
mainfrom
feature/823-fix-assess-dashboard-silently-replaced-by-pros

Conversation

@admarble

@admarble admarble commented Jul 27, 2026 •

Copy link
Copy Markdown
Contributor

Moves /assess output rendering out of the prompt and into code, fixing both defects in #823 at their shared root cause: the model was being asked to do deterministic formatting by hand.

What changed

src/lib/assess/types.ts — zod AssessResult schema. .strict() throughout, because a typo'd key in a hand-built JSON payload is silent data loss. Validation errors name the offending field path (issues[0].action: Invalid option: expected one of "PROCEED"|...), and per-mode requirements are enforced by refinement rather than by making fields unconditionally required, so a batch payload isn't forced to carry titles it never renders.

src/lib/assess/renderer.ts — pure module, string-width its only import. RUN_COL = 47 is the single hand-chosen number; every other offset derives from it. The Reason column absorbs the optional ACs column, so adding or removing ACs never shifts Run — that invariant is what makes the two table forms visually interchangeable.

src/commands/assess-render.ts + bin/cli.ts — a subcommand, not a scripts/ shell-out. skills/spec/SKILL.md:78 establishes that skills may only run npx tsx blocks when the sequant source tree is present, so a script would work in this repo and nowhere else. Hidden from top-level help (it takes a JSON payload no human hand-writes); assess-render --help still works.

skills/assess/SKILL.md (×3 mirrors) — ### Step 6: Render Output at the end of the imperative Assessment Process. That placement is the fix: the old ## Output Format was descriptive, so finishing Step 5 finished the documented procedure and the block could be skipped without violating any instruction.

Output Format reduction (AC-29)

Lines Bytes
Before 416 24,068 (24KB)
After 199 13,670
Delta −52% −43%

Baseline measured against origin/main lines 238–653, matching the figure stated in the issue exactly.

Retained: the schema, one worked example, run symbols, commands-block rules, annotation semantics, and the single-mode field table. Removed: the hand-drawn geometry, including "Column widths should adapt to content — do not force a fixed table width" (line 244).

Verification

Every surviving example is generated from renderer output — and 2 of the 3 in "dashboard vs posted comment" had already drifted from what the renderer produces, which is the issue's premise confirmed on live content. All 9 remaining table rows now sit at RUN_COL=47; all separators are 64 wide.

Anti-drift is enforced, not assumed. AC-36 asks that examples "cannot drift from the implementation." Regenerating once doesn't deliver that, so skill-examples.test.ts asserts each example matches the renderer byte-for-byte, plus a structural scan over all three mirrors that catches examples added later whose payloads live nowhere. Mutation-tested rather than trusted: shifting one data row by a single space (the exact #823 defect) fails 2 tests; widening one separator to 78 fails 2 tests.

Tests: 108 in src/lib/assess/; full suite 4188 passed / 0 failed across 201 files. The alignment invariant is asserted directly — measuring the Run offset on the header and every row — rather than only snapshotted, since a snapshot happily locks in a misaligned table.

AC-20: verified through the built dist bin entry, not just tsx. All five error paths (missing file, directory, malformed JSON, unknown key, schema violation) exit 1; happy path exits 0.

Two deliberate divergences

1. Separator width: 64, not 78. AC-16 mandates 64. The issue's own "Expected output" prototype block measures 78 — I checked with string-width rather than assuming. Implemented 64 on the grounds that the AC text is normative and the prototype was throwaway. One constant; every snapshot regenerates from it. Note 64 is narrower than the widest row (81 columns), so rows deliberately overflow the separator — which AC-9 explicitly sanctions.

2. RUN_COL is hand-chosen. AC-3 asks for padding computed "with no hand-authored offsets"; AC-11 asks for "the Run column start offset documented in the renderer as the single source of truth." Read together these require exactly one authored number and everything else derived, which is what this does. Flagging so it isn't read as an AC-3 violation.

Scope note

performScopeAssessment returns SCOPE_SPLIT_RECOMMENDED (4 features / 38 ACs / 7 directories, all red). Overridden deliberately: the detector counts facets, not features. Schema → renderer → CLI → skill are sequential layers of one change and none ships alone — the skill edit is inert without the subcommand, the subcommand inert without the renderer. 24 of the 38 ACs are single-assertion test or invariant statements. Real surface is 4 source files, 3 test files, and one skill file mirrored three ways.

Not done

Stop-hook enforcement (#22's Layer 3) stays deferred per the issue. Box-drawing borders stay out (#494) — the reasons that survive a renderer are clipboard fidelity (#681) and forced truncation, both documented in the issue's Non-goals.

Fixes #823

🤖 Generated with Claude Code

admarble added 4 commits July 26, 2026 20:57
Moves /assess output rendering out of the prompt and into code. The skill
was asked to hand-draw an aligned ASCII dashboard; it silently substituted
prose for the block entirely, and when it did draw one the columns drifted
(every worked example in SKILL.md had its header offset from its own rows).

- src/lib/assess/types.ts   zod AssessResult schema; validation errors name
                            the offending field path (issues[0].action: ...)
- src/lib/assess/renderer.ts  pure module, string-width its only import. No
                            chalk/boxen/cli-table3/log-update, no TTY state,
                            so output is byte-identical on a pipe or a TTY.
                            RUN_COL=47 is the single source of truth; the
                            Reason column absorbs the optional ACs column so
                            Run never shifts between the two table variants.
- src/commands/assess-render.ts + bin/cli.ts registration. A subcommand, not
  a scripts/ shell-out: skills may only run npx tsx when the sequant source
  tree is present (spec/SKILL.md:78), so a script would work in this repo
  and nowhere else. Hidden from top-level help — internal surface.

43 tests: the alignment invariant is asserted directly (measure the Run
offset on the header and every row) rather than only snapshotted, since a
snapshot happily locks in a misaligned table.

Refs #823
… geometry

Adds `### Step 6: Render Output` at the end of the Assessment Process — the
imperative section, not the descriptive one. That placement is the fix: the
old `## Output Format` was descriptive, so finishing Step 5 finished the
documented procedure and the block could be skipped without violating any
instruction.

- Step 6 states the rendered block is the response's first content, that a
  TLDR/preamble/AskUserQuestion never satisfies it, uses the Step-1
  CMD_PREFIX, and defines a degraded fallback (hand-render + report, never
  prose) when the renderer exits non-zero.
- `## Persist Analysis` now opens with an explicit Step-6 precondition,
  replacing the "After displaying output," subordinate clause that sat 435
  lines downstream. Its steps 1-4 now describe building the single-mode
  payload rather than hand-filling ASCII templates, which also repoints the
  `#### PROCEED`/`#### CLOSE`/... cross-references the reduction deleted.
- `## Output Verification` gains a first item asserting the response opens
  with the rendered block. The existing 17 items all verified properties *of
  a table* and passed vacuously when no table existed.
- `## Output Format`: 416 lines / 24,068 bytes -> 222 / 14,437 (-47% lines,
  -40% bytes). Kept the schema, one worked example, run symbols, commands
  rules, annotation semantics, single-mode field table. Removed the
  hand-drawn geometry, including "Column widths should adapt to content".

Every surviving example is generated from renderer output: 2 of the 3 in
"dashboard vs posted comment" had already drifted. All 9 remaining table
rows now sit at RUN_COL=47, and all 16 separators are 64 wide.

Mirrored across all three skill dirs (md5 10e43d3f..., lint:skill-sync 42/42).

Fixes #823
AC-36 asks that remaining examples "cannot drift from the implementation."
Regenerating them once does not deliver that — #823's root defect was
hand-maintained examples drifting with nothing to notice. Two guards:

- Every example with a known payload must appear in SKILL.md byte for byte
  as the renderer produces it. The payloads live in the test, so adding an
  example to the skill means adding its payload here.
- Every dashboard row in all three mirrors must sit at RUN_COL, every
  separator must be 64 wide, and no box-drawing may appear. This catches
  examples added later whose payloads live nowhere.

Mutation-tested rather than assumed: shifting one data row by a single
space (the exact #823 defect) fails 2 tests; widening one separator to 78
(the width the issue's own prototype used) fails 2 tests.

Refs #823
AC-27 reduces `## Output Format` to "the schema, one worked example, and
the semantic rules." Two survived: the batch dashboard and a single-mode
PROCEED block. The second was also a verbatim duplicate of the posted
comment already shown under `## Persist Analysis`, so it was two copies to
keep in sync — exactly the drift this issue removes.

Replaced with a cross-reference to that section. The skill-examples guard
still covers the rendered block; it asserts presence in SKILL.md, and the
block is still there, just in one place instead of two.

Output Format: 416 lines / 24,068 bytes -> 199 / 13,670 (-52% lines, -43% bytes).

Refs #823
…tter note

Three gaps from the QA review.

1. `src/commands/assess-render.ts` had no unit test (only dist-level smoke
   coverage). Adds 12 tests over real temp files rather than a mocked
   readFile — the command is 60 lines of read/parse/render/print, so mocking
   the read would leave the test asserting its own branching, and real files
   exercise the ENOENT vs EISDIR distinction the messages depend on. Covers
   both success paths, both unreadable paths, three schema paths, and output
   hygiene (no ANSI under a TTY; block emitted as one console.log so nothing
   can interleave into the middle of it).

2. `alignedBlock` returned -Infinity from Math.max() on an empty array. The
   first fix was a guard in each builder — but mutation testing showed that
   changed nothing, because every call site already guarded on `.length`, so
   the builders were unreachable with empty input and the new tests were
   tautological. The real defect underneath was that visibility was decided
   in two places at once. Callers now ask the builder "did that produce
   anything?" instead of re-deriving emptiness, so the builder is the single
   decision point and the guards are load-bearing: deleting them now fails 8
   tests. Also removes a duplicated cleanupLines() call and three redundant
   `.length` checks.

3. The posted comment's `Flags:` gutter silently became computed rather than
   hand-typed. Structure is unchanged and #785 still holds, but it went
   unadvertised. Now stated in the CHANGELOG, including why there was no
   single prior spacing to preserve: the old file specified that gutter at
   four different offsets (24, 34, 24, 9).

Also locks in the batch-vs-single marker asymmetry as intent: the compact
batch form is chat-only and `parseAssessMarkers` does not read it, which the
skill relies on. Tests now assert both directions.

Full suite 4203 passed / 0 failed across 202 files.

Refs #823
@admarble
admarble merged commit 54f3260 into main Jul 27, 2026
8 checks passed
@admarble
admarble deleted the feature/823-fix-assess-dashboard-silently-replaced-by-pros branch July 27, 2026 09:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(assess): dashboard silently replaced by prose, and every table example is misaligned — render via CLI subcommand instead of hand-drawn ASCII

1 participant