Reject malformed keyring integer fields#593
Conversation
|
@samsamtrum is attempting to deploy a commit to the Tempo Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fc4c9a5719
ℹ️ 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".
| } | ||
|
|
||
| function parse(text: string): readonly Entry[] { | ||
| export function parse(text: string): readonly Entry[] { |
There was a problem hiding this comment.
Document the new exported parser
AGENTS.md says “JSDoc on all exports — every exported function, type, and constant gets a JSDoc comment.” This change makes parse exported without adding docs, so the module now violates the documented export contract; either add a JSDoc comment or avoid exporting it just for the test seam.
Useful? React with 👍 / 👎.
| expiry = 2 | ||
| ` | ||
|
|
||
| expect(() => Keyring.parse(content)).toThrow('Invalid chain_id') |
There was a problem hiding this comment.
AGENTS.md Testing Conventions says to use toThrowErrorMatchingInlineSnapshot() for error assertions rather than direct .toThrow() checks. This newly added error test bypasses that convention and only checks a substring, so please snapshot the thrown message in the project’s standard form.
Useful? React with 👍 / 👎.
The CLI keyring parser was using
Number.parseIntforchain_idandexpiry, which accepts partial strings like123abcas123.This rejects malformed integer fields instead, so edited or corrupted keyring entries do not get accepted with truncated values.