|
oc_chat
|
Classes | |
| class | _ForbiddenSqlVisitor |
Functions | |
| int | main (list[str]|None argv=None) |
| list[dict[str, object]] | scan_path (Path path) |
| list[dict[str, object]] | _scan_file (Path path) |
| bool | _is_allowlisted (Path path) |
| str | _format_report (list[dict[str, object]] violations) |
| bool | _is_docstring_expr (ast.stmt node) |
Variables | |
| tuple | FORBIDDEN_SQL_LITERALS |
| str | SQL_OWNER_ALLOWLIST = "oc_chat/registry/backends/sqlite.py" |
AST guard for registry write-invariant SQL ownership.
Purpose
-------
Fail CI when direct operation-log or lock writes appear outside the
SQLite registry backend.
Responsibilities
----------------
- Walk Python files below `oc_chat/` by default.
- Parse files with `ast` and inspect string literals only.
- Ignore comments and module/class/function docstrings.
- Allow the sanctioned SQL owner, `oc_chat/registry/backends/sqlite.py`.
Diagnostics
-----------
Domain: OC_CHAT.MAIN
Levels:
L2 - lifecycle events
L3 - semantic details
L4 - deep tracing
Contracts
---------
- Exit 0 on a clean tree and 1 when violations are found.
- JSON mode returns `{"ok": bool, "violations": [...]}`.
Dependencies
------------
- oc_diagnostics (structured debug logging via _dbg)
- ast (Python AST parsing)
- pathlib (filesystem path walking)
- argparse (CLI argument parsing)
- json (JSON report formatting)
|
protected |
Definition at line 121 of file check_registry_invariants.py.
|
protected |
Definition at line 117 of file check_registry_invariants.py.
|
protected |
Definition at line 171 of file check_registry_invariants.py.
|
protected |
Definition at line 100 of file check_registry_invariants.py.
| int check_registry_invariants.main | ( | list[str] | None | argv = None | ) |
Definition at line 64 of file check_registry_invariants.py.
| list[dict[str, object]] check_registry_invariants.scan_path | ( | Path | path | ) |
Return all forbidden SQL string-literal violations below `path`.
Definition at line 88 of file check_registry_invariants.py.
| tuple check_registry_invariants.FORBIDDEN_SQL_LITERALS |
Definition at line 55 of file check_registry_invariants.py.
| str check_registry_invariants.SQL_OWNER_ALLOWLIST = "oc_chat/registry/backends/sqlite.py" |
Definition at line 61 of file check_registry_invariants.py.