Skip to content

feat(notifications): preview every event rendering with sample fallback - #590

Open
Daluworks wants to merge 10 commits into
mimir-stellar:mainfrom
Daluworks:feat/preview-all-events
Open

Daluworks wants to merge 10 commits into
mimir-stellar:mainfrom
Daluworks:feat/preview-all-events

Conversation

@Daluworks

Copy link
Copy Markdown
Contributor

Summary

Enables operators to preview how every supported contract event renders in Telegram via /preview <event_name>. Introduces src/notifications/samples.ts providing deterministic sample DecodedEvent objects for all 15 market and squad event types, keeps the market and squad command arguments functional as before, and falls back to a MarkdownV2-escaped usage message listing all valid event names whenever an unknown argument is provided.

Linked issue

Closes #371

Failure modes

Failure mode Behavior before Behavior after
Malformed / unknown events previewMessage treated any unknown argument as market, silently rendering only the claim_created sample. Unknown preview arguments return a bounded MarkdownV2-escaped usage message listing all valid event names and shortcuts without throwing. Event parsing in poller remains unchanged.

Cursor safety

Unchanged. This PR touches only the on-demand preview formatting logic (previewMessage) and sample event fixtures. The poller, cursor files, dedup windows, and ledger state are not touched.

Logs and security

No new log lines or configuration variables were added. All operator inputs to /preview are clipped via clip(target, 40) and passed through escapeMd before being included in the reply, preventing MarkdownV2 entity injection or unbounded messages. No secrets, credentials, or bot tokens are exposed.

Configuration and deployment impact

No changes. No environment variables were added or modified. Deployment configuration (Dockerfile, railway.json, status endpoints) and data/ layout are unchanged.

Test coverage

  • npm run typecheck passes
  • npm run build passes
  • npm test passes (no live Testnet, no Telegram credentials required)
  • Fixture guide / README updated where behavior affecting ops changed
  • No real bot tokens, chat ids, or signing keys added to the repo

Coverage details:

  • Added tests/preview-samples.test.mjs verifying:
    • Export of all 15 sample DecodedEvent instances across market and squad contracts.
    • Every sample renders through formatEvent without error.
    • previewMessage renders valid MarkdownV2 for each event name.
    • Backward compatibility for /preview market and /preview squad.
    • Unknown arguments return an escaped usage guide containing all valid names.
    • MarkdownV2 heuristics: zero unescaped reserved characters outside entities across all samples and fallbacks.
  • Verified existing suites (link-preview-control.test.mjs, format.test.mjs, markdown-lint.test.mjs, golden-corpus.test.mjs, scan-secrets.mjs, check-lockfile.mjs) pass cleanly.

@drips-wave

drips-wave Bot commented Oct 18, 2026

Copy link
Copy Markdown

@Daluworks Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@enliven17

Copy link
Copy Markdown
Contributor

Thanks for the contribution. The PR is currently blocked because the main branch has advanced and GitHub reports a merge conflict. Please update or rebase the branch against main, resolve the conflict, and rerun the checks. We will be happy to merge it after that.

@enliven17

Copy link
Copy Markdown
Contributor

Hi @Daluworks, thank you for your contribution.

This PR is not currently in a mergeable state on GitHub, and its mergeability cannot be confirmed after recent repository updates, so I cannot merge it as-is.

Please recreate or rebase your branch from the current main branch and push an updated branch so we can review it again.

This is a mergeability/update note, not a malware finding. Once the branch is updated, we will review it again.

Thank you!

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.

feat(bot): preview any notification type with /preview <event>

2 participants