You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor(planfix): route all requests through Client.Proxy
Previously only Stream read c.Proxy; Do/JSON got proxying from the default
transport, which reads the environment independently. Setting c.Proxy would
have governed downloads but not other requests -- an inconsistent knob.
New now clones the standard transport (keeping its connection-pool defaults)
for the shared Do/JSON client and points its Proxy at c.Proxy, resolved per
request; Stream uses the same helper. A single field now governs proxying for
every request, and nil disables it.
Copy file name to clipboardExpand all lines: AGENTS.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -96,7 +96,7 @@ Implemented:
96
96
- Precedence: command-line flags > environment (`PFIX_DOMAIN`, `PFIX_TOKEN`, `PFIX_PROFILE`, `PFIX_CONFIG`) > config file. Profile name resolves through `config.ResolveProfileName` (`flag > PFIX_PROFILE > current_profile > "default"`) — use it everywhere a command needs the active profile, so the commands stay consistent.
97
97
- Output: typed `task` commands default to a human-readable table (list) or key/value detail (single object), rendered by `internal/output` (stdlib `text/tabwriter`, no color). `--json` emits the API response unmodified (pretty-printed); `--fields` overrides the requested fields and table columns; `-q/--quiet` drops the header row (lists) or prints only the affected id (create/update/comment add). `--jq <expr>` filters the JSON output through a jq expression (implies `--json`). `api` always emits raw JSON. Errors go to stderr with a non-zero exit code. The Planfix layer stays thin — commands render generically from decoded `map[string]any` via dot-paths rather than typed structs, so unconfirmed nested shapes need no model.
98
98
- Transport: `Client.Do` returns the HTTP response for any status (callers inspect `StatusCode` and use `planfix.ParseError` for detail). It retries connection errors + 5xx, never 4xx. Every request carries a `User-Agent` of `pfix/<version>` (from `buildinfo.Version`, set on the `Client.UserAgent` field in `New`); a caller-supplied `User-Agent` header — e.g. `api -H "User-Agent: ..."` — overrides it.
99
-
- Proxy: the client follows the standard Go proxy environment variables (`HTTP(S)_PROXY`/`NO_PROXY`). `Do`/`JSON` inherit them via the default transport; `Stream` (file download) builds its own `http.Transport`, so it must set the proxy explicitly — it uses`Proxy: c.Proxy`, whose `New` default is `http.ProxyFromEnvironment` (a bare transport would disable proxying, so downloads would ignore the env and — where the only egress is a proxy — fail outright). `ALL_PROXY` is not honored (the Go stdlib `httpproxy` package does not read it).
99
+
- Proxy: the client follows the standard Go proxy environment variables (`HTTP(S)_PROXY`/`NO_PROXY`) for every request. Both HTTP paths resolve the proxy through the `Client.Proxy` field (default `http.ProxyFromEnvironment`, set in `New`): `New` clones the standard transport for the shared `Do`/`JSON` client, and `Stream` (file download) builds its own timeout-free transport — both point`Proxy` at `c.Proxy`, resolved per request, so overriding the field (or nil-ing it to force a direct connection) governs all requests. A bare `http.Transport` would instead disable proxying outright, which is why `Stream` must not use one. `ALL_PROXY` is not honored (the Go stdlib `httpproxy` package does not read it).
100
100
- API specifics: list endpoints are POST with `pageSize`/`offset`/`fields`/`filters`; fields must be requested explicitly — ship sensible per-resource defaults, overridable with `--fields`.
101
101
- Files: `task files`/`contact files`/`project files --source inline`*composes* its JSON output (`{"result":"success","files":[...]}` built from resolved ids) rather than echoing an API response — there is no single endpoint for inline files, so `--json`/`--jq` there reflect pfix's aggregation, not one call's response body.
102
102
- Files: `--fields` on the files commands (`task files`, `contact files`, `project files`) selects table columns only. No file-listing endpoint supports server-side field selection — `/file/{id}`'s own `fields` parameter is accepted and silently ignored — so unlike other typed commands, `--fields` there never changes what the API is asked for.
0 commit comments