Friendly upload API: review-fix follow-ups (group_id check, OCR contentFormat) - #183
Draft
alex-struk wants to merge 2 commits into
Draft
Friendly upload API: review-fix follow-ups (group_id check, OCR contentFormat)#183alex-struk wants to merge 2 commits into
alex-struk wants to merge 2 commits into
Conversation
identityCanAccessGroup already throws 403 when the body's group_id is foreign to the API key's scope: the API-key path checks the resolved identity's groupRoles, which only contains the key's own group. Added a test pinning the 403 response so the behavior is anchored to the helper. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
contentFormat was strictly derivable from `markdown !== undefined`: the extract activity set the two fields in lockstep (markdown defined iff contentFormat=="markdown") and the only reader (upsert) used it to stamp the persisted blob's `format` field. Removed it from the type; upsert now derives format from `!!ocrResult.markdown` directly. This collapses one of two layers of redundancy in the in-memory shape. Keeping extractedText and markdown as separate fields is a deliberate scope choice — extractedText is consumed as plain text by classify, split-and-classify, post-ocr-cleanup, normalize-fields, enrichment-llm and others, and collapsing into a single discriminated `content` field would push the format decision into every downstream activity. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Two post-merge review-fix follow-ups on top of #166 (which is already merged). Backend/temporal cleanup only — no behavior change for callers, no data.
Commits
identityCanAccessGroup(...)already throws 403 when the body'sgroup_idis foreign to the API key's scope, so the explicitForbiddenExceptionwas dead. Removed it; added a spec test pinning the 403 to the helper.OCRResult.contentFormat— the field was strictly derivable frommarkdown !== undefined. Removed from the type;upsertOcrResultnow derivesformatfrom!!ocrResult.markdowndirectly.6 files changed, +49 / −19.
🤖 Generated with Claude Code