Skip to content

Make local auth opt-in for dev and expose yt-dlp dependency readiness on /health - #1749

Merged
groupthinking merged 3 commits into
mainfrom
copilot/opt-in-local-auth
Sep 12, 2026
Merged

Make local auth opt-in for dev and expose yt-dlp dependency readiness on /health#1749
groupthinking merged 3 commits into
mainfrom
copilot/opt-in-local-auth

Conversation

Copilot AI commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Canonical issue

Linked automatically by canonical-issue workflow.

Outcome

Local FastAPI+Next runs no longer hit auth-driven 503s by default when no API key is set, while production remains fail-closed. /health now exposes concrete readiness signals for yt-dlp-related runtime dependencies.

Scope

  • Included:
    • Auth gate defaulting (backend middleware): when EVENTRELAY_API_KEY is unset, non-production defaults to open auth (open_dev); production still returns 503 on protected routes unless explicitly overridden.
    • Health readiness surface: extended /health with explicit dependency flags for import/runtime tool availability:
      • yt_dlp_ready
      • youtube_transcript_api_ready
      • yt_dlp_executable_ready
      • ffmpeg_ready
      • ffprobe_ready
      • aggregate video_path_ready preserved
    • Readiness/auth contract tests: updated unit coverage for env-sensitive auth mode behavior and expanded health payload contract.
    • Developer docs: updated local run guidance to reflect opt-in local auth and the expanded readiness payload.
  • Explicitly excluded:
    • Frontend auth middleware behavior
    • API shape changes for /api/v1/health
    • Any production auth policy changes beyond preserving fail-closed semantics

Example payload shape:

{
  "auth_mode": "open_dev",
  "video_deps": {
    "yt_dlp": true,
    "youtube_transcript_api": true,
    "yt_dlp_executable": true,
    "ffmpeg": true,
    "ffprobe": true
  },
  "yt_dlp_executable_ready": true,
  "ffmpeg_ready": true,
  "ffprobe_ready": true,
  "video_path_ready": true
}

Risk

  • Risk level: low
  • Failure mode: incorrect environment classification could open or close auth unexpectedly for non-public routes.
  • Rollback: revert middleware env-default logic and health payload extension in src/youtube_extension/backend/middleware/api_key_auth.py and src/youtube_extension/main.py.

Verification

List exact automated and manual checks, tied to the current head SHA.

  • Focused tests
  • Required CI
  • Review threads resolved

Production evidence

Not applicable for this change set: this PR targets local-dev auth ergonomics and backend health introspection fields; no production behavior expansion beyond existing fail-closed policy.

Agent handoff

  • One canonical issue is linked
  • No competing PR implements the same issue
  • Acceptance criteria are satisfied
  • Required checks pass on the current head
  • Human decision is requested only for product, security, irreversible infrastructure, or production approval

@vercel

vercel Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
v0-uvai Ready Ready Preview, v0 Sep 12, 2026 10:28am UTC

Co-authored-by: groupthinking <154503486+groupthinking@users.noreply.github.com>
Copilot AI changed the title [WIP] Ensure local auth is opt-in and expose video deps readiness Make local auth opt-in for dev and expose yt-dlp dependency readiness on /health Sep 8, 2026
Copilot AI requested a review from groupthinking September 8, 2026 23:59
api_key if api_key is not None else os.getenv("EVENTRELAY_API_KEY")
)
is_production = _is_production_env()
explicit_open = os.getenv("ALLOW_UNAUTHENTICATED", "").strip().lower() in _TRUTHY

@vercel vercel Bot Sep 9, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Auth middleware fails OPEN in any non-production environment (including internet-reachable Vercel preview and staging where ENVIRONMENT is unset), exposing all protected endpoints — including DELETE /api/v1/cache — without authentication when EVENTRELAY_API_KEY is not set.

Fix on Vercel

@github-actions

Copy link
Copy Markdown
Contributor

🔍 PR Validation

⚠️ PR title should follow conventional commits format

@github-actions github-actions Bot added documentation Improvements or additions to documentation python labels Sep 12, 2026
@groupthinking
groupthinking marked this pull request as ready for review September 12, 2026 08:07
@github-actions

github-actions Bot commented Sep 12, 2026

Copy link
Copy Markdown
Contributor

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Snapshot Warnings

⚠️: No snapshots were found for the head SHA d228a56.
Ensure that dependencies are being submitted on PR branches. Re-running this action after a short time may resolve the issue. See the documentation for more information and troubleshooting advice.

Scanned Files

None

@coderabbitai

coderabbitai Bot commented Sep 12, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 03b1436e-58a4-413e-bfb1-f52860ba6c02

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@groupthinking
groupthinking merged commit 69d3f44 into main Sep 12, 2026
18 of 23 checks passed
@groupthinking
groupthinking deleted the copilot/opt-in-local-auth branch September 12, 2026 10:27
@github-actions

Copy link
Copy Markdown
Contributor

🔴 E2E Test Results: FAILURE DETECTED

Metric Value
Status 🔴 RED
Total Tests 6
Passed 11
Failed 6
Deployment https://v0-uvai-19q6j9ml7-garv1.vercel.app
Test Output
2m''�[39m�[33m;�[39m
    �[90m190|�[39m       �[34mexpect�[39m(ct)�[33m.�[39m�[34mtoContain�[39m(�[32m'text/event-stream'�[39m)�[33m;�[39m

�[31m�[2m⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[3/6]⎯�[22m�[39m

�[41m�[1m FAIL �[22m�[49m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mSSE Pipeline Stream�[2m > �[22mSSE stream emits at least a pipeline_status:running event
�[31m�[1mAssertionError�[22m: expected 0 to be greater than or equal to 1�[39m
�[36m �[2m❯�[22m tests/e2e/pipeline.test.ts:�[2m208:29�[22m�[39m
    �[90m206|�[39m
    �[90m207|�[39m       �[90m// Must have at least 1 event�[39m
    �[90m208|�[39m       �[34mexpect�[39m(events�[33m.�[39mlength)�[33m.�[39m�[34mtoBeGreaterThanOrEqual�[39m(�[34m1�[39m)�[33m;�[39m
    �[90m   |�[39m                             �[31m^�[39m
    �[90m209|�[39m
    �[90m210|�[39m       �[90m// Must start with pipeline_status:running�[39m

�[31m�[2m⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[4/6]⎯�[22m�[39m

�[41m�[1m FAIL �[22m�[49m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mError Handling�[2m > �[22mmissing URL returns 400, not a hang
�[31m�[1mAssertionError�[22m: expected 401 to be 400 // Object.is equality�[39m

�[32m- Expected�[39m
�[31m+ Received�[39m

�[32m- 400�[39m
�[31m+ 401�[39m

�[36m �[2m❯�[22m tests/e2e/pipeline.test.ts:�[2m358:26�[22m�[39m
    �[90m356|�[39m
    �[90m357|�[39m       �[35mconst�[39m elapsed �[33m=�[39m �[33mDate�[39m�[33m.�[39m�[34mnow�[39m() �[33m-�[39m start�[33m;�[39m
    �[90m358|�[39m       �[34mexpect�[39m(res�[33m.�[39mstatus)�[33m.�[39m�[34mtoBe�[39m(�[34m400�[39m)�[33m;�[39m
    �[90m   |�[39m                          �[31m^�[39m
    �[90m359|�[39m       �[34mexpect�[39m(elapsed)�[33m.�[39m�[34mtoBeLessThan�[39m(�[34m5_000�[39m)�[33m;�[39m �[90m// Should respond instantly�[39m
    �[90m360|�[39m     })�[33m;�[39m

�[31m�[2m⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[5/6]⎯�[22m�[39m

�[41m�[1m FAIL �[22m�[49m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mAPI Health�[2m > �[22mPOST /api/pipeline/stream with no body returns 400
�[31m�[1mAssertionError�[22m: expected [ 400, 500 ] to include 200�[39m
�[36m �[2m❯�[22m tests/e2e/pipeline.test.ts:�[2m441:26�[22m�[39m
    �[90m439|�[39m       )�[33m;�[39m
    �[90m440|�[39m       �[90m// Should handle gracefully — 400 or 500, but respond quickly�[39m
    �[90m441|�[39m       �[34mexpect�[39m([�[34m400�[39m�[33m,�[39m �[34m500�[39m])�[33m.�[39m�[34mtoContain�[39m(res�[33m.�[39mstatus)�[33m;�[39m
    �[90m   |�[39m                          �[31m^�[39m
    �[90m442|�[39m     })�[33m;�[39m
    �[90m443|�[39m   })�[33m;�[39m

�[31m�[2m⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[6/6]⎯�[22m�[39m


�[2m Test Files �[22m �[1m�[31m1 failed�[39m�[22m�[90m (1)�[39m
�[2m      Tests �[22m �[1m�[31m6 failed�[39m�[22m�[2m | �[22m�[1m�[32m11 passed�[39m�[22m�[90m (17)�[39m
�[2m   Start at �[22m 11:34:22
�[2m   Duration �[22m 4.55s�[2m (transform 40ms, setup 0ms, import 51ms, tests 4.40s, environment 0ms)�[22m


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Opt-in local auth and expose video deps readiness

2 participants