Skip to content

feat(mail): elide quoted reply history - #3

Merged
rianjs merged 2 commits into
mainfrom
feat/2-elide-quoted-replies
Aug 6, 2026
Merged

feat(mail): elide quoted reply history#3
rianjs merged 2 commits into
mainfrom
feat/2-elide-quoted-replies

Conversation

@rianjs

@rianjs rianjs commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Summary

  • conservatively elide confidently identified terminal quoted reply history in mail read and mail thread
  • preserve inline/interleaved replies, forwards, unattributed and generic blockquotes, malformed/uncertain content
  • add --include-quoted-reply-bodies to restore complete body output
  • cover real-world-derived plain-text and Gmail/Thunderbird/Outlook/Zimbra HTML structures without adding a dependency

Safety

This is presentation-only. Gmail API calls, MIME extraction, message models, drafts, scopes, credentials, and persisted data are unchanged. Fixtures are synthetic structural examples and contain no mailbox data or identifiers.

Checks

  • go test -race ./mailcmd
  • make check
  • root diff review
  • one read-only empirical message check with a temporary downstream build

Parent workstream: open-cli-collective/google-readonly#170

Closes #2

rianjs commented Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

Blocker

None.

Major

  • make check is not currently green. Makefile:5 requires lint; it exits at Makefile:15 with context loading failed: no go files to analyze. This leaves the required check gate unmet (although go test -race ./mailcmd passes).

  • HTML forward preservation is untested in the exact wrapper treated as an unconditional quote. mailcmd/quoted_reply.go:346-357 classifies terminal id="divRplyFwdMsg" as removable; mailcmd/quoted_reply_test.go:137-142 only asserts removal, while forward coverage at :85-99 is plain text. Add a terminal Outlook forward in that wrapper and require byte-for-byte preservation; otherwise the workstream's forward invariant can regress unnoticed.

  • The malformed-HTML case only leaves the quote wrapper unclosed (mailcmd/quoted_reply_test.go:183-187). A malformed outer/container tag with an explicitly closed gmail_quote is untested, despite mailcmd/quoted_reply.go:200-255 parsing and rendering that input once the quote-close check succeeds. Add that case and require unchanged output; tolerant parsing plus re-rendering can otherwise elide content and normalize malformed input, violating fail-open behavior.

  • The plain Outlook positive fixture (mailcmd/quoted_reply_test.go:46-50) makes a blank-prefixed From/Sent/To/Subject block sufficient to delete all remaining text, matching mailcmd/quoted_reply.go:154-184. There is no collision/ambiguous-header preservation case. Add one before treating this heuristic as conservative; otherwise authored text that resembles a pasted header block has no data-loss regression guard.

Minor

  • Command coverage uses only a plain-text synthetic message (mailcmd/handlers_test.go:168-173, :176-300). The HTML fixtures call the helper directly, so no test proves mail read/mail thread propagate BodyIsHTML and the include flag correctly for client HTML. Cover one HTML client body through each command (or the shared print path) in both default and include modes.

Nit

None.

@rianjs-bot rianjs-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Automated PR Review

Reviewed commit: c37591d0ede2
Profile: codex-rianjs-bot - Posting as: rianjs-bot[bot]

Summary

Reviewer Findings
go:implementation-tests 0
policies:conventions 0

Reviewer Coverage

  • go:implementation-tests — complete (broad); skipped: none; constraints: Repository docs/development.md and docs/README.md referenced by AGENTS.md are absent in this checkout. go test -race ./mailcmd could not build because clang mishandles the workspace path; CGO_ENABLED=0 go test ./mailcmd passed.
  • policies:conventions — complete (broad); inspected 5 assigned files (7 inspected across reviewers): mailcmd/handlers_test.go, mailcmd/output.go, mailcmd/output_test.go, mailcmd/read.go, mailcmd/thread.go; skipped: none; constraints: The referenced repo-local standards documents (docs/development.md and docs/README.md) are absent from this review checkout. go test -race ./mailcmd could not build because clang mishandled the workspace path containing spaces; this is an environment limitation, not a diff finding.
Inspected files (7)
  • mailcmd/handlers_test.go
  • mailcmd/output.go
  • mailcmd/output_test.go
  • mailcmd/quoted_reply.go
  • mailcmd/quoted_reply_test.go
  • mailcmd/read.go
  • mailcmd/thread.go

0 PR discussion threads considered. 0 summarized; 0 resolved.


Completed in 2m 07s | gpt-5.6-terra | cr 0.10.279
Field Value
Model gpt-5.6-terra
Reviewers go:implementation-tests, policies:conventions
Engine codex_cli · gpt-5.6-terra
Reviewed by cr · rianjs-bot[bot]
Duration 2m 07s wall · 3m 01s compute
Cost unavailable
Tokens 575.1k in / 6.4k out

Per-workstream usage

  • orchestrator-selection — gpt-5.6-terra
    • In: 16.8k
    • Out: 239
    • Cache read: 11.0k
    • Cache create: unavailable
    • Cost: unavailable
    • Duration: 7s
  • go:implementation-tests — gpt-5.6-terra
    • In: 276.6k
    • Out: 3.3k
    • Cache read: 241.4k
    • Cache create: unavailable
    • Cost: unavailable
    • Duration: 1m 36s
  • policies:conventions — gpt-5.6-terra
    • In: 245.7k
    • Out: 2.6k
    • Cache read: 201.7k
    • Cache create: unavailable
    • Cost: unavailable
    • Duration: 1m 13s
  • orchestrator-rollup — gpt-5.6-terra
    • In: 36.1k
    • Out: 278
    • Cache read: 27.1k
    • Cache create: unavailable
    • Cost: unavailable
    • Duration: 3s

@rianjs
rianjs merged commit 33d4c4c into main Aug 6, 2026
4 checks passed
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(mail): conservatively elide terminal quoted reply history

1 participant