This repository was archived by the owner on Jul 16, 2026. It is now read-only.
Repository navigation
feat(dm-result): record outbox audit on REST-fallback DM delivery (Phase 5.18) - #86
Merged
Merged
Conversation
…ase 5.18)
Closes the bridge-family outbox coverage gap. Phase 5.16 added
outbox_log.append calls to discord-bridge.py for live-bridge deliveries;
this phase ports the OSS dm-result.py write site for the REST-fallback
path used when the live bridge isn't connected. Without this PR, an
offline-bridge owner DM would land successfully on Discord but never
appear in the dashboard's Outbox card alongside live-bridge rows —
silently missing every delivery during bridge downtime.
Changes:
- `src/dm-result.py`: after the success-state print "sent to DM"
and before the final `return True` in `send_dm`, append an outbox
audit row wrapped in `try / import outbox_log / append / except
Exception: pass`. channel_type="discord_dm" matches discord-bridge's
live-bridge vocabulary so both surfaces render the same 💬 icon in
the dashboard card. recipient_label is the constant
"owner DM (via dm-result.py)" — a deliberate divergence from
discord-bridge's per-user label, used as an audit-trail marker
letting operators distinguish REST-fallback rows from live-bridge
rows at a glance.
- `tests/dm-result-outbox.test.py` (new, 6 tests):
- Structural: exactly 1 append site, fail-open wrapped.
- Channel-type vocabulary: must be `discord_dm` (matches discord-
bridge writes so both surfaces share the same icon).
- Variable-binding: required kwargs present (channel_type, recipient,
body, recipient_label).
- Recipient-label marker: must be the dm-result audit marker so
operators can distinguish surfaces.
- Positioning: append sits AFTER the "sent to DM" success print
and BEFORE the final `return True` (catches a refactor that
hoists it above an error branch — would record rows for unsent
messages — or moves it past the return — unreachable).
- Round-trip: append → outbox_log → dashboard.get_outbox reader
picks it up with the right channel_type + marker.
Verification:
- 60/60 Python tests pass (was 59; +1 net-new file).
- TypeScript typecheck clean.
- `python3 -m py_compile src/dm-result.py` clean.
Phase 5.18 of the OSS → private sync. Bridge → outbox → dashboard
pipeline is now feature-complete across slack + discord (live bridge +
REST fallback) + telegram.
Co-authored-by: Cursor <cursoragent@cursor.com>
This was referenced Jun 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes the last bridge-family outbox coverage gap. Phase 5.16 added
outbox_log.appendcalls todiscord-bridge.pyfor live-bridge deliveries; this phase ports the OSSdm-result.pywrite site for the REST-fallback path used when the live bridge isn't connected.Without this PR, an offline-bridge owner DM would land successfully on Discord but never appear in the dashboard's Outbox card alongside live-bridge rows — silently missing every delivery during bridge downtime.
Changes
src/dm-result.py— after the success-state print"sent to DM"and before the finalreturn Trueinsend_dm, append an outbox audit row wrapped intry / import outbox_log / append / except Exception: pass.Two intentional design points:
channel_type"discord_dm"discord-bridge.py's live-bridge vocabulary so both surfaces render the same 💬 icon in the dashboard cardrecipient_label"owner DM (via dm-result.py)"(constant)"alice DM"). dm-result doesn't have the username locally and we don't want to pay an extra REST call just to populate it. The constant marker doubles as an audit-trail signal that lets operators distinguish REST-fallback rows from live-bridge rows at a glanceTests
tests/dm-result-outbox.test.py(new, 6 cases)discord_dm(matches discord-bridge writes for icon parity)."sent to DM"success print and BEFORE the finalreturn True. Catches both a refactor that hoists it above an error branch (would record rows for unsent messages) and one that moves it past the return (unreachable).outbox_log→dashboard.get_outboxreader picks it up with the rightchannel_type+ marker.Test plan
python3 tests/dm-result-outbox.test.py→ 6/6pnpm -s typecheck→ cleanpython3 -m py_compile src/dm-result.py→ cleanResult
Bridge → outbox → dashboard pipeline is now feature-complete across:
slack-bridge.pydiscord-bridge.pydm-result.pytelegram-bridge.pyRoadmap
The outbox pipeline is now complete. Possible next directions if you want to keep going on Phase 5:
dashboard.pydivergence (we touched it for the reader in 5.15; other 100+ lines of diff are deliberate path-resolution divergence — confirm there's no hidden portable win we missed).morning-briefing.py/obsidian-mirror.py/task_archive.py/result_channel_key.pyOSS-only files for any that have a clear, low-risk, additive port path.Or this may be a natural stopping point for the OSS → private sync.
Made with Cursor