TW-5303: add nylas email reply command and fix dormant integration tests#100
Merged
Conversation
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.
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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
Two changes:
New
nylas email reply <message-id> [grant-id]— fetches the original message and auto-populates a threaded reply (viareply_to_message_id), so users no longer needemail send --reply-towith manual recipients/subject.Reply-Toheader (when it carries a usable address) elseFrom; the replier's own address is always excluded.--alladds 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.-b/--bodyor-i/--interactive(terminates on.or EOF, CRLF-safe).-y/--yesskips the confirm prompt; defaults to the active grant when[grant-id]is omitted.common.WithClient,getGrantForSend, andsendMessageForGrant— no package-local wrappers.Test-file rename hygiene — 8 files renamed from
*_test_*.go(with_testin the middle, which Go does not treat as test files) to a proper*_test.gosuffix. This fixesgo build -tags integration(the non-test files referenced helpers defined in real_test.gofiles) 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 behindNYLAS_TEST_DELETE/NYLAS_TEST_AUTH_LOGOUT, so default runs continue to skip them.Testing
make cigreen — fmt, vet, lint, unit, race, security, vuln, build../EOF/CRLF), threading viareply_to_message_id.--help, body-required fast-fail, and a gated live send→reply round-trip verified against the real Nylas API.Related docs
email send --reply-toin its error/help text--reply-to