capnweb-validate: ignore extra args instead of refusing the call - #227
Merged
Conversation
🦋 Changeset detectedLatest commit: a4e5bfe The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
commit: |
teamchong
force-pushed
the
ignore-extra-args
branch
4 times, most recently
from
July 31, 2026 18:18
172f252 to
f3aee16
Compare
Extra args past a method's declared parameters no longer fail the call: a
newer caller passing a parameter this build's signature doesn't know about is
normal schema evolution in JS/TS.
Ignored means the implementation never sees them. Args past what the spec
declares are dropped before the call, so the impl cannot read a value no
validator checked:
// spec generated from: greet(name: string)
greet(name: string, ...rest: unknown[]) { /* rest is always empty */ }
// spec generated from: sum(label: string, ...values: number[])
sum(label: string, ...values: number[]) { /* gets every arg, each validated */ }
Truncation only applies when the spec declares its params; a client-side spec
omits `args` entirely, so nothing is dropped there.
teamchong
force-pushed
the
ignore-extra-args
branch
from
July 31, 2026 18:22
f3aee16 to
7e1bc1c
Compare
dimitropoulos
approved these changes
Aug 3, 2026
dimitropoulos
left a comment
Collaborator
There was a problem hiding this comment.
I'm not 100% sold on the premise - but I understand the reasoning. maybe later it can be configurable (strict mode?)
dimitropoulos
self-requested a review
August 3, 2026 17:46
dimitropoulos
requested changes
Aug 3, 2026
dimitropoulos
left a comment
Collaborator
There was a problem hiding this comment.
let's document allowable evolution places (e.g. extra args, extra fields).
Adds a Schema Evolution section to the validate README: which type changes survive a version skew between peers, that extra object properties reach the implementation unvalidated while extra arguments are dropped, and that building without strictNullChecks emits a validator that refuses null values a strict peer considers valid.
dimitropoulos
approved these changes
Aug 4, 2026
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.
validateArgsrefused any call carrying more args than the method's declared parameter list. That breaks schema evolution: a caller built against a newer signature cannot pass a new parameter to a peer whose validator was generated from the old one, even though plain JS drops the unused arg.Before:
After:
Declared parameters are still validated, and a rest parameter still validates every extra arg.