Skip to content

feat(plugin): connector-media + utility-youtube-read (#105) - #150

Merged
rucka merged 6 commits into
mainfrom
feature/US-105-connector-media-plugin-utility-youtube-read
Nov 29, 2026
Merged

rucka merged 6 commits into
mainfrom
feature/US-105-connector-media-plugin-utility-youtube-read

Conversation

@rucka

@rucka rucka commented Nov 29, 2026

Copy link
Copy Markdown
Owner

Summary

What Changed

  • New plugin plugins/connector-media/ (manifest, pinned yt-dlp==2026.11.23, marketplace entry).
  • utility-youtube-read: YouTube URL → caption transcript MD in _ingest/<slug>.md; stdout {"items":[{"id","path"}]}.
  • gilberto-capability-fetch passes GILBERTO_CORE_SKILLS to utilities so plugin utilities resolve core _lib.

Why This Change

Video sources feed ingest like any other source (epic #63).

Story Context

User Story: #105. AC: 1–7 covered, tests per AC in tests/test_youtube_read.py.

Changes Made

  • Decisions: captions only (--skip-download --write-subs --write-auto-subs), manual over auto, lang --lang → video default → en.
  • source = canonical https://www.youtube.com/watch?v=<id>; state _ingest/.youtube-read/_state.json; --force rewrites keeping created.
  • Errors auth|rate-limit|not-found|provider, exit 1; rate-limit/transient retried with backoff (3).
  • Core _lib lookup: $GILBERTO_CORE_SKILLS, else sibling plugins/gilberto-core/skills; absent → provider.
  • Host allowlist youtube.com (+subdomains), youtu.be, before any call.
  • Modified: .claude-plugin/marketplace.json, gilberto-capability-fetch/script.py. Added: plugins/connector-media/**, .changeset/US-105.md.

Testing

  • pytest offline (stub yt-dlp runner, VTT fixtures): full skill-tests suite green; pre-push gate green.
  • Capability-fetch routing via $GILBERTO_UTILITY_PATH tested with fake yt-dlp on PATH.

Closes #105

Captions-only pinned yt-dlp to _ingest/<slug>.md.
capability-fetch passes GILBERTO_CORE_SKILLS to utilities.
@rucka

rucka commented Nov 29, 2026

Copy link
Copy Markdown
Owner Author

Code Review — PR #150 (US-105)

Verdict

risk:red · cost:n/a — CHANGES-REQUESTED — 3 Minor: two AC tests cannot fail (mutation-proven), one timeout defeats retry via fetch.

Open findings: 3. r0-1, r0-2, r0-3.

Classification changed: not assessed → risk:red — untrusted remote input parsed.

Classification matrix — per dimension
Dimension Tier Source
Criticality yellow KB default
Diff risk yellow diff
Business green generic
Security red untrusted parsing
Coupling green diff

Assessments

Security — Input validation

Verdict: green — URL validated by _lib/url_validate, host allowlisted, then fully rebuilt from a regex-checked id; no option/path injection.

Details
  • Probed: youtube.com.evil.com, evil.com@youtube.com, localhost, ftp, youtu.be/, /v/<id>, nocookie → all provider, no call. Slug is [a-z0-9-]; --ignore-config; tmp cwd.

Security — Output handling

Verdict: green — frontmatter round-trips hostile titles (---, :, newline, YAML literals); body is plain text.

Security — Authentication

Verdict: not applicable — public captions, no secrets.

Security — Authorization

Verdict: not applicable — writes only inside _ingest/.

Security — Introduced vulnerabilities

Verdict: green — 0 introduced, 0 pre-existing.

Cost

Verdict: cost:n/a — not assessed (no media download; captions only).

Architecture (Coupling)

Verdict: green — plugin reuses core _lib via $GILBERTO_CORE_SKILLS/sibling path; adopted (story assumption, ADR-0003, tech-stack yt-dlp).

Bug fix — Red test before fix

Verdict: not applicable — not a bug fix.

Details

Findings by severity

Minor (must fix before merge — same bar as Major, just lower impact)

  • r0-1 tests/test_youtube_read.py:90 — AC4 "manual preferred" unproven. Mutant: swap _pick loop to auto-first ⇒ all 44 connector-media tests pass, yet {subtitles:{en-US}, automatic_captions:{en}} picks auto en. Add a test with manual en-US + auto en asserting --sub-langs en-US.
  • r0-2 gilberto-capability-fetch/script.py:115 — the new GILBERTO_CORE_SKILLS env pass has no test: removing it keeps 123 connector-media + fetch tests green (AC7 test resets fetch.SKILLS and passes via sibling fallback). In an installed layout without the sibling path, routing would return provider: core _lib not found. Add a test where the utility can resolve _lib only through the env fetch passes.
  • r0-3 utility-youtube-read/script.py:37 — per-call TIMEOUT = 120 equals fetch's whole-utility TIMEOUT = 120 (fetch script.py:18), with up to 3 attempts × 2 calls. Via fetch a yt-dlp stall ≥120 s kills the utility: fetch returns untyped UTILITY_ERROR (no utility_code), the AC6 transient retry never runs, and yt-dlp is orphaned. Bound the per-call timeout so total retries fit fetch's budget (siblings use 15 s).
Positive feedback
  • Clean anti-corruption layer; canonical URL; manual-over-auto delegated correctly to yt-dlp's own precedence; state convention matches utility-fetch-rss; error codes all exercised; real end-to-end routing test.
Functionality & requirements (AC coverage)
  • AC1 proven (test_manifest_and_marketplace_entry, test_requirements_exact_pin); AC2/AC3 proven (test_writes_transcript_with_frontmatter_and_stdout_contract, clean_vtt, url forms); AC4 weak (r0-1); AC5 proven (reread/force/corrupt-state); AC6 proven (error mapping, retry tests) — r0-3 under fetch; AC7 weak (r0-2).
Testing & quality gates
  • ts:check, test, lint, prettier:check, mdlint:check, hygiene:check all exit 0; skill-tests 1081 passed (ledger command reproduced). Combined quality-gate:ci hit a __pycache__ race in source.packed.test.ts (parallel pytest), green when sequential — not this diff.
Adoption compliance
  • yt-dlp in tech-stack.md:84 and ADR-0003; layout mirrors gilberto-core; no new ADR needed.
Documentation
  • SKILL.md documents CLI, errors, JSON contract; changeset present.

Pair-RED-Snapshot: pr=150; phase=r1-g1; base=49fe2bf88a726452b208b4994a7c424607f8bed9; manifest=.pair/red-snapshots/pr-150-r1-g1.json
Pair-RED-Snapshot: pr=150; phase=r1-g2; base=05d3b651da08e0989f5929e8425751687a8c70b1; manifest=.pair/red-snapshots/pr-150-r1-g2.json
@rucka

rucka commented Nov 29, 2026

Copy link
Copy Markdown
Owner Author

Delivery workflow summary

1. Identity — pair-implement-batch 4.0.1 | run story-105 | models: not recorded (in-session) | reviewed head: c4c8319fc37cf6854a797618f286506e3bb3dd8e

2. Status — quality: converged · delivery: ready-for-merge · gate/custody: passed

3. Cycles — completed 1 / attempted 1 · review batches 2 · review executions 2 · retries 0 · redirects null · contract revisions 0 · preparation repairs 0 · invalidated remediations 0 · regression repairs 0 · active regression risks 0 · discharged regression risks 0 · admin/engine recoveries null

4. Cost / time — tokens not recorded (in-session: no host runtime supplied usage) · elapsed ≈ 24m (handoff timestamps, 8 handoffs; wall clock including waits) · profile economico-pi

5. Late defects (by origin) — preexisting-missed 0 · introduced-by-remediation 0 · unknown 0 · missedUpstream 0

Findings

id severity found status location summary resolution
r0-1 Minor r0 resolved plugins/connector-media/skills/utility-youtube-read/tests/test_remediation_r1_g1.py:13 AC4 manual-over-auto preference now proven: test_manual_regional_variant_beats_auto_exact_language passes on … resolved (see the re-review)
r0-2 Minor r0 resolved plugins/connector-media/skills/utility-youtube-read/tests/test_remediation_r1_g1.py:21 GILBERTO_CORE_SKILLS env pass in capability-fetch now proven: isolated utility copy (no sibling gilberto-core… resolved (see the re-review)
r0-3 Minor r0 resolved plugins/connector-media/skills/utility-youtube-read/script.py:37 Per-call TIMEOUT 120->15: worst case 2 calls x 3 attempts x 15s + 3s backoff = 93s < fetch TIMEOUT 120; persi… resolved (see the re-review)

No scope proposals.

6. Machine-readable summary

{
  "schemaVersion": 1,
  "sourceDigest": "sha256:5452db4013de738368089701cb8ecf7afd80ad6020fc2e5fe1d2a63772ec6211",
  "asOf": "2026-11-29T20:08:00.271Z",
  "metricsRevision": 1,
  "completeness": "partial",
  "missingSources": []
}

@rucka
rucka merged commit 6030290 into main Nov 29, 2026
7 checks passed
@rucka
rucka deleted the feature/US-105-connector-media-plugin-utility-youtube-read branch November 29, 2026 20:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

connector-media plugin + utility-youtube-read (captions)

1 participant