[FIX] portal_backend: assert the parent menus group on registry load - #436
Open
rov-adhoc wants to merge 1 commit into
Open
[FIX] portal_backend: assert the parent menus group on registry load#436rov-adhoc wants to merge 1 commit into
rov-adhoc wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Este PR corrige un efecto colateral en portal_backend donde se escribía en ir.ui.menu desde load_menus (ruta readonly), provocando errores de transacción de solo lectura en logs y fallos en CI/tours. La solución mueve la autocorrección de grupos a _register_hook, que corre con cursor de lectura/escritura durante la carga del registry.
Changes:
- Mueve la asignación de
base.group_usera menús raíz sin grupos desdeload_menusa_register_hook. - Elimina el
ormcachey el override deload_menus, evitando escrituras desde requests web readonly. - Evita la escritura cuando no hay menús que corregir.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Granting base.group_user to the parent menus without group was done while loading the menus, but /web/webclient/load_menus is a readonly route, so the write breaks its cursor with "cannot execute INSERT in a read-only transaction". The request itself survives -it is retried with a read/write cursor- but the failed query is already logged as an error, which is enough to turn a test run red. On a real database it happened once, since the retry commits the group; on tests it happens on every tour that loads the webclient, because each test rolls that write back. Doing it on _register_hook keeps the case covered -another module installing a parent menu without internal group after portal_backend- and runs on a read/write cursor: the hook is called when the registry is loaded, which is what installing or updating a module does.
rov-adhoc
force-pushed
the
19.0-t-64440-rov
branch
from
August 19, 2026 16:04
f087943 to
64b57b1
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

portal_backendgrantedbase.group_userto the parent menus without group from inside itsload_menusoverride. That method serves/web/webclient/load_menus, a route declaredreadonly=True, so the write hits a read-only cursor:The request survives (
http._serve_dbretries it with a read/write cursor), butodoo.sql_dbalready logged the failed query as an error, which is enough to turn a build red. On a real database it happens once, because the retry commits the group. On tests it happens on every tour that loads the webclient, since each test rolls that write back — so any module adding anHttpCasetour gets these errors in its log on a full OBA database that has a parent menu without group.What changes
The assignment moves to
_register_hook, which runs on a read/write cursor and is called every time the registry is loaded — which is exactly what installing or updating a module does. That keeps the case the original note cared about covered (another module installing a parent menu without internal group afterportal_backend), without writing from a web request.The
ormcacheon the override is dropped along with it: the coreload_menusis already cached, and the override existed only for the write.Also skips the write when there is nothing to fix, so the common case is a single search per registry load.
Test plan
On a 19.0 database with
portal_backendinstalled and three active parent menus stripped of their group (Calendar, WhatsApp, Dashboards), running the threestock_account_uxtours of ingadhoc/account-financial-tools#984:read-only transactionerrorsERRORlinesAfter the run the three menus have
base.group_useragain, written during the registry load.Branch name matches ingadhoc/account-financial-tools#984 so runbot builds both in a single bundle.