Skip to content

fix(platform): truthful skill reads, lossless labels, keyboard access - #3894

Merged
yannickmonney merged 15 commits into
mainfrom
fix/skills-load-states-labels-keyboard
Sep 29, 2026
Merged

yannickmonney merged 15 commits into
mainfrom
fix/skills-load-states-labels-keyboard

Conversation

@yannickmonney

@yannickmonney yannickmonney commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Repairs the five parent-verified skill dialog findings. Each one has its own commit and its own regression tests.

Closes #3752
Closes #3753
Closes #3754
Closes #3755
Closes #3756

What changed

#3752 — failed detail/asset reads (skill-read-state.ts, skill-detail-pane.tsx, skill-asset-viewer.tsx)

  • The pane used to collapse any absent data to "Skill not found", and the viewer rendered only its 404 branch. Both now read one state:
    • loading: this includes Try again after a failed first read, because react-query goes back to pending.
    • failed: no answer and nothing on screen.
    • ready: null is the door's 404. An empty file is a successful answer.
    • refreshFailed: a shown answer whose last refresh failed.
  • A failed read shows the shared CatalogLoadError with Try again and failureDetail's reason. It never shows skills.notFound or an empty preview, and Copy stays off.
  • A successful retry shows the saved content without reopening. If the retry fails again, focus goes back to the new Try again, but only when removing the control stranded it: focus is on the page, or on the dialog container where the focus trap parks it (use-retry-focus.ts). A member who moved focus while the retry ran keeps it there, and opening another skill or file disarms the hook. This is the same rule the approvals card in fix(platform): preserve approval decisions and scope card recovery #3881 is asked to follow.
  • The door's 404 keeps skills.viewer.notFound. A genuinely empty file now says skills.viewer.empty.
  • If a refresh of a shown skill or file fails, the shown version and any draft stay on screen, with a notice and its own Try again. The notice stays through the retry, because a query with data keeps its error while it is fetched again, so focus is not lost.

#3753 — labels past the cap (skill-metadata-fields.tsx, skill-detail-pane.tsx)

  • parseLabelsInput no longer cuts the list.
  • Changed labels are checked against the shared caps (MAX_SKILL_LABELS, MAX_SKILL_LABEL_LENGTH) through the shared Input hint and error: aria-invalid, aria-describedby, role="alert".
  • The field keeps the whole draft, and Save waits. A save sends exactly the labels the member kept.
  • Labels the member did not touch are not sent, because an omitted field keeps the stored list. Stored labels that the comma-separated field cannot represent (a label containing a comma) therefore no longer block or mangle an unrelated save.
  • The too-long message quotes the first 20 characters of the label, so the live region does not change on every keystroke.

#3754 — icon options and the keyboard (skill-icon-picker.tsx)

  • This follows SearchableSelect's model. The options are tabIndex={-1} while the search box owns aria-activedescendant.
  • Options pick on click, and mousedown keeps focus in the search box. A pointer click, a key press on an option that assistive technology focused, and Enter in the search box all go through the same pick.
  • The highlighted option scrolls into view with block: 'nearest'. Before, ArrowDown ×9 left it below the listbox fold.

#3755 — remembered folders (skill-bundle-tree-panel.tsx)

  • The tree now persists the collapsed folders, read on first render through usePersistedState, under skill-bundle-tree-collapsed:<organizationId>:<slug>. Every other folder opens expanded, including one the bundle gains later.
  • The old skill-bundle-tree-expanded:<slug> record listed the open folders and was never honoured. It is removed unread: a folder missing from it may have been collapsed, or may have been added since.

#3756 — the tree's keyboard entry point (build-bundle-tree.ts, skill-bundle-tree-panel.tsx)

  • bundleTreeEntryPath picks the one Tab stop: the selected entry while it is on screen, otherwise the outermost collapsed folder hiding it, otherwise its nearest folder still in the bundle, otherwise SKILL.md.

Shared concepts reused. The skill tree now renders @tale/ui/file-tree-primitives (TreeRowButton with its tabbable override, treeNavigationKeyDown, iconForPath) instead of its own copies. The shared row gains an optional className, so the tree's larger top level keeps its look: identical pixels in the before/after screenshots, and tailwind-merge resolves py-1.5 text-sm. Other pieces reused: CatalogLoadError, failureDetail, usePersistedState, and Input hint/errorMessage.

Locales, docs, manual

  • EN/DE/FR keys: skills.detail.loadFailed/refreshFailed, skills.viewer.loadFailed/refreshFailed/empty, skills.editor.labelsTooMany/labelTooLong.
  • docs/{en,de,fr}/platform/workspace/skills.md ("Update and troubleshoot", plus the file reference row).
  • New boxes SKILL-F21, SKILL-B7, SKILL-B8, SKILL-A3, SKILL-A4, with their pins and a component-half row in reference/automation.md.
  • tests/manual/readme.md is recounted against the suites as they stand. Six other suites had drifted since fix(manual): recount the platform suite totals #3807.

How it was verified

  • Reproduced first. All five were reproduced on an isolated checkout of main in real Chromium (Playwright 1.58) against a local stack: PG16, the native backend ROLE=all, and vite preview of the production build. That stack had no provider, no egress and no agent runs. Faults were injected only on the fixture skill's own requests with page.route: 503 for all 4 attempts the hook makes, and 403 on the PUT for refused saves.
  • Before/after in the real browser (main build → this branch; every probe re-run on the final head).
  • Tests (regression cases fail on main, pass here).
    • skill-detail-pane.test.tsx (read failure, lost connection, retry mask, focus back on Try again, 404 control, failed refresh keeps the draft and its notice through the retry; nine labels, eight saved, long label, untouched labels not sent).
    • skill-asset-viewer.test.tsx, skill-read-recovery.test.tsx (a real QueryClient with the production retry rule: fail ×4 → Try again fails ×4 with focus kept → success; the same for a file).
    • skill-icon-picker.test.tsx, skill-bundle-tree-panel.test.tsx (real user-event Tab, arrows and Enter; remembered folders per org and skill; the old record dropped).
    • skill-metadata-fields.test.ts, skill-read-state.test.ts, build-bundle-tree.test.ts (bundleTreeEntryPath), file-tree-primitives.test.tsx (className).
    • With main's sources restored, the first round's 29 regression cases failed while their controls passed. The review round's additions were written against the fixed code.
  • Local gates.
    • oxlint --type-aware --type-check on app/features/skills, lib/skills, the shared primitive and its two other consumers: clean.
    • oxfmt.
    • vitest --project client app/features/skills/ and --project server lib/skills.
    • vitest related --project server --project client for every changed module: 29 files / 234 tests before the review round.
    • Browser project skill-asset-viewer.browser.test.tsx and skills-settings.browser.test.tsx.
    • lib/i18n/messages.test.ts; the docs suite (36 files / 200 tests).
    • bun run lint:manual; check-guide.ts on suites/skills.md (OK) and on the two registers (the same 44/3 existing findings as main).
  • Retry-focus review round (discussion_r4133919336).
    • hooks/use-retry-focus.test.tsx has 6 cases. Stranded focus is restored, and a focus-trap container counts as stranded. Focus moved to a mounted control is kept. An answer and another read both disarm the hook, and a press made without focus on the control stays disarmed.
    • skill-read-recovery.test.tsx uses a real QueryClient with a held response. A held file retry followed by a click on references/ keeps focus on the folder. A held retry with nothing moved puts focus on Try again. Another file opened while the retry is held keeps focus on its row.
    • Against the previous hook the 4 regression cases fail, and the controls pass on both.
    • Chromium replay on the exact head 6d23cc4c, with the next retry held behind a gate:
      • Focus moved to references/, to another file's row, or to the dialog's Close stays there. With the previous hook, each of these was moved to Try again.
      • The stranded controls, where focus was parked on the dialog container, still land on Try again on both builds.
  • CI. On 7ad78429, on cb14a619 and on the current head 6d23cc4c, all 53 checks pass; 4 are skipped by design (fork-only, release, Trivy). On 6d23cc4c the UI job executed (cache miss) and ran use-retry-focus.test.tsx (6) and skill-read-recovery.test.tsx (5). Knip, which flagged the first push of this round (5b344be6) for an unused export, passes.
    • The UI, Unit, Browser, Type check and Lint jobs show cache miss, executing for @tale/platform and @tale/ui, and the UI job ran every new skills test file.
    • Between those two heads, main was merged in twice. The only conflict both times was the manual readme's suite totals, recounted from the suites.
    • On the first merge head, one run of "UI docs container test" hung in its in-container vite build and was cancelled at 15 minutes. It passed in 2m53s on the next head.
  • Visual gate (visual-aspect-analyzer, embed path with a logged-in interact, final build):
    • Scenarios: the tree keyboard walk with a collapse, a failed detail read, and the labels error.
    • All three score 100/100, with no defects across 86–110 tracked elements.
    • The labels scenario scores 100 when the labels are typed with real keys. With a programmatic fill() it reports one 0.001 layout shift of the Visibility row, because the new error line pushes it down.
    • This host could not finish the pixel pipeline: two 45-minute runs were cut off. These scores are therefore without dithering and the paint check.
  • Review. A read-only adversarial review found no high-severity defects. Its medium finding (focus lost on Try again) and its low findings (comma labels blocking saves, the legacy-record guess, the live-region churn, SKILL-B7's cache trap, box step gaps, reasons dropped on refresh, org-scoped storage) are fixed in this branch.

Notes

  • bug(platform): successful skill saves can leave the editor blank until it is reopened #3642 (a successful save can blank the editor) is untouched and out of scope. I saw it race once in the real-browser probe. Nothing here makes it more likely.
  • The Labels hint now sits in Input's field frame, 6 px lower than before, which is the design-system spacing for every input hint. The skill-library-detail docs screenshot is otherwise unchanged. I did not retake it, because the capture pipeline needs the Docker-seeded stack.
  • Out of scope, seen while scripting fixtures: afterCreateOrganization queues org.scaffold with cleanFirst: true. A skill saved through the door before that job runs (a PUT answering 200) was gone from the org tree afterwards, twice. integration-check.ts already waits for the job for the same reason. I have not investigated it further; it is worth an issue of its own.

Screenshots (before/after, DE/FR/dark) and the probe results are attached to TALE-90.

Reviewer: Yannick Monney

The icon picker's 97 options were native buttons that picked on mousedown
only, so each was a Tab stop that ignored Enter and Space. The search box
already owns the grid through aria-activedescendant, the way
SearchableSelect's search box owns its list. The options now sit outside
the Tab order and pick on click (a pointer, or a key on an option
assistive technology focused) through the same pick as Enter in the
search box, and the highlighted option scrolls into view as the arrows
move it past the fold.

Closes #3754
The bundle tree stored the folders left open, then re-added every folder
missing from that set on mount, so a collapsed folder reopened expanded
(#3755). It now stores the collapsed folders, per organization and skill,
so every other folder, one the bundle gains later included, opens
expanded. The older open-folder record is dropped unread: a folder missing
from it may have been collapsed or added since.

Its one Tab stop followed the selected file, so collapsing that file's
folder unmounted the only tabbable row and Tab skipped the tree (#3756).
The stop now falls to the outermost collapsed folder above the selection
(bundleTreeEntryPath), or to SKILL.md.

The tree renders the shared file-tree primitives (TreeRowButton and its
tabbable override, treeNavigationKeyDown, iconForPath) instead of its own
copies. The shared row takes a className for the tree's larger top level,
so nothing moves on screen.

Closes #3755
Closes #3756
The skill dialog read a failed detail read as "Skill not found" and a
failed file read as an empty preview, with no error and no way back. Both
panes now read one state (skill-read-state.ts). A failed read offers Try
again (CatalogLoadError, with failureDetail's reason); a retry masks the
pane again and a success shows the saved content without reopening. The
door's 404 and a genuinely empty file keep their own messages, the empty
one now saying so. A failed refresh of a shown skill or file keeps it on
screen, drafts included, under a notice whose Try again stays through its
own retry; a Try again that fails again hands focus back to the new
control.

Closes #3752
The labels parser cut the list to eight, so a ninth label vanished behind
a "Skill saved" toast. The field now keeps every entry, sends exactly what
it holds, and holds changed labels to the caps the doors enforce
(MAX_SKILL_LABELS, MAX_SKILL_LABEL_LENGTH): a translated field error names
the excess or the long label, and Save waits. Labels the member did not
touch are not sent, so stored labels the comma-separated field cannot
represent survive an unrelated save.

Closes #3753
The skill library guide (EN/DE/FR) says what the Labels field takes and
does past the cap, that the Bundle tree remembers collapsed folders, and
what a failed load or refresh looks like. The skills suite gains
SKILL-F21, SKILL-B7, SKILL-B8, SKILL-A3 and SKILL-A4 for what only a real
browser can judge, with their pins and a component-half row in the
automation register. The suite table in the manual readme is recounted
against the suites as they stand; six other suites had drifted since the
last recount.

Refs #3752, #3753, #3754, #3755, #3756

@yannickmonney yannickmonney left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

One actionable focus regression found in the Skills repair; see the inline reproduction. Please fix this before acceptance. The remaining scoped checks passed (144 existing tests); no merge approval.

…s-labels-keyboard

# Conflicts:
#	services/platform/tests/manual/readme.md
yannickmonney and others added 9 commits September 29, 2026 14:16
…s-labels-keyboard

# Conflicts:
#	services/platform/tests/manual/readme.md
…s-labels-keyboard

# Conflicts:
#	services/platform/tests/manual/readme.md
The Try again recovery put focus on the new control after every retry the
member started that failed again, even when they had moved focus to a
control that stayed on screen while it ran (a bundle tree row, the
dialog's close button), or had opened another file whose own first read
then failed. It now restores focus only when removing the control
stranded it, on the page or on a container around it where the dialog's
focus trap parks it, and opening another skill or file disarms it. The
approvals card in #3881 is asked to follow the same rule.

The new cases hold a retry on the network while the member acts: a move
to a tree row, a move to the close button, another file opened, and the
stranded control that must still recover. SKILL-A5 covers the same in a
browser.

Refs #3752
Knip flagged the exported isFocusStranded: nothing outside the retry
hook reads it.
@yannickmonney
yannickmonney merged commit 6b6db04 into main Sep 29, 2026
57 checks passed
@yannickmonney
yannickmonney deleted the fix/skills-load-states-labels-keyboard branch September 29, 2026 21:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment