7f2c71299f
OAuthClient wraps @simpleworkjs/orm's Resource model, whose instance delete method is .delete() -- not .remove(), which is what model-redis's Table instances (e.g. this app's ApiToken, AuthToken) use. The DELETE route called the wrong one, so every delete silently 500'd; the route's try/catch turned it into a plain JSON error response rather than a thrown exception, and the existing tests' cleanup-only delete calls (afterAll, end of the rotate test) never checked the response status, so the bug shipped unnoticed. The Directory Management UI was never affected -- routes/api_directory_admin.js's DELETE routes already used .delete() correctly throughout. Found and root-caused live against a real deployment's SSO API, then reproduced and fixed against a local docker stack with a rebuilt image: confirmed DELETE returned a genuine 500 before the fix and a real 200 + 404-on-subsequent-GET after. Adds two dedicated tests (PUT and DELETE persistence, each verified by a follow-up GET rather than trusting the mutating response alone), and hardens the existing rotate test's incidental delete call with real assertions. Verified the new DELETE test fails on the old code and passes on the fix. Full suite (189 tests, real LDAP + Redis) passes. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>