Skip to content

Corpus harvesting + ERID weak-label mining pipeline - #5

Merged
denfry merged 11 commits into
mainfrom
worktree-corpus-erid-mining
Jun 16, 2026
Merged

Corpus harvesting + ERID weak-label mining pipeline#5
denfry merged 11 commits into
mainfrom
worktree-corpus-erid-mining

Conversation

@denfry

@denfry denfry commented Jun 16, 2026

Copy link
Copy Markdown
Owner

Summary

Implements the corpus-harvesting + ERID weak-label mining pipeline (plan: docs/superpowers/plans/2026-06-16-corpus-erid-mining-pipeline.md). A small, dependency-light Python package research/, fully decoupled from the production backend:

  • schema — dataclasses/enums + JSONL (de)serialization, SCHEMA_VERSION, provenance (fetched_at).
  • erid_miner — deterministic disclosure-marker mining: ERID token, advertiser INN, #реклама/#ad hashtags, "на правах рекламы" phrase, sponsor phrases, promo codes.
  • labeler — weak labels with strong/weak marker tiers; only strong markers promote a video to the disclosed_ad positive set (keeps distant-supervision positives clean); weak-only signals stay unlabeled but are flagged.
  • fetchersMetadataFetcher Protocol + YtDlpFetcher; parsing is pure and fixture-tested, live yt_dlp import is lazy so unit tests never touch the network.
  • manifest — JSONL store: append / load / dedup (existing_ids) / stats.
  • cli — resumable, fault-tolerant harvest orchestrator (per-video try/except continues on failure; already-harvested IDs skipped; fake-fetcher injection for hermetic tests).
  • docsdocs/research/related-work.md (P0 literature-review tracking protocol), research/README.md, seed source list.
  • uv-managed env with committed uv.lock for reproducible rebuilds.

Test Plan

  • cd research && uv sync
  • uv run pytest -q28 passed
  • uv run python -m corpus.cli --help → prints --sources/--manifest interface
  • All 7 modules import cleanly without yt_dlp loaded (network isolation verified)
  • Live smoke run: replace a placeholder in research/data/sources.example.jsonl with a real public video whose description contains an erid: marker, then run the CLI (manual — real URLs can't be fabricated)

Known follow-ups (Minor)

  • research/README.md links to ../docs/research/2026-06-16-veritasad-research-roadmap.md, which does not yet exist in the repo (verbatim from the plan; create that doc or repoint the link).
  • research/data/sources.example.jsonl contains intentional REPLACE_WITH_REAL_ID placeholders for the live smoke run.

🤖 Generated with Claude Code

@vercel

vercel Bot commented Jun 16, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
veritas-ad Ready Ready Preview, Comment Jun 16, 2026 12:50pm

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f7ab34ab03

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread research/corpus/cli.py
Comment on lines +38 to +42
try:
record = fetcher.fetch(url)
except Exception as exc: # one bad video must not abort the harvest
print(f"[skip] {url}: {exc}", file=sys.stderr)
continue

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Fail systemic fetcher errors instead of skipping them

Because this catches every Exception from fetch, a systemic setup or code problem such as missing yt_dlp, bad fetcher options, or an extractor regression is reported as per-URL [skip] and main() still exits successfully with an empty or partial manifest. In the corpus-building workflow that can silently corrupt experiment inputs; catch only expected per-video download failures, or fail the run when the fetcher/environment is broken.

Useful? React with 👍 / 👎.

Comment thread research/pyproject.toml
name = "veritasad-research"
version = "0.1.0"
description = "Research tooling for VeritasAd: corpus harvesting and weak-label mining"
requires-python = ">=3.12"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Constrain research to the repo Python range

The rest of the repo declares Python >=3.12,<3.13 (for example backend/pyproject.toml and the repository instructions), but this new package allows any future 3.x runtime. On machines with a newer interpreter installed, uv run can resolve and execute this tooling under an unsupported Python version, producing a lock/test environment that does not match the supported VeritasAd stack; add the same <3.13 upper bound here.

Useful? React with 👍 / 👎.

…ections 1-2)

Brainstorm checkpoint for the next research milestone (M2): cached,
versioned multimodal feature extraction (ASR/CLIP/OCR/MFCC) feeding
model training and evaluation. Captures the four scoping decisions, the
shared veritas-features core approach, the two-plan decomposition, and
the agreed Sections 1-2. Sections 3-4 still being designed.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@denfry
denfry merged commit e80e20c into main Jun 16, 2026
2 checks passed
@denfry
denfry deleted the worktree-corpus-erid-mining branch June 16, 2026 21:20
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