release: 1.77.0#664
Conversation
46f336f to
6881f1c
Compare
6881f1c to
81598b8
Compare
| custom_headers_env = os.environ.get("MODERN_TREASURY_CUSTOM_HEADERS") | ||
| if custom_headers_env is not None: | ||
| parsed: dict[str, str] = {} | ||
| for line in custom_headers_env.split("\n"): | ||
| colon = line.find(":") | ||
| if colon >= 0: | ||
| parsed[line[:colon].strip()] = line[colon + 1 :].strip() | ||
| default_headers = {**parsed, **(default_headers if is_mapping_t(default_headers) else {})} |
There was a problem hiding this comment.
🚩 copy(set_default_headers=...) semantics changed by env header injection
The copy() method at src/modern_treasury/_client.py:521 passes headers to __init__(), which now re-reads MODERN_TREASURY_CUSTOM_HEADERS from the environment at line 204-211. When a user calls copy(set_default_headers={}) intending to clear all custom headers, env-derived headers would still be injected via {**parsed, **default_headers}. This is a semantic change to set_default_headers — previously it would result in zero custom headers, now env headers persist. This is likely intentional (env headers are always-on infrastructure config), but it's worth documenting since it changes the contract of set_default_headers. The same applies to the async client at line 664.
Was this helpful? React with 👍 or 👎 to provide feedback.
81598b8 to
fb5fa8c
Compare
fb5fa8c to
2164c9b
Compare
2164c9b to
4536df9
Compare
4536df9 to
cdc0888
Compare
cdc0888 to
4438585
Compare
4438585 to
3401eda
Compare
3401eda to
426c7e1
Compare
426c7e1 to
db0e123
Compare
db0e123 to
fd10854
Compare
233ae0c to
6db952d
Compare
| custom_headers_env = os.environ.get("MODERN_TREASURY_CUSTOM_HEADERS") | ||
| if custom_headers_env is not None: | ||
| parsed: dict[str, str] = {} | ||
| for line in custom_headers_env.split("\n"): | ||
| colon = line.find(":") | ||
| if colon >= 0: | ||
| parsed[line[:colon].strip()] = line[colon + 1 :].strip() | ||
| default_headers = {**parsed, **(default_headers if is_mapping_t(default_headers) else {})} |
There was a problem hiding this comment.
🚩 Custom env headers could override security-sensitive headers
The new MODERN_TREASURY_CUSTOM_HEADERS env var at src/modern_treasury/_client.py:204-211 allows setting arbitrary headers. Since the env-parsed headers are spread first ({**parsed, **default_headers}), user-passed default_headers take priority, but the Authorization header (set separately in auth_headers at line 469-472) is merged later in the request pipeline and would override any env-set Authorization header. This means the env var cannot accidentally override auth — but it can still set other sensitive headers (e.g., X-Forwarded-For). This is likely acceptable since the user controls their own env, but it's worth documenting the security implications.
Was this helpful? React with 👍 or 👎 to provide feedback.
6db952d to
fe6e959
Compare
fe6e959 to
dcc87cf
Compare
dcc87cf to
a91d074
Compare
a91d074 to
e93f4bd
Compare
e93f4bd to
0e3d531
Compare
0e3d531 to
1498dd3
Compare
1498dd3 to
b65f374
Compare
b65f374 to
a9c8cfd
Compare
a9c8cfd to
5b1894b
Compare
| amount: int | ||
| """Value in specified currency's smallest unit. | ||
|
|
||
| e.g. $10 would be represented as 1000. Can be any integer up to 36 digits. | ||
| """ | ||
|
|
||
| amount_string: str | ||
| """ | ||
| The amount of the ledger entry as a string, preserving full precision for values | ||
| that may exceed safe integer limits in some languages. | ||
| """ |
There was a problem hiding this comment.
🚩 LedgerEntryCreateRequest.amount changed from Required to optional
In both src/modern_treasury/types/shared/ledger_entry_create_request.py and src/modern_treasury/types/shared_params/ledger_entry_create_request.py, amount was changed from a required field to optional (Optional[int] = None / non-Required). The new amount_string field is also optional. This means neither amount nor amount_string is required, which could allow creating a ledger entry with no amount specified. This appears to be an intentional API spec change (the server presumably validates that at least one is provided), but callers relying on the type system to enforce amount presence will no longer get that guarantee.
Was this helpful? React with 👍 or 👎 to provide feedback.
| "USDB", | ||
| "USDC", | ||
| "USDG", | ||
| "USDP", |
There was a problem hiding this comment.
🚩 Currency enum removes USDB and USDP stablecoin values
In both src/modern_treasury/types/shared/currency.py and src/modern_treasury/types/shared_params/currency.py, the USDB and USDP currency values were removed from the Currency type. If any existing API consumers are using these currency values, their code would still work at runtime (the values are just strings sent to the API), but type checkers would flag them. This is a potentially breaking change for users relying on these specific currencies.
Was this helpful? React with 👍 or 👎 to provide feedback.
5b1894b to
32b4c97
Compare
32b4c97 to
18aa125
Compare
18aa125 to
0d541c8
Compare
0d541c8 to
dfb720c
Compare
Automated Release PR
1.77.0 (2026-06-09)
Full Changelog: v1.76.0...v1.77.0
Features
Bug Fixes
Chores
This pull request is managed by Stainless's GitHub App.
The semver version number is based on included commit messages. Alternatively, you can manually set the version number in the title of this pull request.
For a better experience, it is recommended to use either rebase-merge or squash-merge when merging this pull request.
🔗 Stainless website
📚 Read the docs
🙋 Reach out for help or questions