Skip to content

refactor(tests): make the mount harness discoverable and ratchet source-text specs over components (#2918) - #2922

Merged
vybe merged 1 commit into
devfrom
refactor/2918-executable-ui-coverage
Sep 21, 2026
Merged

vybe merged 1 commit into
devfrom
refactor/2918-executable-ui-coverage

Conversation

@dolho

@dolho dolho commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

Fixes #2918

What

The issue: safety-critical UI logic (#2756's canRemove, #2778's BaseModal Esc/focus-trap) keeps landing under regex-over-source coverage that an inverted predicate passes byte-identically, each time justified by "this repo's vitest cannot mount" — which is false (vitest.config.js: plugins: [vue()], jsdom, @vue/test-utils, per-file // @vitest-environment jsdom; precedents portalThemeSwitch.spec.js, portalComposerDraft.spec.js). The three items the issue names:

1. Discoverable at the decision point — docs/memory/design-system-contract.md (read before any src/frontend/ change) gains "Testing a component — the harness mounts (#2918)" + a PR self-check item: the opt-in, the copyable precedent, and the bar (source-text-only coverage of a predicate gating a destructive verb / keyboard contract / store write is not acceptable). Same rule in design-system.md §9 (fifth enforcement layer) and docs/testing/STRATEGY.md.

2. Named in the methodology — .claude bump to trinity-dev 437674f: /validate-pr §5.4 (v1.5), /review Step 2.5 (v1.4) and the /implement checklist state the tell (a .vue subject under readFileSync + toContain), the verdict rule, the harness, and the escape (@source-text-pin: <reason> accepted only for what a mount cannot prove); /merge-train lists the new baseline among regenerable ratchets.

3. The lint, as a ratchet (the "needs care" shape — legitimate pins stay, silently adding a new one does not):

  • src/frontend/scripts/scan-source-text-specs.mjs — per spec, counts non-import .vue literals under components//views/ in a spec that calls readFileSync/readFile. Mount imports, comments and non-reading specs never count (unit-pinned).
  • src/frontend/source-text-baseline.json — freezes today: 86 specs / 271 reads.
  • tests/unit/sourceTextRatchet.spec.js — fails when a spec grows, when a new spec reads SFC source without // @source-text-pin: <reason> (≥10-char reason) in its docblock, or when an entry is stale (paid-down spec must lower it). The failure message names the harness + precedent — the point-of-decision hint.

Note: on dev today only 2 specs mount (the issue counted 20 — that number includes the train PRs); the ratchet keeps both precedents alive by asserting they still carry the opt-in.

Verification

npx vitest run                      → 142 files / 3244 tests pass (incl. sourceTextRatchet: 8)
npm run check:tokens                → OK
node scripts/scan-source-text-specs.mjs .   → 86 specs, 271 reads, 0 pinned

Negative controls (each restored after):

  • new zzProbe.spec.js reading SkillsPanel.vue → ❌ "A NEW spec asserts over a component's SOURCE TEXT … put // @vitest-environment jsdom on line 1 … copy tests/unit/portalThemeSwitch.spec.js"
  • same spec + @source-text-pin: <reason> → ✅
  • +1 .vue read appended to a baseline spec → ❌ "GREW … 3 > 2"

Gotcha found while writing it: vitest reads @vitest-environment from any leading comment, so the ratchet spec spells the marker only in split string form — otherwise it runs itself under jsdom.

🤖 Generated with Claude Code

…ce-text specs over components (#2918)

Two PRs ejected from the 2026-09-20 merge train and three from the previous
one landed safety-critical UI logic — a fleet-delete confirmation's
`canRemove`, a modal's Esc/focus-trap contract — in the one tier with no
executable coverage: regexes over the component's source, which an inverted
predicate passes byte-identically. Each justified itself with "this repo's
vitest is node-only, nothing can mount", which has been false since
`vitest.config.js` grew `plugins: [vue()]` + jsdom + @vue/test-utils for a
per-file `// @vitest-environment jsdom` opt-in (precedent:
portalThemeSwitch.spec.js). The capability was never the gap; its
discoverability at the decision point was.

Three things close it:

1. The design-system contract (read before any src/frontend change) gains a
   "Testing a component — the harness mounts" section and a PR self-check
   item naming the opt-in, the copyable precedent, and the bar: source-text-
   only coverage of a predicate that gates a destructive verb, a keyboard
   contract or a store write is not acceptable. design-system.md §9 and
   docs/testing/STRATEGY.md carry the same rule.
2. The methodology names the tell (.claude submodule bump → trinity-dev
   5b09829 + 437674f): /validate-pr §5.4, /review Step 2.5 and the /implement
   checklist state the verdict rule and the escape, and merge-train lists the
   new baseline among the regenerable ratchets.
3. A ratchet, the same shape as raw colours and loading gates:
   scripts/scan-source-text-specs.mjs counts, per spec, non-import `.vue`
   literals under components/ or views/ in a spec that calls readFileSync;
   source-text-baseline.json freezes today's 86 specs / 271 reads;
   tests/unit/sourceTextRatchet.spec.js fails when a spec grows, when a NEW
   spec reads SFC source without a `@source-text-pin: <reason>` marker (the
   reviewable escape for an AST-shaped call-site guard or a parity table), or
   when an entry is stale. The failure message names the harness and the
   precedent — the point-of-decision hint the issue asked for. Negative-
   controlled: a new unpinned spec fails, the same spec pinned passes, and a
   +1 read in a baseline spec fails.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@dolho dolho added priority-p1 Critical path type-refactor Code improvement theme-devex Theme: DevEx labels Sep 21, 2026
@dolho
dolho requested a review from vybe September 21, 2026 11:37
dolho added a commit that referenced this pull request Sep 21, 2026
…) — mechanical, per the merge-train note on the PR

The train (#2922's source-text ratchet + this stack) found the joint break:
this spec reads 20 SFCs by text and is a NEW spec with no baseline entry.
It is a legitimate pin — an adoption guard over a set of call sites a mount
cannot prove — so it declares itself one, per the ratchet's escape hatch.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
dolho added a commit that referenced this pull request Sep 21, 2026
…urce-text-pin (#2711) — mechanical, per the merge-train note on the PR

The train (#2922's source-text ratchet + this stack) found the joint break:
the `route.value` spelling guard reads Portal.vue by text and this is a NEW
spec with no baseline entry. It is a legitimate pin — only the text proves a
spelling is absent — so it declares itself one.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
dolho added a commit that referenced this pull request Sep 21, 2026
vybe pushed a commit that referenced this pull request Sep 21, 2026
…ming no mount harness exists

Two things, one file.

**The pin.** #2922 lands a ratchet that holds any spec with no baseline entry
to ZERO source-text reads. This spec is new, so it fails that ratchet — the
two PRs are individually green and jointly red, which is invisible to either
one alone. It is a legitimate pin rather than a missing mount: the defect is a
cascade tie broken by stylesheet EMISSION ORDER, and neither jsdom nor
@vue/test-utils evaluates a stylesheet, so a mount would report the class list
it was handed and prove nothing. That is exactly the case the marker exists to
make visible to review.

**The false rationale.** The docblock said vitest "runs `environment: 'node'`
here with no mount harness". `environment: 'node'` is the DEFAULT only; a spec
opts into jsdom per file and mounts, which 22 specs already do. Saying the
harness does not exist is the claim #2918 was filed about, and repeating it in
a new file is how the belief survives. The harness exists and is reachable —
this spec stays at source level because a cascade is invisible to it, which is
a different and true reason.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@vybe

vybe commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

merge-train — on the 2026-09-21 train, nothing pushed to this branch

Validated as lane B (/validate-pr + /review, no prior review existed). No CRITICAL. The ratchet was checked by running it, not by reading it — four controls in an isolated worktree, all behaving:

control result
a NEW unpinned spec reading an SFC ❌ fails, naming file:line
the same spec + @source-text-pin: <reason> ✅ passes — the escape works
+1 read in a baselined spec ❌ fails (5 > 4)
a baseline entry above reality ❌ fails (baseline 99, now 4)

It is genuinely wired: frontend-build runs npm run test:unit, so the build check on this PR is the job that executes it. The .claude bump is a clean fast-forward whose contents match the body, and src/backend/enterprise does not move.

One interaction you should know about, already handled. #2756 is on the same train and adds baseButtonVariantBorder.spec.js, a source-text spec with no baseline entry — so your ratchet fails it. The two PRs are individually green and jointly red; I reproduced it on the assembled tree and it was the only failure in 3276 tests. Resolved on #2756's side, where it belongs: that spec now declares @source-text-pin with a real reason (its defect is a cascade tie broken by stylesheet emission order, which no mount can observe). Your ratchet did exactly what it was built to do, on its first live encounter.

One latent hole, left for you as a follow-up rather than patched here. The ratchet's own spec self-exempts by accident. PIN_MARKER.exec(source) (scan-source-text-specs.mjs:65) scans the whole file, though the contract says "in its docblock" in four places — so sourceTextRatchet.spec.js:30's own prose harvests as its pin reason, the literal placeholder <reason>. It is therefore the only file marked [pinned], absent from the baseline, and its 5 reads are ungated. Today that is harmless (its source-text reads are legitimate by construction), but any future spec that quotes the failure message in its header self-exempts the same way. The precedent avoids it structurally: loadingGateRatchet.spec.js:70 scans src/, not the directory containing itself.

Related: running the documented regen command on this branch adds a it's-own-entry line and rewrites totals to 276/87 vs the committed 271/86 — so the committed baseline is not the fixed point of its own command, and totals is unasserted and already stale. All three are the same root cause.

Worth naming, because it is the point of #2918 and this PR does not close it: the ratchet fails a spec that reads source text; it does nothing about a component with no spec at all. #2920 is on this same train and is a live instance — SkillsPanel.vue had zero specs, so disabling its entire conflict UI left CI byte-identically green. The scanner has nothing to look at in that case. Mechanism and problem don't quite meet yet.

@vybe vybe left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merge-train: batch validated on train/20260921-1644 (#2939) — full suite green. The ratchet was verified by running it (four controls: new unpinned spec fails, pin passes, grown count fails, stale baseline fails), and it caught a real member-vs-member interaction on its first live encounter (#2756's new source-text spec). Nothing pushed to this branch; one latent self-exempt hole noted above as a follow-up.

@vybe
vybe merged commit 92d7ff5 into dev Sep 21, 2026
27 of 30 checks passed
vybe pushed a commit that referenced this pull request Sep 21, 2026
…ership read, a license-blind MCP proxy, and a gated remove panel (Abilityai/trinity-enterprise#454) (#2756)

* docs(requirements): system teardown — the public half (Abilityai/trinity-enterprise#454)

Rule #1: requirements before implementation. Records only what lives in this
repo — the edition-agnostic membership primitive, the license-blind MCP proxy
and the Vue gate — and states plainly that the teardown control plane is an
entitlement-gated module in the private submodule (404 on an OSS build). The
paid module's surface and internals stay in the private tree (ent#45).

Also cross-references §33.1: a teardown is N of that soft-delete composed
through the same endpoint, so the 180-day window, name reservation and
schedule freeze are preserved by construction rather than re-implemented.

Co-Authored-By: Claude Opus 5 <[email protected]>

* refactor(systems): structured membership + one auto-view vocabulary (Abilityai/trinity-enterprise#454)

`system_member_names` keeps its signature and becomes a thin wrapper; the body
moves verbatim into `system_membership`, which additionally returns the two
facts the flat name list discarded:

  * `tags_readable` — the body degrades to the raw prefix on a tag-read
    failure, argued there for `restart` (over-capture restarts one container
    too many and logs it; under-capture restarts a subset and reports success).
    A verb that DELETES inverts the cheap half, so it can refuse on unverified
    membership instead of degrading — at its own call site, without forking
    THE ONE predicate into a fourth rule.
  * `evidence` (tag|prefix|both) — derived from the two sets that already
    decided membership, so it cannot disagree with them. Makes the prefix
    fallback's documented residual visible to a caller instead of silent.

`SYSTEM_VIEW_AUTO_DESCRIPTION` replaces the inline f-string: nothing persists a
system<->view link, so that description IS the identifier for the view a deploy
auto-created, and a reader that has to find it again must not restate the
literal.

Behaviour-preserving, not asserted to be: the #2373 suite (33) and the whole
ent#124/125/126 + systems set (325) pass unchanged against the wrapper.

Co-Authored-By: Claude Opus 5 <[email protected]>

* test(systems): pin the destructive-read membership primitive as properties (Abilityai/trinity-enterprise#454)

#2373's fallback rule was wrong three times and each wrong rule passed the case
test written for its predecessor, so the fallback is pinned as a PROPERTY
through the new entry point: members ⊇ raw prefix match whenever the tags are
unreadable, plus tagged ⊆ members whenever they are readable. Any future
narrowing fails by construction, whatever shape it narrows on.

Also pinned: the wrapper is a projection of `system_membership` (generated, AND
source-anchored — a property cannot see a copied body that happens to agree
today), evidence is keyed by exactly the members and true of each, and the
auto-view description is asserted THROUGH `create_system_view` rather than by
restating the literal.

The named incidents stay as discrete cases: the eleven `vc-due-diligence-dd-*`,
an agent named exactly `acme`, the sibling-prefixed `acme-api-worker`, and the
`acme` vs `acme-extra` floor from the AC.

One counterexample found by Hypothesis and fixed as a TEST bug, not a code one:
`roster=[]` short-circuits before the tag read and so reports
`tags_readable: True` by design — a destructive caller refuses on False, and
refusing a teardown of a memberless system is a 503 where 404 is the truth.

17 passed under the derandomized `ci` profile and under `explore` (5000
examples); both lint guards clean.

Co-Authored-By: Claude Opus 5 <[email protected]>

* feat(mcp): teardown_system — a license-blind proxy for the gated verb (Abilityai/trinity-enterprise#454)

Invariant #13's third surface. The tool ships in the OSS bundle and knows
nothing about entitlement: it proxies DELETE
/api/enterprise/system-teardown/{name} and reports what the route says.

`dry_run` defaults to TRUE — the opposite of `deploy_system`, deliberately: an
unwanted preview costs a round trip, an unwanted execute costs a deleted fleet.
The default lives in tool code, so it is pinned by a test that an `|| false`
typo would fail.

Refusals degrade rather than throw, and stay DISTINCT: 404 (no such build) /
403 (not licensed, or an agent key on a human-only verb) / 503 (membership
unverified — flagged retryable, and says nothing was removed). A thrown error
reaches the agent as an opaque transport failure it cannot reason about, and
flattening the three is how a human on a user key gets told a licensed feature
"doesn't exist". A `failed` report arriving as a 500 is kept as a RESULT — its
per-member reasons are the only actionable output.

Reads `ApiError.body` rather than regexing `ApiError.message`: the field is
retained verbatim for exactly this purpose (ent#443), and its own docstring
says the regex is what breaks when the message format changes. Found while
writing the test, which constructs a real ApiError rather than a `{status}`
stand-in that would have passed over broken body parsing.

No server.ts change: createSystemTools is already in toolGroups, so the tool
inherits the operatorOnly allow-list.

tsc --noEmit clean; npm test 383 pass / 0 fail (364 before).

Co-Authored-By: Claude Opus 5 <[email protected]>

* feat(systems): a gated "Remove a deployed system" panel (Abilityai/trinity-enterprise#454)

Library -> Systems gains the inverse of install: preview -> per-agent checklist
-> acknowledgement -> remove. Gated on `system_teardown` in
`enterprise_features`, so an OSS build's Systems section looks exactly as it
did rather than offering a control whose route 404s.

The preview is a CHECKLIST, not a list, and that is the design rather than
decoration: a member whose `evidence` is `prefix` matched by name with no
deploy tag to confirm it, so it may belong to a sibling system sharing this
one's prefix. The server cannot tell — only the operator can — so the badge
plus the opt-out IS the over-capture escape hatch, and the confirmed list goes
back on execute to be intersected with freshly-resolved membership.

Remove is gated on four conditions, each blocking something the others do not:
the preview is current for the typed name, membership was verified, the
consequence is acknowledged (ent#126's ack contract reused, not a second
pattern), and at least one agent is checked. A disabled button says why.

Honest reporting: tone switches on `status`, never the HTTP code (`partial` is
200, `failed` is 500 with the report as the body). skipped / failed / aborted
render as three different things with per-reason operator copy, because a
refusal is not a breakage and an un-attempted member is neither; `discarded`
never claims recoverability. A timeout is "outcome unknown" and offers no
retry — the server keeps deleting.

`ManifestPreview`'s "there is no un-deploy" now tracks the CAPABILITY: still
exactly true where the module is absent. Retiring it everywhere because one
edition gained the verb would have been the dishonest fix. `DeployResult` gains
a de-emphasised "Remove this system", also entitlement-gated (AC 7).

Design contract: token-only (scanner reports 0 non-gray / 0 hex across all six
systems files), both themes, primitives only, bounded member viewport with a
stated total, no bare loading gate — the in-flight flags reach only BaseButton.

Tests: 21 vitest store specs + 25 source-anchored contract assertions.
Mutation-checked, and it found a real gap: "the preview is bound to its name"
passed with the name comparison replaced by `true`, because `setTeardownName`
nulls the preview and the null-check carried the assertion alone. The
comparison guards a direct-assignment bypass, so the test now uses one.
Frontend suite 2795 passed (2774 before); check:tokens clean.

Co-Authored-By: Claude Opus 5 <[email protected]>

* docs(systems): teardown's public half in the flow, index and area files (Abilityai/trinity-enterprise#454)

`system-manifest.md` gains entry-point rows (the gated route, the license-blind
MCP tool, the UI's new status) and a "Teardown — the public half" section
covering what lives in THIS repo: the membership split and why it is a wrapper
rather than a fork, the one-constant auto-view description, the MCP degradation
contract, the checklist UI, and the four tests. The gated verb's own design
stays in the private tree (#151 doc-follows-the-code).

Feature-flows index row added, per the standing rule that a row goes in even
when the flow doc already exists. (The "newest ~20" cap on that table is
already at 140 rows — pre-existing drift, deliberately not pruned here, since
dropping 120 rows would bury this diff.)

Area files: mcp-server.md `systems.ts (4)` -> `(5)`, backend.md's
`system_service.py` line records the membership split and the constant,
frontend.md records the gated half of the Systems section.

Public docs carry the seam and the gate's name only — no paid-module internals.
Verified by running the enterprise-docs-guard's own grep locally: clean.

Co-Authored-By: Claude Opus 5 <[email protected]>

* docs(flows): the two sibling flows the teardown change also touches (Abilityai/trinity-enterprise#454)

`/sync-feature-flows` mapped every changed file to a flow; two changed files
belong to a second flow each, and those were the gap:

* `mcp-orchestration.md` — the System Tools table and the enumerated tool-count
  comment both said four. `teardown_system` makes five, with its license-blind
  degradation contract and its inverted `dry_run` default recorded where the
  other tools are catalogued.
* `library-page.md` — the `#systems` section now hosts two panels, and the
  second renders nothing without the entitlement. Worth stating there because
  that page's doc is where someone checks why a tab looks different between
  editions.

The index row's Flow column now names all three flows rather than only
`system-manifest.md`.

`system_service.py` also appears in `scheduling.md` and `agent-tags.md`, but
only as the module that writes schedules and tags — nothing this change touched,
so no update.

Index is 552 lines against the skill's 400-line guidance. That is the
pre-existing Recent Updates table at 140 rows against its own documented "~20"
cap; my row is one line of it, and condensing 120 rows would bury this diff.
Flagged, not fixed.

Co-Authored-By: Claude Opus 5 <[email protected]>

* fix(systems): the teardown ack gets its own test id (Abilityai/trinity-enterprise#454)

Reusing ent#126's acknowledgement contract was right for the prop/emit shape and
wrong for the `data-testid`. Install and remove can both be previewed on the
same Library page, so a shared id puts two elements at one address — and
`e2e/system-install.spec.js` addresses the install ack as
`getByTestId('ack-checkbox')` in three places, which would be strict-mode
ambiguous on an entitled build.

It would NOT have failed CI: the teardown panel is unentitled there and renders
nothing, so the collision is invisible to every check that runs today. That is
exactly why it gets a test rather than a CI run. Found by reading the spec that
shares the surface, while waiting on the e2e job.

The pattern is worth sharing; the address is not. `ManifestPreview` keeps
`ack-checkbox`; the teardown ack is `teardown-ack-checkbox`; the contract test
now asserts BOTH — the shared prop/emit shape and the distinct ids.

Frontend suite 2795 passed, check:tokens clean.

Co-Authored-By: Claude Opus 5 <[email protected]>

* fix(systems): no test id is shared with the install panel beside it (Abilityai/trinity-enterprise#454)

The per-id fix in the previous commit was the wrong SHAPE, and looking for a
second instance found one immediately: `goto-fleet`, owned by DeployResult.vue
and copied into TeardownResult.vue. Two collisions is the signal to write the
rule instead of fixing instances.

Install and remove are two panels on one Library page, and on an entitled build
both can show a preview AND a result at once — so any id they share is
strict-mode ambiguous for a Playwright `getByTestId(...)`, which is exactly how
`e2e/system-install.spec.js` addresses both `ack-checkbox` and `goto-fleet`.

None of it fails CI today: the teardown panel is unentitled there and renders
nothing, so the collision is invisible to every check that runs. Hence a test
rather than a CI run — `test_no_test_id_is_shared_with_the_install_panel_it_sits_beside`
intersects the two panels' id sets and fails on any overlap, so a third
collision cannot be introduced quietly.

Measured: reintroducing the `goto-fleet` collision turns it red; control clean.

Also drops a now-stale docstring line in TeardownPreview that still claimed the
shared testid.

Frontend suite 2795 passed.

Co-Authored-By: Claude Opus 5 <[email protected]>

* fix(systems): a teardown failure never gives deploy's advice (Abilityai/trinity-enterprise#454)

`normalizeError` is shared with deploy, and its unknown-outcome copy read
"Deployment may still be running — re-deploying creates duplicate agents." On a
teardown timeout that is the opposite advice at the worst possible moment: the
in-flight work is removal, and the members removed so far are already gone.

The two sentences that are about WHAT was in flight move into `UNKNOWN_OUTCOME_COPY`,
keyed by verb — everything else in the normalizer is verb-independent, which is why
this stays one function. `teardown-preview` gets its own arm because a dry run writes
nothing, so neither sentence may imply work in flight.

The MCP tool copy is corrected alongside it: the 403 said "an agent-scoped key",
which understates a gate that is now an allowlist refusing every machine credential;
the 503 said "membership could not be verified", which no longer covers the case
where the roster itself was unreadable; and `dry_run` now states that a member with
no container is removed the same way, since that is what frees its name.

Co-Authored-By: Claude Opus 5 <[email protected]>

* docs(systems): what a REMOVAL needs from the roster that a read does not (Abilityai/trinity-enterprise#454)

Three docs claimed the teardown acknowledgement reuses ent#126's
`data-testid="ack-checkbox"`. The code deliberately does the opposite and a guard
test requires it to: both panels render on one Library page, so a shared address
makes every `getByTestId('ack-checkbox')` strict-mode ambiguous. The PATTERN is
what is reused (`:acknowledged` / `update:acknowledged`); the address is not.

The flow and roadmap gain the roster-completeness ruling behind the private fix: every
OSS sibling on this surface resolves its roster from containers, which is cosmetic for
`get_system` / `restart_system` / `export_manifest` and is under-capture-reporting-success
for a verb that claims completion — plus why the #2196 tri-state reader is what makes
the ownership supplement safe, and why an unreadable Docker refuses rather than 404s.

`learnings.md` records C1's class for the next planner: a guard that tests membership
against a list the disqualified entries were just appended to is dead for the case its
own comment describes, and the narrow test beside it passes either way.

Co-Authored-By: Claude Opus 5 <[email protected]>

* style(design): a secondary button's border is the variant's, not the base string's (Abilityai/trinity-enterprise#454)

BaseButton's shared class string carried `border-transparent` next to the
reserved `border` width, while `secondary` — the one variant drawn BY its
border — set `border-gray-300`. Both are single-class selectors, so
specificity ties and emission order decides: Tailwind emits
`.border-transparent` after `.border-gray-300` (rule 729 vs 698 on the live
dev stylesheet), and the resting keyword won. Every secondary button
rendered borderless in light mode — a white button on a white card with no
outline — across 24 call sites.

It survived review because dark mode won by accident rather than by design:
`dark:border-gray-700` compiles to `.dark .border-gray-700`, one class
heavier, which outranks the tie. The theme most of us work in was correct.

The fix is the one `fieldClasses.js` already documents for FIELD_GHOST_CLASS
one primitive over: the base string keeps the bare `border` (so the focus
ring still costs no layout shift) and every variant names its own colour.

Measured, not reasoned — resting border on the teardown panel's
"Preview removal" control, before → after:
  light: rgba(0,0,0,0)      → rgb(209,213,219)  (gray-300)
  dark:  rgb(55,65,81)      → rgb(55,65,81)     (gray-700, unchanged)

Guard: tests/unit/baseButtonVariantBorder.spec.js pins the base string
colour-free, asserts secondary is outlined in BOTH themes (the bug was
theme-asymmetric, so a light-only pin would let the next edit break dark
while staying green), and fails closed on a fifth variant that names no
border colour. Mutation-checked: restoring `border-transparent` to the base
string turns it red.

Co-Authored-By: Claude Opus 5 <[email protected]>

* style(design): the preview action sits on the field, not under it (Abilityai/trinity-enterprise#454)

BaseInput is a three-part stack — label, control, help — so a flex row that
holds one whole aligns against that whole box. `items-end` therefore put the
button's bottom edge on the HELP TEXT's bottom rather than the control's,
leaving "Preview removal" 22px below the field's centre where it read as a
stranded caption instead of the field's action.

Fixed by composing the row the way BaseInput documents and the way
TemplateRegistryPanel already does it for the same control-plus-action shape:
the panel owns the label and the help, and the row holds two control boxes,
so alignment means what it says. `items-stretch` rather than `items-start`
because the two primitives are deliberately different heights (field py-2 on
a 20px line box = 38px; button py-[7px] on 13.5px/1.35 = 34px) and stretching
the shorter one costs no magic number and overrides neither recipe.

Measured on the live dev stack, before → after:
  input  top/bottom  1295/1333  →  1295/1333
  button top/bottom  1319/1353  →  1295/1333
  centre delta           +22px  →       0px

BaseInput carries the second half. Its `:aria-describedby` binding is applied
AFTER `v-bind="controlAttrs"`, so with no `help` prop of its own it did not
leave a caller's `aria-describedby` alone — it ERASED it, and the help
paragraph stopped being announced the moment the panel took ownership of it.
It now hands the attr back instead of winning a merge the caller never knew
it had entered. Strictly additive: error and help still win, in that order,
so no existing caller changes.

There is no mount harness in this project (no @vue/test-utils, vitest runs
environment: 'node'), so the a11y half is browser-verified rather than
unit-pinned — on the live render the control resolves
aria-describedby="v-1-help" to the help paragraph, and label[for] to
"System name". Full unit suite green: 131 files, 2937 tests.

Co-Authored-By: Claude Opus 5 <[email protected]>

* style(design): the consequence heading stops outranking the panel it sits in (Abilityai/trinity-enterprise#454)

Two h4s in this PR's own files were written without a size class and fell
through to the UA default of 1em. On a 16px root that made the DEEPEST
headings on the page the LARGEST — bigger than their four `text-sm` siblings
and bigger than the h3 that contains all of them:

  h3  "Remove a deployed system"        14px
  h4  "Agents to remove" / "Also removed" / "Notes"
                                        14px
  h4  "This removes running agents"     16px   ← TeardownPreview.vue:149
  h4  "Outcome unknown"                 16px   ← SystemTeardownPanel.vue:38

Both are warning callouts whose anatomy is identical to the danger callout at
TeardownPreview.vue:8 — bordered box, icon span, heading, list — and that one
already carries `text-sm`. So this was an inconsistency inside a single file,
not a scale that needed inventing. All five h4s now measure 14px on the live
render, matching the h3 they sit under.

Scope is pinned to the three components this PR ADDS. Six more unsized
headings exist on the install side (ManifestPreview ×2, DeployResult ×3,
SystemInstallPanel ×2) and are left alone: they predate this branch, and
TeardownResult's banner h3 is deliberately byte-identical to DeployResult's,
so changing one half would break a parallel that was built on purpose. They
are reported for their own issue rather than folded in here.

Full unit suite green: 131 files, 2937 tests.

Co-Authored-By: Claude Opus 5 <[email protected]>

* fix(mcp): teardown_system declares how it treats an agent target (Abilityai/trinity-enterprise#454)

dev's ent#628 policy table landed while this branch was out. Every registered
tool must carry a TOOL_ACCESS_POLICY row, and policyFor checks it AT
REGISTRATION — so merging dev left the MCP server crash-looping on boot
(ToolAccessPolicyError: tool 'teardown_system' has no entry; nine restarts on a
live stack). PR CI never said so: the PR was CONFLICTING, which runs zero checks.

The row is `baselined`, not `none`. The siblings can honestly say "a system
name, not an agent" (deploy_system, restart_system); this one cannot — it takes
the confirmed removal set as `agents` and deletes them. `agents` is absent from
AGENT_TARGET_PARAMS, so a `none` row would have passed the shape check while
saying something false. The owner names the fence that actually holds the line:
the gated route requires role 'creator' AND a human caller.

Proof: src/mcp-server npm test 440/440, including access.test.ts's "createServer
boots: every registered tool has a row"; rebuilt image boots and stays up.

Co-Authored-By: Claude Opus 5 <[email protected]>

* fix(systems): an unconfirmable member is opt-in, never pre-ticked (Abilityai/trinity-enterprise#454)

A fresh teardown preview ticked EVERY member regardless of `evidence`. A
member the server matched by NAME with no deploy tag is one it cannot
vouch for — and arriving ticked makes the escape hatch an opt-OUT on a
verb that deletes.

The 503 refusal does not already cover this. It fires only when the tag
read FAILED (`membership_verified: false`, Remove disabled). A `prefix`
member also appears in the HEALTHY state — tags read fine, that one agent
simply has no tag row — where membership is verified, Remove is ENABLED,
and the unconfirmable agent was pre-ticked beside it. #2373 ranks
under-capture as cheaper than over-capture, which is right for `restart`
and inverts for a verb that deletes; that inversion is why teardown
refuses rather than degrades everywhere else, and the default handed it
back in the one state the refusal misses.

The rule moves to the STORE (`teardownDefaultSelection`) rather than
staying in the panel's watcher, because `vitest.config.js` pins
`environment: 'node'` with no component mounting: a default written into
a `.vue` watcher is a decision no runnable test can execute, which is how
this shipped. The panel now applies it and nothing else.

Found by clicking through a live stack, not by any test.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* fix(systems): the preview says why the selection is short, and asks for an opt-in (Abilityai/trinity-enterprise#454)

The rendered half of the pre-tick fix.

A `prefix` member now arrives UNTICKED, so its own copy had to stop
saying "uncheck it if so" — that sentence describes a box that arrives
ticked, and left in place it would have told the operator to undo a
safeguard that had not been applied.

The short selection is also stated above the list. Without it the
unticked rows read as a miscount against the "N of M selected" counter
beside them, and an operator who re-ticks them to "fix" the count has
re-created the defect by hand.

Guards are source-level because nothing renders this component: vitest
is `environment: 'node'` with zero mounts, and the green `e2e` runs
`system-install.spec.js`, which never touches teardown. They go through
a new `_prose` helper that strips comments AND collapses wrapping — the
first version of one of them matched its own JSDoc line, which is the
trap `_code_only` already existed for, landing a third time.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* fix(systems): the refusal names no fault the flag cannot identify, and no retry that cannot help (Abilityai/trinity-enterprise#454)

Two defects in one banner.

"Try the preview again in a moment" is advice for a transient fault.
The condition this renders under is a failed database read — a schema
or permission fault that does not clear on its own — so re-previewing
produces the identical screen forever, which trains the operator to
read a real stop as flakiness. It now says the fault is standing and
offers the one thing that does work: the per-agent path the server's
own refusal detail already names.

The banner also named the TAG read specifically, and it cannot know
that. `membership_verified` is `tags_readable AND roster_complete` —
one boolean over two independent faults — so on the roster arm the
copy was simply false: the tags read perfectly and it is the agent
LIST that is incomplete. The banner now states the consequence, which
IS identical either way, and quotes the server for the cause.

That required routing the warnings. The roster line used to fall
through to "Notes", which put the real fault in a footnote underneath
a banner naming the other one. Both membership lines are now claimed
by the banner while it renders, and `otherWarnings` is defined by
SUBTRACTING what the banner took rather than by a second independent
regex — two filters that must stay complementary are two chances to
drop a line off the screen entirely.

Also repairs an existing assertion that broke on the re-wrap: the
phrase it pinned was split across two lines without a word changing,
so it now goes through `_prose` like the rest.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* fix(systems): the tag line claims no count the payload cannot support (Abilityai/trinity-enterprise#454)

"The acme tag goes with the agents (2 tagged)" was rendering
`SystemTeardownTag.member_count`, which the service sets to
`len(members)` — every candidate, tagged OR matched by name. So the
word "tagged" overstated the tag the moment any member was `prefix`.

In the refusal state it was worse than imprecise: the banner at the top
of the same screen says the membership could not be confirmed, and this
line then quoted a figure derived from that very read. Two statements
about one read, opposite in confidence, on one screen.

Dropped rather than reworded. The total the operator actually needs is
already stated on the list itself ("N of M selected"), and the
sentence's job is the other clause — that the tag is not a separate
record to go and delete.

The field is not wrong; `member_count` counts members and says so. Only
the noun beside it in the UI was.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* docs(systems): the rendered-UI round, in the flow and the ledger (Abilityai/trinity-enterprise#454)

The flow doc described the old checklist ("the badge plus the opt-out
is the mechanism") and said nothing about which boxes arrive ticked,
which is the half that was wrong. It now records the opt-in/opt-out
split and where the decision lives, why the refusal banner names no
fault, how warning routing partitions, and that the tag line carries
no count. Tests table and change history updated with it.

The ledger entry is the transferable part: a UI default written in a
`.vue` watcher is a decision no node-environment suite can execute, so
it is reviewed by eye forever — move it to the store and the spec that
already exists starts covering it. Plus the three smaller shapes this
round produced: a boolean over two faults must name neither, a count
rendered with a different noun than the field counts is a lie with a
number on it, and warning routing partitions by subtraction.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* fix(systems): the default selection survives a remount (Abilityai/trinity-enterprise#454)

The preview watcher was not `immediate`, and the store outlives the
component. `Library.vue` mounts the systems section lazily and nothing
resets teardown state on unmount, so leaving the page and coming back
remounts this panel onto a preview that is STILL current — and the
watcher never fires for it. The removal set rendered with every box
empty and "Select at least one agent", which makes this component's own
stated default untrue on the second visit.

Pre-existing (the previous all-members default had the same hole) and
fail-safe in both directions, which is exactly why it survived: nothing
breaks, the panel is just wrong and asks the operator to re-tick a set
it had already reasoned about.

Found by driving the real panel in a browser — the store spec cannot
see it (the rule is correct; the wiring never ran) and neither can a
source regex, until one is told to look for `immediate`.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* fix(systems): the server's opt-out sentence stops contradicting the opt-in one (Abilityai/trinity-enterprise#454)

The server's prefix warning ends "Uncheck anything that does not belong
before confirming" — the opt-OUT instruction this branch reversed. It
rendered under "Notes", six lines below the panel's own "tick it only
if it belongs", so one screen gave opposite instructions about the same
row and the stale half read as the authoritative one, because it came
from the server.

Suppressed, which is the rule this component's docstring already
states: a warning that has a dedicated block above is not repeated as
prose. The prefix warning simply had no such block until the
short-selection note gave it one, so it was the only member of that
family still falling through. The excluded, ephemeral and unverified
lines were already suppressed for exactly this reason.

SUPPRESSED rather than MEMBERSHIP_FAULT: it is raised in the HEALTHY
state too, where no banner renders at all.

Visible only in situ — the warning comes from the enterprise module, so
it is absent from every fixture in the frontend tests.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* fix(systems): the result stops printing an instruction for the screen before it (Abilityai/trinity-enterprise#454)

`TeardownResult` rendered `result.warnings` unfiltered, so the server's
prefix warning — which ends "Uncheck anything that does not belong
before confirming" — appeared under Notes on the RESULT, beneath a
report of what had already been removed. Advice for a decision already
taken, in the opt-OUT wording the preview stopped using.

Only that line is dropped. Every other warning is a statement of fact
about what happened (agents excluded, members with no container,
ephemeral members with no recovery window) and still reads correctly
after the event.

The preview gained this filter in 581a531; this component did not,
because nothing renders either of them in CI and the preview is the one
a source guard had been written against. Found by tearing a system down
for real on a live stack.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* fix(systems): the teardown default is an allowlist, and its three mirrors are one rule

`teardownDefaultSelection` pre-ticked `evidence !== 'prefix'`. `evidence` is
free-form text off the wire and the consumer DELETES, so a member arriving
with the field absent, null, or carrying a future fourth value was pre-ticked
by a denylist that had never heard of it.

It was worse than one predicate: the polarity was hand-mirrored in THREE
places, two of them in the template — the store's default, the "matched by
name only" BaseBadge, and the explanation beneath it. The badge and the note
tested `=== 'prefix'`, which is not the complement of `!== 'prefix'` for an
unrecognised value, so such a member was pre-ticked AND unbadged AND
unexplained: swept into a delete with no signal at all.

All three now read one exported predicate, `isConfirmedMember`, an allowlist
of positive confirmation (`tag` / `both` — what `system_service.py` actually
emits). `teardownUnconfirmedMembers` is its complement by subtraction, so the
pair partitions the roster by construction.

Four cases + a partition property added to the spec that already executes this
rule. Negative-controlled: restoring the denylist turns the three
unrecognised-evidence cases red.

The source guard's assertion moved with it — it pinned the literal
`m.evidence === 'prefix'`, i.e. the implementation spelling, and now pins the
shared predicate plus the absence of a raw comparison.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* test(ui): declare the cascade guard's @source-text-pin, and stop claiming no mount harness exists

Two things, one file.

**The pin.** #2922 lands a ratchet that holds any spec with no baseline entry
to ZERO source-text reads. This spec is new, so it fails that ratchet — the
two PRs are individually green and jointly red, which is invisible to either
one alone. It is a legitimate pin rather than a missing mount: the defect is a
cascade tie broken by stylesheet EMISSION ORDER, and neither jsdom nor
@vue/test-utils evaluates a stylesheet, so a mount would report the class list
it was handed and prove nothing. That is exactly the case the marker exists to
make visible to review.

**The false rationale.** The docblock said vitest "runs `environment: 'node'`
here with no mount harness". `environment: 'node'` is the DEFAULT only; a spec
opts into jsdom per file and mounts, which 22 specs already do. Saying the
harness does not exist is the claim #2918 was filed about, and repeating it in
a new file is how the belief survives. The harness exists and is reachable —
this spec stays at source level because a cascade is invisible to it, which is
a different and true reason.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* docs(mcp): correct the teardown_system policy comment — `agents` IS a target param

The comment justified the `baselined` row by saying `agents` is absent from
AGENT_TARGET_PARAMS, so a `none` row "would have passed the shape check and
said something false". `agents` is in that set (`access.ts`), and `policyFor`
THROWS on a `none` row whose parameters name an agent — the server refuses to
boot. The row is right; its stated reason was the one thing about it that was
wrong, and it understated why the row matters.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

---------

Co-authored-by: Claude Opus 5 <[email protected]>
Co-authored-by: sim <[email protected]>
vybe pushed a commit that referenced this pull request Sep 22, 2026
…) — mechanical, per the merge-train note on the PR

The train (#2922's source-text ratchet + this stack) found the joint break:
this spec reads 20 SFCs by text and is a NEW spec with no baseline entry.
It is a legitimate pin — an adoption guard over a set of call sites a mount
cannot prove — so it declares itself one, per the ratchet's escape hatch.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
vybe pushed a commit that referenced this pull request Sep 22, 2026
… and NavBar (#1925) (#2781)

* refactor(ui): adopt the priority+ tab pattern on Settings, Operations and NavBar (#1925)

Three audited surfaces hand-rolled a tab/nav strip instead of using the
`OverflowTabs` primitive (#1114). Settings and Operations now render their tabs
through it; NavBar gets the same measured priority+ split without mounting it,
because its items are `<router-link>`s that must keep a real href and the
primitive's are `<button>`s that emit a selection.

NavBar is the case the audit called worst. Its link row was an `overflow-x-auto`
scroller with the scrollbar suppressed inside the 64px bar (#1789), so an
overflowed link stayed reachable but became invisible and undiscoverable — the
bar gave no signal that more navigation existed. It now renders the links that
fit plus a counted "N more ▾" disclosure, with the active state reflected on the
trigger when the current route's link is one of the hidden ones.

The fit arithmetic is SHARED, not re-derived: `utils/overflowFit.js` holds the
rule verbatim from `OverflowTabs::recompute`, and both surfaces call it. It also
gained a `gap` term, which NavBar needs and the tab strip does not — the tabs are
padding-spaced, while the nav row carries a real flex gap that is invisible to
the per-item rects, and a gap-blind sum hides ~120px on a six-link row (one whole
link) and so keeps the last one inline to clip.

Both new modules are pure because vitest runs `environment: 'node'` with no mount
harness, so a rule inside an SFC is one no test can reach (the ent#392
precedent). `utils/navLinks.js` likewise derives the link set once — a strip that
can hide a link renders the same link three times (inline, menu, hidden mirror),
and three hand-written copies is three places for an active predicate or a badge
to drift.

Colours: the new code is semantic-token only, so the active underline moves from
raw `blue-500/400` to `action-primary` (the primitive's own active token) and the
Enterprise PRO pill from raw `purple-*` to `accent-purple-*`. Visible as a slight
indigo shift on the nav's active indicator.

Triage of the audit's nine scanner candidates: every one is a bounded wide table
or a preformatted code block, where horizontal scroll inside the container is the
correct treatment (design-system principle 7) — collapsing columns into a "More"
menu would hide data, not navigation. None migrate; each is marked in place so a
later audit does not re-flag it. The advisory two-pill strip in Audit.vue is a
segmented control, a different primitive, and is recorded as such.

`workspaceNewTab.spec.js` (ent#456) asserted `target`/`rel` against NavBar's
template text; that truth moved into `navLinks.js`, so the NavBar half now drives
the data and additionally pins that the strip binds both fields onto its links —
the half a data-driven refactor can get wrong is correct data that never reaches
the DOM.

Baseline: NavBar raw_nongray 35 -> 19, raw_gray 125 -> 105. Edited by hand rather
than regenerated, per the `refrozen` note — a wholesale run deletes that block.

Fixes #1925

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01Q19uRCksdn4DiRAJ55rfpZ

* fix(ui): give the nav strip the width it is measuring against (#1925)

Caught by a live check, not by the suite: at 1440px the strip hid four of five
links behind "4 more". The row and its parent cluster sized to content, so
`clientWidth` reported the row's own min-content — and because the inner nav is
`overflow-hidden`, that is near zero — making the fit rule correct about a
container that was lying to it.

The old #1789 row never needed this: a row that SCROLLS sizes to its content and
lets the overflow happen, while a row that COLLAPSES has to be told how much
space it actually has. `flex-1` on both supplies it; `justify-between` plus the
controls' `flex-shrink-0` keeps the right-hand cluster where it was.

Verified against the local dev instance across 1440/1300/1200/1100/1000/900/800/700
and back up again: one row at every width, never clipped, collapsing at 800 and
700 and re-expanding on the way back up.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01Q19uRCksdn4DiRAJ55rfpZ

* test(e2e): navbar-overflow pins the priority+ mechanism, not the scroll row (#1925)

`navbar-overflow.spec.js` is #1789's guard, and its third test asserts
`overflow-x: auto` on the link row — the hidden-scrollbar scroller this issue
deliberately replaced. It went red the moment the strip started collapsing, and
I missed it because I grepped `src/` for that pattern and never `e2e/`.

Confirmed it is this branch and not the tree: the spec passes against plain
`origin/dev` built and served the same way, and fails here.

Properties 1 and 2 — links never collide with the controls, controls stay
on-screen and the user menu stays hit-testable — are unchanged and still pass;
they were never about the mechanism. Property 3 now pins what #1925 actually
guarantees: the links that fit render inline, the rest collapse into a counted
"N more" disclosure, the count agrees with what the menu holds, every hidden
link is a real href, and Escape closes it.

It also pins the ABSENCE of the old mechanism — no `overflow-x: auto`, no
scrollWidth past the box. A future refactor reintroducing the scroll row would
restore exactly the undiscoverable-link failure this issue removed, and this is
where that gets caught.

`settleNav` is not politeness: the strip re-measures on a rAF after a resize, so
a snapshot taken in the same tick as `setViewportSize` reports the previous split
— "it fits" one frame before the links move into the menu. That is how the first
version of this rewrite failed, and the fix is to sample until two reads agree
rather than to widen a timeout.

Verified against this branch's build: 4/4 pass, and the collapsed branch is
genuinely exercised — at 640px the trigger reads "4 more" with 1 link inline and
4 in the menu, at 1440px there is no trigger and 5 links inline.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01Q19uRCksdn4DiRAJ55rfpZ

* merge-train: loop the HTML-comment strip to a fixpoint (#1925) — mechanical, per the merge-train note on the PR

CodeQL js/incomplete-multi-character-sanitization (train #2896, alert 364)
flagged the one-shot replace in a source-text guard. A fixpoint loop is the
shape the rule accepts; behaviour on every real input is unchanged.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* merge-train: declare tabStripAdoption.spec.js a @source-text-pin (#1925) — mechanical, per the merge-train note on the PR

The train (#2922's source-text ratchet + this stack) found the joint break:
this spec reads 20 SFCs by text and is a NEW spec with no baseline entry.
It is a legitimate pin — an adoption guard over a set of call sites a mount
cannot prove — so it declares itself one, per the ratchet's escape hatch.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* merge-train: correct the NavBar figures in the baseline's _1925_note (#1925) — mechanical, per the merge-train note on the PR

The note narrated 35 -> 19 / 125 -> 105; the entry holds 7 / 93 against dev's 23 / 113 (post-rebase compose with ent#625).

Co-Authored-By: Claude Fable 5.1 <[email protected]>

---------

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Co-authored-by: sim <[email protected]>
vybe pushed a commit that referenced this pull request Sep 22, 2026
…urce-text-pin (#2711) — mechanical, per the merge-train note on the PR

The train (#2922's source-text ratchet + this stack) found the joint break:
the `route.value` spelling guard reads Portal.vue by text and this is a NEW
spec with no baseline entry. It is a legitimate pin — only the text proves a
spelling is absent — so it declares itself one.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
vybe pushed a commit that referenced this pull request Sep 22, 2026
…#2785)

* fix(workspace): reserve the rail column while the stage loads (#2711)

On every cold load the conversation column rendered full width, then lost the
rail's width the moment the roster arrived — sliding the composer, the thread and
the header left. Since #2676 that is a 300ms animated slide rather than a
one-frame jump, which is prettier and still a shift: the contract's
layout-stability rule is that loading and loaded share ONE footprint and nothing
moves on arrival.

Measured on a local instance before the fix, the Send button at 1440px goes
1327 → 1300 (27px) as the roster lands, and 916 → 884 (32px) at 1024px.

`railVisibleFor` answers "may the rail RENDER", and false for a non-ready stage
is right — its tabs need the roster. But the column's WIDTH does not need the
roster: it comes from the persisted rail state and is known synchronously at
first paint. So the wrapper now renders on `railHasColumn || railColumnReserved`
and gates only `PortalRail` inside. Space is reserved; content is not faked.

`railColumnReservedFor` is deliberately NARROWER than `railVisibleFor`'s route
set, and the exclusions are the interesting part:

  * an agent page never carries a rail, so reserving there would invent a gap;
  * a ROOM route is excluded even though a ready room usually has a rail,
    because that depends on `roomsAvailable`, which arrives ON the roster
    payload (#2128). Reserving against a capability we have not been told about
    yet would trade this shift for the opposite one on every install without
    rooms.

So it reserves for exactly the case the bug is about: a 1:1 conversation route,
mid-load. If the rail then turns out not to render, the column leaves through the
existing width transition — a shrink, not a jump.

Nothing about the motion changes: the `<Transition>` classes, the #2676
voice-canvas swap and `motion-reduce` are untouched, and the reserved column is
present from the first frame so its enter never runs.

Verified: the composer's x is stable within 1px across 24 samples through roster
arrival at 1440/1024/768/640, the column keeps the same width when the rail
lands, and `workspace-model-choice.spec.js` — the spec whose measurements the
#2676 transition split — stays green. Reverted, the same spec fails with the
27px/32px slides above, so it bites. Unit suite 135 files / 2957 tests.

One e2e case was written and then removed rather than left skipping: "an agent
page carries no rail column" asserted a premise the router does not hold —
`/workspace/a/:name` REDIRECTS into a conversation, which legitimately has a
rail. The rule it meant to check is covered in the unit spec, which does not
depend on which URL the router settles on.

Fixes #2711

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01Q19uRCksdn4DiRAJ55rfpZ

* fix(workspace): give an unfulfilled rail reservation back in one frame (#2711)

Review finding, reproduced: the reservation fires for any non-room, non-agent-
page route while the stage loads, but `stageZone` keys on the ROSTER — so a
caller with no rostered agents settles `empty` and a failed roster fetch settles
`failed`. In both the rail never arrives, the reservation drops, and the column
left through the 300ms width transition:

    EMPTY roster   ->  none -> reserved(48) -> reserved(22) -> reserved(3) -> none
    FAILED roster  ->  none -> reserved(48) -> reserved(10) -> reserved(1) -> none

A 48px animated shift on first run — nobody has shared an agent yet — and on
every roster error, landing beside an error state. That is the same defect this
PR removes, handed back, and it is exactly the hazard the docblock reasons about
for ROOMS without applying it to `empty` / `failed`.

The fix is not to reserve less. Narrowing to `/workspace/c/:id` would protect the
AC's route and leave the common path — the nav's `/workspace`, which redirects
into a conversation — shifting as before, because the redirect happens after the
roster lands. Instead the LEAVE is animated only when the column actually held a
rail (`railEverHeldRail`): a reservation that paid off animates as before, one
that did not is given back in a single frame. Measured after:

    EMPTY roster   ->  none -> reserved(48) -> none
    FAILED roster  ->  none -> reserved(48) -> none

and the normal load is unchanged: `reserved(48) -> rail(48)`, no shift.

The ENTER keeps its transition unconditionally — it only ever runs for the
voice-canvas swap (#2676), since a reserved column is present from the first
frame and never enters. The flag resets per route, because the question is about
THIS stage: navigating from a conversation to an empty roster must not inherit
the conversation's verdict.

Two spec arms added for the second finding — the suite measured bare
`/workspace`, not the `/workspace/c/<session>` the AC names, so it was right
only by accident of the fixture:

  * a direct load of `/workspace/c/<id>` (resolved from the sessions route)
    keeps Send within 1px;
  * an empty and a failed roster give the column back with NO intermediate
    width. The assertion is about the shape of the removal, not its speed:
    every width observed must be the full reserved width or nothing, because an
    intermediate width IS an animation frame. Negative control: forcing the old
    unconditional leave fails it with "animated away through 6,22px".

`portalVoiceLayoutMotion.spec.js` pinned the literal `leave-to-class="!w-0"`,
which is now a binding. Updated rather than deleted: the #2676 property it
protects is intact, since the canvas only ever takes the row from a rail that was
on screen, so `railEverHeldRail` is true wherever that spec cares.

Frontend unit suite 135 files / 2957 tests; the rail and model-choice e2e suites
12/12.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01Q19uRCksdn4DiRAJ55rfpZ

* fix(workspace): read `route.fullPath`, not `route.value.fullPath` (#2711)

Caught by chasing a red CI run rather than dismissing it. The reset watcher
added with the reservation read `route.value.fullPath`, but `useRoute()` returns
a reactive OBJECT, not a ref — every other route read in this 2,000-line file is
the plain form, and this line was the only `route.value.` in it.

It is not a silent no-op, it is a silent THROW: Vue routes a watch-getter error
to its error handler instead of aborting setup, so the page rendered, the rail
e2e passed 12/12, the unit suite passed 2957, and the watcher was dead the whole
time while every Workspace load logged

    TypeError: Cannot read properties of undefined (reading 'fullPath')

Verified in a browser before and after: the error is on the previous build and
gone from this one. The measured rail behaviour is unchanged (`reserved(48) ->
none` on an empty or failed roster, `reserved(48) -> rail(48)` normally) because
the flag is only ever SET by the other watcher on a cold load; what was broken is
the per-route reset, which is the in-session case.

Guarded rather than just fixed: `portalRailReserve.spec.js` now fails on any
`route.value.` in the shell, and the guard was proven to bite by reintroducing
the bug (it fails) — a dead watcher is invisible to every test that does not read
the console, so the spelling is worth pinning in the one file that mixes it.

Unit suite 135 files / 2959 tests. The three workspace e2e suites CI flagged —
rail-reserved, model-choice, stick-to-bottom — 15/15 locally.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01Q19uRCksdn4DiRAJ55rfpZ

* merge-train: declare portalRailReserve.spec.js's spelling guard a @source-text-pin (#2711) — mechanical, per the merge-train note on the PR

The train (#2922's source-text ratchet + this stack) found the joint break:
the `route.value` spelling guard reads Portal.vue by text and this is a NEW
spec with no baseline entry. It is a legitimate pin — only the text proves a
spelling is absent — so it declares itself one.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

---------

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority-p1 Critical path theme-devex Theme: DevEx type-refactor Code improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants