refactor(core): use common arn util for parsing. - #2254
Merged
Merged
Conversation
Contributor
|
Claude Security Review: no high-confidence findings. (run) |
Contributor
There was a problem hiding this comment.
AgentCore Harness Review
Verdict: Looks good
Pure refactor that consolidates duplicated ARN parsing onto src/core/arn.ts. I traced each call site against the code it replaces and the behavior is preserved for real inputs:
accountIdFromArn/accountIdFromRoleArn:parseArn(arn)?.accountreturns the same value asarn.split(":")[4]for well-formed ARNs, and still throws for malformed input.roleNameFromArn→resourceNameFromArn: identical last-segment-after-/result for IAM role ARNs (paths included).resourceIdFromArninpolicy.tsx→resourceNameFromArn: same "strip if ARN, else pass through" contract viaparseArnreturningundefinedfor non-ARNs.providerFromModelArn: only invoked afterstartsWith("arn:"), so equivalent for foundation-model and inference-profile ARNs.knowledgeBaseRegion: the||→??swap is safe becauseregionFromArnalready normalizes an empty region toundefined, and returnsundefinedfor non-ARNs.resolveSkillsinexport.ts:credentialName/credentialArnare validated as simple names or ARNs, so the "contains/→ last segment" fallback isn't needed in practice.
arn.ts itself is well-covered by arn.test.ts. No new user-facing behavior, so no telemetry is needed. Nothing blocking — LGTM to merge.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## refactor #2254 +/- ##
=========================================
Coverage 97.04% 97.04%
=========================================
Files 566 566
Lines 39409 39407 -2
=========================================
Hits 38244 38244
+ Misses 1165 1163 -2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Hweinstock
marked this pull request as ready for review
September 9, 2026 16:49
jariy17
approved these changes
Sep 9, 2026
aidandaly24
approved these changes
Sep 9, 2026
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.
Problem
Each component is re-implementing arn parsing, rather than relying on the top level
src/core/arn.ts.Solution
Verification