Skip to content

Add cold-start first-10 quality readout - #330

Merged
ohld merged 2 commits into
productionfrom
fix/ffm-1869-cold-start-quality
Jul 11, 2026
Merged

Add cold-start first-10 quality readout#330
ohld merged 2 commits into
productionfrom
fix/ffm-1869-cold-start-quality

Conversation

@ohld

@ohld ohld commented Jul 11, 2026

Copy link
Copy Markdown
Member

Fixes FFM-1869.

What changed

  • Added a repeatable true-new cold-start first-10 readout in src/stats/cold_start_quality.py.
  • Added scripts/cold_start_first10_quality_readout.py for Analyst/ops execution with ANALYST_DATABASE_URL support.
  • Documented the readout entrypoint in docs/analyst/README.md.
  • Added focused integration coverage for true-new cohort selection, dormant/non-cold first-send exclusion, sent_at ordering, skip scoring, continuation, engine/segment splits, and top/bottom candidate meme output.

Readout coverage

The readout reports first-meme LR/continuation, first-10 LR/continuation, reached-5, reached-10, second-session, per-position quality, per-engine split, source/type/language segments, and top/bottom first-10 candidate memes.

Guardrails

  • Measurement-only; no ranking, threshold, weight, queue, or experiment-assignment changes.
  • Does not touch recently_liked_blender_v2 logic or readout rules.
  • True-new cohort requires each user's first-ever user_meme_reaction.sent_at to be a cold-start engine send.

Verification

  • ruff check --fix src/ tests/
  • ruff format src/ tests/
  • ruff check --fix scripts/cold_start_first10_quality_readout.py && ruff format scripts/cold_start_first10_quality_readout.py
  • python3 -m compileall -q src/stats/cold_start_quality.py scripts/cold_start_first10_quality_readout.py tests/stats/test_cold_start_quality.py

Focused pytest was attempted locally with normalized DATABASE_URL, but this workspace DB is not in a clean migrated test state: Alembic hit an existing user table and the fixture then failed because meme_source was absent. CI should run this against its clean test DB.

Post-merge handoff

After merge/deploy, Analyst should run:

source .env
python scripts/cold_start_first10_quality_readout.py --lookback-days 14

Then recommend whether the next step should be a cold-start candidate/filter experiment, continued measurement, or rejecting the quality-score hypothesis.

@ohld

ohld commented Jul 11, 2026

Copy link
Copy Markdown
Member Author

STAFF ENGINEER REVIEW: CHANGES REQUESTED — two verified script-entrypoint bugs need fixing before merge.

[P2] scripts/cold_start_first10_quality_readout.py:29 - The script only uses ANALYST_DATABASE_URL when DATABASE_URL is absent. Analyst docs say this readout should use the read-only analyst DB, but a normal sourced .env can contain both variables; in that case the script keeps DATABASE_URL and may connect to the wrong DB. Verified with both vars set: DATABASE_URL stayed on the primary DSN.

[P2] scripts/cold_start_first10_quality_readout.py:64 - The documented command python scripts/cold_start_first10_quality_readout.py --lookback-days 14 fails from repo root before execution because Python puts scripts/ on sys.path and cannot import src. Verified locally: ModuleNotFoundError: No module named src.

Other checks: CI is green; ruff check, compileall, git diff --check, and /cso diff review passed. Raw SQL uses fixed templates plus bound params; no secrets found. Auto-merge was disabled before posting this change request.

@ohld

ohld commented Jul 11, 2026

Copy link
Copy Markdown
Member Author

STAFF ENGINEER REVIEW: APPROVED — Cold-start first-10 quality readout reviewed clean after the entrypoint fixes. Verified the prior blockers are fixed: ANALYST_DATABASE_URL takes priority over DATABASE_URL, and the script can import repo modules when run from repo root. Local checks: ruff check, ruff format --check, compileall, git diff --check; /cso diff review found no SQL injection or secret exposure; /codex review found no blocking correctness issues. CI lint and test are green.

@ohld
ohld merged commit 850a8e7 into production Jul 11, 2026
3 checks passed
@ohld

ohld commented Jul 11, 2026

Copy link
Copy Markdown
Member Author

✅ Approved + merged.

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