Back to Opik

Known Dependency Violations

apps/opik-frontend/.dependency-cruiser-known-violations.README.md

2.0.24-52622.7 KB
Original Source

Known Dependency Violations

This file documents the known dependency violations captured in .dependency-cruiser-known-violations.json.

Purpose

The baseline file allows us to:

  1. Prevent NEW violations - Any new violation will fail the build
  2. Track existing violations - All current violations are documented
  3. Gradually fix issues - Remove entries as violations are resolved

Current Violations Summary

Circular Dependencies (12) - MUST FIX

These create maintenance nightmares and potential runtime issues:

  • useOpenAICompatibleModelsprovider.tsuseLLMProviderModelsData
  • useProviderKeysprovider.tsuseLLMProviderModelsDatauseOpenAICompatibleModels
  • MetricTagPlaygroundOutputScores
  • useDatasetItemDatauseDatasetItemFormHelpers (2 locations)
  • FeedbackScoreTable cells ↔ utils.tsconstants.ts (5 violations)

Shared → Pages-shared (35) - Refactor needed

Components in shared/ importing from pages-shared/:

  • Dashboard widgets importing from pages-shared
  • DataTableCells importing from pages-shared
  • TruncationConfigPopover, PromptImprovementDialog, etc.

Fix: Move these components to pages-shared/ or extract shared utilities

Pages-shared → Pages (8) - Extract shared code

  • AddToDatasetDialogAddEditDatasetDialog
  • DatasetSelectBoxAddEditDatasetDialog
  • ThreadDetailsPanelWorkspacePreferencesTab/types.ts
  • ExperimentsRadarChartuseCompareExperimentsChartsData

Fix: Extract shared types/utilities to pages-shared/ or lib/

Cross-page Imports (5) - Extract to pages-shared

  • HomePageProjectsPage, OptimizationsPage
  • TracesPageHomePageShared

Fix: Move shared dialogs/components to pages-shared/

Hooks → Components (1)

  • useProviderOptionsProviderGrid

Fix: Use composition pattern instead

Types → Components (2)

  • dashboard.tsDateRangeSelect, breakdown.ts

Fix: Move types to types folder, keep runtime code separate

API → Components (1)

  • useProjectMetricbreakdown.ts

Fix: Move breakdown.ts to lib/

How to Fix

  1. Pick a violation from the list
  2. Refactor the code to fix it
  3. Run npm run deps:validate to verify
  4. Remove the fixed entry from .dependency-cruiser-known-violations.json
  5. Commit changes

Regenerating Baseline

If you need to regenerate the baseline (after fixing violations):

bash
npx depcruise src --config --output-type baseline > .dependency-cruiser-known-violations.json

Adding to CI

Add this to your CI pipeline to prevent new violations:

bash
npm run deps:validate

The command will:

  • ✅ Pass if only known violations exist
  • ❌ Fail if any NEW violations are introduced