Skip to content

TW-5303: add nylas email reply command and fix dormant integration tests#100

Merged
qasim-nylas merged 2 commits into
mainfrom
feature/TW-5303-email-reply
Jun 8, 2026
Merged

TW-5303: add nylas email reply command and fix dormant integration tests#100
qasim-nylas merged 2 commits into
mainfrom
feature/TW-5303-email-reply

Conversation

@qasim-nylas
Copy link
Copy Markdown
Collaborator

Summary

Two changes:

  1. New nylas email reply <message-id> [grant-id] — fetches the original message and auto-populates a threaded reply (via reply_to_message_id), so users no longer need email send --reply-to with manual recipients/subject.

    • Recipients target the Reply-To header (when it carries a usable address) else From; the replier's own address is always excluded. --all adds the original To/Cc (de-duped, case-insensitive) and promotes those recipients to the To line when replying to a message you sent.
    • Re: subject prefix unless already present.
    • Body via -b/--body or -i/--interactive (terminates on . or EOF, CRLF-safe). -y/--yes skips the confirm prompt; defaults to the active grant when [grant-id] is omitted.
    • Reuses common.WithClient, getGrantForSend, and sendMessageForGrant — no package-local wrappers.
  2. Test-file rename hygiene — 8 files renamed from *_test_*.go (with _test in the middle, which Go does not treat as test files) to a proper *_test.go suffix. This fixes go build -tags integration (the non-test files referenced helpers defined in real _test.go files) and activates ~44 previously-dormant integration tests across auth, calendar, and slack. Pure git renames — content unchanged. Activated tests stay //go:build integration-gated, and the destructive ones remain opt-in behind NYLAS_TEST_DELETE / NYLAS_TEST_AUTH_LOGOUT, so default runs continue to skip them.

Testing

  • make ci green — fmt, vet, lint, unit, race, security, vuln, build.
  • Unit tests: recipient resolution (self-exclusion, dedupe, reply-all promotion, blank Reply-To fallback), subject prefixing, body reader (./EOF/CRLF), threading via reply_to_message_id.
  • Integration: --help, body-required fast-fail, and a gated live send→reply round-trip verified against the real Nylas API.
  • Dual review (Claude + Codex) run to convergence — both green.

Related docs

Add a first-class reply command that fetches the original message and
auto-populates the reply, so users no longer have to use
`email send --reply-to` with manual recipients/subject.

- Threads via reply_to_message_id so replies group with the original.
- Recipients target the Reply-To header (when it carries a usable
  address) else From; the replier's own address is always excluded.
  --all adds the original To/Cc (de-duped, case-insensitive) and
  promotes those recipients to the To line when replying to a message
  you sent.
- Subject gets a "Re: " prefix unless one is already present.
- Body via -b/--body or -i/--interactive (terminates on "." or EOF,
  CRLF-safe). -y/--yes skips the confirm prompt; defaults to the active
  grant when [grant-id] is omitted.
- Reuses common.WithClient, getGrantForSend, and sendMessageForGrant
  rather than introducing package-local wrappers.

Covered by unit tests (recipient resolution, subject prefixing, body
reader, threading) and integration tests (help, body-required, and a
gated live send/reply round-trip).
Eight integration test files used a `*_test_*.go` name (with `_test` in
the middle, not as a suffix). Go only treats the `_test.go` suffix as a
test file, so these compiled as ordinary package files: their Test
functions were never registered (~44 dormant tests across auth,
calendar, and slack) and `go build -tags integration` failed because the
non-test files referenced helpers defined in real `_test.go` files.

Rename them to the proper `_test.go` suffix (content unchanged) so the
tests are discovered and the integration package builds under the tag.
The activated tests remain `//go:build integration`-gated and the
destructive ones stay opt-in behind NYLAS_TEST_DELETE /
NYLAS_TEST_AUTH_LOGOUT, so default runs continue to skip them.
@qasim-nylas qasim-nylas requested a review from AaronDDM June 8, 2026 11:20
Copy link
Copy Markdown
Collaborator

@AaronDDM AaronDDM left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@qasim-nylas qasim-nylas merged commit df7cc00 into main Jun 8, 2026
7 checks passed
@qasim-nylas qasim-nylas deleted the feature/TW-5303-email-reply branch June 8, 2026 11:23
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.

2 participants