omi icon indicating copy to clipboard operation
omi copied to clipboard

Bounty proposal: flatten parenthesized notification links without stray punctuation

Open PlayerBC opened this issue 2 months ago • 2 comments

Would you fund US$10, payable privately via PayPal after acceptance and merge, for correctly flattening Markdown links and images whose destinations contain parentheses, with focused regression coverage?

At Omi commit 9d5cfa8e3fcf34a6be0f6d64dd54b98ee774da8f, source blob 83e6e6594aa201656e5a4767ad8620aa5d71e060, backend/utils/notification_text.py::to_plain_text uses a destination pattern that stops at the first ). A common link such as [Function](https://example.test/wiki/Function_(mathematics)) therefore becomes Function) in the OS-rendered notification body. Image alt text has the same problem, and a malformed fragment of the destination leaks into otherwise plain notification text.

The bounded candidate lets a Markdown destination contain one balanced parenthesized segment, while keeping separate links independent and preserving punctuation after a link. It changes only the two destination patterns; all later plain-text transformations remain untouched.

Focused extracted-pattern validation across six cases: current behavior 3 pass / 3 fail; candidate 6 pass / 0 fail. Cases cover an ordinary link, parenthesized link and image destinations, two independent links, following punctuation, and an unclosed construct. I have not run backend/tests/unit/test_notification_text.py, the full backend suite, a notification worker, Firebase delivery, or a real iOS/Android lock screen.

Open/closed issue and all-PR searches for notification Markdown links, balanced/parenthesized destinations, stray parentheses, and the concrete example found no matching report or implementation. The large Windows chat Markdown parser in PR #11806 is a different renderer and does not change this backend push-notification helper. No reward or assignment is assumed. Please confirm scope and reward before repository integration.

Prepared with OpenAI Codex assistance for @PlayerBC; AI assistance and actual checks will remain disclosed.

PlayerBC avatar Sep 09 '26 04:09 PlayerBC

Verification update: I reran this against the complete backend/utils/notification_text.py module (unchanged upstream blob 83e6e6594aa201656e5a4767ad8620aa5d71e060), using the repository's actual testing.import_isolation.load_module_fresh helper.

The four unchanged functions in tests/unit/test_notification_text.py pass on both versions. Ten additional cases exercise the public to_plain_text function: parenthesized link/image destinations, following punctuation, adjacent links, heading/bold labels, bullet labels, ordinary links/images, plain parentheses, and query parentheses.

  • Original module: 7 passed / 7 failed overall.
  • Same full module with the proposed regex change: 14 passed / 0 failed.

This was a standard-library runner directly invoking the four upstream test functions and ten additional checks, not pytest or the full backend suite. No notification delivery, Firebase, worker, or device testing was performed; repository preflight remains outstanding. The proposed matcher supports one nested parenthesized segment, not arbitrary CommonMark parsing. No new funding request or approval is implied by this update.

PlayerBC avatar Sep 09 '26 05:09 PlayerBC

/claim #13334

CreamPle avatar Sep 09 '26 17:09 CreamPle