Implement staged Read Need-Fit boundary#7
Conversation
|
Deployment failed with the following error: |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Superseded by #8 from gate-number-prefixed branch v28/gate-3-staged-reading-need-fit. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 748ee9c32f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| export function isAcceptedReadNeed(value: unknown): value is ReadNeed { | ||
| const record = recordValue(value); | ||
| return Boolean( | ||
| record?.schema === 'bitcode.read.need' && | ||
| record.reviewState === 'accepted' && | ||
| typeof record.needId === 'string' && | ||
| typeof record.measurementRoot === 'string' | ||
| ); |
There was a problem hiding this comment.
Reject incomplete accepted Needs
When a caller supplies acceptedReadNeed/readNeed from the harness manifest or API with only schema, reviewState, needId, and measurementRoot, this guard treats it as accepted even though read and sourceConstraints may be missing. normalizeDepositorySearchRead then calls readNeedToDepositorySearchRead and dereferences need.read.prompt / need.sourceConstraints, so a malformed accepted Need crashes the pipeline instead of producing the intended blocked_readiness admission failure. Please validate the required nested fields before admitting the Need.
Useful? React with 👍 / 👎.
| const weightedAdmittedVolume = weightedMeasurementVolume( | ||
| input.need.pricingMeasurementInputs.measurementVector, | ||
| Math.max(0, Math.min(1, input.admittedFitQuality)) | ||
| ); |
There was a problem hiding this comment.
Clamp non-finite fit quality before pricing
If the admitted fit quality is NaN or another non-finite number (for example from parsing an absent score), Math.min/Math.max propagate it into weightedMeasurementVolume, and the returned preview has weightedAdmittedVolume: NaN and sats: NaN despite the minimum fee. Since this preview is the deterministic Share-to-Fee boundary, non-finite quality should be rejected or coerced before calculating the BTC quote.
Useful? React with 👍 / 👎.
Summary
Verification