fix(sources): normalise t.me message links to their chat #11

Merged
vmruiz merged 3 commits from fix/message-link-normalise into main 2026-08-23 20:40:41 +02:00
Owner

Closes #10.

t.me//<msg_id> links were stored verbatim and failed at indexing (get_entity -> ValueError). The normaliser now collapses them to the chat _resolve_chat understands:

  • https://t.me//<msg_id> -> @channel (album ids and query strings stripped)
  • t.me/c/<internal_id>/<msg_id> (private chats) -> -100<internal_id>
  • t.me/s/ previews and non-numeric tails pass through untouched so the resolver keeps raising a clear error

TDD: 8 new tests, verified RED without the fix, full suite green (160 passed; only the 3 known Redis-sidecar failures remain), ruff + compileall clean.

Closes #10. t.me/<channel>/<msg_id> links were stored verbatim and failed at indexing (get_entity -> ValueError). The normaliser now collapses them to the chat _resolve_chat understands: - https://t.me/<channel>/<msg_id> -> @channel (album ids and query strings stripped) - t.me/c/<internal_id>/<msg_id> (private chats) -> -100<internal_id> - t.me/s/ previews and non-numeric tails pass through untouched so the resolver keeps raising a clear error TDD: 8 new tests, verified RED without the fix, full suite green (160 passed; only the 3 known Redis-sidecar failures remain), ruff + compileall clean.
fix(sources): normalise t.me message links to their chat (refs #10)
All checks were successful
Deploy Development Branch / deploy-dev (push) Successful in 48s
e703bf1fef
t.me/<channel>/<msg_id> links passed through
_normalize_telegram_chat_identifier() unchanged because Telethon's
parse_username() returns (None, False) for that shape, were stored as
Source.telegram_chat verbatim, and then failed at indexing time with
get_entity() -> ValueError.

_message_link_to_chat() now collapses every message-link shape to a
chat identifier _resolve_chat understands:

- https://t.me/<channel>/<msg_id> -> @channel
- album links .../<msg_id>/<msg_id> -> @channel
- ?query suffixes stripped
- t.me/c/<internal_id>/<msg_id> (private chats) -> -100<internal_id>
- telegram.me hosts accepted

Non-t.me URLs, t.me/s/ web previews and links whose trailing segments
are not numeric message ids are passed through untouched so
_resolve_chat keeps surfacing a clear error.
ci: comment the preview endpoint on issues referenced by HEAD commit (refs #10)
Some checks failed
Deploy Development Branch / deploy-dev (push) Failing after 0s
568604be9c
The dev stack id is random per branch and only visible in the run logs,
so the preview URL was effectively unrecoverable via API. Each deploy
now parses refs (#N) from the HEAD commit message and posts the endpoint
as an issue comment using the built-in GITEA_TOKEN.
ci: fix workflow validation and post preview comment only once (refs #10)
All checks were successful
Deploy Development Branch / deploy-dev (push) Successful in 42s
Clean Up Development Branch / cleanup-dev (pull_request) Successful in 20s
df887fbee0
- drop the gitea. context (rejected by this Forgejo's schema validator);
  the API base URL is now literal
- token from secrets.GITEA_TOKEN with fallback to the job-scoped
  GITHUB_TOKEN
- skip commenting when the issue already has a CI preview comment, so
  redeploys never duplicate it
vmruiz merged commit 0f7bf87f6c into main 2026-08-23 20:40:41 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
vmruiz/telegramarr!11
No description provided.