Originally created by: fu351
Originally owned by: slegarraga
The local SQLite decision log (src/doberman/storage/log.py, the decisions table, schema owned by src/doberman/storage/db.py) grows without bound — one row per engine decision. Add a configurable max-age and/or max-row prune for fully-resolved rows, with a safe default (e.g. off, or a generous retention window).
This is a distinct module from the append-only policy-drift ledger (src/doberman/policy/drift.py, the policy_changes table) — that ledger is a separate tamper-evidence record for policy changes and is explicitly out of scope here (see safety constraints).
Additive storage-policy change — pruning never rewrites what already happened, but it touches the decision-log write/read path and needs a design that keeps pruning off the hot decision path.
src/doberman/storage/log.py — decision-log writer (decisions table)src/doberman/storage/db.py — schema (decisions table)src/doberman/policy/drift.py — the append-only policy-drift ledger (policy_changes table) — do not touchtests/integration/test_decision_log.py — existing decision-log test patterndecisions table, with a safe defaultruff check . && ruff format --check . and lint-imports passpytest passespip install -e ".[dev]"
ruff check . && ruff format --check .
lint-imports
pytest tests/integration/test_decision_log.py -v
pytest --cov=doberman --cov-report=term-missing
src/doberman/policy/drift.py, policy_changes table) — never prune itsrc/doberman/policy/drift.py, table policy_changes) — that ledger is a tamper-evidence record; pruning it defeats its purpose. This issue covers only the decision log (src/doberman/storage/log.py, table decisions).New here? Start with CONTRIBUTING.md. Issues are labelled level-1 (docs only) through level-10 (new subsystem) — pick one at your level and climb. Comment to claim an issue before starting.
Originally posted by: fu351
Re-leveled 7 → 5. A retention/prune policy on the
decisionstable is a config knob plus a bounded delete query and its tests — the same weight as thememory prunethat already shipped.Originally posted by: slegarraga
Hi @fu351! I'd love to take this one — thanks for the invitation in the merge comments of [#450], and for the kind words there. The storage readers I touched for that fix are exactly where this prune policy will live, so it feels like the natural next step.
My plan, roughly:
storage/log.py,storage/db.py, and the existingmemory pruneimplementation you mentioned to match its config-knob + bounded-delete pattern.I'll comment here with any design questions before opening a PR. Thanks again for running such a welcoming project!
Related
Tickets:
#450Originally posted by: fu351
Thanks for taking this on Sebastian! If you have any questions that require some discussion, I suggest using our discord for easier comms.
https://discord.gg/Sfy5XGNqty
Originally posted by: slegarraga
Thank you, @fu351! That is really kind. I will start with a focused proposal for the configurable prune policy and keep the reader semantics from the recent fixes intact. If anything needs a quick discussion before code, I will bring it to Discord.
Originally posted by: slegarraga
Update: the focused implementation is ready for review in [#461]. It supports both max-age and max-row pruning, protects pending AUTH rows, stays completely outside the decision path, and leaves
policy_changesuntouched. Thanks again for the guidance and for such a friendly project to contribute to!Related
Tickets:
#461Ticket changed by: vinayjagan03