You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(schema): multi-language path restructure + languages table
Phase B of the big plot migration. Layers {language} into every path so
future R, JavaScript, Julia implementations fit without another schema
change — today {language} is always "python".
Filesystem: 5354 files moved via `git mv` (blame preserved).
- plots/{spec}/implementations/{library}.py
→ plots/{spec}/implementations/python/{library}.py
- plots/{spec}/metadata/{library}.yaml
→ plots/{spec}/metadata/python/{library}.yaml
- Migration script: automation/scripts/migrate_paths_to_language.py
(idempotent, re-runnable, used for this commit).
Database: Alembic migration f2d9c8a1b4e0 creates:
- `languages` table (analog `libraries`) with Python seed.
- `libraries.language` (String) → `libraries.language_id` (FK → languages.id)
— models.py adds a synonym so `library.language` keeps working.
- `impls.language_id` FK with backfill to "python"; UQ broadened from
(spec_id, library_id) to (spec_id, language_id, library_id).
- `preview_url` → `preview_url_light`; new `preview_url_dark`,
`preview_html_light`, `preview_html_dark` (Phase C will fill the dark
variants). `Impl.preview_url` kept as synonym for preview_url_light so
existing callers continue to work.
Sync pipeline (`automation/scripts/sync_to_postgres.py`): language-aware
discovery that iterates `implementations/{language}/` subdirs, preserves
the legacy flat layout as fallback during transition, reads from
`metadata/{language}/{library}.yaml`, and upserts using the new
three-key constraint. LANGUAGES_METADATA now seeds the languages table
before libraries.
Workflows (`impl-generate`, `impl-merge`, `impl-repair`, `impl-review`):
export `LANGUAGE=python` and thread it through every filesystem + GCS
path. staging and production GCS paths now include the language segment:
gs://anyplot-images/{staging,plots}/{spec}/{language}/{library}/...
`sync-labels.yml` regex updated for the new path depth;
`spec-create.yml` creates empty `python/` subdirs for new specs.
Prompts (`impl-generate-claude.md`, `impl-repair-claude.md`): the
{LANGUAGE} variable is declared and substituted into every path template.
The change is strictly additive for existing data — all backfilled rows
have language_id="python" and preview_url_light pointing at the current
plot.png URLs. GCS objects stay at their current paths until Phase D
regenerates each spec into the new {language}/{library}/plot-{theme}.png
layout.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
0 commit comments