Skip to content

feat(akamai-client): add bounded active-version lookup - #1901

Open
adityamisra08 wants to merge 1 commit into
mainfrom
feat/LLMO-7225-akamai-automation-improvements
Open

feat(akamai-client): add bounded active-version lookup#1901
adityamisra08 wants to merge 1 commit into
mainfrom
feat/LLMO-7225-akamai-automation-improvements

Conversation

@adityamisra08

Copy link
Copy Markdown

Summary

Adds getLatestVersionActivatedOn(propertyId, contractId, groupId, network) to the Akamai client, backed by PAPI's bounded GET /versions/latest?activatedOn=NETWORK. It returns the version currently active on a network without scanning the property's full activation history, so callers stay independent of the number of versions/activations.

Consumed by spacecat-api-service getVersions (LLMO-7225) to replace a listActivations() full-history scan.

What changed

  • src/akamai-client.js
    • New getLatestVersionActivatedOn(...) — bounded active-version lookup per network.
    • #request gains an allow404 option so a "never activated on this network" 404 returns undefined instead of throwing. (Also covers the 200-with-empty-items case.)
  • src/index.d.ts — type declaration for the new method.
  • test/akamai-client.test.js — new getLatestVersionActivatedOn suite: success, network uppercasing, 404 → undefined, empty-items → undefined, non-404 rethrow.

Testing

  • npm test -w packages/spacecat-shared-akamai-client98 passing, 100% lines/statements/functions (branch 99.44%, gate 97%).
  • npm run lint clean.

Breaking changes

None — purely additive.

Downstream

spacecat-api-service must bump @adobe/spacecat-shared-akamai-client to the release cut from this PR to pick up the new method.

🤖 Generated with Claude Code

Add getLatestVersionActivatedOn(propertyId, contractId, groupId, network),
backed by PAPI's GET /versions/latest?activatedOn=NETWORK. Returns the version
currently active on a network without scanning the property's full activation
history, so callers stay independent of the number of versions/activations.

Add an allow404 option to the internal request helper so a "never activated on
this network" 404 is treated as an absent result (undefined) rather than an
error.

LLMO-7225

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@MysticatBot MysticatBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @adityamisra08,

⚠ Degraded review - no spec document was found for this change (searched the PR links, the touched repos' docs, the architecture/guidelines docs, and linked Jira). This review covers code-level quality but could not validate the change against an agreed design, so confidence is reduced. Add a spec link (PR template section 4) and re-request review for a full-confidence pass.

Verdict: Approve - clean, well-scoped addition with thorough test coverage; only minor polish items.
Complexity: LOW - small additive change within a single package.
Changes: Adds a bounded active-version lookup method to the Akamai PAPI client, with an allow404 option in the private #request method to treat 404 as "absent" (3 files).

Non-blocking (4): minor issues and suggestions
  • suggestion: TypeScript return type Promise<object | undefined> is uninformative - consider defining a VersionItem interface with at least propertyVersion: number and using Promise<VersionItem | undefined> - packages/spacecat-shared-akamai-client/src/index.d.ts:97
  • suggestion: Add a README entry for getLatestVersionActivatedOn to match the existing pattern where all public methods are documented - packages/spacecat-shared-akamai-client/README.md
  • nit: The 404 path in #request returns undefined without consuming the response body (res.text()), unlike the error path - consider draining it for connection hygiene - packages/spacecat-shared-akamai-client/src/akamai-client.js:275
  • nit: The non-404 error test uses .query(true) wildcard instead of pinning exact query params like the other tests in the block - packages/spacecat-shared-akamai-client/test/akamai-client.test.js:910

Skill: pr-review | Model: us.anthropic.claude-opus-4-6-v1[1m] | Duration: 3m 7s | Cost: $4.56 | Commit: 2f16d258222fc31aef630d4eb6d7e25ef97ae83c
If this code review was useful, please react with 👍. Otherwise, react with 👎.

@MysticatBot MysticatBot added ai-reviewed Reviewed by AI complexity:low AI-assessed PR complexity: LOW labels Aug 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-reviewed Reviewed by AI complexity:low AI-assessed PR complexity: LOW

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants