feat(akamai-client): add bounded active-version lookup - #1901
feat(akamai-client): add bounded active-version lookup#1901adityamisra08 wants to merge 1 commit into
Conversation
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>
There was a problem hiding this comment.
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 aVersionIteminterface with at leastpropertyVersion: numberand usingPromise<VersionItem | undefined>-packages/spacecat-shared-akamai-client/src/index.d.ts:97 - suggestion: Add a README entry for
getLatestVersionActivatedOnto match the existing pattern where all public methods are documented -packages/spacecat-shared-akamai-client/README.md - nit: The 404 path in
#requestreturnsundefinedwithout 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 👎.
Summary
Adds
getLatestVersionActivatedOn(propertyId, contractId, groupId, network)to the Akamai client, backed by PAPI's boundedGET /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 alistActivations()full-history scan.What changed
src/akamai-client.jsgetLatestVersionActivatedOn(...)— bounded active-version lookup per network.#requestgains anallow404option so a "never activated on this network" 404 returnsundefinedinstead 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— newgetLatestVersionActivatedOnsuite: success, network uppercasing, 404 → undefined, empty-items → undefined, non-404 rethrow.Testing
npm test -w packages/spacecat-shared-akamai-client— 98 passing, 100% lines/statements/functions (branch 99.44%, gate 97%).npm run lintclean.Breaking changes
None — purely additive.
Downstream
spacecat-api-service must bump
@adobe/spacecat-shared-akamai-clientto the release cut from this PR to pick up the new method.🤖 Generated with Claude Code