odoo-session-db
Give one session its own throwaway test database name, so two sessions on one task in one project cannot land on the same database. Use before odoo-dev:odoo-test-run whenever more than one session can work in the same project, and when a test database vanished mid-run.
- License 许可
- MIT
- 最近更新
- 2026-11-02
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- odoo-session-db
- description
- Give one session its own throwaway test database name, so two sessions on one task in one project cannot land on the same database. Use before odoo-dev:odoo-test-run whenever more than one session can work in the same project, and when a test database vanished mid-run.
- user-invocable
- false
02 资源文件 2
- 脚本scripts/session-db.sh6.0 KB
- 脚本scripts/tests/session-db.test.sh9.6 KB
03 SKILL.md 正文
Odoo Session DB
Wrap odoo-dev:odoo-test-run so each session runs on a database no other session can name.
run-tests.sh names its database <project>_test_<task_id><suffix> and runs
dropdb --if-exists on that name before it creates it. Postgres is one shared
server for every container on the machine. Two sessions on one task in one project, with
no suffix, share one name, and the second drops the first one's database mid-run.
This skill adds a suffix that is unique to the session. It adds no naming scheme.
The name stays <project>_test_<task_id><suffix>, and run-tests.sh still creates and
drops it.
Run the tests
<base directory>/scripts/session-db.sh run <repo> <task_id> <module> \
[--session-id ID] [any run-tests.sh option except --db-suffix]
→ the result JSON of run-tests.sh, unchanged. Read status as in odoo-dev:odoo-test-run.
- Pass the same
--session-idon every call in a session. The suffix is a hash of it, so the name is the same for the whole session. An empty value exits 2. SESSION_DB_IDworks the same way, but an exported value is inherited by every parallel subagent. That gives them all one suffix and brings the collision back. Each session must set its own id. Prefer--session-id.- The result JSON is always printed, also when the run fails. The script then exits with
the exit code of
run-tests.sh.series_mismatchcreates no database, so it is not an exit 3. task_idmust match[0-9A-Za-z_-]+.- With no session id the suffix is random for each call. That is still unique.
- The script exits 3 if the database
run-tests.shreports is not the database named here, or was not dropped. Treat exit 3 as a failed run. Do not retry on the same name. - Do not pass
--db-suffix. The script sets it and refuses yours.
Read a name or a suffix
<base directory>/scripts/session-db.sh name <repo> <task_id> [--session-id ID]
<base directory>/scripts/session-db.sh suffix [--session-id ID]
name prints the database for this session. suffix prints _s and 8 hex digits.
name exits 2 when the name is over the Postgres limit of 63 bytes, because Postgres
cuts longer names without a warning.
04 同仓库更多 Skills
report-incident
Draft a terse GitHub issue for an incident in the Odoo dev suite (odoo-dev, odoo-orchestrator, dispatcher), with a current environment block and no private data. Files it only after you approve. Use when a tool or workflow failed.
principles
Engineering principles indexed as one-liners: safety and correctness, design and architecture, composition and interfaces, code structure, performance, visibility. Use when writing new code, reviewing a diff, or justifying a design choice.
odoo-upgrade
Plan and run code upgrades of custom Odoo modules between major versions (16.0→17.0→18.0→19.0). Use to migrate or port a module or addon, for breaking changes, a module inventory, or an upgrade estimate or plan.
odoo-upgrade-project
Human SOP for a whole Odoo upgrade project past the code port: staging database upgrade through upgrade.odoo.com, on-prem restore, cutover, go-live, support tickets and functional requirements. A planning reference.
odoo-test-run
Run an Odoo module's unit tests and HttpCase browser tours on a throwaway database and return machine-checkable evidence: tests executed, tours executed, failure lines. Use before a PR, after a fix, or when a green run never said how many tests ran.
odoo-task-env
Stand up the working environment for one Odoo task: find work that already exists, create or reuse an isolated git worktree on the task branch, bring a runnable stack up. Use at the START of implementing any task, and whenever one is picked back up.