Skip to content

feat(mentor): safety tab becomes a thin wrapper over the SDK - #550

Open
conradmugabe wants to merge 3 commits into
mainfrom
feat/migrate-safety-tab
Open

conradmugabe wants to merge 3 commits into
mainfrom
feat/migrate-safety-tab

Conversation

@conradmugabe

Copy link
Copy Markdown
Contributor

The Safety tab in the Edit Agent modal is now a thin wrapper over the SDK's AgentSafetyTab. It is part of the SDK-as-source-of-truth migration; Skills is #549.

What changed

  • Wrapper: edit-mentor-modal/safety-tab.tsx renders AgentSafetyTab inside AgentSettingsProvider (tenant, agent id, username, RBAC, executeGatedAction set to the OS free-trial check). It passes in the OS pieces the SDK accepts as props:
    • the lazily loaded flagged-prompts modal, which stays in OS;
    • showFlaggedPrompts, from the same #view_moderation_logs permission check;
    • markdown prompt rendering (Markdown + parsePrompt);
    • next-intl labels;
    • FreeTrialDialog.
  • Removed:
    • the local tabs/safety-tab.tsx (525 lines) and its 1,419-line test;
    • the now-unused SafetyPrompt type, with its fixtures and tests in edit-prompt-modal;
    • 9 tabsSafetyTab keys per locale (en, es, fr, zh).
    • Net −1,602 lines.
  • Tests first: the new journey 79 (safety-01 to safety-12) was written before the swap and passed on main. It covers:
    • the four cards;
    • the moderation and safety switches, with persistence;
    • prompt edit and validation, copy, and tooltips;
    • flagged prompts: empty and populated states, pagination, search, filter, and delete;
    • non-admin gating.

Verification

  • PLAYWRIGHT_HTML_OPEN=never pnpm exec playwright test --config e2e/playwright.config.ts e2e/journeys/79-mentor-safety-tab.spec.ts --project=mentor-desktop-chrome --workers=1 --retries=0 against a production build of this branch: 16 passed. No spec was edited after the swap, and no test was re-run.
  • Unit tests: 100% coverage on the wrapper. The affected suites pass (198 tests), and typecheck and lint are clean.
  • Pre-push AI review: no bugs found.

Behaviour differences

  • The info box at the top of the tab is gone; the SDK has no equivalent.
  • The switch, info-icon and content aria labels now come from the SDK's i18n.

Follow-ups (not in this PR)

  • The send-notification dialog inside flagged prompts is unreachable, because onContactUser is never rendered.
  • There is a commented-out ViolationCategories import in flagged-prompts/index.tsx.
  • Moving the flagged-prompts modal itself into the SDK would make this tab fully SDK-owned.
  • Spec 29's Safety accessibility test is still test.fixme.

🤖 Generated with Claude Code

conradmugabe and others added 3 commits October 2, 2026 08:31
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
New journey 79 (safety-01..12): the four cards, moderation and safety
switches persisting, prompt edit and validation, copy, tooltips,
flagged-prompts empty/populated/pagination/search/filter/delete, and
non-admin gating. Passed against main before the swap.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The tab renders AgentSafetyTab inside AgentSettingsProvider and injects
the OS pieces: the flagged-prompts modal, the view_moderation_logs
permission, the free-trial gate, and markdown prompt rendering. Delete
the local tab, its tests, the SafetyPrompt type, and the i18n keys the
SDK now owns.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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.

1 participant