Commit Graph

2 Commits

Author SHA1 Message Date
kshitijk4poor
28a0bf19e6 refactor(state): name absorbed-row stamps by constant, hoist replay-entry import
hermes_state_coverage.py read "_absorbed_row_ids" by literal in
_proved_coverage and _uncounted_merged_rows while every other stamp
there goes through its conversation_compression_archive constant; use
ABSORBED_ROW_IDS so a rename cannot leave one reader behind.

gateway/run.py imported the durable-row stamp constants inside
_build_replay_entry, which runs once per replayed message. The module
already imports agent.message_metadata, which imports the same
constants at module level, so a top-level import adds no cycle.

_tail_rows_after_watermark is a plain SQL tail read used only by
SessionMessagesMixin's archive/rewind paths, not coverage resolution;
move it back beside _clone_message_rows where it lived on main.
hermes_state_messages.py stays under 2000 lines (1972).
2026-10-03 18:17:35 +05:30
kshitijk4poor
a9ee040807 refactor(state): move held-row coverage resolution into SessionCoverageMixin
hermes_state_messages.py grew past the 2000-line shape gate (2215) with
the repair-accounting stack. The coverage-resolution helpers are one
topic: naming which durable rows the compressor held
(_tail_rows_after_watermark, _resolve_carried_row_ids,
_matching_active_ids, _matching_retired_ids, _merged_user_run,
_proved_coverage, _uncounted_merged_rows, _tail_originals). Move them
verbatim into hermes_state_coverage.py as SessionCoverageMixin (the
hermes_state_rewind.py / SessionRewindMixin pattern) and add it to
SessionDB's bases next to SessionMessagesMixin. Callers reach them via
self, so nothing else changes; no re-export shims, and no test patches
these names on hermes_state_messages.

hermes_state_messages.py is now 1967 lines.
2026-10-03 18:17:35 +05:30