[16.0][FIX] endpoint_route_handler: drop route_group length limit #205
All Vouch review confidence checks passed
Residual risk 0.23 = Change Risk (0.43) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.43 · 388 lines diff across 4 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.357
Shallow Review Depth
shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #205"
general
weight: 0.35
simahawk
endpoint_route.route_groupis created asVARCHAR(32). Any group longer than32 characters makes the route registration fail after the record was saved:
The most visible case is
shopfloor_base: an app registers its routes undershopfloor.app:<tech_name>, so anyshopfloor.appwhose technical name islonger than 18 characters is saved but gets no routes (every endpoint answers
404, and the app only says the login failed). The same happens for an
endpoint.endpointwhose free-text "Route Group" is longer than 32 characters.The limit seems to have been copied from
endpoint_hashon the line above whenthe table was introduced in #3. Nothing depends on it: there is no index or
constraint on the column, the lookup is a plain equality filter, and the ORM
field
route_grouphas no size.keyandroutein the same table have nolimit either.
Changes
route_groupis created asVARCHARwithout a length limit.migrations/16.0.1.1.4/pre-migrate.pydrops the limit on existing databases(the table is only created on install). Widening a
varcharis a catalog-onlychange in PostgreSQL: no table rewrite.
get_rules_by_groupbuilt itsWHEREclause with an f-string, so a groupcontaining a quote broke the query and the value ended up as SQL. The group
is now passed as a query parameter;
get_rules/_get_rulestake anoptional
paramstuple for the placeholders ofwhere(default(), so thecurrent callers behave as before).
Tests
test_route_group_longer_than_32_chars: rules with a 77-character group arestored and found by group.
test_get_rule_by_group_is_escaped: a group containing a quote is found, andx' OR '1'='1returns nothing.test_migration_drops_route_group_length_limit: the pre-migration turns aVARCHAR(32)column into an unlimited one.Also checked on a database with
shopfloor_base: an app with a 30-charactertechnical name registers all its routes after the migration.
Not changed here
Noticed while reviewing, left out to keep this fix small:
_setup_dbonly creates the table and never aligns existing columns with_columns, so any future type change needs its own migration like this one.route_grouphas no index;get_rules_by_groupscans the table.get_rules(keys=[])returns every rule, since an empty list counts as nofilter.
Forward port
17.0, 18.0, 19.0 and the open 20.0 migration (#177) have the same column
definition and the same f-string. In 19.0, OCA/rest-framework#634 gave the
fastapi.endpoint.route_groupfieldsize=32to match the column; that sizecan be relaxed once this is forward-ported.
AI assistance
Prepared with Claude Code (Claude Opus 5.5): tracing the error to the column
definition, searching the history and the other branches, drafting the fix,
tests and this description. I reviewed the change and ran the tests myself.