Skip to content

feat(experimental): add http.readonly and http.returned field attrs - #204

Merged
ping-maxwell merged 8 commits into
better-auth:experimentalfrom
ping-maxwell:feat/experimental-http-readonly-returned
Sep 3, 2026
Merged

feat(experimental): add http.readonly and http.returned field attrs#204
ping-maxwell merged 8 commits into
better-auth:experimentalfrom
ping-maxwell:feat/experimental-http-readonly-returned

Conversation

@ping-maxwell

Copy link
Copy Markdown
Collaborator

Wire and capability edges can reject fields the client must not set, and v.fn output validation strips fields that must not leave in the response. I also lifted the schema walk into core (parseFields / omitFields / rejectFields) so those gates stay attribute-key agnostic.

http.serverOnly still works as a deprecated alias of the readonly gate.

Wire edges can reject client-set fields, fn output validation strips
response-excluded fields, and core parseFields/omitFields/rejectFields
back those gates without hard-coding HTTP keys.
@pkg-pr-new

pkg-pr-new Bot commented Sep 3, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/better-call@204

commit: 619a07b

@greptile-apps

greptile-apps Bot commented Sep 3, 2026

Copy link
Copy Markdown

Greptile Summary

The PR adds http.readonly and http.returned field attributes and centralizes attribute-based schema projection and rejection.

  • Rejects readonly fields at HTTP and capability boundaries while retaining serverOnly as a deprecated alias.
  • Projects returned fields out of validated function outputs.
  • Adds async-aware union selection and projected fallbacks to the shared schema helpers.

Confidence Score: 4/5

The PR is not yet safe to merge because nested-union defaults and transforms can still execute twice despite the attempted probe-result reuse fix.

The selected outer union arm is validated once by parseFields, but rejectFields subsequently validates nested union arms again, repeating default factories or transform side effects and leaving the previously reported duplicate-validation defect outstanding.

Files Needing Attention: packages/experimental/src/schema.ts

Reviews (7): Last reviewed commit: "fix(experimental): reuse union probe res..." | Re-trigger Greptile

Comment thread packages/experimental/src/schema.ts
Comment thread packages/experimental/src/schema.ts Outdated
Comment thread packages/experimental/src/schema.ts Outdated
Comment thread packages/experimental/src/schema.ts Outdated
Comment thread packages/experimental/src/schema.ts Outdated
Comment thread packages/experimental/src/schema.ts
Comment thread packages/experimental/src/schema.ts Outdated
@ping-maxwell
ping-maxwell merged commit 56bc136 into better-auth:experimental Sep 3, 2026
6 checks passed
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