Skip to content

refactor(kanban): extract board-path/integrity/policy mixins from kanban_db.py (shard s1) - #79613

Open
andrexibiza wants to merge 1 commit into
NousResearch:mainfrom
andrexibiza:gfg/kanban-extract-s1-w1a
Open

refactor(kanban): extract board-path/integrity/policy mixins from kanban_db.py (shard s1)#79613
andrexibiza wants to merge 1 commit into
NousResearch:mainfrom
andrexibiza:gfg/kanban-extract-s1-w1a

Conversation

@andrexibiza

@andrexibiza andrexibiza commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Godfile kill — hermes_cli/kanban_db.py shard s1

Extracts the board-paths/integrity/policy mixins (c7+c8, c13, c2) into focused modules (5x2x3 blind-witness extraction, waves 1-3 verified). Verbatim method bodies; module-level test constants stay; regression tests shipped.

Line math: 1203 added / 692 deleted in run.py (moved into mixin modules).

Related #78791 #78792 #77376 #77746 #77748 #77751 #77752 #77756 #77759 #79066 #79067 #79068 #79069 #79070 #78689 #78690 #78691 #78692 #78693 #78694 #78695 #78696 #78697 #78698 #78699 #78700 #78701 #78702 #78703 #78704 #78705 #78706 #78707 #78708 #78709 #78710 #78711 #78712 #78713 #78714 #78715 #78716 #78717 #78718 #78719 #78720 #78721 #78722 #78723 #78724 #78725 #78726 #78727 #78728 #78729 #78730 #78731 #78732 #78733 #78734 #78735 #78736 #78737 #78738 #78739 #78740 #78741 #78742 #78743 #78744 #78745 #78746 #78747 #78748 #78749 #78750 #78751 #78752 #78753 #78754 #78755 #78756 #78757 #78758 #78759 #78760 #78761 #78762 #78763 #78764 #78765 #78766 #78767 #78768 #78769 #78770 #78771 #78772 #78773 #78774 #78775 #78776 #78777 #78778 #78779 #78780 #78781 #78782 #78783 #78784 #78785 #78786 #78787 #78788 #78789 #78790

Part of #78632
Part of #78647

@alt-glitch alt-glitch added type/refactor Code restructuring, no behavior change P3 Low — cosmetic, nice to have comp/cron Cron scheduler and job management labels Aug 5, 2026
@spfcraze

spfcraze commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

This was generated by AI during triage.

Summary:
The moved functions read their constants from the sibling modules' namespaces, so a monkeypatch.setattr(kb, ...) on a moved name changes only the kanban_db binding — this PR's own test_kanban_db_repair.py change had to patch kanban_integrity as well.

Problems:

  • The re-imports at the bottom of hermes_cli/kanban_db.py keep kb.* reachable for every existing caller, but each moved function resolves its globals in its new module: _prune_corrupt_backups reads _CORRUPT_BACKUP_RETENTION from hermes_cli/kanban_integrity, _resolve_claim_ttl_seconds reads DEFAULT_CLAIM_TTL_SECONDS from hermes_cli/kanban_policy, and the board-path helpers read DEFAULT_BOARD/_BOARD_SLUG_RE from hermes_cli/kanban_board_paths.
  • A test that patches kb._CORRUPT_BACKUP_RETENTION therefore changes only the kanban_db binding, and the moved function still reads the original value — this PR's change to tests/hermes_cli/test_kanban_db_repair.py patches the same constant in both namespaces (import hermes_cli.kanban_integrity as _ki plus setattr(_ki, "_CORRUPT_BACKUP_RETENTION", 3)) with a comment explaining why. The same applies to _SQLITE_HEADER, _INITIALIZED_PATHS, _REPAIRABLE_INDEX_ERROR_PATTERNS and the three policy defaults.

Solution:
For future tests that need to influence a moved function, patch the owning module (kanban_integrity, kanban_policy, kanban_board_paths) directly, or reuse the dual-patch pattern this PR added to test_kanban_db_repair.py.


Checked against 4e0adf1 — the tip of gfg/kanban-extract-s1-w1a when this was written — and 241605d, main at the same moment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cron Cron scheduler and job management P3 Low — cosmetic, nice to have type/refactor Code restructuring, no behavior change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants