Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review. 📝 WalkthroughWalkthroughThe server enables OpenAPI response validation only when ChangesAPI response validation
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix Suggested reviewers: Merge Risk: ⚪ Minimal · up to Response mismatches are logged while responses remain available, and the validation flag is correctly enabled for Cypress diagnostics. 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
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. A rabbit reads each line, Comment |
38beec2 to
b243890
Compare
Response validation was installed in September 2020 and lost three months later in 96f3861, the upgrade to express-openapi-validator v4.8.0: the move from `new OpenApiValidator().install()` to `OpenApiValidator.middleware()` did not carry `validateResponses` over. The workaround comment that exists for it is still in server/index.ts, six years later, with nothing left to guard. It comes back off by default, because a schema that has drifted from its handler would otherwise turn a working endpoint into a 500. With VALIDATE_API_RESPONSES=true a mismatch is logged and the response is still served, so the spec can be brought back in line one endpoint at a time. The Cypress job sets it, so the drift is reported on every run without failing anything. The logged paths drop their query string. The validator reports an undocumented status code with req.originalUrl as the error path, which would otherwise put a search term in a log file that the Logs page copies to the clipboard.
b243890 to
67dc180
Compare
There was a problem hiding this comment.
I have not reviewed this but from a quick look at the PR, there are a few details that violate our contributing guidelines, and we haven't made exceptions for it in the past either, so just wanted to flag it.
While we do appreciate the detail in the AI disclosure, since it's more specific than most we get here, read against our policy it describes Claude Code doing the actual implementation work, which is a violation of our contributing guidelines' AI policy. Claude Code traced the regression through git history, measured a live server against the spec, wrote the patch, and ran the build and tests, with your review coming afterward.
Our contributing guideline's AI assistance notice asks for AI-assisted development, where AI is used as a tool to assist with development that you are actually doing, not AI-driven development where the model is doing the implementation and you are reviewing the result. Reviewing or testing an AI-generated implementation afterward doesn't move a contribution from one category to the other. How clean the resulting diff reads doesn't change that either.
The same notice also expects PR descriptions to be your own words. The disclosure says this description started as Claude's draft and was edited by you, which is the same issue. An edited AI draft isn't a description written by you, no matter how much editing happened. Writing the PR description yourself takes a few minutes, so please just write it yourself next time.
To keep this open, I'd like to understand your reasoning around a couple of things the PR text doesn't already spell out. If an endpoint started returning a genuinely empty body on purpose, would the 204 rewrite mask that being wrong, or would it still catch it? And why log at warn rather than error, given the response is served either way?
If the intention is to have Claude do the implementation and then have you review what it produced, though, that's not something we can accept as a contribution here. At that point the implementation is being outsourced to the model rather than being your work with AI assisting you. If that's the workflow you want to use, that's fine, but those contributions will be closed without review under our existing guidelines for this repository.
Description
Streamyfin is a Jellyfin client with a Seerr integration. It takes its types from a fork of the server pulled in as a submodule, because the spec does not match the responses. Moving it onto the published spec is what turned this up.
validateResponses: truewas dropped in96f3861c, the bump to express-openapi-validator v4.8.0, when the call moved fromnew OpenApiValidator().install()toOpenApiValidator.middleware(). Nothing has checked a response againstseerr-api.ymlsince, which is how the spec got to where #3298 found it. The workaround comment for it is still under the validator, guarding nothing.Switching it straight back on would be rough after six years of drift, so it only runs with
VALIDATE_API_RESPONSES=true, and it logs throughonErrorinstead of throwing. The response is still served, with one exception that comes from the validator's own response wrapper: anullJSON body becomes a 204. Nothing inserver/routessends one today. The Cypress job sets it, so the drift shows up in CI without failing anything.It won't catch a property that is served and not declared, since none of our schemas set
additionalProperties: false. It catches missing required properties, wrong types and nullability.Related to #3298.
AI Disclosure: AI-assisted throughout. I used Claude Code (Opus 5, max effort) to trace the regression through the git history, to measure a live server against the spec, to write the patch, and to run the build and the test suite. I reviewed all of it, and this description started as its draft and was edited by me.
How Has This Been Tested?
Built in a
node:22container, seeded withpnpm cypress:prepare, run with the flag. Signing in as the seeded admin catches one straight away:POST /auth/localsends the user throughfilter(), which stripsemail, against a schema that declares it required. Still answered 200.Without the flag the same requests log nothing, so the default path is unchanged.
pnpm testis 189 passing before and after.pnpm buildpasses.Screenshots / Logs (if applicable)
Checklist:
pnpm buildpnpm i18n:extractSummary by CodeRabbit
New Features
Documentation
Tests