mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[GH-ISSUE #479] Phase 3/3: Cleanup dual-path ALS and evaluate per-call scopes #107
Labels
No labels
enhancement
enhancement
good first issue
help wanted
nextjs-tracking
nextjs-tracking
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/vinext#107
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Divkix on GitHub (Mar 11, 2026).
Original GitHub issue: https://github.com/cloudflare/vinext/issues/479
Problem
After Phases 1 and 2, all per-request state will be consolidated into
UnifiedRequestContext. However, there remain ALS scopes that are intentionally per-call, not per-request:cacheContextStorage(cache-runtime.ts:61) — Tracks cache context for individualcache()calls_unstableCacheAls(cache.ts:598) — Tracks whether execution is insideunstable_cache()These exist outside the unified scope because:
cache()calls)cache()call has its own context (tags, revalidate, cache life)Additionally, Phase 1 and 2 leave behind dual-path code — standalone ALS instances that exist only for backward compatibility. Once the unified scope is proven stable, these can be removed.
Goal
Phase 3A: Evaluate Per-Call Scope Consolidation
Current State
Questions to Answer
Should these be consolidated into unified context?
currentCacheContextfield toUnifiedRequestContextPerformance impact?
cache()callsCorrectness implications?
cache()calls need isolation from each other?Spike Tasks
cache()calls with current separate ALScache()calls with unified approachPhase 3B: Cleanup Dual-Path Code
What Gets Removed
After Phases 1 and 2 are stable (suggest waiting 2-4 weeks), remove standalone ALS fallbacks:
headers.ts
_alsstandalone instance_fallbackStateobjectisInsideUnifiedScope()check, but fail/throw if false in productionnavigation-state.ts
_alsstandalone instance_fallbackStateobjectcache.ts
_alsstandalone instance (for cache state)_fallbackStateobjectcache-runtime.ts
cacheContextStorage(per-call, not per-request)_privateCachestandalone ALS (unified has this now)fetch-cache.ts
_alsstandalone instance_fallbackStateobjectrequest-context.ts
_alsstandalone instance (for execution context)router-state.ts (after Phase 2)
_alsstandalone instance_fallbackStateobjecthead-state.ts (after Phase 2)
_alsstandalone instance_fallbackStateobjectWhat Stays (and why)
cacheContextStorage_unstableCacheAls_alsinunified-request-context.tsPhase 3C: Documentation
Architecture Document
Create
docs/als-architecture.mdexplaining:Code Comments
Update each shim module with:
Risks and Mitigations
Decision Gates
Gate 1: Phase 3A approval
Gate 2: Phase 3B timing
Related
shims/unified-request-context.tsEstimated Effort
Total: Medium — mostly waiting for stabilization between phases.
@Divkix commented on GitHub (Mar 11, 2026):
Closing this as a standalone phase. The ALS rollout is now being tracked as a 2-issue plan:
#451/ PR#450for the rollout itself, and#478for the remaining parity tests, cleanup, per-call ALS evaluation, and documentation. The remaining useful parts of this issue are folded into#478.