oc_chat
Loading...
Searching...
No Matches
oc_chat.registry.backends.sqlite Namespace Reference

Classes

class  RegistrySeed
class  SQLiteBackend

Functions

list[Mapping[str, object]] _mapping_list (object value)
Mapping[str, object] _required_mapping (Mapping[str, object] row, str key)
dict[str, object] _row_dict (sqlite3.Row row)
str|None _optional_str (object value)
int|None _optional_int (object value)
int _bool_int (object value)
str|None _phase_code_for_item_id (str item_id)
str|None _parent_phase_code (str phase_code)
int _phase_sort_order (str phase_code)
str _era_id_for_version (str version_id)
int _era_sort_order (str era_id)
Path canonical_schema_path ()
str load_canonical_schema_sql ()
str canonical_schema_sql_without_pragmas ()
dict[str, object] _foreign_key_error (sqlite3.Row row)
list[tuple[str, str]] _default_settings (str app_version)

Variables

int SCHEMA_VERSION = 1
str SCHEMA_DESCRIPTION = "baseline REGISTRY_SCHEMA_V0_2_3"
str _PRAGMA_PREFIX = "PRAGMA "
dict _ACTOR_TYPES_BY_SLOT_KIND
int _MAX_PARENT_DEPTH = 1000

Detailed Description

SQLite backend for the orchestration registry.

Purpose
-------
Own all SQL used by the M11 registry storage foundation, including
canonical schema loading, connection PRAGMAs, init-time seeding, and
backend maintenance operations.

Responsibilities
----------------
- Load the canonical registry schema from the design-lock SQL file.
- Apply required SQLite PRAGMAs on every connection.
- Seed singleton rows for ``python -m oc_chat.registry init``.
- Execute the single mutating seam and insert one operation-log row.
- Own lock acquisition, release, renewal, and expiry sweep SQL.
- Provide integrity check, backup/restore, and vacuum hooks.

Diagnostics
-----------
Domain: OC_CHAT.MAIN
Levels:
    L2 - lifecycle events
    L3 - semantic details
    L4 - deep tracing

Contracts
---------
- SQL remains in this module; higher registry layers call backend methods.
- Init is all-or-nothing: schema load and seed inserts share one transaction.
- No SQLite ``datetime('now')`` defaults are used; timestamps come from Clock.

Dependencies
------------
- oc_diagnostics (structured debug logging via _dbg)
- sqlite3 (registry storage engine)
- oc_chat.registry.clock (injected time)
- oc_chat.registry.backends.base (StorageBackend contract, capability error and return types)
- oc_chat.registry.canonical (canonical_json for operation payloads and lock metadata)
- oc_chat.registry.errors (registry error types raised by the mutating seam and lock SQL)
- oc_chat.registry.migrations.v0_3_1_auth_events (auth events schema migration and version row)
- oc_chat.registry.migrations.v0_3_2_roadmap_source_fields (roadmap source fields schema migration and version row)
- oc_chat.registry.migrations.v0_3_roadmap (roadmap schema SQL, version row and upgrade checks)
- oc_chat.registry.store_scope (assert_live_store guard before each domain command)

Function Documentation

◆ _bool_int()

int oc_chat.registry.backends.sqlite._bool_int ( object value)
protected

Definition at line 2673 of file sqlite.py.

Here is the caller graph for this function:

◆ _default_settings()

list[tuple[str, str]] oc_chat.registry.backends.sqlite._default_settings ( str app_version)
protected

Definition at line 2750 of file sqlite.py.

Here is the caller graph for this function:

◆ _era_id_for_version()

str oc_chat.registry.backends.sqlite._era_id_for_version ( str version_id)
protected

Definition at line 2701 of file sqlite.py.

Here is the caller graph for this function:

◆ _era_sort_order()

int oc_chat.registry.backends.sqlite._era_sort_order ( str era_id)
protected

Definition at line 2706 of file sqlite.py.

Here is the caller graph for this function:

◆ _foreign_key_error()

dict[str, object] oc_chat.registry.backends.sqlite._foreign_key_error ( sqlite3.Row row)
protected

Definition at line 2734 of file sqlite.py.

Here is the caller graph for this function:

◆ _mapping_list()

list[Mapping[str, object]] oc_chat.registry.backends.sqlite._mapping_list ( object value)
protected

Definition at line 2638 of file sqlite.py.

Here is the caller graph for this function:

◆ _optional_int()

int | None oc_chat.registry.backends.sqlite._optional_int ( object value)
protected

Definition at line 2669 of file sqlite.py.

Here is the caller graph for this function:

◆ _optional_str()

str | None oc_chat.registry.backends.sqlite._optional_str ( object value)
protected

Definition at line 2662 of file sqlite.py.

Here is the caller graph for this function:

◆ _parent_phase_code()

str | None oc_chat.registry.backends.sqlite._parent_phase_code ( str phase_code)
protected

Definition at line 2685 of file sqlite.py.

Here is the caller graph for this function:

◆ _phase_code_for_item_id()

str | None oc_chat.registry.backends.sqlite._phase_code_for_item_id ( str item_id)
protected

Definition at line 2677 of file sqlite.py.

Here is the caller graph for this function:

◆ _phase_sort_order()

int oc_chat.registry.backends.sqlite._phase_sort_order ( str phase_code)
protected

Definition at line 2691 of file sqlite.py.

Here is the caller graph for this function:

◆ _required_mapping()

Mapping[str, object] oc_chat.registry.backends.sqlite._required_mapping ( Mapping[str, object] row,
str key )
protected

Definition at line 2651 of file sqlite.py.

Here is the caller graph for this function:

◆ _row_dict()

dict[str, object] oc_chat.registry.backends.sqlite._row_dict ( sqlite3.Row row)
protected

Definition at line 2658 of file sqlite.py.

Here is the caller graph for this function:

◆ canonical_schema_path()

Path oc_chat.registry.backends.sqlite.canonical_schema_path ( )

Definition at line 2711 of file sqlite.py.

Here is the caller graph for this function:

◆ canonical_schema_sql_without_pragmas()

str oc_chat.registry.backends.sqlite.canonical_schema_sql_without_pragmas ( )

Definition at line 2725 of file sqlite.py.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ load_canonical_schema_sql()

str oc_chat.registry.backends.sqlite.load_canonical_schema_sql ( )

Definition at line 2721 of file sqlite.py.

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ _ACTOR_TYPES_BY_SLOT_KIND

dict oc_chat.registry.backends.sqlite._ACTOR_TYPES_BY_SLOT_KIND
protected
Initial value:
1= {
2 "operator": "human_operator",
3 "orchestrator": "orchestrator_agent",
4 "worker": "worker_agent",
5}

Definition at line 95 of file sqlite.py.

◆ _MAX_PARENT_DEPTH

int oc_chat.registry.backends.sqlite._MAX_PARENT_DEPTH = 1000
protected

Definition at line 100 of file sqlite.py.

◆ _PRAGMA_PREFIX

str oc_chat.registry.backends.sqlite._PRAGMA_PREFIX = "PRAGMA "
protected

Definition at line 94 of file sqlite.py.

◆ SCHEMA_DESCRIPTION

str oc_chat.registry.backends.sqlite.SCHEMA_DESCRIPTION = "baseline REGISTRY_SCHEMA_V0_2_3"

Definition at line 93 of file sqlite.py.

◆ SCHEMA_VERSION

int oc_chat.registry.backends.sqlite.SCHEMA_VERSION = 1

Definition at line 92 of file sqlite.py.