Skip to content

fix(bb-file-bucket): return 404 for missing version downloads - #960

Merged
xyos merged 2 commits into
aws:mainfrom
ikenyal:fix/file-bucket-versioned-download-not-found
Nov 4, 2026
Merged

xyos merged 2 commits into
aws:mainfrom
ikenyal:fix/file-bucket-versioned-download-not-found

Conversation

@ikenyal

@ikenyal ikenyal commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Problem

A local FileBucket download URL with an explicit versionId silently serves the current file when the requested version is missing but a current file still exists. For example, after an older version is permanently deleted, bucket.get(path, { versionId }) returns null, but fetching the URL previously issued for that version returns HTTP 200 with the newer version's content.

The dev file-server only switches away from the current file when the requested version exists. If it does not exist, the request falls through to the current file instead of returning 404. This fallback is still present on current main.

Issue #, if available: None.

Changes

  • Resolve an explicit versionId directly to that version's body and metadata. A missing version reaches the existing 404 response instead of falling back to current content.
  • Add HTTP regression tests for an unknown version and a previously valid URL whose older version is permanently deleted. Preserve valid-version downloads and URLs without versionId, including their content types.
  • Add a comprehensive frontend-API regression for fetching a deleted version's URL while a newer version remains.
  • Document the local download behavior and include a patch changeset for @aws-blocks/bb-file-bucket and @aws-blocks/blocks.
  • Merge current main and resolve the README/DESIGN conflicts without losing fix(bb-file-bucket): reconcile current files after version deletion #693's current-copy reconciliation or its documented historical delete-marker limitation.

The AWS runtime, public library API, token validation, and mock storage format are unchanged. Merged PR #693 reconciles the current object's stored copies after version deletion; this PR independently fixes HTTP requests that explicitly select a version. It does not add historical delete-marker support.

Validation

  • Rechecked both HTTP regressions against the latest main server source, using the real FileBucket and HTTP server: both fail with HTTP 200 instead of 404 before the fix, and pass after it. The checked-in source is unchanged by this validation.
  • The HTTP tests also verify that a valid old version downloads correctly before deletion, that the removed version agrees with bucket.get() returning null, and that current downloads still return the correct content and Content-Type with and without an explicit current version ID.
  • The comprehensive frontend-API regression passes on the updated branch.
  • npm run build
  • npm run lint and npm run lint:deps
  • npm test -w @aws-blocks/bb-file-bucket
  • npm test across all workspaces, with serial test-file execution and all four generate-client fixture cases run in separate processes; none excluded
  • npm run test:e2e:local, including comprehensive E2E, vendorize, IAM-boundary synth, and background-suite regression tests
  • API reports, export consistency, client user-agent consistency, packed assets, runtime guards, documentation synchronization, and changeset guards and their regression tests
  • git diff --check upstream/main

Checklist

  • PR description included
  • Tests are changed or added
  • Relevant documentation is changed or added (and PR referenced)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@ikenyal
ikenyal requested a review from a team as a code owner October 22, 2026 20:25
@changeset-bot

changeset-bot Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 2d2cb36

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@aws-blocks/bb-file-bucket Patch
@aws-blocks/blocks Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@xyos xyos left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM. Explicit-versionId downloads now resolve only from that version, matching get().

@xyos
xyos merged commit f643a76 into aws:main Nov 4, 2026
42 checks passed
harsh62 added a commit that referenced this pull request Nov 4, 2026
Brings in the blocks CLI (#1203), CLI-calling templates (#1207),
AuthBasic sign-in metrics (#1296), docs corrections (#1288), the
native export type-name rule (#1134), the consolidated Data block
bb-database (#774), CI checkout of the PR merge commit (#1291) and
smaller fixes (#960, #1292, #1294).

Conflict resolutions:
- packages/bb-auth-basic, bb-auth-cognito/DESIGN.md, bb-auth-oidc:
  kept deleted. #1288's cookie correction already holds in Auth's
  DESIGN.md; #1203's `cdk-blocks secret` wording has no Auth
  counterpart (Auth's README uses `npm run secret`). #1296's metrics
  are not ported here (see the follow-up and the pending-changes note).
- Changesets naming deleted packages: auth-basic-signin-metrics and
  bb-auth-oidc-cdk-blocks-secret removed and folded into
  auth-replaced-blocks-pending-changes.md; docs-correct-infra-guidance
  drops bb-auth-cognito.
- templates/auth-cognito: not re-added (its e2e test is git rm'd).
  templates/auth/aws-blocks/scripts/*: deleted, as #1207 deleted them
  from every template; auth's package.json, README and gitignore
  auto-merged onto the cdk-blocks scripts.
- templates/default and react e2e tests: kept this branch's Auth
  sign-up-with-code flow and its per-run username, plus main's
  package.json port lookup and graceful server shutdown.
- create-blocks-app cli.test.ts: main's per-template tables name
  `auth`, not `auth-cognito`.
- package.json workspaces: bb-database added, old auth packages stay
  removed, bb-auth kept. packages/blocks/package.json: main's
  cdk-blocks bin, tsx dependency and cli tests, plus this branch's
  test files. package-lock.json regenerated with
  `npm install --package-lock-only`, keeping main's @aws/dsql-lint
  0.2.20.
- docs/DECISIONS.md: both sides kept. main's D-021 (export type
  names) keeps its number; the auth decision becomes D-022, and every
  link to it is updated. D-008's reference keeps the bb-auth path,
  without the PR numbers #1288 removed.
- native fixture 27 dart/client.dart: regenerated with
  regenerate-all.sh; the drift is #1134's APILink plus this branch's
  positional params.
- bb-database README quick start: Auth from @aws-blocks/bb-auth
  instead of AuthBasic.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants