Skip to content

Stabilize phases 0–4: autosave, rename cascade, auto-commit, apply-to-warehouse#59

Merged
KKranthi6881 merged 1 commit into
mainfrom
feat/stabilize-phases-0-4
Apr 22, 2026
Merged

Stabilize phases 0–4: autosave, rename cascade, auto-commit, apply-to-warehouse#59
KKranthi6881 merged 1 commit into
mainfrom
feat/stabilize-phases-0-4

Conversation

@KKranthi6881

Copy link
Copy Markdown
Collaborator

Summary

Lands the backend + frontend stabilization work from the DataLex roadmap (phases 0–4 of plans/you-are-focusin-on-foamy-bachman.md). Every UI edit now persists within 1s, renames cascade atomically, auto-commit is opt-in, and forward-engineering to the warehouse is one click.

Changes by phase

Phase 0 — Foundation

  • FK shape canonicalized to {entity, field} end-to-end (EntityNode.jsx, schemaAdapter.js)
  • Structural YAML validation on PUT /api/files returns 422 with {code, message, details} on parse/shape errors; non-YAML files skip
  • NodeErrorBoundary wraps React-Flow nodes so a malformed entity renders a red chip without blanking the canvas

Phase 1 — Autosave + diagram sync

  • 800ms debounced autosave keyed by activeFile.fullPath; flushes on Ctrl+S, tab switch, close, and input blur
  • bumpModelGraphVersion fires on structural edits so cross-file changes repaint open diagrams
  • Shell.jsx memo key on modelGraphVersion

Phase 2 — Import fidelity

  • ImportResultsPanel surfaces the sync report (models imported, type: unknown counts, unresolved relationships, manifest-only banner when warehouse creds missing)
  • modelToFlow.js attaches warnings[] to entities; EntityNode renders amber chip + tooltip
  • importers.py emits partial relationships with status: "unresolved" instead of dropping silently — rendered as dashed grey edges, skipped by DDL generation

Phase 3 — Rename cascade

  • applyRenameCascade composes with bulkRefactor walkers to rewrite FKs, relationship endpoints, and indexes
  • matchesRenameSource normalizes paths (./foo, /foo, foo all compare equal) — unit tests in renamePaths.test.js
  • New POST /api/projects/:id/rename-cascade endpoint snapshots every rewrite target, applies serially, and rewinds on any write failure; returns { touched, untouched } on partial failure

Phase 4 — Auto-commit + apply

  • PATCH /api/projects/:id/config merges projectConfig patches with a shallow+one-level-deep strategy so { autoCommit: { enabled: true } } doesn't wipe messageTemplate
  • saveCurrentFile fires POST /api/git/commit with a 2s debounce when autoCommit.enabled — bursty autosaves produce one commit
  • ApplyDdlDialog + Shell palette entry "Apply to warehouse…" wires to /api/forward/apply (existing DIRECT_APPLY_ENABLED gate)
  • ⌘⇧E / Ctrl+Shift+E shortcut exports diagram to PNG via html-to-image; DiagramToolbar promotes export buttons to the primary row

Test plan

  • npm test in packages/web-app — 55 passing
  • npm test in packages/api-server — 59 passing (incl. 6 new put-files-validation.test.js)
  • Manual smoke: import jaffle-shop demo → open customers.model.yaml → change a field type → reload → persists
  • Manual smoke: enable auto-commit → 3 edits in 10s → git log shows 1 commit
  • Manual smoke: Apply to warehouse with Dry Run → DDL preview + success response

Follow-ups

PR #2 (next) replaces the bundled jaffle-shop fixture with a clone-from-GitHub flow, adds Playwright E2E coverage, CI workflow, and rewrites the tutorial docs.

🤖 Generated with Claude Code

…ply-to-warehouse)

Phase 0 — Foundation & consistency
  - Canonicalize FK shape to {entity, field} in EntityNode + schemaAdapter
  - YAML structural validation on PUT /api/files (422 on parse/shape errors)
  - NodeErrorBoundary wraps diagram nodes so one bad field can't blank canvas

Phase 1 — Autosave + diagram sync
  - 800ms debounced autosave in workspaceStore; save-on-blur from ColumnsView
  - bumpModelGraphVersion on shape edits so cross-file edits repaint

Phase 2 — Import fidelity & warnings
  - Import Results panel surfaces sync report, manifest-only banner, unknown-type counts
  - modelToFlow attaches warnings to entities; EntityNode shows amber chip + tooltip
  - importers emit partial relationships with status: unresolved (dashed grey edges)

Phase 3 — Rename cascade hardening
  - applyRenameCascade walks FKs, relationships, and indexes via bulkRefactor
  - matchesRenameSource path normalization (renamePaths helper + tests)
  - POST /api/projects/:id/rename-cascade atomic rewrite with snapshot/rollback

Phase 4 — Auto-commit + apply-to-warehouse
  - PATCH /api/projects/:id/config with one-level deep merge for autoCommit settings
  - saveCurrentFile fires POST /api/git/commit (2s debounced) when autoCommit.enabled
  - ApplyDdlDialog + Shell palette entry; ⌘⇧E export PNG shortcut
  - DiagramToolbar promotes PNG/SVG export to primary row

Tests: 55 web-app + 59 api-server unit tests pass.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@KKranthi6881 KKranthi6881 merged commit 275b676 into main Apr 22, 2026
3 checks passed
@KKranthi6881 KKranthi6881 deleted the feat/stabilize-phases-0-4 branch April 22, 2026 16:48
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