Skip to content

chore(vtex): bump @decocms/start devDep to 2.5.0 + drop responseHeaders bag fallback - #30

Merged
vibe-dex merged 1 commit into
mainfrom
chore/bump-deco-start-devdep-and-simplify-headers
May 1, 2026
Merged

vibe-dex merged 1 commit into
mainfrom
chore/bump-deco-start-devdep-and-simplify-headers

Conversation

@vibe-dex

@vibe-dex vibe-dex commented May 1, 2026

Copy link
Copy Markdown
Contributor

Summary

Resolves a stale `TODO` in `vtex/client.ts:15` that asked to remove a forward-compat fallback once `decocms/deco-start#57` shipped — that PR merged on 2026-03-30 (~5 weeks ago).

The `getResponseHeaders()` helper was carrying:

  1. An `(ctx as any).responseHeaders instanceof Headers` runtime check
  2. A bag-backed fallback that lazily created a `Headers` instance and stored it in `ctx.bag`

…because apps-start's `@decocms/start` devDep was still pinned to `^0.38.0`, which predates the `responseHeaders` property added in v0.39.0. Real consumers (baggagio, casaevideo-storefront) use `@decocms/[email protected]` via the `>=0.19.0` peerDep range, so they were already on the runtime fast path — the dead branch only existed to keep the typechecker happy.

Changes

  • `package.json`: `@decocms/start` devDep `^0.38.0` → `^2.5.0`. PeerDep (`>=0.19.0`) is unchanged — no impact on consumers.
  • `vtex/client.ts`: simplified `getResponseHeaders()` from 12 lines to 4. Dropped the `(ctx as any)` cast, the bag.set/bag.get fallback, and the `biome-ignore`. Updated the docstring to mention the floor version.

```diff
-/**

    • Get the response headers from RequestContext.
    • Uses `responseHeaders` when available (@decocms/start PR#57),
    • falls back to the bag with a lazily-created Headers instance.
    • TODO: Remove fallback once @decocms/start PR#57 is published.
  • */
    -function getResponseHeaders(): Headers | null {
  • const ctx = RequestContext.current;
  • if (!ctx) return null;
  • // biome-ignore lint/suspicious/noExplicitAny: forward-compat with upcoming responseHeaders property
  • if ((ctx as any).responseHeaders instanceof Headers) return (ctx as any).responseHeaders;
  • let headers = ctx.bag.get("responseHeaders") as Headers | undefined;
  • if (!headers) {
  •   headers = new Headers();
    
  •   ctx.bag.set(\"responseHeaders\", headers);
    
  • }
  • return headers;
    -}
    +/**
    • Outgoing response headers for the active request, or `null` when
    • called outside a request scope (which happens during module init).
    • `RequestContext.responseHeaders` was added to `@decocms/start` in
    • v0.39.0; we now require >=2.5.0 as a devDep so the property is
    • always typed/present.
  • */
    +function getResponseHeaders(): Headers | null {
  • const ctx = RequestContext.current;
  • return ctx ? ctx.responseHeaders : null;
    +}
    ```

Verification

```
$ npx tsc --noEmit
exit 0

(was 0 before — clean 0.38 → 2.5 bump in the surface area apps-start touches)

$ npx vitest run
Test Files 18 passed (18)
Tests 244 passed (244)
```

Test plan

  • CI passes
  • Confirm a consumer site (e.g. baggagio at `@decocms/[email protected]`) still receives session cookies via `Set-Cookie` headers (the only path that uses `getResponseHeaders`)

Made with Cursor

…rs bag fallback

`vtex/client.ts:getResponseHeaders` was carrying a forward-compat
fallback that bag-stored a `Headers` instance because
`RequestContext.responseHeaders` didn't exist when the function was
written. The TODO comment pointed at a PR — `decocms/blocks#57`,
merged 2026-03-30 — and the property has been part of every
`@decocms/start` release since v0.39.0.

apps-start's devDep was still pinned to `^0.38.0`, which is *before*
the new property landed, forcing the `(ctx as any).responseHeaders`
biome-ignored cast and the bag-backed fallback to satisfy the type
checker. Real consumers (baggagio, casaevideo-storefront) all use
>= 2.x via the `>=0.19.0` peerDep range, so they were silently using
the runtime fast path.

Changes:
- Bump `@decocms/start` devDep `^0.38.0` → `^2.5.0`. Peer dep
  (`>=0.19.0`) is unchanged — no impact on consumers.
- Simplify `getResponseHeaders()` from 12 lines to 4. Drop the
  `(ctx as any)` cast, drop the bag.set/bag.get fallback, drop the
  biome-ignore.
- Update the docstring to call out the floor version.

Verification:
- `npx tsc --noEmit` exits 0 (was 0 before too — no other type
  errors surfaced from a 0.38 → 2.5 bump in the surface area we use).
- `npx vitest run` → 18 files, 244 tests, all pass.

Made-with: Cursor
@vibe-dex
vibe-dex merged commit 460d216 into main May 1, 2026
2 checks passed
@github-actions

github-actions Bot commented May 1, 2026

Copy link
Copy Markdown

🎉 This PR is included in version 1.6.5 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant