Skip to content

docs(overview): Describe AsyncLocalStorage wrapping and global context#2060

Merged
Tobbe merged 2 commits into
mainfrom
tobbe-docs-overview-als
Jul 8, 2026
Merged

docs(overview): Describe AsyncLocalStorage wrapping and global context#2060
Tobbe merged 2 commits into
mainfrom
tobbe-docs-overview-als

Conversation

@Tobbe

@Tobbe Tobbe commented Jul 8, 2026

Copy link
Copy Markdown
Member

Explain how and where asl wrapping is applied. Plus how and where the global context is populated

@netlify

netlify Bot commented Jul 8, 2026

Copy link
Copy Markdown

Deploy Preview for cedarjs ready!

Name Link
🔨 Latest commit 560615c
🔍 Latest deploy log https://app.netlify.com/projects/cedarjs/deploys/6a4e4f6ee80f750008fc5451
😎 Deploy Preview https://deploy-preview-2060--cedarjs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions github-actions Bot added this to the next-release-patch milestone Jul 8, 2026
@greptile-apps

greptile-apps Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR documents how ALS wrapping and global context population work. The main changes are:

  • Added a new ALS wrapping and global context section.
  • Explained how context reads and writes through the ALS store.
  • Added a deployment matrix for GraphQL, functions, and Universal Deploy paths.

Confidence Score: 4/5

This is close, but the serverless GraphQL row should be corrected before merging.

  • The new docs mostly match the GraphQL-only setContext() behavior.
  • The Netlify/Vercel GraphQL row still omits the internal createGraphQLHandler ALS wrapping.
  • That can send readers to the wrong runtime boundary when debugging context.currentUser.

docs/implementation-docs/2026-03-26-cedarjs-project-overview.md

Important Files Changed

Filename Overview
docs/implementation-docs/2026-03-26-cedarjs-project-overview.md Adds the ALS/global-context overview and deployment matrix, with one serverless GraphQL mechanism that still needs correction.

Reviews (2): Last reviewed commit: "Add "why"" | Re-trigger Greptile

Comment thread docs/implementation-docs/2026-03-26-cedarjs-project-overview.md
| **Non-UD dev** — Functions | Fastify `onRequest` hook | ✅ | ❌ | ❌ `undefined` |
| **Non-UD serve/deploy** (baremetal/docker) — GraphQL | Fastify `onRequest` hook | ✅ | ✅ plugin chain | ✅ |
| **Non-UD serve/deploy** (baremetal/docker) — Functions | Fastify `onRequest` hook | ✅ | ❌ | ❌ `undefined` |
| **Non-UD deploy** (Netlify/Vercel serverless) — GraphQL | Babel safety net in output | ✅ | ✅ plugin chain | ✅ |

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.

P1 Serverless GraphQL path This row still points readers to only the Babel safety net for Netlify/Vercel GraphQL wrapping. Standard GraphQL handlers are also wrapped inside createGraphQLHandler with getAsyncStoreInstance().run(new Map(), ...), so a reader debugging context.currentUser can still inspect the wrong boundary if the outer transform is absent or skipped. Please include the internal GraphQL handler wrapping in this mechanism.

Suggested change
| **Non-UD deploy** (Netlify/Vercel serverless) — GraphQL | Babel safety net in output || ✅ plugin chain ||
| **Non-UD deploy** (Netlify/Vercel serverless) — GraphQL | `createGraphQLHandler` internal `store.run()` + Babel safety net in output || ✅ plugin chain ||

Context Used: Make sure everything in docs/implementation-docs/2... (source)

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

For an overview doc targeted towards framework developers, not Cedar App developers, this is fine.

@Tobbe Tobbe merged commit 5876968 into main Jul 8, 2026
37 checks passed
@Tobbe Tobbe deleted the tobbe-docs-overview-als branch July 8, 2026 13:28
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.

1 participant