Skip to content

Comments

Add --fetch-all-body-values, email.read command, fix pipeline.run default#11

Merged
turian merged 2 commits intomainfrom
fix/email-body-values-and-pipeline-defaults
Feb 10, 2026
Merged

Add --fetch-all-body-values, email.read command, fix pipeline.run default#11
turian merged 2 commits intomainfrom
fix/email-body-values-and-pipeline-defaults

Conversation

@turian
Copy link
Member

@turian turian commented Feb 10, 2026

Summary

  • email.get --fetch-all-body-values: Exposes JMAP's fetchAllBodyValues: true (RFC 8621) as a CLI flag. Without this, bodyValues always returned {} even when included in --properties, making it impossible to read email bodies through email.get.
  • email.read --id <id>: New convenience command that returns subject, from, to, and plain text body in a single flattened response. Uses fetchAllBodyValues internally and extracts text via textBody[].partIdbodyValues lookup.
  • pipeline.run default --json: Added missing set_defaults(json="compact") — every other command had this, but pipeline.run crashed with ValueError: Unknown json style: None when --json was omitted.

Test plan

All three fixes were verified against the live Fastmail API:

  • email.get --ids '["..."]' --properties '["subject","textBody","bodyValues"]' --fetch-all-body-valuesbodyValues now populated with text/plain and text/html content (previously {})
  • email.read --id <id> --json pretty — returns flattened {id, subject, from, to, body} with extracted plain text
  • pipeline.run --input '{"calls":[["Email/query",{"limit":1},"q1"]]}' (no --json) — outputs compact JSON, no crash
  • help lists email.read with correct summary
  • describe email.get shows new fetch_all_body_values flag
  • describe email.read shows id option
  • Verified EmailGet.to_dict() serializes fetch_all_body_values=True as "fetchAllBodyValues": true matching RFC 8621 wire format
  • Verified fetch_all_body_values=None (default when flag omitted) omits the key entirely from the request — no behavior change for existing usage

🤖 Generated with Claude Code

… pipeline.run default

email.get had no way to pass fetchAllBodyValues: true (RFC 8621), so
bodyValues always came back empty even when requested in --properties.
Added --fetch-all-body-values flag that maps to the JMAP parameter.

Added email.read convenience command that returns subject, from, to, and
plain text body in a single flattened call — the most common "read an
email" use case no longer requires pipeline.run with raw JMAP.

Fixed pipeline.run crashing with "ValueError: Unknown json style: None"
when --json is omitted. Every other command set a default; this one didn't.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4fd08c287a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +311 to +313
except Exception as exc:
err = {"type": "runtimeError", "message": str(exc), "details": {}}
return 6, envelope(False, "email.read", vars(args), meta_block(args.host, "unknown", []), error=err)

Choose a reason for hiding this comment

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

P2 Badge Preserve specific error codes in email.read

email.read only catches Exception and always returns runtimeError/exit code 6, so authentication failures, JMAP method errors, and HTTP status errors are no longer distinguishable for this command. That diverges from the CLI’s documented per-error exit-code behavior used by the other handlers and can break scripts that branch on those codes (for example, retrying HTTP failures but not auth failures).

Useful? React with 👍 / 👎.

Address Codex review: email.read now matches the error handling pattern
used by all other handlers (ValueError→2, ClientError→5, HTTPError→3/4,
Exception→6) instead of catching bare Exception for everything.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@turian
Copy link
Member Author

turian commented Feb 10, 2026

@codex review

@chatgpt-codex-connector
Copy link

Codex Review: Didn't find any major issues. Breezy!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@turian turian merged commit 410d6ab into main Feb 10, 2026
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