Skip to content

refactor: untangle runtime ownership and durable delivery - #292

Merged
iamwavecut merged 1 commit into
mainfrom
feat/untangle-runtime
Nov 8, 2026
Merged

iamwavecut merged 1 commit into
mainfrom
feat/untangle-runtime

Conversation

@iamwavecut

Copy link
Copy Markdown
Owner

Final song, rates and check-in replies bypass the persisted Telegram delivery path, while provider transport rules differ across features. This refactor gives those operations one owner and removes obsolete routes through the code.

Changes

  • Carry the selected protocol and overrides through routing. Share endpoint, credentials and wire-model resolution across dialog, history, media, translation, memory and YouTube. Cache dialog adapters from the captured attempt without another routing-table lookup.
  • Prepare final rich Telegram commands through the existing Postgres outbox. Stable job/command/tool identities reuse the first prepared payload and uploaded media. Music/check-in wait for actual receipts and save real Telegram message IDs. Transient drafts remain separate.
  • Move HTTP handlers and scoped state out of the composition root. Move their entity/settings/Redis queries into existing storage modules. Group workers with the existing lifecycle registry.
  • Move Discovery redaction HTTP/codecs/polling from the memory domain to llm. Share deletion-rights and Telegram execution primitives while retaining each feature's authorization checks.
  • Make startup routing updates and their existing markers atomic. Remove unused static provider factories, obsolete feature workers, queue delegates, the unused memory provider selector and fake pprof routes. Retain persisted job/checkpoint compatibility and one legacy membership drain.

Production Rust decreases from 194,162 to 191,997 lines (−2,165, excluding tests/comments). Tests increase by 1,270 lines and migration SQL by 6 lines. Thirty-one HTTP forwarding calls and the intermediate payment queue facade are removed. Most diff churn moves existing HTTP logic and the Discovery adapter to their owners. docs/CODEBASE_MAP.md documents the resulting paths.

Behavior and compatibility

The intended behavior changes are durable final rich delivery, consistent explicit protocol/provider configuration, and removal of fake pprof endpoints (authenticated 404). Existing commands, payloads, auth, payment semantics, streaming, budgets, fallback order, shutdown phases and persisted keys remain. Ambiguous Telegram sends keep a separate state; this does not promise exactly-once delivery.

Migrations 213/214 add nullable prepared-song payloads and a concurrent partial unique job index. Existing songs with NULL preparation and legacy rows remain readable. Down migration 214 removes the index concurrently; down 213 discards preparation data, so drain pending music delivery before rollback. Historical migrations are unchanged.

Verification

  • tools/rust-fast-gate.sh: formatting, Clippy across all targets/features with warnings denied, and workspace tests; 2,693 passed, 10 ignored. Repeated before publication.
  • OPENPLOTVA_TEST_POSTGRES_DSN=<isolated-db> OPENPLOTVA_TEST_REDIS_URL=<isolated-redis> cargo test --locked -p openplotva-storage --lib -- --test-threads=1 --nocapture: 184 passed, 1 ignored benchmark, with actual Postgres 17/pgvector and Redis.
  • Twelve isolated app suites passed with explicit service URLs: payment/control jobs, translation/settings/members, music/check-in/rates/help, outbox, routing/bootstrap and entity profiles. Additional music integration covered HTTP upload → durable payload → runtime reload → mock Telegram receipt and task/song completion.
  • Ingestion/materializer: 20 passed, 1 ignored load test. Memory runtime: 45 passed. Serialized albums cover caption/source ordering and accepted/rejected source-limit cases. HTTP JSON, atomic admin deletion and delivery recovery fixtures passed.
  • tools/local-smoke.sh: health/readiness, settings routes/assets, login and signed admin state passed.
  • Providers and Telegram sends use fixed fixtures/mock transports. Live provider/Telegram tests and load benchmarks were not run. Tests returning early without a DSN are not counted as database coverage.

Existing fixture setup/expectations were corrected where real-service verification exposed missing migrations, a missing fixed-date outbox partition and stale direct album-routing expectations. Those corrections do not change runtime album behavior. Production deployment is separate.

@github-actions

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown
Warnings
⚠️ Large PR (37656 changed lines). Consider splitting unless this is generated/mechanical.
Messages
📖 Danger checked 99 changed file(s).

Generated by 🚫 dangerJS against f63af70

@iamwavecut
iamwavecut merged commit 61c402e into main Nov 8, 2026
12 checks passed
@iamwavecut
iamwavecut deleted the feat/untangle-runtime branch November 8, 2026 00:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant