Skip to content

Track channel lifecycle events#304

Merged
ohld merged 1 commit into
productionfrom
cto/ffm-1459-channel-lifecycle
Jun 5, 2026
Merged

Track channel lifecycle events#304
ohld merged 1 commit into
productionfrom
cto/ffm-1459-channel-lifecycle

Conversation

@ohld
Copy link
Copy Markdown
Member

@ohld ohld commented Jun 1, 2026

Fixes FFM-1459.\n\n## Summary\n- adds channel_lifecycle_event storage with channel/event dedupe and Analyst-friendly indexes\n- extends the existing Telethon channel stats collector to ingest join/leave admin-log events using a high-water mark\n- documents the passive lifecycle daily readout query for Analyst\n\n## Verification\n- ruff check --fix src/ tests/\n- ruff format src/ tests/\n- DATABASE_URL=postgresql+asyncpg://app:app@app_db:5432/app pytest tests/flows/crossposting/test_channel_lifecycle.py\n\n## Notes\n- Does not alter recommendation weights or bot session flows.\n- Collection requires the existing Telethon session to have admin-log access to the channels.

@ohld
Copy link
Copy Markdown
Member Author

ohld commented Jun 1, 2026

STAFF ENGINEER REVIEW: APPROVED — Structural review clean. Verified lifecycle migration chain, parameterized readout SQL, Telethon admin-log high-water ingestion, diff-level secret scan, Alembic head, ruff, and targeted tests. Codex raised a P2 on admin-invite attribution, but Telethon's AdminLogEvent.new returns action.participant for ParticipantInvite, which this PR reads before falling back to event.user_id.

@ohld
Copy link
Copy Markdown
Member Author

ohld commented Jun 1, 2026

⚠️ Merge did not queue: PR is still a draft. Review is approved via STAFF ENGINEER fallback comment and CI is green; ohld/CTO needs to mark the PR ready for review, then the next PR update/wake can queue squash auto-merge.

@ohld ohld marked this pull request as ready for review June 5, 2026 06:37
@ohld ohld merged commit ddbecee into production Jun 5, 2026
3 checks passed
@ohld
Copy link
Copy Markdown
Member Author

ohld commented Jun 5, 2026

✅ Approved + merged.

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