Conversation
There was a problem hiding this comment.
Pull request overview
This PR focuses on small performance/cleanup optimizations across the backend, mainly by reducing repeated global lookups, tightening some parsing logic, and simplifying response streaming paths.
Changes:
- Refactor global mutable state from a single
mutableobject into dedicated live bindings (mutableDatabase,mutableHttpServer,mutableRootId) initialized via setters. - Micro-optimize hashing/token parsing (reuse ASCII85 options, avoid
split()allocations). - Simplify document read endpoints by returning the
ReadableStreamdirectly viactx.body(...)instead ofhono/streaming.
Reviewed changes
Copilot reviewed 25 out of 25 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/global.ts | Replaces mutable object with mutableDatabase/mutableHttpServer/mutableRootId and setter functions. |
| src/init.ts | Initializes the new globals via setters; computes and stores mutableRootId after migrations. |
| src/utils/document.ts | Uses mutableDatabase and cached mutableRootId for name generation / ownership checks. |
| src/utils/crypto.ts | Reuses ASCII85 options and avoids string splitting in verifyHash. |
| src/http/middleware/authorization.ts | Avoids split(".") and swaps to mutableDatabase access. |
| src/tasks/list/sweeper.ts | Uses mutableRootId and hoists env-derived age computations out of the loop. |
| src/http/handler.ts | Switches Cache-Control mutation from append to set. |
| src/endpoints/** | Mechanical updates to use mutableDatabase; some document endpoints return ReadableStream directly. |
| src/database/migration.ts | Updates global access usage inside a migration hook (see review comments). |
| src/database/index.ts | Replaces savepoint name generation with an incrementing counter; adds savepointId. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.