Skip to content

Another alignment fix to the CSS for desktop rendering - #38

Merged
pabooth merged 1 commit into
mainfrom
20260701-164034
Jul 1, 2026
Merged

Another alignment fix to the CSS for desktop rendering#38
pabooth merged 1 commit into
mainfrom
20260701-164034

Conversation

@pabooth

@pabooth pabooth commented Jul 1, 2026

Copy link
Copy Markdown
Owner

Adjusted the desktop email rendering CSS by nudging the numbered story marker top offset from 3px to 2px, tightening the HTML output alignment. The Anthropic digest flow was switched to streaming, and now warns when the response is truncated due to max_tokens; prompt construction and credentials handling were not changed.

Affected files: inbrief.py, tests/test_inbrief.py

Tests added or updated: updated the Anthropic digest mock in tests/test_inbrief.py to use a streaming context manager and final-message retrieval.

@pabooth
pabooth enabled auto-merge (squash) July 1, 2026 20:40
@coderabbitai

coderabbitai Bot commented Jul 1, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 32399fce-3f91-455f-bd76-abbbbc373bda

📥 Commits

Reviewing files that changed from the base of the PR and between 5d690be and dab4f07.

📒 Files selected for processing (2)
  • inbrief.py
  • tests/test_inbrief.py
📜 Recent review details
🧰 Additional context used
📓 Path-based instructions (3)
**

⚙️ CodeRabbit configuration file

**: InBrief

CI
License: MIT
Version

InBrief reads messages received during the previous 24 hours from selected Gmail
labels, asks a configured Claude, OpenAI, or DeepSeek model to produce a concise
digest, and sends one digest per label by email.

[!WARNING]
InBrief sends the contents of matching emails to the configured AI provider.
Do not use it with sensitive mail unless that data transfer is acceptable
under your security, privacy, and compliance requirements.

Requirements

  • Python 3.10 or newer
  • pipx for an isolated command-line installation
  • A Google Cloud OAuth desktop client with the Gmail API enabled
  • An Anthropic, OpenAI, or DeepSeek API key
  • An SMTP account

Installation

Install the latest released version in its own managed environment:

pipx install "git+https://github.com/pabooth/inbrief.git@v1.3.6"

If pipx is not already installed on macOS:

brew install pipx
pipx ensurepath

On other platforms, follow the
pipx installation instructions.
You may need to open a new terminal after running pipx ensurepath.

pipx keeps InBrief and its Python dependencies out of the system Python
environment. It normally stores the environment under
~/.local/share/pipx/venvs/inbrief/ and exposes inbrief and
inbrief-oauth through ~/.local/bin/.

To install another release version, replace X.Y.Z below with the released version:

pipx install --force "git+https://github.com/pabooth/inbrief.git@vX.Y.Z"

To remove InBrief:

pipx uninstall inbrief

Quick start

On first use, inbrief or inbrief-oauth creates
~/.config/inbrief/config from the bundled example if no existing
configuration i...

Files:

  • tests/test_inbrief.py
  • inbrief.py
tests/**

⚙️ CodeRabbit configuration file

tests/**: Check for real credentials or personal data in test fixtures. Verify that security-sensitive paths (injection, escaping, header injection) have meaningful assertions, not just coverage hits.

Files:

  • tests/test_inbrief.py
inbrief.py

⚙️ CodeRabbit configuration file

inbrief.py: Focus on:

  • Secrets handling: API keys, SMTP credentials, and OAuth tokens must only be read via get_secret() or environment variables — never hardcoded or logged.
  • Prompt injection: email bodies are untrusted input. Check that they remain isolated inside tags and cannot escape into the instruction portion of the prompt.
  • HTML output: verify that all dynamic values inserted into the email template are properly escaped to prevent XSS.
  • Email header injection: confirm reject_header_injection() is called on every user-controlled header value.
  • SMTP TLS: flag any path that could send credentials or email content over an unencrypted connection.

Files:

  • inbrief.py
🔇 Additional comments (3)
inbrief.py (2)

657-657: LGTM!


827-839: LGTM!

tests/test_inbrief.py (1)

348-365: LGTM!


Walkthrough

Updates generate_anthropic_digest in inbrief.py to use the Anthropic streaming API via client.messages.stream() and get_final_message(), adding a truncation warning when stop_reason is max_tokens. Test mocks in tests/test_inbrief.py are updated accordingly. A minor CSS top offset adjustment is also included.

Changes

Anthropic Streaming Digest

Layer / File(s) Summary
Streaming digest generation and truncation warning
inbrief.py
generate_anthropic_digest now calls client.messages.stream(...) as a context manager, retrieves the result via get_final_message(), and logs a warning with the configured max_tokens value when stop_reason == "max_tokens".
Test mocks updated for streaming interface
tests/test_inbrief.py
FakeMessages.create is replaced with FakeMessages.stream, returning a context-managed FakeStream whose get_final_message() yields content and stop_reason matching the new streaming flow; call arguments are still recorded.

Cosmetic CSS Tweak

Layer / File(s) Summary
Story number marker offset
inbrief.py
.content .story-number CSS top offset changed from 3px to 2px.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

  • pabooth/inbrief#13: Also refactors generate_anthropic_digest in inbrief.py, overlapping directly with the streaming API change.
  • pabooth/inbrief#25: Touches the same .content .story-number list-marker CSS in render_email_html.
  • pabooth/inbrief#28: Adjusts story-number rendering/CSS in the same email template area.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning No pull request description was provided, so the required template sections are all missing. Add the required template sections: Summary, Testing, Security and privacy, and Checklist, with 'None' where not applicable.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title matches the CSS alignment tweak, but it misses the main Anthropic streaming change.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 20260701-164034

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@pabooth
pabooth merged commit c9c5737 into main Jul 1, 2026
7 checks passed
@pabooth
pabooth deleted the 20260701-164034 branch July 1, 2026 20:43
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.

1 participant