Skip to content

🧪 fix: Serve the Admin's Effective Capabilities from the E2E Mock Backend - #190

Merged
danny-avila merged 1 commit into
mainfrom
pr/e2e-mock-effective
Oct 28, 2026
Merged

danny-avila merged 1 commit into
mainfrom
pr/e2e-mock-effective

Conversation

@danny-avila

Copy link
Copy Markdown
Contributor

Pull Request Template

⚠️ Before Submitting a PR, Please Review:

  • Please ensure that you have thoroughly read and understood the Contributing Docs before submitting your Pull Request.

⚠️ Documentation Updates Notice:

  • Kindly note that documentation updates are managed in this repository: librechat.ai

Summary

Since #185, the /_app route loads GET /api/admin/grants/effective before the panel renders and fails closed when it can't. e2e/mock-backend.mjs never served that route, so in a mock e2e run every signed-in page showed "Could not verify permissions" instead of the panel. That broke grants.spec.ts's "management tab is active by default", which passed against the mock before #185.

Changes

  • GET /api/admin/grants/effective answers the mock's admin tokens with every capability in SystemCapabilities (imported from @librechat/data-schemas/capabilities, so the list follows the package). LibreChat gives an admin the same.
  • A request without a valid admin token gets the same 401 as /api/admin/verify. Both routes now share one authFailure check, and the admin tokens are listed in one place.

Not in this PR. Most of access.spec.ts and grants.spec.ts still fails against the mock, as it did before #185: those specs expect roles, groups and grants that the server functions now read from LibreChat's admin API (/api/admin/roles, /api/admin/groups, /api/admin/grants, …), and the mock serves none of them. Making them pass means giving the mock fixtures for those routes, or running them against a live backend with E2E_BASE_URL. CI doesn't run e2e.

Change Type

  • Bug fix (non-breaking change which fixes an issue)

Testing

The whole Playwright suite against the mock backend, on main and on this branch:

Passed Failed Skipped
main 30 46 137
this PR 35 41 137
main before #185 (access and grants specs only) 3 45 —
  • grants.spec.ts:30 ("management tab is active by default") passes again.
  • No test fails here that passes on main, and every remaining failure is in access.spec.ts or grants.spec.ts and also failed before 🛂 fix: Decide Admin Access Before the Panel Renders and Fail Closed on Errors #185.
  • login.spec.ts passes in full.
  • Probed the mock directly: no token gets 401 Authentication required, the admin token gets all 25 capabilities, and /api/admin/verify answers as before.

Test Configuration:

  • npx playwright test --workers=2 with vite dev and e2e/mock-backend.mjs, Playwright 1.61.

Checklist

  • My code adheres to this project's style guidelines
  • I have performed a self-review of my own code
  • My changes do not introduce new warnings

…kend

Since #185 the /_app route loads GET /api/admin/grants/effective before the
panel renders, and fails closed when it can't. e2e/mock-backend.mjs never
served that route, so every signed-in page in the mock e2e run showed "Could
not verify permissions". The mock now answers it for its admin tokens with
every capability in SystemCapabilities, refusing other requests the way it
refuses /api/admin/verify; both share one token check.
@danny-avila

Copy link
Copy Markdown
Contributor Author

@codex review

Pass 1. Head: f4de93a

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-27T06:33:44.881773Z f4de93a Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Swish!

Reviewed commit: f4de93a328

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

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