Skip to content

Settle the three decisions a 1.0 tag would freeze - #119

Merged
rasuvaeff merged 1 commit into
masterfrom
feat/freeze-the-1-0-surface
Sep 6, 2026
Merged

Settle the three decisions a 1.0 tag would freeze#119
rasuvaeff merged 1 commit into
masterfrom
feat/freeze-the-1-0-surface

Conversation

@rasuvaeff

Copy link
Copy Markdown
Owner

Fixes #116
Fixes #117
Fixes #118

Three decisions that cost nothing today and a major release after 1.0.

Operation is an output type (#116). Its constructor was public, but Contract is built only from documents and the validators are internal — a hand-built operation could be read back and asked for responseFor(), and nothing else. The constructor is now @internal; the class stays @api as the compiled read model consumers actually use. The alternative (a public entry taking a MatchedOperation) was rejected: requestBody/responses are array<array-key, mixed>, so it would promise fail-closed behaviour over input the package never validated.

CompiledParameter declares its variance (#117). Read-only for consumers, open to new keys in a minor. allowReserved is documented as what it is — a hand-off to consumers that render query values and cannot derive it from the schema — rather than as an annotation nobody reads. Validation still never reads it, and the docs now say why: after a message is parsed, an encoded reserved character cannot be told from an unencoded one.

Budgets belong to the caller (#118). Limits(documentBytes, messageBodyBytes, documentFiles) is accepted by all three factories as an optional last argument; Contract::MAX_DOCUMENT_BYTES/MAX_MESSAGE_BODY_BYTES give way to Limits::DEFAULT_* at the same values. A budget below 1 is refused.

The semantic half matters more than the knob. *.body.too_large accused a message the validator had merely declined to read, so a gate on isValid() rejected traffic it never judged — and a third ValidationResult state cannot be added after 1.0 without changing what isValid() === false means for every consumer. This keeps the two-state result and the codes, and makes the other half honest: the budget is the caller's, and the code says "we did not look".

roave reports four breaks (two constants, the @internal constructor twice), all deliberate; CHANGELOG declares 0.9.0 over v0.8.0, which is the boundary the BC job checks against.

Verification: composer build, composer rector, bin/package-audit green; mutation 2149 killed / 148 escaped, MSI 93% against a gate of 92.

`Operation` was half an input type and half an output type: its constructor is
public, but `Contract` is built only from documents and the validators are
internal, so a hand-built operation could be read back and asked for
`responseFor()` and nothing else. Mark the constructor `@internal` and keep the
class `@api` as the compiled read model consumers actually use, and declare the
variance of `CompiledParameter` while it is still free — read-only for
consumers, open to new keys in a minor. `allowReserved` is documented as what
it is: a hand-off to consumers that render query values and cannot derive it
from the schema, not an annotation nobody reads.

The byte budgets were constants with no way to raise them, and a body over one
was reported as a violation — accusing a message the validator had merely
declined to read, so a gate on `isValid()` rejected traffic it never judged.
`Limits` makes the policy the caller's, on the factories rather than on three
signatures, so later knobs land on the object; `too_large` keeps its code and
its two-state result and is documented as a refusal to look.
@coderabbitai

coderabbitai Bot commented Sep 6, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Team

Run ID: 6cb59f00-9c47-455d-8931-d616f28ddf38

Warning

Your free Security trial is over. An organization admin can upgrade to Advanced for continuous pull request security review or dismiss this notice.


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.

@rasuvaeff
rasuvaeff merged commit b84b3cd into master Sep 6, 2026
10 checks passed
@rasuvaeff
rasuvaeff deleted the feat/freeze-the-1-0-surface branch September 6, 2026 16:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant