refactor(training): T-CONTEXTS partial — _dump_frozen_dataset takes ctx#83
Open
refactor(training): T-CONTEXTS partial — _dump_frozen_dataset takes ctx#83
Conversation
…t × aspect) cell Replaces the long flat matrix as the default view of /benchmark with a 3-aspects × N-categories grid of compact heatmap cards. Each cell ranks embeddings by Fmax with horizontal bars colored on a perceptual scale, the leader marked with a medal, and a slot reserved for bootstrap CI whiskers (rendered when persisted). The original full matrix table stays one click away behind a Heatmap | Table toggle so the export-friendly raw-numbers view isn't lost. New components/BenchmarkHeatmap.tsx - bestRowsByEmbedding: collapses the matrix endpoint's per-K rows to one bar per embedding (the cell's best across stages/Ks already in the active selection). - HSL gradient blue→violet by Fmax, bar width proportional. Color is supportive; the bar length is the primary signal for accessibility. - Aspect-tinted card header (MFO blue / BPO violet / CCO emerald) so the per-aspect column reads at a glance. - Hover tooltip exposes stage / K / Fmax. Future CI whiskers will render in the same row without changing the cell layout. apps/web/app/[locale]/benchmark/page.tsx - New viewMode state (default "heatmap"). - Toggle bar (role=tablist, aria-selected) rendered when there's data. - Existing leaderboards (global + in-selection) stay above the toggle unchanged — they're already the per-cell story. Behavior unchanged: - Filters (stage, K, evaluation_set), CSV export, leaderboards, full matrix table — all preserved. Toggle to "Table" for the prior view. CI: next build green; backend untouched.
Collapses ``_dump_frozen_dataset`` from 11 keyword-only args to 1 ``ParquetExportContext`` argument. The helper was already a thin wrapper around ``export_reranker_parquets`` (which now takes the same context); this slice removes the redundant repackaging. The single call-site in ``TrainRerankerAutoOperation.execute`` (``dump_helper`` branch) is updated to build the context inline, filling ``store=None`` + ``producer_version`` + ``producer_git_sha`` the wrapper used to fill internally. Body uses ``ctx.stage_dir`` for the legacy ``dump_dir`` return-key preservation. Forward-reference ``"ParquetExportContext"`` in the signature avoids a circular import (parquet_export pulls heavy deps). Sizes: - training_dump_helpers.py: -25 LOC (wrapper body shrinks; caller picks up 7 LOC for the inline context construction) - Smell baseline: 75 -> 74 (params>6 20 → 19; ``_dump_frozen_dataset`` retired) Local-first 5 verde (ruff + flake8 + pytest 1163 + check_smells).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Acceptance criteria (master plan §24 Fase 1 — T-CONTEXTS partial)
Sixth incremental Parameter Object slice.
_dump_frozen_datasetwas already a thin wrapper overexport_reranker_parquets(which now takesParquetExportContext); this slice removes the redundant repackaging and drops 11 keyword args to 1.Changes
protea/core/training_dump_helpers.py:_dump_frozen_datasetsignature collapses 11 args → 1 (ctx: ParquetExportContext).ctx.stage_dirto preserve the legacydump_dirreturn-key contract.TrainRerankerAutoOperation.execute(dump_helper branch) builds the context inline (store=None+ producer fields filled where the wrapper used to fill them internally)."ParquetExportContext"in the signature (TYPE_CHECKING import) avoids a circular dep withparquet_export.Smell budget
75 → 74 offenders. params>6: 20 → 19 (
_dump_frozen_datasetretired).Test plan
poetry run ruff check protea scriptspoetry run flake8 protea/poetry run pytest tests/ --ignore=tests/test_jobs_pg.py(1163 passed, 11 skipped)poetry run python scripts/check_smells.py(74 known, none new)Branch naming
Pushed as
feat/t-contexts-dump-frozen-minebecause another agent had already taken the more naturalfeat/t-contexts-dump-frozenfor an unrelated PR (#81, web benchmark heatmap).