Files
ss-tools/specs/030-dataset-lifecycle-workspace/quickstart.md
busya b529e8082a feat(030): Dataset Lifecycle Workspace — Stats Bar, split-view, inline-edit, bulk actions
Backend:
- Add MetricItem, StatsCounts, ColumnDescriptionUpdate, MetricDescriptionUpdate DTOs
- Add metric_count to DatasetItem and DatasetDetailResponse
- Add server-side filtering via ?filter=unmapped|mapped|linked|all
- Add PUT endpoints for column/metric description inline-edit
- Add HTML stripping validation (max 2000 chars, plain text)
- Add WebSocket dataset.updated event on task completion
- RBAC: plugin:migration:WRITE for mutations, READ for reads
- 14 pytest tests (stats, filter, metrics, inline-edit, validation, 502/503)

Frontend:
- Rewrite +page.svelte as split-view orchestrator (387 lines)
- StatsBar.svelte — 4 metric tiles with aria-pressed, server-side filter dispatch
- DatasetList.svelte — card grid with progress bars, checkboxes, search
- DatasetPreview.svelte — presentational detail panel (container fetches)
- ColumnsTable.svelte — inline-edit with type chips, bold/italic fallback
- MetricsTable.svelte — inline-edit with expression hints
- 52 vitest tests across 7 test files
- i18n: 11 EN + 11 RU keys (with_mapping/с_маппингом)

Spec:
- 15 issues resolved (semantic label, filtering, endpoints, conflict, metric_count, RBAC, ID types, ports, i18n, validation, a11y, propagation, resize, perf, ownership)

Status: 14/14 backend tests pass, 52/52 frontend tests pass, build succeeds
Risk: Low — T051 browser validation pending (non-blocking)
2026-05-21 13:58:47 +03:00

3.5 KiB

Quickstart: Dataset Lifecycle Workspace

Prerequisites

  • Backend virtualenv: cd backend && source .venv/bin/activate
  • Frontend deps: cd frontend && npm install
  • Superset environment configured (dev instance, URL configured in backend/.env)
  • RBAC: user must have plugin:migration:WRITE permission for mutation endpoints, plugin:migration:READ for list/detail reads
  • Backend dev server: http://localhost:8000
  • Frontend dev server (proxies API to backend): http://localhost:8100
  • Direct backend API access for smoke tests: http://localhost:8000/api/datasets/...
  • Frontend proxy access (browser): http://localhost:8100/datasets

Backend Verification

# Run backend tests
cd backend && source .venv/bin/activate && python -m pytest -v

# Lint
python -m ruff check .

# Run dev server
uvicorn src.main:app --reload --port 8000

Frontend Verification

# Run frontend tests
cd frontend && npm run test

# Lint
cd frontend && npm run lint

# Build check
cd frontend && npm run build

# Dev server (requires backend on :8000)
cd frontend && npm run dev

Feature-Specific Verification

Backend API Tests

# Test metrics in dataset detail response (direct backend)
curl -s http://localhost:8000/api/datasets/32?env_id=dev | jq '.metrics, .metric_count'

# Test stats counts in dataset list
curl -s 'http://localhost:8000/api/datasets?env_id=dev&page=1&page_size=5' | jq '.stats'

# Test server-side filtering
curl -s 'http://localhost:8000/api/datasets?env_id=dev&filter=unmapped&page=1&page_size=5' | jq '.datasets | length'

# Test column description inline-edit
curl -s -X PUT http://localhost:8000/api/datasets/32/columns/851/description \
  -H 'Content-Type: application/json' \
  -d '{"description":"Updated via API"}'

# Test metric description inline-edit
curl -s -X PUT http://localhost:8000/api/datasets/32/metrics/70/description \
  -H 'Content-Type: application/json' \
  -d '{"description":"Count of all records"}'

Frontend Component Tests

# Run dataset-specific component tests
cd frontend && npx vitest run src/routes/datasets/ --reporter=verbose

Browser Validation

  1. Open http://localhost:8100/datasets
  2. Verify Stats Bar shows 4 tiles with counts
  3. Click each tile — list filters correctly
  4. Click a dataset card — detail panel loads with columns + metrics
  5. Click ✏️ on a column — textarea appears, type description, save
  6. Verify description persists after save
  7. Check 2+ checkboxes — bottom panel appears
  8. Click "Map Columns" — modal opens

Docker

docker compose up --build
# Visit http://localhost:8100/datasets

Key Files Changed/Created

File Change
backend/src/api/routes/datasets.py +MetricItem, +StatsCounts, +2 endpoints, MOD DatasetsResponse/DatasetDetailResponse
backend/src/core/superset_client/_datasets.py +metrics extraction in get_dataset_detail
backend/src/core/task_manager.py +dataset.updated WebSocket event on task complete
frontend/src/routes/datasets/+page.svelte REWRITE (split-view orchestrator)
frontend/src/routes/datasets/StatsBar.svelte NEW
frontend/src/routes/datasets/DatasetList.svelte NEW
frontend/src/routes/datasets/DatasetPreview.svelte NEW
frontend/src/routes/datasets/ColumnsTable.svelte NEW
frontend/src/routes/datasets/MetricsTable.svelte NEW
frontend/src/lib/i18n/locales/en/datasets.json +11 keys
frontend/src/lib/i18n/locales/ru/datasets.json +11 keys