fix(ci): resolve ty type-check errors in account guard formatting - #80
fix(ci): resolve ty type-check errors in account guard formatting#80lee101 wants to merge 2 commits into
Conversation
|
Codex Infinity Start a task on this PR's branch by commenting:
Tasks and logs: https://codex-infinity.com |
703e34f to
75b9aea
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 703e34f16e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if len(encoded.encode()) > max_bytes: | ||
| raise ValueError(f"{metadata_label} exceeds {max_bytes} bytes when JSON-encoded") | ||
|
|
||
| return dict(value) |
There was a problem hiding this comment.
Return normalized metadata after JSON coercion
normalize_order_metadata checks serializability with json.dumps(..., default=str) but then returns dict(value) unchanged, so non-JSON-native values (for example datetime, Decimal, or custom objects) pass validation yet can still fail later when callers serialize the returned dict without default=str. This breaks the helper’s contract that it returns metadata “safe to JSON-serialise” and can surface as runtime order-submission failures.
Useful? React with 👍 / 👎.
| return PathResolution(path=Path(path), source=f"explicit({explicit_label})") | ||
|
|
||
| env_val = os.getenv(env_name) | ||
| if env_val is not None: | ||
| return PathResolution(path=Path(env_val), source=f"env({env_name})") |
There was a problem hiding this comment.
Resolve relative paths against repo_root
resolve_repo_relative_path never uses repo_root, so explicit/env relative paths are returned as cwd-relative Path(...) values. If the server is launched from a directory other than the repo root, this can point registry/state paths at the wrong location (or fail to find them), which is inconsistent with existing settings resolvers that anchor relative paths to the repository.
Useful? React with 👍 / 👎.
75b9aea to
310f2a6
Compare
310f2a6 to
77dd293
Compare
77dd293 to
5c8c584
Compare
3f704c7 to
d6d5bcd
Compare
Use cast(float, ...) instead of float() for JSONDict value accesses where ty infers the value type as `object` from dict[str, object]. This fixes all 7 invalid-argument-type errors in the type-check CI job. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ility The `ty` type checker rejects `float(dict_value)` when the dict value type is `object`, since `object` does not satisfy `SupportsFloat`. Changing `JSONDict = dict[str, object]` to `dict[str, Any]` is the standard typing for JSON-like dicts and resolves all 7 ty errors in the type-check CI job. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
d4d9b5e to
a6520a8
Compare
Summary
JSONDicttype alias fromdict[str, object]todict[str, Any]— the root cause of all 7tytype-check errorsfloat(item['key'])withcast(float, item['key'])at call sites as a belt-and-suspenders fixAnyis the standard typing for JSON-like dicts and correctly signals values may be str, int, float, bool, None, or nested structuresRoot cause
tyrejectsfloat(v)whenvis typedobjectbecauseobjectdoesn't satisfySupportsFloat. Changing the alias todict[str, Any]fixes this at the source rather than patching each call site.Test plan
ty checkpasses on all CI-checked files locally (hybrid_prompt.py, trade_binance_live.py, evaluate_binance_lora_candidate.py, scripts/evaluate_binance_lora_candidate.py, trltraining)Anyis equivalent toobjectat runtimecast()calls from prior commit are harmless (no-op at runtime)🤖 Generated with Claude Code