Repository navigation
refactor(runtime): isolate monitor and lifecycle callbacks - #350
Conversation
Keep neutral event observation separate from Telegram routing and process-owned shutdown state. Snapshot death recipients before awaited topic cleanup can unbind them. Preserve destructive policy and shutdown ordering, with behavior and import guards plus aligned architecture docs.
[Medium impact] The PR appears safe to merge; no new actionable issues were found.
|
Archfit: Architecture needs attention · advisory · no baselineNext: Advisories never block. Review the listed dimensions and diagnostics on the archfit/state check. 95 advisories · never block
On every row: Imbalanced coupling · critical · across modules · high volatility.
Why: functional coupling across a module boundary to a volatile target: a change on one side forces a change on the other (Balanced Coupling: critical severity) Why: intrusive (implementation-level) coupling across a module boundary to a volatile target: a change on one side forces a change on the other (Balanced Coupling: critical severity) Evidence and inputsDecision
Dimensions
Evidence gaps
Inputs and identity
Measurement is customer-attested: the producer is authenticated, the report content is not independently checked. For coding agentsAgent tasks[] |
Address the PR Archfit private-bootstrap finding with one supported Telegram entrypoint and existing query snapshots. Guard direct and re-exported policy imports. Align mobile/core responsibilities and verify neutral imports without Telegram dependencies.
Changes
EventStreamMonitorneutral: require an awaited death callback instead of importing Telegram routing or private polling code.handlers.polling.window_death.handle_window_deathentrypoint. This 21-line Telegram adapter uses the existingsession_query.iter_bound_topicssnapshot and the unchanged death policy. It does not add direct singleton access.RuntimeError: dictionary changed size during iteration: deleting a topic unbinds recipients during await.main._shutdown_signal; PR341's restart callback stays intact.make arch-guard. Regroup routing tests under polling and signal diagnostics under runtime; align architecture docs.The destructive topic-policy handler is byte-for-byte unchanged. Exact-chat, pending-creation, authoritative-liveness, deduplication, cancellation, and stop-before-drain behavior remain covered. No broker, state framework, dependency, ownership/volatility changes, baseline reset, or blanket public declarations.
PR report feedback addressed
The first PR report flagged bootstrap's newly relocated private policy import. That was a real new runtime dependency, not dismissed as warning noise. The follow-up adds one supported adapter entrypoint, keeps private policy access inside its existing handler module group, and forbids bootstrap from importing the policy implementation. Only the small new adapter module is declared public; other polling internals stay private.
A layering test then rejected direct router access from the new handler. The adapter now uses the existing query seam; the audit and its allow-list were not weakened.
Verification
Mobile alignment
Reviewed the iOS and session-protocol plans against the implemented core. Shared session IDs, messages, requests, safe actions and replay remain transport-neutral. Telegram topic deletion and delivery receipts stay adapter-owned. The architecture doc records that current push subscriptions cover Telegram-bound targets while mobile-only sessions use core refresh; it does not claim headless startup or APNs is implemented. A clean-interpreter check rejects transitive Telegram/handler imports from the monitor.
Local Archfit 3.2 evidence
Used the checksum-verified published v3.2.0 binary, not the host's v3.0.1.
Code-only comparison under the original identical config/model/classification and v7 rubric: 98 → 95 advisory groups, three resolved, none added:
00bacbce5c97967814736b85441f659a: event monitor → private Telegram death handler.ebbc8fbd9c3c4185cc045c5fc9bffe15: event monitor → Telegram client.2c5200c672430d0cd1f2c2885f303c6d: bot → private main shutdown state.With the new guards and narrow public-entrypoint declaration: eleven required import rules pass, zero blockers, zero unmapped first-party edges, still 95 advisories. Config lint passes. Public-surface/model changes are reported separately from code-only improvement; ownership, volatility/cascade, labels files, baseline, and waivers are unchanged.
archfit checkpreviously exited 2, not a clean architecture verdict. Advisories and evidence gaps remain.Findings retained deliberately
reset_for_testing, not a runtime death-policy import.Comparison limits
On the untouched released base, local
--basecomparison already labelled three existing provider groups introduced, despite head finding IDs and the entire seam ledger matching merged-main CI. Do not mistake those zero-diff entries for code regressions. The later query-seam dependency is a real new dependency within an existing aggregated finding and is assessed as a supported read contract, not lumped into that noise.The first PR report had one introduced private-bootstrap group and seven resolved IDs, including four new-rule violations of the base tree. That is a different comparison from the unchanged-model code-only counts above. Final-head verification is complete; details below.
Final-head Archfit review
Verified head
09398a9fdc36354afb3d050f2c03e61d90e44d34in CI run 40190314059. Config29f0b18a…, modelb8bc8b9e…, classification and v7 rubric match the final local report. The final CI finding IDs and entire seam ledger match local analysis. CI and Greptile pass;archfit/stateis neutral/advisory.no-import-cycles, whose conformance remains unmeasured. Zero blockers, zero unmapped first-party edges, empty agent tasks. This is not a clean architecture verdict: 95 advisories remain.bootstrap.py:523.08f2b089fa9734a8db6152f3c84ad5ba(handlers → session_state). The new member iswindow_death.py:7 → session_query.iter_bound_topics: the already-supported read/snapshot contract required by the existing handler layering audit. It returns copied value tuples, not mutable stores or duplicated death rules. Retained deliberately rather than adding another interface or calling the entire legacy group harmless. This is distinct from the three proven zero-diff provider-origin anomalies.No merge, deployment, live bridge update, release or tag change.