Skip to content

add an unauthenticated read surface for published reviews - #81

Merged
tekrajchhetri merged 1 commit into
improve-ingestion-query-servicefrom
feat/synth-scholar-public-reads
Aug 13, 2026
Merged

add an unauthenticated read surface for published reviews#81
tekrajchhetri merged 1 commit into
improve-ingestion-query-servicefrom
feat/synth-scholar-public-reads

Conversation

@tekrajchhetri

Copy link
Copy Markdown
Collaborator

This PR adds public endpoints for listing, viewing, logging, and exporting reviews. Public access:

Requires reviews to be both public and completed, enforced at the SQL/store layer.
Supports anonymous access without exposing drafts or runtime state.
Returns 404 for unpublished reviews to avoid confirming their existence.
Reuses the existing export logic and format validation.

Authenticated routes remain unchanged, and no additional sensitive data is exposed.

Nothing could read a review its author marked Public. Every synth-scholar route
depends on get_current_user, GET /reviews is owner-scoped, and _session_or_404
404s for non-owners — so the public web pages at /knowledge-base/synth-scholar
failed for anonymous visitors and showed signed-in ones their own reviews. The
is_public flag was write-only.

Add /api/synth-scholar/public/reviews{,/{id},/{id}/log,/{id}/export}. Three rules
hold across all four:

  * no get_current_user, so an anonymous browser can read them;
  * every lookup goes through store.list_public / get_public, which require
    is_public AND completed — the filter is in SQL, not the caller, so other
    people's drafts are never shipped to a browser to be filtered there;
  * an unpublished id answers 404, not 403, so the status code does not confirm
    it exists.

list_public skips the runtime-state merge: a completed review has none, and
consulting it would leak progress for a row being re-run.

Export shares one _export_session helper with the authenticated route (the two
were identical past the access check) and one _EXPORT_FORMAT_PATTERN constant, so
a format added for signed-in users cannot silently 400 on a public review.

No behaviour change to the authenticated routes. Nothing new is exposed: the
detail payload already excludes openrouter_api_key from run_request, and these
routes serve only what an author explicitly published.
@tekrajchhetri
tekrajchhetri merged commit 0f1f8b2 into improve-ingestion-query-service Aug 13, 2026
tekrajchhetri added a commit that referenced this pull request Aug 13, 2026
…ards, CORS

Brings the three commits added after PR #81 was merged. The aiohttp one is the
reason ml_service could not boot (gunicorn exit 3), so deploying this branch
without it would reintroduce that crash on the next --no-cache rebuild:

  c970966  survive an unimportable structsense; fail the build instead
  be4eac8  unpin aiohttp 3.8.6, widen the import guards to Exception
  29c1fb0  make the four CORS origin lists identical, add CORS_ALLOWED_ORIGINS
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.

1 participant