Skip to content

feat(workflows): unified plot-prepare workflow#535

Merged
MarkusNeusinger merged 11 commits intomainfrom
claude/plots-restructure-01Pi7U6YJE6erMpGqL1ea5kg
Dec 9, 2025
Merged

feat(workflows): unified plot-prepare workflow#535
MarkusNeusinger merged 11 commits intomainfrom
claude/plots-restructure-01Pi7U6YJE6erMpGqL1ea5kg

Conversation

@MarkusNeusinger
Copy link
Copy Markdown
Owner

Summary

  • Merge bot-validate-request + gen-create-spec into single plot-prepare.yml
  • Disable old workflows (renamed to .yml.disabled)
  • Add update request analysis (validates if update reason is sensible)
  • Update issue templates for clearer workflow

New Workflow Flow

User creates Issue + plot-request label
    ↓
[plot-prepare.yml] (1 Claude Opus Call)
    ├── NEW: Duplicate check → Generate spec-id → Create branch → Create spec.md
    └── UPDATE: Validate spec exists → Analyze update reason → Create branch
    ↓
Comment with spec content + recommendation
    ↓
STOP ← waits for `approved` label

Test Plan

  • Create new plot request issue → verify spec is generated
  • Create update request issue → verify analysis is posted
  • Verify old workflows don't trigger (disabled)

claude and others added 11 commits December 8, 2025 21:28
…info

Add a new `metadata/` directory that stores structured metadata for each spec:
- Tags (plot_type, domain, features, audience, data_type) at spec level
- Per-library implementation metadata (generation info, quality scores, preview URLs)
- History of previous attempts with feedback and improvement suggestions

Changes:
- Add metadata/*.yaml files for all 8 existing specs
- Add metadata/schema.yaml defining the YAML structure
- Update database models with new fields (structured_tags, generated_at, generated_by, etc.)
- Add migration 002 for the new database columns
- Update sync_to_postgres.py to read and sync metadata from YAML files
- Update sync-postgres.yml workflow to trigger on metadata/* changes
- Document the metadata system in CLAUDE.md

This enables tracking which AI model generated each implementation, quality scores
with evaluator details, and improvement suggestions for future spec updates.
Reorganize from three separate directories (specs/, metadata/, plots/)
to a unified structure where each plot has its own directory containing
all related files:

plots/{spec-id}/
├── spec.md              # Description, data requirements, use cases
├── metadata.yaml        # Tags, generation info, quality history
└── implementations/     # Library implementations (matplotlib.py, etc.)

Key changes:
- Migrate 8 specs with 72 implementations to new structure
- Add content field to Spec model (full markdown)
- Add code field to Implementation model (Python source)
- Remove plot_function field (no longer needed)
- Update sync script to scan new structure
- Update API to use PLOTS_DIR instead of SPECS_DIR
- Update CLAUDE.md documentation throughout
- Add migration 003 for database schema changes

This enables the app to display full spec descriptions and
implementation code directly from the database.
Update all documentation files to reflect the new structure where
everything for one plot lives in plots/{spec-id}/:

- docs/architecture/repository.md - Complete rewrite
- docs/specs-guide.md - Update file locations
- docs/workflow.md - Update path references in diagrams
- docs/plot-types-catalog.md - Update spec creation path
- docs/development.md - Update implementation paths and examples
…→ Notes

- Rename "Use Cases" to "Applications" for clearer terminology
- Remove Tags section (tags belong in metadata.yaml only)
- Simplify Data section formatting (list without bold headers)
- Add optional Notes section for implementation hints
- Update all 8 existing spec files to new format
- Update template and documentation to reflect changes
- Add created_at, created_by_issue, updated_at to metadata.yaml
- Create templates/metadata.yaml template
- Update all 8 existing metadata files with new fields
- Document new tracking fields in CLAUDE.md
- Rename created_at → created, created_by_issue → issue, updated_at → updates
- Add 'suggested' field to credit contributors (GitHub username)
- Add 'updates' list for tracking spec changes with issue references
- Set suggested: pyplots for all seed plots
- Update template and CLAUDE.md documentation
Specs table:
- description (text), applications/data/notes (arrays)
- created, issue, suggested from metadata.yaml
- tags as JSONB (structured)
- Remove: content, data_requirements, optional_params, structured_tags

Implementations table:
- preview_url, preview_thumb, preview_html for multiple formats
- python_version, library_version (created with)
- tested as JSONB array [{py, lib, ok, error?}]
- Remove: variant, file_path, tested bool, workflow_run, evaluator_scores, quality_feedback, improvements_suggested

Libraries table:
- Remove: active, created_at (not needed)
- Changed spec file paths from `specs/` to `plots/`
- Updated implementation file paths to reflect new directory structure
- Adjusted documentation and comments to align with new paths
- Change template paths from `templates/` to `prompts/templates/`
- Move `sync_to_postgres.py` to `automation/scripts/`
- Update documentation to reflect new file structure
- Simplified GCS preview URL to point directly to latest.png
- Added versioning, date, issue, and quality score to current and history fields in metadata
- Updated repository documentation to reflect new GCS storage structure
- Merge bot-validate-request + gen-create-spec into plot-prepare.yml
- Disable old workflows (renamed to .yml.disabled)
- Add update request analysis (validates if update reason is sensible)
- Update issue templates for clearer workflow
Copilot AI review requested due to automatic review settings December 9, 2025 20:17
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Dec 9, 2025

⏭️ Plot Tests Skipped

No plot files changed

Compatibility: 3.12 3.13

Note: Only Python 3.13 is required to pass. Python 3.12 is tested for compatibility.

@MarkusNeusinger MarkusNeusinger merged commit 109a8fa into main Dec 9, 2025
9 of 13 checks passed
@MarkusNeusinger MarkusNeusinger deleted the claude/plots-restructure-01Pi7U6YJE6erMpGqL1ea5kg branch December 9, 2025 20:19
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR implements a major restructuring from a library-centric to a plot-centric repository organization. The changes consolidate all assets for each plot type (specification, metadata, and implementations across 9 libraries) into single directories under plots/{spec-id}/. This includes:

  • Migration from specs/{spec-id}.md and plots/{library}/{plot_type}/{spec-id}/default.py to plots/{spec-id}/spec.md and plots/{spec-id}/implementations/{library}.py
  • Introduction of structured metadata files (metadata.yaml) alongside specs
  • Updated database models to track version history, quality scores, and generation metadata
  • New sync script that parses the plot-centric structure and syncs to PostgreSQL
  • Comprehensive documentation updates reflecting the new architecture
  • Template files for AI-generated specs and metadata

Key Improvements:

  • Self-contained plot directories (easier navigation)
  • Structured metadata for tracking (tags, versions, quality scores)
  • Simplified file naming (library.py instead of default.py in nested paths)
  • Better separation between spec content and metadata

Reviewed changes

Copilot reviewed 66 out of 139 changed files in this pull request and generated no comments.

Show a summary per file
File Description
specs/.template.md Deleted - Replaced by prompts/templates/spec.md
scripts/sync_to_postgres.py Deleted - Replaced by automation/scripts/sync_to_postgres.py
prompts/templates/spec.md Added - New spec template with simplified structure (Applications, Data, Notes)
prompts/templates/metadata.yaml Added - Comprehensive metadata template with tags and implementation tracking
plots/{spec-id}/spec.md Added - New plot-centric specs for multiple plot types
plots/{spec-id}/metadata.yaml Added - Metadata files for each plot
plots/{spec-id}/implementations/*.py Added - Library implementations in new structure
plots/{library}/{plot_type}/{spec-id}/default.py Deleted - Old library-centric implementations removed
core/database/models.py Modified - Enhanced schema with history tracking, quality metadata
automation/scripts/sync_to_postgres.py Added - New sync script for plot-centric structure
api/main.py Modified - Updated to use PLOTS_DIR instead of SPECS_DIR
docs/*.md Modified - Documentation updated to reflect new structure
prompts/*.md Modified - AI prompts updated with new file paths
alembic/versions/004_*.py Added - Migration for history fields
Files not reviewed (1)
  • .idea/data_source_mapping.xml: Language not supported

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.

3 participants