fix(rust): a bad title mode reaches the form as a sentence
All checks were successful
PR Checks / client-build (pull_request) Successful in 22s
PR Checks / server-tests (pull_request) Successful in 27s
PR Checks / frozen-manifest (pull_request) Successful in 50s

The router's own isIn check answered a mode it did not know with
express-validator's "Invalid value" before titles.validateSettings could
say which words are allowed. Found on the walk; the router now checks shape
only, as every other phase-17 route does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01E14m6SuuY6i1vASFeGDBeY
This commit is contained in:
2026-09-25 18:23:29 -05:00
parent 1b70cef5be
commit 0efd5644f6

View File

@@ -159,8 +159,10 @@ adminRustRouter.put(
/* #swagger.responses[404] = { description: 'No such server' } */
requireRole('admin'),
param('id').isString().isLength({ min: 1, max: 64 }),
body('mode').optional().isIn(['first', 'all', 'upto']),
body('rules').isArray({ max: 10 }).withMessage('rules is a list of at most ten'),
// Shape only. The words, the bounds and the per-rule sentences are
// `titles.validateSettings`'s, in the controller, so a bad mode reaches the
// form as a sentence rather than as "Invalid value".
body('rules').isArray().withMessage('rules is a list'),
validate,
admin.putTitles,
)