feat: cover letter training export (Phase 1) #111

Merged
pyr0ball merged 9 commits from feat/cover-letter-training-export into main 2026-05-04 08:55:16 -07:00
Owner

Summary

  • Adds opt-in consent gate (training_export_opt_in in user.yaml, default false) for cover letter training data
  • Alpaca-format JSONL export of applied-job cover letters with per-job exclude/restore curation
  • 5 new API endpoints: opt-in toggle, db-pairs list, exclude/include, streaming JSONL export, Phase 2 stubs (501)
  • FineTuneView.vue gains Training Export consent section + From Applied Jobs curation list
  • New WizardTrainingStep.vue opt-in step inserted between Resume and Identity
  • All 4 a11y BLOCK issues resolved: confirmed state on toggle, visible tier gate, aria-live on pairs region, cloud-aware consent copy

Test Plan

  • Backend: 802 passing (pytest tests/ -v), 17 new tests in test_training_export.py
  • Frontend: 89 passing (5 pre-existing failures in prep/survey stores, not regressions)
  • Toggle opt-in ON in Settings → Fine-Tune: From Applied Jobs section appears
  • Applied jobs with cover letters populate the curation list
  • Exclude a row: grays out with Restore button; Download JSONL reflects the exclusion
  • Download JSONL: valid newline-delimited JSON, each record has instruction, input, output, source
  • Toggle opt-in OFF: From Applied Jobs section disappears immediately
  • Wizard: Resume step → Training step → Identity step navigates correctly
  • Cloud Fine-Tune button is disabled on Free/Paid tiers with upgrade link visible
  • Cloud mode: consent copy says "stored on your CircuitForge account" not "stays on your device"

Files changed

migrations/009_training_export.sql · scripts/db.py · scripts/user_profile.py · dev-api.py · web/src/stores/settings/fineTune.ts · web/src/views/settings/FineTuneView.vue · web/src/views/wizard/WizardTrainingStep.vue (new) · web/src/router/index.ts · web/src/stores/wizard.ts · web/src/views/wizard/WizardResumeStep.vue · web/src/views/wizard/WizardIdentityStep.vue · web/src/views/wizard/WizardInferenceStep.vue · web/src/views/wizard/WizardSearchStep.vue · web/src/views/wizard/WizardIntegrationsStep.vue · tests/test_training_export.py

## Summary - Adds opt-in consent gate (`training_export_opt_in` in `user.yaml`, default `false`) for cover letter training data - Alpaca-format JSONL export of applied-job cover letters with per-job exclude/restore curation - 5 new API endpoints: opt-in toggle, db-pairs list, exclude/include, streaming JSONL export, Phase 2 stubs (501) - `FineTuneView.vue` gains Training Export consent section + From Applied Jobs curation list - New `WizardTrainingStep.vue` opt-in step inserted between Resume and Identity - All 4 a11y BLOCK issues resolved: confirmed state on toggle, visible tier gate, `aria-live` on pairs region, cloud-aware consent copy ## Test Plan - [ ] Backend: 802 passing (`pytest tests/ -v`), 17 new tests in `test_training_export.py` - [ ] Frontend: 89 passing (5 pre-existing failures in prep/survey stores, not regressions) - [ ] Toggle opt-in ON in Settings → Fine-Tune: From Applied Jobs section appears - [ ] Applied jobs with cover letters populate the curation list - [ ] Exclude a row: grays out with Restore button; Download JSONL reflects the exclusion - [ ] Download JSONL: valid newline-delimited JSON, each record has `instruction`, `input`, `output`, `source` - [ ] Toggle opt-in OFF: From Applied Jobs section disappears immediately - [ ] Wizard: Resume step → Training step → Identity step navigates correctly - [ ] Cloud Fine-Tune button is disabled on Free/Paid tiers with upgrade link visible - [ ] Cloud mode: consent copy says "stored on your CircuitForge account" not "stays on your device" ## Files changed `migrations/009_training_export.sql` · `scripts/db.py` · `scripts/user_profile.py` · `dev-api.py` · `web/src/stores/settings/fineTune.ts` · `web/src/views/settings/FineTuneView.vue` · `web/src/views/wizard/WizardTrainingStep.vue` (new) · `web/src/router/index.ts` · `web/src/stores/wizard.ts` · `web/src/views/wizard/WizardResumeStep.vue` · `web/src/views/wizard/WizardIdentityStep.vue` · `web/src/views/wizard/WizardInferenceStep.vue` · `web/src/views/wizard/WizardSearchStep.vue` · `web/src/views/wizard/WizardIntegrationsStep.vue` · `tests/test_training_export.py`
pyr0ball added 8 commits 2026-05-03 01:42:17 -07:00
Premium/ultra users with a custom_writing_model in their session are
routed to that model as the first cf-orch candidate; all other tiers
use the shared Qwen2.5-3B-Instruct base. complete_json() is unchanged
since fine-tuned writing models aren't trained for structured output.

Adds _request_tier and _request_writing_model ContextVars. Resolution
order: USER_WRITING_MODELS env var (Monday path) then Heimdall meta
(future path via peregrine#110).
Add excluded_from_training column to jobs table (migration 009 + _MIGRATIONS
entry for existing DBs). Add get_db_pairs(), get_training_pairs(), and
set_training_exclusion() helpers for the cover letter training export pipeline.
Add test_training_export.py with 8 tests covering all helpers (all passing).
- PATCH /api/settings/fine-tune/opt-in — toggle training_export_opt_in in user.yaml
- GET /api/settings/fine-tune/db-pairs — list DB jobs with exclusion flags (403 without opt-in)
- PATCH /api/settings/fine-tune/db-pairs/{id}/exclude|include — per-job exclusion toggle
- GET /api/settings/fine-tune/export — NDJSON streaming download of all training pairs (DB + file)
- POST/GET /api/settings/fine-tune/cloud-request|cloud-status — Phase 2 stubs (501)
- finetune_status now includes opted_in field
- 6 new API tests; all 17 tests pass
Inserts a new optional Training Export step between Resume and Identity
in the setup wizard. Users can opt in to saving cover letters for
fine-tuning dataset export. Consent copy distinguishes local vs. cloud
storage. WIZARD_STEPS bumped to 7; router, and adjacent step
back/next navigation updated accordingly.
fix: wizard step numbering and loadDbPairs race on mount
Some checks failed
CI / Backend (Python) (pull_request) Failing after 1m51s
CI / Frontend (Vue) (pull_request) Failing after 21s
f42a515629
Insert Training at step 4 in WIZARD_STEPS (7→8), STEP_LABELS, and
STEP_ROUTES. Bump Identity→5, Inference→6, Search→7, Integrations→8 in
their respective saveStep calls. Cap resumeAt at 8. Await loadStatus()
before loadDbPairs() in FineTuneView onMounted so optedIn is set before
the early-exit guard runs.
pyr0ball added 1 commit 2026-05-03 07:27:23 -07:00
chore(release): v0.9.2 changelog entry
Some checks failed
CI / Backend (Python) (pull_request) Failing after 1m0s
CI / Frontend (Vue) (pull_request) Failing after 21s
424a946ca0
pyr0ball merged commit 77e49db4e9 into main 2026-05-04 08:55:16 -07:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: Circuit-Forge/peregrine#111
No description provided.