Repository navigation
Conversation
199cff0 to
4b2d028
Compare
Coverage Report for CI Build 47369392798Coverage decreased (-0.02%) to 88.868%Details
Uncovered Changes
Coverage RegressionsNo coverage regressions found. Coverage Stats💛 - Coveralls |
8d61b87 to
b51fc90
Compare
8c3ed0c to
1d8b632
Compare
There was a problem hiding this comment.
Findings marked 🟡 are optional suggestions and need no follow-up push.
Additional findings (outside the current diff — GitHub can't attach inline comments there):
-
🟡
acceptance/support/cdn-purge.ts— Core and versioning suites with no CDN requirement can fail outright when ACCEPTANCE_CDN_NEEDS_PURGE=true is set against a target with no CDN. The helper checks only cdnNeedsManualPurge, never capabilities.cdn. It then sends DELETE /cdn with expectedStatus: 200, and that fails when no purge endpoint is configured. Fix: skip the purge unless both cdnNeedsManualPurge and capabilities.cdn are true. This covers the new callers in rest-extended.test.ts (profile 'core') and rest-object-versioning.test.ts (requires only 'versioning').Why this was flagged
Trigger: an operator sets ACCEPTANCE_CDN_NEEDS_PURGE=true (for example in a shared CI env) and runs against a target where ACCEPTANCE_ENABLE_CDN is not set, such as the local target. The helper at cdn-purge.ts:43-47 calls purgeCdnCache, which sends DELETE /cdn/... with expectedStatus: 200 and retries: 3 (cdn-purge.ts:532-536). It also calls requireServiceKey(). This diff adds unconditional calls to it in rest-extended.test.ts:479 and :791 (describe profiles: ['core'], no cdn requirement) and in rest-object-versioning.test.ts (requires: ['versioning'] only). Those tests never touch the CDN on the base branch. After this change they fail with 'Unexpected HTTP status for DELETE .../cdn/...' whenever the server has no CDN purge endpoint configured (src/storage/cdn/cdn-cache-manager.test.ts:254 tests the cdnPurgeEndpointURL: undefined case). The capabilities.cdn flag (config.ts:184) exists to gate exactly this, but the helper does not consult it.
Verification: In acceptance/support/cdn-purge.ts, purgeCdnCacheIfNeeded (lines 43-47) checks only
if (getAcceptanceConfig().cdnNeedsManualPurge), and purgeCdnCache (lines 34-38) sendsDELETE /cdn/...withexpectedStatus: 200. config.ts:129 never ties it tocdnEnabled(config.ts:171). The diff calls the helper from rest-extended.test.ts:479 and rest-object-versioning.test.ts:463, which then fail. Hence nit.
| { versionId: a.version } | ||
| ) | ||
| const historical = await client.request('GET', historicalRoute, { | ||
| expectedCacheStatus: isSigned ? 'MISS' : 'HIT', |
There was a problem hiding this comment.
🔴 Signed-URL versioning tests will fail on any V2 edge that verifies signed tokens itself, even though the CDN is behaving correctly. They hard-code a MISS for a later signed token on an etag that is already warm. cdn.test.ts:901-917 shows such tokens share the object-level entry and return HIT. Fix: read x-smart-cdn-access from the warm-up response and expect HIT when it is signed-verified, as cdn.test.ts does, which covers the 3 sites listed. Same pattern at 3 sites (cdn-object-versioning.test.ts:127, :226, :286).
Why this was flagged
The trigger is a V2 project whose edge verifies signed tokens, so responses carry x-smart-cdn-access: signed-verified. cdn.test.ts:901-910 already treats that case as valid: a second signed token for the same object gets a HIT on the entry the first token warmed. cdn-object-versioning.test.ts:127 requests current, which resolves to etag B after routeB was warmed, and expects isSigned ? 'MISS' : 'HIT'. Lines 226 and 286 send historical versionId requests for etag A after the current route warmed A, with the same expectation. On such an edge every attempt returns HIT, and the client throws Unexpected cache status after CACHE_RETRIES (15) attempts. So the signed suite fails even though the CDN behaves as designed. These tests are new, so the base branch has nothing to compare against. Retries do not help because each attempt keeps returning HIT.
Verification: Trigger: a Smart CDN V2 project whose edge verifies signed tokens, so responses carry x-smart-cdn-access: signed-verified. cdn.test.ts:901-910 then expects a second signed token to get 'HIT'. cdn-object-versioning.test.ts makes no such check, so line 127 always expects isSigned ? 'MISS' : 'HIT', as do lines 226 and 286. http.ts (lines 102-113) throws on a mismatch, so all 15 CACHE_RETRIES fail.
| } else if (versionId) { | ||
| url += '?versionId=' + encodeURIComponent(versionId) | ||
| } |
There was a problem hiding this comment.
🟡 (optional) Against this repo's storage server, version-scoped purges clear the whole object, so both V2 per-version purge tests fail. The helper sends ?versionId= to DELETE /cdn/:bucket/*. But purgeQuerySchema (src/http/routes/cdn/purgeCache.ts:25) only declares transformations, so the handler ignores it. Fix: add versionId support to the purge route in this change, or gate both tests on a server that has it. The tests sit at cdn-object-versioning.test.ts:370 and :416.
Why this was flagged
The trigger is a run with ACCEPTANCE_CDN_VERSION=2 against a server built from this checkout. In 'purges only the targeted version...', purgeCdnCache(client, { bucketName, objectKey, versionId: a }) at cdn-object-versioning.test.ts:370 builds /cdn/<bucket>/<key>?versionId=.... The /:bucketName/* handler in src/http/routes/cdn/purgeCache.ts:123-133 reads only transformations and calls cdnCache.purge({ type: 'object', ... }). That purges every cached entry for the object. The hitB and hitCurrent requests run with no retries and expect 'HIT', so they get MISS and the test fails. With ACCEPTANCE_CDN_NEEDS_PURGE=true, the same thing happens at :416 in the auto-purge test, so the stillCurrent HIT assertion fails. No guard catches the unknown query param. The schema has no additionalProperties:false, so the server ignores it and still returns 200 'success'.
Verification: nit. The trigger is a run with ACCEPTANCE_CDN_VERSION=2 against a storage server built from this checkout. On the server, purgeQuerySchema (src/http/routes/cdn/purgeCache.ts:25-30) declares only transformations. So a version-scoped purge is sent upstream as a purge of the whole object. Nothing in the diff adds versionId support to the server route.
1d8b632 to
898f66d
Compare
What kind of change does this PR introduce?
Adds more test coverage for CDN behavior and support for Smart CDN V2 differences
Adds
ACCEPTANCE_CDN_NEEDS_PURGE(default false) to manual purge cache where the storage service will be expected to actively purge in the future. This can be removed once #1772 is deployed and enabled.Adds
ACCEPTANCE_CDN_VERSION(default V1) to allow checking V2 specific expectations and timing. This can be removed once all projects are migrated to V2.Adds cache key edge cases which includes cache keys that cannot be purged with Smart CDN V1. These tests fail against V1 projects and pass when run on projects using Smart CDN V2.
Adds test that creates/rotates signing keys across both supported algorithms and confirms CDN behavior for both. Asymmetric keys should share cache, symmetric must not. This test cannot currently clean up after itself because there is no delete jwk endpoint (I'll add one before we enable this test)