Skip to content

patch 1.4.20#1637

Merged
SaltyAom merged 15 commits intomainfrom
next
Jan 3, 2026
Merged

patch 1.4.20#1637
SaltyAom merged 15 commits intomainfrom
next

Conversation

@SaltyAom
Copy link
Copy Markdown
Member

@SaltyAom SaltyAom commented Dec 26, 2025

Summary by CodeRabbit

  • New Features

    • ModelValidator.schema added for direct access to raw schemas.
    • WebSocket clients expose a readonly subscriptions list to inspect current topics.
  • Improvements

    • Broader schema resolution for imported references to improve model validation.
    • Enforced fetch handlers to return promise-compatible responses.
  • Bug Fixes

    • Fixed crash when models reference non-TypeBox schemas.
    • Fixed ReferenceError when error handlers return plain objects with response mapping.
  • Tests

    • Added test for route params derived from models.
  • Chores

    • Bumped package to 1.4.20 and added changelog entry.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Dec 26, 2025

Warning

Rate limit exceeded

@SaltyAom has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 2 minutes and 8 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 7337ba7 and 87c7836.

📒 Files selected for processing (2)
  • src/schema.ts
  • src/utils.ts

Walkthrough

Adds ModelValidator.schema, broadens Import/$ref resolution with model fallback and passes models into Import, exposes websocket subscriptions on WS types/instances, tightens compose typings/output formatting, bumps package to v1.4.20, adjusts route-unwrapping conditional, updates example to export a WS app, and adds a params-with-model test.

Changes

Cohort / File(s) Summary
Version & Changelog
CHANGELOG.md, package.json
Bump to v1.4.20 and add changelog entry listing improvements and bug fixes.
Type definitions
src/types.ts
Add schema: T property to ModelValidator<T>; change UnwrapRoute params conditional from InputSchema<never> extends Schema to {} extends Schema.
Schema & model resolution
src/schema.ts, src/index.ts
getSchemaValidator now falls back to models[schema.$ref] when $defs lookup is missing; models getter passes { models: this.definitions.type } into Import.
WebSocket runtime surface
src/ws/bun.ts, src/ws/index.ts, example/a.ts
Add subscriptions: string[] property to ServerWebSocket and ElysiaWS; example a.ts exported app and switched to a WebSocket-based entry.
Codegen / compose output
src/compose.ts
Import MaybePromise and set composeGeneralHandler return type to (request: Request) => MaybePromise<Response); minor whitespace/newline edits in generated error handling.
Tests
test/types/index.ts
Add "params with model" test validating model-based dot-notation fields resolve into route params.

Sequence Diagram(s)

(Skipped — changes are type/schema resolution, API surface additions, typing and formatting edits; no new multi-component sequential control flow.)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐇 I nibble schemas in moonlit code,

Models sprout paths where routes once strode,
Subscriptions hum like carrots sweet,
Params hop home on nimble feet,
I thump a beat — new release to greet 🥕

Pre-merge checks

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'patch 1.4.20' directly corresponds to the main change in the PR: updating the version from 1.4.19 to 1.4.20 with multiple bug fixes and improvements documented in CHANGELOG.md.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Dec 26, 2025

Open in StackBlitz

npm i https://pkg.pr.new/elysiajs/elysia@1637

commit: 87c7836

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (2)
src/types.ts (2)

546-551: UnwrapRoute.params condition is now looser; confirm it matches intended inference

Changing:

params: {} extends Schema['params']
  ? ResolvePath<Path>
  : InputSchema<never> extends Schema
    ? ResolvePath<Path>
    : UnwrapSchema<Schema['params'], Definitions>

to:

params: {} extends Schema['params']
  ? ResolvePath<Path>
  : {} extends Schema
    ? ResolvePath<Path>
    : UnwrapSchema<Schema['params'], Definitions>

means we now fall back to ResolvePath<Path> whenever the overall Schema type is “empty‑ish” ({} extends Schema), not just when it’s assignable from InputSchema<never>.

That likely improves the “no explicit params” case, but it can also catch schemas where all fields (including params) are optional and thus structurally compatible with {}. Please verify via type tests that:

  • Routes with explicitly defined params schema still get UnwrapSchema<Schema['params'], Definitions> (not ResolvePath<Path>).
  • Guard/macro‑produced schemas that only add optional fields but no params still benefit from ResolvePath<Path> as intended.

If any regressions appear, a more targeted condition such as checking for the absence/unknown-ness of Schema['params'] rather than {} vs whole Schema might be safer.


2356-2368: New ModelValidator.schema surface is reasonable; ensure runtime implementations populate it correctly

Adding:

export interface ModelValidator<T> extends TypeCheck<T> {
  schema: T
  parse(a: T): T
  // ...
}

is consistent with TypeBox’s TypeCheck.schema for TypeBox models and gives a convenient way to get back to the underlying schema for both TypeBox and non‑TypeBox validators.

Two follow‑ups to consider:

  • Make sure all ModelValidator instances returned by getSchemaValidator actually expose a schema property of type T at runtime for:
    • TypeBox models (TSchema)
    • StandardSchemaV1Like models
  • (Optional) The error branch of safeParse currently uses success: true; if you ever touch this again, you may want to correct that to success: false for clearer discriminated unions, though changing it now would be a breaking type change.
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 00ea802 and 42d6eec.

📒 Files selected for processing (7)
  • CHANGELOG.md
  • example/a.ts
  • package.json
  • src/index.ts
  • src/schema.ts
  • src/types.ts
  • test/types/index.ts
🧰 Additional context used
🧬 Code graph analysis (2)
test/types/index.ts (1)
src/index.ts (3)
  • Elysia (190-8168)
  • Elysia (8170-8170)
  • t (8172-8172)
src/schema.ts (3)
src/types.ts (1)
  • StandardSchemaV1Like (58-70)
src/utils.ts (1)
  • randomId (964-983)
src/replace-schema.ts (1)
  • replaceSchemaTypeFromManyOptions (37-50)
🔇 Additional comments (13)
package.json (1)

4-4: LGTM! Version bump aligns with changelog.

The patch version increment to 1.4.20 is appropriate and consistent with the changelog entry.

CHANGELOG.md (1)

1-7: LGTM! Changelog entry properly documents the release.

The 1.4.20 changelog entry clearly describes the improvement (ModelValidator.schema access) and bug fix (Elysia.models with non-typebox models), aligning with the PR objectives.

test/types/index.ts (1)

2956-2971: This test is valid. The "// ?" comment indicates a regression test checking that parameter type inference from the URL path works correctly even when models are registered on the app. The models are intentionally unused—the test verifies that their presence doesn't interfere with param inference. This pattern is consistent with other tests in the file (e.g., "// ? infer params name", "// ? infer multiple params name").

Likely an incorrect or invalid review comment.

src/index.ts (1)

468-474: Aligning .models with model-aware validators looks good; please verify non-TypeBox behavior

Passing { models: this.definitions.type } into getSchemaValidator here matches how validators are built elsewhere and should allow model-based resolution inside imported TypeBox schemas.

One thing to double-check: Object.keys(this.definitions.type) includes non‑TypeBox models, but you always call this.definitions.typebox.Import(name as never). For models that exist only as StandardSchemaV1Like entries, this still relies on the new fallback logic in getSchemaValidator/resolveSchema to behave correctly. It would be good to have/confirm a test where:

  • app.model('ZodUser', someStandardSchema)
  • app.models.ZodUser is accessed and works without throwing at runtime.
src/schema.ts (6)

134-150: LGTM!

The formatting changes to resolveSchema improve readability without altering the function's behavior.


172-180: LGTM!

The multi-line formatting of the conditional improves code readability.


469-472: LGTM!

The refactored hasAdditionalCoerce calculation is clearer and maintains the same logic.


709-721: LGTM!

The multi-line formatting of the schema replacement logic significantly improves readability without changing behavior.


1111-1114: LGTM!

The multi-line array spread formatting improves readability while maintaining identical semantics.


21-21: No issue found—the deepClone import removal is correct.

deepClone is not used in this file and has been properly removed from the imports. The function remains available in utils.ts for any other modules that may need it.

example/a.ts (3)

1-14: LGTM! Good demonstration of the new .model() API.

This example effectively demonstrates:

  • The new .model() configuration method
  • Support for both TypeBox schemas (lines 6-9)
  • Support for Zod schemas (lines 10-13)

This aligns well with the PR's objective to support referencing non-TypeBox models.


22-22: LGTM! Good demonstration of the new schema property access.

The console.log statement appropriately demonstrates the new public API for accessing app.models.sign.schema, which is one of the key features introduced in this release (v1.4.20).


16-19: Remove or correct the misleading commented code.

Line 17 uses .Schema() (method) instead of the correct .schema (property) shown on line 22. Additionally, the "For TypeBox" comment is misleading—the code accesses app.models.zodSign (a Zod schema), not a TypeBox model. Either remove this commented example or correct it to use .schema and reference the appropriate model type.

Comment on lines +476 to 483
schema = schema.$defs[schema.$ref] ?? models[schema.$ref]

if (coerce || hasAdditionalCoerce) {
schema = replaceSchema(schema as TSchema)
if ('$id' in schema && !schema.$defs) {
schema.$id = `${schema.$id}_coerced_${randomId()}`;
}

if ('$id' in schema && !schema.$defs)
schema.$id = `${schema.$id}_coerced_${randomId()}`
}
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.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Search for other locations where schema.$ref and schema.$defs are accessed together
rg -n -C3 '\$defs\[\s*schema\.\$ref\s*\]' src/

Repository: elysiajs/elysia

Length of output: 1750


🏁 Script executed:

#!/bin/bash
# Read the context around lines 476-483 in src/schema.ts
sed -n '460,500p' src/schema.ts | cat -n

Repository: elysiajs/elysia

Length of output: 1377


🏁 Script executed:

#!/bin/bash
# Find the hasRef function definition
rg -n 'const hasRef|function hasRef|export const hasRef' src/

Repository: elysiajs/elysia

Length of output: 133


🏁 Script executed:

#!/bin/bash
# Get more context around line 475 to understand the logic flow
sed -n '470,490p' src/schema.ts | cat -n

Repository: elysiajs/elysia

Length of output: 783


🏁 Script executed:

#!/bin/bash
# Check the unwrapImportSchema function at lines 1351-1356
sed -n '1351,1360p' src/schema.ts | cat -n

Repository: elysiajs/elysia

Length of output: 292


🏁 Script executed:

#!/bin/bash
# Get the full hasRef function definition
sed -n '285,310p' src/schema.ts | cat -n

Repository: elysiajs/elysia

Length of output: 1032


🏁 Script executed:

#!/bin/bash
# Search for where Import schemas are created to understand their structure
rg -n "Kind.*===.*'Import'" src/ -A 3 | head -50

Repository: elysiajs/elysia

Length of output: 1645


🏁 Script executed:

#!/bin/bash
# Search for usages of unwrapImportSchema
rg -n 'unwrapImportSchema' src/

Repository: elysiajs/elysia

Length of output: 634


🏁 Script executed:

#!/bin/bash
# Also check the context to understand when Import schemas are created
# and if schema.$defs[schema.$ref] can ever be undefined
sed -n '158,165p' src/schema.ts | cat -n

Repository: elysiajs/elysia

Length of output: 338


🏁 Script executed:

#!/bin/bash
# Check how unwrapImportSchema is used in compose.ts to see if there's protection
sed -n '715,725p' src/compose.ts | cat -n

Repository: elysiajs/elysia

Length of output: 551


🏁 Script executed:

#!/bin/bash
# Check the context of another unwrapImportSchema usage
sed -n '1355,1370p' src/compose.ts | cat -n

Repository: elysiajs/elysia

Length of output: 583


🏁 Script executed:

#!/bin/bash
# Verify if the Import schema is guaranteed to have schema.$defs[schema.$ref]
# by checking how Import schemas are created
rg -n "t\.Import|Kind.*Import" src/schema.ts | grep -E "export|function" | head -10

Repository: elysiajs/elysia

Length of output: 41


🏁 Script executed:

#!/bin/bash
# Check if hasRef function can handle undefined input
sed -n '285,295p' src/schema.ts | cat -n

Repository: elysiajs/elysia

Length of output: 444


🏁 Script executed:

#!/bin/bash
# Check the critical line 475 - does hasRef protect against undefined?
# and verify if schema.$defs[schema.$ref] could be undefined at this point
rg -n "if.*hasRef\(schema\.\$defs" src/schema.ts -A 2 -B 2

Repository: elysiajs/elysia

Length of output: 41


🏁 Script executed:

#!/bin/bash
# Verify the actual potential issue - what happens if schema.$defs is undefined
# when we call hasRef(schema.$defs[schema.$ref])?
python3 << 'EOF'
# Simulate what happens at line 475
schema_defs = None  # or could be undefined
schema_ref = "someRef"

# This is what line 475 does:
try:
    result = schema_defs[schema_ref]
    print(f"Result: {result}")
except TypeError as e:
    print(f"ERROR at line 475: {e} - trying to access undefined schema.$defs")
EOF

Repository: elysiajs/elysia

Length of output: 145


🏁 Script executed:

#!/bin/bash
# Look at the exact context around line 475 with more lines
sed -n '473,478p' src/schema.ts | cat -n

Repository: elysiajs/elysia

Length of output: 312


🏁 Script executed:

#!/bin/bash
# Check if schema.$defs is guaranteed to exist before line 475
# by looking at how Import schemas are created
rg -n 'Kind.*Import' src/schema.ts -B 5 | head -40

Repository: elysiajs/elysia

Length of output: 1255


🏁 Script executed:

#!/bin/bash
# Check if there are any Import schemas created without $defs
rg -n "schema\.\[Kind\]\s*=\s*'Import'" src/ -A 5 | head -50

Repository: elysiajs/elysia

Length of output: 41


🏁 Script executed:

#!/bin/bash
# Look at the full context - is schema.$defs guaranteed to exist?
# Check what happens before line 475
sed -n '440,478p' src/schema.ts | cat -n

Repository: elysiajs/elysia

Length of output: 1377


🏁 Script executed:

#!/bin/bash
# Check if Import schemas are always created with $defs
# by looking at the t.Import or Module creation
rg -n "\.Import\(" src/ -B 3 -A 3 | head -60

Repository: elysiajs/elysia

Length of output: 1688


🏁 Script executed:

#!/bin/bash
# Check dynamic-handle.ts to see how it safely handles this
sed -n '30,40p' src/dynamic-handle.ts | cat -n

Repository: elysiajs/elysia

Length of output: 438


🏁 Script executed:

#!/bin/bash
# Check if there's a potential issue at line 475 with direct access
# Is schema.$defs always defined for Import schemas?
# Let's look for where schema.$defs could be undefined
rg -n "Kind.*===.*'Import'" src/schema.ts -A 5 | grep -E "(\$defs|schema\.\[)" | head -20

Repository: elysiajs/elysia

Length of output: 41


🏁 Script executed:

#!/bin/bash
# Check the actual issue - line 475 does direct access without checking $defs exists
# while line 476 has a fallback. Is this inconsistent?
sed -n '473,483p' src/schema.ts

Repository: elysiajs/elysia

Length of output: 428


🏁 Script executed:

#!/bin/bash
# Verify if unwrapImportSchema at line 1354 has the same vulnerability
sed -n '1351,1360p' src/schema.ts

Repository: elysiajs/elysia

Length of output: 250


🏁 Script executed:

#!/bin/bash
# Let me verify - is line 475 accessing schema.$defs without safety check?
# This could be a critical issue
sed -n '474,477p' src/schema.ts | cat -n

Repository: elysiajs/elysia

Length of output: 232


🏁 Script executed:

#!/bin/bash
# Check if hasRef handles undefined gracefully
sed -n '285,290p' src/schema.ts

Repository: elysiajs/elysia

Length of output: 254


🏁 Script executed:

#!/bin/bash
# Double-check: what happens if schema.$defs is undefined at line 475?
# Line 475: if (!hasRef(schema.$defs[schema.$ref]))
# This will throw TypeError if schema.$defs is undefined
rg -n "if.*!hasRef.*\\\$defs" src/schema.ts

Repository: elysiajs/elysia

Length of output: 108


Critical: Line 475 still has unsafe direct access to schema.$defs.

The added fallback ?? models[schema.$ref] at line 476 addresses missing references but does not prevent the TypeError at line 475 (if (!hasRef(schema.$defs[schema.$ref]))). If schema.$defs is undefined, accessing schema.$defs[schema.$ref] throws before the fallback can apply.

Both lines 475 and 476 need optional chaining for safety: schema.$defs?.[schema.$ref] (as seen in dynamic-handle.ts line 35).

Additionally, unwrapImportSchema (lines 1354-1355) has the identical vulnerability without any fallback: schema.$defs[schema.$ref][Kind] will throw if schema.$defs is undefined.

The condition at line 481 ('$id' in schema && !schema.$defs) is appropriate.

}

let schema = mapSchema(s)
// console.log([s, schema])
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.

🛠️ Refactor suggestion | 🟠 Major

Remove debug console.log before merging.

This commented-out debug statement should be removed to keep the codebase clean.

🔎 Proposed fix
-	// console.log([s, schema])
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// console.log([s, schema])
🤖 Prompt for AI Agents
In src/schema.ts around line 505, there is a commented-out debug console.log("//
console.log([s, schema])"); remove this commented debug statement entirely to
clean up the codebase before merging.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (4)
src/compose.ts (1)

2661-2661: Consider maintaining consistent spacing in generated code.

The space removal around the assignment operator (error.message=error.response) creates formatting inconsistency with similar assignments elsewhere in the file that maintain spaces (e.g., line 2624 uses error.message=error.response without spaces as well, but many other assignments in the file use spaces).

example/a.ts (3)

2-2: Remove unused import.

The z import from 'zod' is not used anywhere in this example file.

🔎 Proposed fix
-import { z } from 'zod'

5-14: Clarify the example's purpose or demonstrate more practical patterns.

The current example has mapResponse completely ignoring the responseValue and always returning new Response('A'), which makes the onError handler's return value (line 8) meaningless. While the comment on line 7 suggests this tests a specific condition, as an example file, this pattern may confuse users about the intended use of these hooks.

Consider either:

  1. Adding clear documentation explaining what specific behavior this demonstrates, or
  2. Showing a more practical example where onError and mapResponse work together meaningfully.

16-18: Clarify the example pattern: listen() followed by handle().

Calling .listen(3000) (line 14) followed immediately by .handle() is an unusual pattern. Typically, you would either:

  • Use .listen() to start a server (for production/development), OR
  • Use .handle() directly for testing or programmatic request handling

If this example is meant to demonstrate testing or specific behavior, consider adding a comment to clarify the intent. Otherwise, consider splitting this into separate examples for server usage vs. request handling.

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 42d6eec and 2528880.

📒 Files selected for processing (3)
  • CHANGELOG.md
  • example/a.ts
  • src/compose.ts
✅ Files skipped from review due to trivial changes (1)
  • CHANGELOG.md
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-09-22T23:46:33.200Z
Learnt from: 81reap
Repo: elysiajs/elysia PR: 1431
File: src/dynamic-handle.ts:127-131
Timestamp: 2025-09-22T23:46:33.200Z
Learning: The File System Routing feature in Elysia is Bun-specific and only works with Bun.FileSystemRouter, so Bun-specific import patterns and path resolution using import.meta.url are acceptable in this context.

Applied to files:

  • example/a.ts
🔇 Additional comments (1)
src/compose.ts (1)

2679-2679: LGTM!

Adding the newline after the assignment improves the readability of the generated code.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 443eef2 and 127bc93.

📒 Files selected for processing (2)
  • CHANGELOG.md
  • example/a.ts
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-09-22T23:46:33.200Z
Learnt from: 81reap
Repo: elysiajs/elysia PR: 1431
File: src/dynamic-handle.ts:127-131
Timestamp: 2025-09-22T23:46:33.200Z
Learning: The File System Routing feature in Elysia is Bun-specific and only works with Bun.FileSystemRouter, so Bun-specific import patterns and path resolution using import.meta.url are acceptable in this context.

Applied to files:

  • example/a.ts
🧬 Code graph analysis (1)
example/a.ts (1)
src/adapter/bun/index.ts (1)
  • ws (432-652)
🔇 Additional comments (2)
CHANGELOG.md (1)

1-13: Changelog entry for v1.4.20 is well-structured and accurate.

The new release notes clearly document the improvements and bug fixes, with proper issue/PR references and consistent formatting matching existing entries. Content aligns with the PR objectives (ModelValidator.schema access, websocket subscriptions support, compose error handling, and model resolution fixes).

example/a.ts (1)

5-14: WebSocket example correctly demonstrates the new subscriptions feature.

The example effectively showcases the WebSocket functionality with the new subscriptions property (line 11) that's being exposed in this PR. The code structure is clean and demonstrates both subscribing to a topic (line 8) and accessing subscriptions. The zod version 4.1.5 referenced in the library context is valid and stable.

Comment on lines +1 to +3
import { Elysia, t } from '../src'
import { z } from 'zod'
import { req } from '../test/utils'
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.

⚠️ Potential issue | 🟡 Minor

Remove unused imports.

The imports t, z, and req are not used anywhere in the code. Since this is an example file meant to demonstrate library usage, removing unused imports will improve clarity and reduce confusion.

🔎 Proposed fix
-import { Elysia, t } from '../src'
-import { z } from 'zod'
-import { req } from '../test/utils'
+import { Elysia } from '../src'
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
import { Elysia, t } from '../src'
import { z } from 'zod'
import { req } from '../test/utils'
import { Elysia } from '../src'
🤖 Prompt for AI Agents
In example/a.ts lines 1-3, remove the unused imports t, z, and req from the
import statements; keep only the imports actually used (e.g., Elysia) so the
file only imports required symbols and avoid unused-import lint errors/clarity
issues.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 127bc93 and 7337ba7.

📒 Files selected for processing (1)
  • CHANGELOG.md

Comment on lines +7 to +15
Bug fix:
- [#1649](https://github.com/elysiajs/elysia/pull/1649) add null check for object properties (t.Record)
- [#1646](https://github.com/elysiajs/elysia/pull/1646) use constant-time comparison for signed cookie verification
- [#1639](https://github.com/elysiajs/elysia/issues/1639) compose: ReferenceError: "_r_r is not defined" when onError returns plain object & mapResponse exists
- [#1631](https://github.com/elysiajs/elysia/issues/1631) update Exact Mirror to 0.2.6
- [#1630](https://github.com/elysiajs/elysia/issues/1630) enforce fetch to return MaybePromise<Response>

Bug fix:
- `Elysia.models` broke when referencing non typebox model
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.

⚠️ Potential issue | 🟡 Minor

Consolidate duplicate "Bug fix:" header and add missing issue reference.

Lines 7-15 contain two separate "Bug fix:" headers, which breaks the standard changelog format used throughout the file. Additionally, the last item on line 15 lacks an issue/PR reference that all other entries include.

Merge the two sections into a single "Bug fix:" header and add a reference to the non-typebox model issue.

🔎 Proposed fix
 Bug fix:
 - [#1649](https://github.com/elysiajs/elysia/pull/1649) add null check for object properties (t.Record)
 - [#1646](https://github.com/elysiajs/elysia/pull/1646) use constant-time comparison for signed cookie verification
 - [#1639](https://github.com/elysiajs/elysia/issues/1639) compose: ReferenceError: "_r_r is not defined" when onError returns plain object & mapResponse exists
 - [#1631](https://github.com/elysiajs/elysia/issues/1631) update Exact Mirror to 0.2.6
 - [#1630](https://github.com/elysiajs/elysia/issues/1630) enforce fetch to return MaybePromise<Response>
-
-Bug fix:
-- `Elysia.models` broke when referencing non typebox model
+- `Elysia.models` broke when referencing non typebox model

Note: If the last item references a specific issue/PR, include its number in the format [#XXXX](link) before the description.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
Bug fix:
- [#1649](https://github.com/elysiajs/elysia/pull/1649) add null check for object properties (t.Record)
- [#1646](https://github.com/elysiajs/elysia/pull/1646) use constant-time comparison for signed cookie verification
- [#1639](https://github.com/elysiajs/elysia/issues/1639) compose: ReferenceError: "_r_r is not defined" when onError returns plain object & mapResponse exists
- [#1631](https://github.com/elysiajs/elysia/issues/1631) update Exact Mirror to 0.2.6
- [#1630](https://github.com/elysiajs/elysia/issues/1630) enforce fetch to return MaybePromise<Response>
Bug fix:
- `Elysia.models` broke when referencing non typebox model
Bug fix:
- [#1649](https://github.com/elysiajs/elysia/pull/1649) add null check for object properties (t.Record)
- [#1646](https://github.com/elysiajs/elysia/pull/1646) use constant-time comparison for signed cookie verification
- [#1639](https://github.com/elysiajs/elysia/issues/1639) compose: ReferenceError: "_r_r is not defined" when onError returns plain object & mapResponse exists
- [#1631](https://github.com/elysiajs/elysia/issues/1631) update Exact Mirror to 0.2.6
- [#1630](https://github.com/elysiajs/elysia/issues/1630) enforce fetch to return MaybePromise<Response>
- `Elysia.models` broke when referencing non typebox model
🤖 Prompt for AI Agents
In CHANGELOG.md around lines 7 to 15 there are duplicate "Bug fix:" headers and
the final bullet lacks an issue/PR reference; merge the two "Bug fix:" sections
into one contiguous "Bug fix:" header containing all bullets, and update the
last bullet to include the missing issue/PR reference in the same format as the
others (e.g. add `[#XXXX](https://github.com/elysiajs/elysia/pull/XXXX)` or
`[#XXXX](https://github.com/elysiajs/elysia/issues/XXXX)` immediately before the
description of "Elysia.models broke when referencing non typebox model").

@SaltyAom SaltyAom merged commit c163c89 into main Jan 3, 2026
4 checks passed
@coderabbitai coderabbitai bot mentioned this pull request Jan 14, 2026
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