Skip to content

ci: truncate commit message before telegram upload#96

Merged
NextAlone merged 1 commit into
mainfrom
claude/fix-ci-telegram-caption-length
Apr 19, 2026
Merged

ci: truncate commit message before telegram upload#96
NextAlone merged 1 commit into
mainfrom
claude/fix-ci-telegram-caption-length

Conversation

@NextAlone

Copy link
Copy Markdown
Owner

sendDocument caption limit is 1024 chars. After backtick-stripping, long commit bodies still bust the limit and uploadCI.py fails with 400 Bad Request. Do both the strip and an 800-char cap in one Python step so the release notification survives verbose commits.

Tittle Here

Description

Issues Fixed or Closed by This PR

Check List

  • I have tested the changes and verified that they work and don't break anything(as well as I can manage) or drop the support for previous versions.
  • My code follows the code style of this project
  • I have merged commits that are meaningless for follow-up work and confirmed that they will not cause damage to follow-up maintenance

sendDocument caption limit is 1024 chars. After backtick-stripping,
long commit bodies still bust the limit and uploadCI.py fails with
400 Bad Request. Do both the strip and an 800-char cap in one Python
step so the release notification survives verbose commits.
Copilot AI review requested due to automatic review settings April 19, 2026 14:59
@NextAlone NextAlone merged commit 0813da8 into main Apr 19, 2026
2 checks passed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the GitHub Actions release workflow to prevent Telegram upload failures caused by overly long commit messages and Markdown parsing issues, ensuring release notifications reliably send.

Changes:

  • Replaces shell tr sanitization with an inline Python step to normalize COMMIT_MESSAGE.
  • Strips backticks/CR characters and truncates commit text to reduce the chance of exceeding Telegram’s caption limits.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/ci.yml
Comment on lines +167 to +168
if len(s) > MAX:
s = s[:MAX].rstrip() + "\n…(truncated)"

Copilot AI Apr 19, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The truncation logic can produce a string longer than MAX because it slices to MAX and then appends the "…(truncated)" suffix. If the goal is to cap the commit body at 800 chars to guarantee headroom for Telegram’s 1024 caption limit, consider ensuring the final string length (including the suffix/newline) is <= MAX (or adjust the comment/constant to match the actual maximum output).

Suggested change
if len(s) > MAX:
s = s[:MAX].rstrip() + "\n…(truncated)"
suffix = "\n…(truncated)"
if len(s) > MAX:
keep = MAX - len(suffix)
if keep > 0:
s = s[:keep].rstrip() + suffix
else:
s = suffix[:MAX]

Copilot uses AI. Check for mistakes.
seyrenus added a commit to seyrenus/Nnngram that referenced this pull request Apr 29, 2026
* feat(chat): force gallery refresh and add quick-send popup for new photos (NextAlone#95)

Clicking the attachment button now forces a MediaStore refresh so
newly-added photos and screenshots appear without waiting for the
ContentObserver's 2s debounce. Attach-menu opens run the scan at
NORM_PRIORITY (was MIN), parallel scans coalesce via an atomic
in-flight flag, and a new quickRefreshLatestPhotos fast-path
prepends the top N MediaStore rows into the cached album so new
shots surface in the grid in ~100ms while the full rescan finishes.

Adds a bottom-right floating popup in ChatActivity that surfaces
the latest image taken while away and, on tap, opens the standard
PhotoViewer preview/editor so the user can review, caption or
cancel before sending. Detection runs only on onResume / first
entry; gated on chatMode, preview/bubble/report/container state,
secret chat, ChatObject.canSendPhoto and the images permission.
The popup auto-dismisses after 10s; a persisted watermark
(quickSendMediaLastDismissedId) is written the moment a photo is
shown so send / preview-cancel / timeout / leaving the chat / cold
restart all count as already seen and the same image never pops
again. Ships with a toggle in the Nnngram Chat settings
(quickSendMediaPopup, default on) and en / zh-CN / zh-TW strings.

CI: strip backticks from COMMIT_MESSAGE before uploadCI.py so the
triple-backtick fence in the Telegram template stops colliding with
inline-code spans in the commit body and the release notification
stops failing with "can't parse entities".

* ci: truncate commit message before telegram upload (NextAlone#96)

sendDocument caption limit is 1024 chars. After backtick-stripping,
long commit bodies still bust the limit and uploadCI.py fails with
400 Bad Request. Do both the strip and an 800-char cap in one Python
step so the release notification survives verbose commits.

* feat(chat-menu): add compact icon bar w/ 3-state toggle

Long context menu now supports per-option HIDE / TEXT / ICON
modes via segmented control in chat settings. Icon mode renders
options as a horizontal GridLayout (≤4 cols) at popup bottom.

- store compact + hidden sets as CSV in SharedPreferences
- migrate stale `compactBarPosition` int from earlier draft
- Translate stays HIDE/TEXT only — compact would lose swipeback
  + lang detection wiring
- Delete works in icon mode (TTL subtext lost; confirm dialog
  still fires)
- order in dialog mirrors fillMessageMenu sequence

---------

Co-authored-by: Next Alone <12210746+NextAlone@users.noreply.github.com>
@NextAlone NextAlone deleted the claude/fix-ci-telegram-caption-length branch May 9, 2026 20:17
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.

2 participants