Tw 5660 reduce over engineering Patch 1#112
Merged
Merged
Conversation
…n & quiet flow
Repo-wide over-engineering cleanup plus two correctness fixes surfaced along
the way. Net: 90 files, +398/-6092.
HTTP client consolidation
- Single shared httputil.DefaultClient (120s timeout + nylas-cli User-Agent)
replaces the ad-hoc &http.Client{} literals; dashboard keeps its own DPoP
(non-redirect) client. nylas/client.go uses the shared client; attachment
downloads are bound by the 120s default. userAgentTransport clones the
request before setting User-Agent (RoundTripper no-mutation contract).
- httputil.NewServer centralizes server timeouts; air/ui/studio/chat migrated.
Dead-code removal (~6k lines)
- pattern_learner, config/validation.go, ports/utilities.go, ports/templates.go,
adapters/utilities/mock.go, internal/testutil/*, and assorted dead
helpers/flags/timeout constants.
Fixes
- Default grant: validate the stored default before use and self-heal a stale
pointer with a clear "select a grant" error instead of a confusing 404.
auth list (ListGrants) now reconciles the default across the grant cache and
config — writing a still-live default back into the cache so every command
agrees, clearing it from both stores when dead.
- --quiet: wire the cobra flag into process-wide quiet mode via auditPreRun;
quietMode is now atomic.Bool (read by spinner/progress goroutines).
Tests
- Remove two flaky Slack integration tests (users list rate-limit, E007).
…wnload Unify the API timeout default and make it overridable per-install. - domain.TimeoutAPI 90s -> 120s, matching httputil.DefaultClientTimeout (now derived from it as a single source of truth). Previously CLI commands were effectively capped at 90s by CreateContext while the client allowed 120s. - Add api.timeout config key (Config.Timeout) and NYLAS_API_TIMEOUT env var, resolved via Config.ResolveAPITimeout (env > config > default; invalid or non-positive values fall back to the default). The previously-dead `nylas config set api.timeout` help text now works. - nylas client ApplyConfig applies the resolved timeout to requestTimeout and swaps in a matching http.Client when non-default so a >120s override isn't clipped by the transport cap. - common.CreateContext honors the resolved timeout via SetAPITimeout (atomic), set in GetNylasClient. Also: point Slack file downloads at the shared 120s client and delete the now-single-use domain.TimeoutDownload (15m), making Slack and email attachment downloads consistent. Tests: ResolveAPITimeout (env/config/default/invalid), CreateContext (default + configured), ApplyConfig timeout wiring.
…used code - Delete write-only internal/adapters/providers package and its client init() (Register was called but the factory map was never read) - Remove unused CheckForUpdateAsync and now-dead domain import - Replace status-code loop with slices.Contains; inline stringSliceContains as slices.ContainsFunc (TrimSpace semantics preserved) - Delete dead DialogType type and constants - Inline single-caller stripHTMLForQuote into stripHTMLForTUI
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.
No description provided.