Skip to content

Friendly upload API: review-fix follow-ups (group_id check, OCR contentFormat) - #183

Draft
alex-struk wants to merge 2 commits into
developfrom
feature/friendly-upload-api
Draft

Friendly upload API: review-fix follow-ups (group_id check, OCR contentFormat)#183
alex-struk wants to merge 2 commits into
developfrom
feature/friendly-upload-api

Conversation

@alex-struk

Copy link
Copy Markdown
Collaborator

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

  • upload: drop redundant group_id mismatch checkidentityCanAccessGroup(...) already throws 403 when the body's group_id is foreign to the API key's scope, so the explicit ForbiddenException was dead. Removed it; added a spec test pinning the 403 to the helper.
  • temporal: drop redundant OCRResult.contentFormat — the field was strictly derivable from markdown !== undefined. Removed from the type; upsertOcrResult now derives format from !!ocrResult.markdown directly.

6 files changed, +49 / −19.

🤖 Generated with Claude Code

strukalex and others added 2 commits May 14, 2026 10:43
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants