Skip to content

Conversation

@DaxServer
Copy link
Owner

Addresses Task 6 of #66

@coderabbitai
Copy link

coderabbitai bot commented Jul 20, 2025

Warning

Rate limit exceeded

@DaxServer has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 24 minutes and 6 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between d424a39 and 3a23ff5.

📒 Files selected for processing (5)
  • frontend/src/composables/__tests__/useSchemaApi.test.ts (5 hunks)
  • frontend/src/composables/useSchemaApi.ts (1 hunks)
  • frontend/src/composables/useSchemaBuilder.ts (0 hunks)
  • frontend/src/types/__tests__/drop-target-validation.test.ts (6 hunks)
  • frontend/src/utils/data-type-compatibility.ts (1 hunks)
📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Introduced a global drag-and-drop state management system for schema editing, improving consistency and validation of drag-and-drop actions.
    • Added utilities for checking compatibility between database column types and Wikibase data types.
  • Refactor

    • Updated drag-and-drop logic to use a centralized store, simplifying local state management in components.
    • Renamed schema property from "wikibaseUrl" to "wikibase" for consistency.
  • Bug Fixes

    • Improved type compatibility checks and validation logic for drag-and-drop targets.
  • Tests

    • Added comprehensive tests for the new drag-and-drop store and updated related composable tests.
  • Chores

    • Updated TypeScript and ESLint configurations for improved type support and auto-imports.
    • Fixed Bun version in CI workflow for consistent testing.
    • Removed an unused test script from the project configuration.

Walkthrough

This change migrates drag-and-drop state management in the schema editor frontend from a local composable to a new global Pinia store (useDragDropStore). The composable is refactored to delegate state and logic to the store. Type definitions, tests, and auto-import configurations are updated accordingly. TypeScript config and task documentation are also adjusted.

Changes

File(s) Change Summary
frontend/src/stores/drag-drop.store.ts, frontend/src/stores/tests/drag-drop.store.test.ts Added a new Pinia store for drag-and-drop state with comprehensive unit tests.
frontend/src/composables/useDragDropContext.ts, frontend/src/composables/tests/useDragDropContext.test.ts Refactored composable and its tests to use the new global store for drag-and-drop logic and state.
frontend/src/types/drag-drop.ts Removed global state from SchemaDragDropContext interface; clarified its scope with comments.
frontend/auto-imports.d.ts, frontend/.eslintrc-auto-import.json Registered the new store for auto-import and ESLint global recognition.
frontend/tsconfig.app.json, frontend/tsconfig.vite.json Added "esnext" and "dom" to TypeScript lib compiler options.
.kiro/specs/wikibase-schema-editor/tasks.md Marked the "Create drag-and-drop composable" task as completed.
package.json Removed the "test" script entry.

Sequence Diagram(s)

sequenceDiagram
    participant UI
    participant useDragDropContext
    participant useDragDropStore

    UI->>useDragDropContext: Initiate drag (startDrag)
    useDragDropContext->>useDragDropStore: startDrag(column)
    useDragDropStore-->>useDragDropContext: Updates state

    UI->>useDragDropContext: Enter drop zone (enterDropZone)
    useDragDropContext->>useDragDropStore: setHoveredTarget(targetPath)
    useDragDropStore-->>useDragDropContext: Updates hovered target

    UI->>useDragDropContext: Perform drop (performDrop)
    useDragDropContext->>useDragDropStore: setDragState("dropping")
    useDragDropContext->>useDragDropStore: endDrag()
    useDragDropStore-->>useDragDropContext: Resets drag state
Loading

Possibly related PRs

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🔭 Outside diff range comments (1)
frontend/src/composables/useDragDropContext.ts (1)

34-54: Duplicate compatibility mapping logic.

The isDataTypeCompatible function contains the same compatibility mapping that exists in the store (lines 37-52 and 111-126 in the store). This violates the DRY principle and could lead to maintenance issues.

Consider refactoring to reuse the compatibility logic from the store. You could either:

  1. Export a helper function from the store that both the store and composable can use
  2. Move the validation logic entirely to the store and have the composable call store methods

Example approach:

-const isDataTypeCompatible = (columnType: string, acceptedTypes: WikibaseDataType[]): boolean => {
-  const compatibilityMap: Record<string, WikibaseDataType[]> = {
-    VARCHAR: ['string', 'url', 'external-id', 'monolingualtext'],
-    // ... duplicate mapping
-  }
-
-  const compatibleTypes = compatibilityMap[columnType.toUpperCase()] || []
-  return acceptedTypes.some((type) => compatibleTypes.includes(type))
-}
+const isDataTypeCompatible = (columnType: string, acceptedTypes: WikibaseDataType[]): boolean => {
+  const store = useDragDropStore()
+  // Create a mock column to leverage the store's validation logic
+  const mockColumn: ColumnInfo = {
+    name: '',
+    dataType: columnType,
+    nullable: false,
+    sampleValues: []
+  }
+  const mockTarget: DropTarget = {
+    type: 'statement',
+    path: '',
+    acceptedTypes,
+    propertyId: 'P1'
+  }
+  // Use the store's validation logic
+  return store.getValidTargetsForColumn(mockColumn).some(
+    target => target.acceptedTypes.some(type => acceptedTypes.includes(type))
+  )
+}
🧹 Nitpick comments (4)
frontend/tsconfig.vite.json (1)

18-18: Global @types/node in a browser-facing config can mask misuse of Node-only APIs

Keeping

"types": ["node"]

makes Buffer, process, etc. compile in every src/**/*.ts|vue file matched by this config.
That may silently ship Node-specific code to the browser bundle.
Typical pattern:

"types": ["node"],
"typeRoots": ["./types"],           // limit to config/cli only
"exclude": ["src/**/*"]             // or move the Node config to a separate tsconfig.node.json

Unless you intentionally need Node globals in your runtime code, consider scoping them to build scripts instead.

frontend/tsconfig.app.json (2)

15-19: Redundant lib definition – already provided by @vue/tsconfig/tsconfig.dom.json

tsconfig.dom.json that you extend at line 2 already sets

"lib": ["dom", "esnext"]

Re-declaring the same array here adds maintenance overhead and risks divergence between configs.
You can safely drop the block below to inherit the upstream defaults:

-    "lib": [
-      "esnext",
-      "dom"
-    ]

14-16: Missing comma after closing brace will break JSON5 tooling

There is no comma between the "lib" block (now suggested for removal) and the closing brace of "compilerOptions".
If you decide to keep additional properties later, ensure the trailing comma on "tsBuildInfoFile" stays consistent.

frontend/src/composables/useDragDropContext.ts (1)

186-198: TODO: Implement actual drop operation logic.

The current implementation contains placeholder logic that simulates an async operation. The comments indicate this should be replaced with actual implementation such as API calls or store updates.

Would you like me to help implement the actual drop operation logic or create an issue to track this TODO?

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between eb4c3f8 and c49733c.

📒 Files selected for processing (11)
  • .kiro/specs/wikibase-schema-editor/tasks.md (1 hunks)
  • frontend/.eslintrc-auto-import.json (1 hunks)
  • frontend/auto-imports.d.ts (2 hunks)
  • frontend/src/composables/__tests__/useDragDropContext.test.ts (10 hunks)
  • frontend/src/composables/useDragDropContext.ts (6 hunks)
  • frontend/src/stores/__tests__/drag-drop.store.test.ts (1 hunks)
  • frontend/src/stores/drag-drop.store.ts (1 hunks)
  • frontend/src/types/drag-drop.ts (1 hunks)
  • frontend/tsconfig.app.json (1 hunks)
  • frontend/tsconfig.vite.json (1 hunks)
  • package.json (0 hunks)
💤 Files with no reviewable changes (1)
  • package.json
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{ts,tsx,js,jsx}

Instructions used from:

Sources:
📄 CodeRabbit Inference Engine

  • .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc
**/*.{html,ts,tsx,css}

Instructions used from:

Sources:
📄 CodeRabbit Inference Engine

  • .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc
**/*.test.{ts,tsx,js,jsx}

Instructions used from:

Sources:
📄 CodeRabbit Inference Engine

  • .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc
🧠 Learnings (11)
📓 Common learnings
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/**/*.{vue,ts} : Use Pinia stores for global state
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/composables/**/*.ts : Do not proxy or export Pinia store state/actions from composables
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.690Z
Learning: Applies to src/**/*.vue : Use Pinia for state management in all Vue components
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/composables/**/*.ts : Do not export store state from composables
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/**/*.vue : Use auto-imports for Vue, Pinia, composables, and utilities
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/**/*.vue : Use storeToRefs for state in components
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/composables/**/*.ts : Use composables for logic that is not global state
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/composables/**/*.ts : Place composables in the composables/ directory
.kiro/specs/wikibase-schema-editor/tasks.md (1)
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/composables/**/*.ts : Use composables for logic that is not global state
frontend/.eslintrc-auto-import.json (4)
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/**/*.vue : Use auto-imports for Vue, Pinia, composables, and utilities
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/**/*.{vue,ts} : Use Pinia stores for global state
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-07-20T14:13:40.125Z
Learning: Applies to **/*.{html,tsx,jsx,js,css} : Use HTML imports with `Bun.serve()` instead of `vite` for frontend development
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-07-20T14:13:40.126Z
Learning: Applies to **/*.{tsx,jsx,js} : Import .css files directly in .tsx, .jsx, or .js files and Bun will handle them
frontend/tsconfig.vite.json (11)
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-07-20T14:13:40.125Z
Learning: Applies to **/*.{html,tsx,jsx,js,css} : Use HTML imports with `Bun.serve()` instead of `vite` for frontend development
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/**/*.{ts,vue} : Type safety everywhere
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/**/*.{vue,ts} : Always use backend-inferred types for API data
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.690Z
Learning: Applies to src/**/*.vue : Use Vue 3 with Composition API and <script setup lang="ts"> in all Vue components
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-07-20T14:13:40.125Z
Learning: Applies to **/*.{html,ts,tsx,css} : Use `bun build <file.html|file.ts|file.css>` instead of `webpack` or `esbuild` for building HTML, TypeScript, or CSS files
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-07-20T14:13:40.125Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Use `bun:sqlite` for SQLite instead of `better-sqlite3`
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-07-20T14:13:40.125Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Use built-in `WebSocket` instead of `ws`
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-07-20T14:13:40.125Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Use `bun <file>` instead of `node <file>` or `ts-node <file>` for running TypeScript or JavaScript files
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/**/*.vue : Props and emits must use explicit TypeScript interfaces
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-07-20T14:13:40.125Z
Learning: Applies to **/*.html : HTML files can import .tsx, .jsx, or .js files directly and Bun's bundler will transpile & bundle automatically
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-07-20T14:13:40.125Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Prefer `Bun.file` over `node:fs`'s readFile/writeFile
frontend/tsconfig.app.json (10)
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-07-20T14:13:40.125Z
Learning: Applies to **/*.{html,ts,tsx,css} : Use `bun build <file.html|file.ts|file.css>` instead of `webpack` or `esbuild` for building HTML, TypeScript, or CSS files
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/**/*.{ts,vue} : Type safety everywhere
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-07-20T14:13:40.125Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Use `bun <file>` instead of `node <file>` or `ts-node <file>` for running TypeScript or JavaScript files
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-07-20T14:13:40.125Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Use `bun:sqlite` for SQLite instead of `better-sqlite3`
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.690Z
Learning: Applies to src/**/*.vue : Use Vue 3 with Composition API and <script setup lang="ts"> in all Vue components
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-07-20T14:13:40.125Z
Learning: Applies to **/*.{html,tsx,jsx,js,css} : Use HTML imports with `Bun.serve()` instead of `vite` for frontend development
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-07-20T14:13:40.125Z
Learning: Applies to **/*.test.{ts,tsx,js,jsx} : Use `bun test` instead of `jest` for running tests
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/**/*.vue : Use auto-imports for Vue, Pinia, composables, and utilities
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-07-20T14:13:40.125Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Do not use dotenv; Bun automatically loads .env files
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/composables/**/*.ts : Place composables in the composables/ directory
frontend/auto-imports.d.ts (14)
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/**/*.{vue,ts} : Use Pinia stores for global state
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/**/*.vue : Use storeToRefs for state in components
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/composables/**/*.ts : Do not export store state from composables
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/**/*.{ts,vue} : Type safety everywhere
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/**/*.{vue,ts} : Always use backend-inferred types for API data
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/**/*.{vue,ts} : Use useApi composable (Elysia Eden) for all API calls
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.690Z
Learning: Applies to src/**/*.vue : Use Vue 3 with Composition API and <script setup lang="ts"> in all Vue components
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/**/*.{vue,ts} : Use readonly and shallowReactive for large or expensive data
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/**/*.vue : Use auto-imports for Vue, Pinia, composables, and utilities
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/**/*.vue : Props and emits must use explicit TypeScript interfaces
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/composables/**/*.ts : Use composables for logic that is not global state
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/**/*.vue : Use v-memo, shallowRef, markRaw, and Suspense for performance optimization
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/**/*.vue : Prefer composables over methods in Vue components
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/composables/**/*.ts : Do not proxy or export Pinia store state/actions from composables
frontend/src/composables/__tests__/useDragDropContext.test.ts (10)
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/composables/**/*.ts : Do not proxy or export Pinia store state/actions from composables
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/**/*.{vue,ts} : Use Pinia stores for global state
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/composables/**/*.ts : Do not export store state from composables
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/composables/**/*.ts : Use composables for logic that is not global state
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.690Z
Learning: Applies to src/**/*.vue : Use Pinia for state management in all Vue components
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-07-20T14:13:40.125Z
Learning: Applies to **/*.test.{ts,tsx,js,jsx} : Use `bun test` instead of `jest` for running tests
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/**/*.vue : Use auto-imports for Vue, Pinia, composables, and utilities
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-07-20T14:13:40.125Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Use `bun:sqlite` for SQLite instead of `better-sqlite3`
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-07-20T14:13:40.126Z
Learning: For more information, read the official Bun documentation at https://bun.sh/docs or check `node_modules/bun-types/docs/**.md` if available locally
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-07-20T14:13:40.125Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Use `Bun.sql` for Postgres instead of `pg` or `postgres.js`
frontend/src/types/drag-drop.ts (2)
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/composables/**/*.ts : Do not export store state from composables
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/**/*.vue : Props and emits must use explicit TypeScript interfaces
frontend/src/stores/__tests__/drag-drop.store.test.ts (4)
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/**/*.{vue,ts} : Use Pinia stores for global state
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/composables/**/*.ts : Do not proxy or export Pinia store state/actions from composables
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.690Z
Learning: Applies to src/**/*.vue : Use Pinia for state management in all Vue components
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/composables/**/*.ts : Do not export store state from composables
frontend/src/composables/useDragDropContext.ts (13)
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/composables/**/*.ts : Do not export store state from composables
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/composables/**/*.ts : Use composables for logic that is not global state
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/**/*.vue : Use storeToRefs for state in components
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/composables/**/*.ts : Do not proxy or export Pinia store state/actions from composables
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/**/*.{vue,ts} : Use Pinia stores for global state
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/**/*.vue : Use v-memo, shallowRef, markRaw, and Suspense for performance optimization
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/**/*.vue : Use auto-imports for Vue, Pinia, composables, and utilities
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/**/*.{ts,vue} : Type safety everywhere
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/**/*.vue : Prefer reactivity over computed unless necessary
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/**/*.{vue,ts} : Use readonly and shallowReactive for large or expensive data
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/**/*.vue : Use reactive objects for form state and errors
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.690Z
Learning: Applies to src/**/*.vue : Use Vue 3 with Composition API and <script setup lang="ts"> in all Vue components
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/**/*.{vue,ts} : Use useApi composable (Elysia Eden) for all API calls
frontend/src/stores/drag-drop.store.ts (5)
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/**/*.{vue,ts} : Use Pinia stores for global state
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/composables/**/*.ts : Do not proxy or export Pinia store state/actions from composables
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/composables/**/*.ts : Do not export store state from composables
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.690Z
Learning: Applies to src/**/*.vue : Use Pinia for state management in all Vue components
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/**/*.vue : Use storeToRefs for state in components
🧬 Code Graph Analysis (3)
frontend/auto-imports.d.ts (1)
frontend/src/stores/drag-drop.store.ts (1)
  • useDragDropStore (9-201)
frontend/src/composables/__tests__/useDragDropContext.test.ts (2)
frontend/src/composables/useDragDropContext.ts (1)
  • useDragDropContext (60-278)
frontend/src/stores/drag-drop.store.ts (1)
  • useDragDropStore (9-201)
frontend/src/stores/drag-drop.store.ts (2)
frontend/auto-imports.d.ts (4)
  • ColumnInfo (359-359)
  • DragState (353-353)
  • DropTarget (353-353)
  • WikibaseDataType (359-359)
frontend/src/types/drag-drop.ts (2)
  • DragState (53-53)
  • DropTarget (35-42)
🪛 Biome (1.9.4)
frontend/src/stores/drag-drop.store.ts

[error] 64-64: Other switch clauses can erroneously access this declaration.
Wrap the declaration in a block to restrict its access to the switch clause.

The declaration is defined in this switch clause:

Unsafe fix: Wrap the declaration in a block.

(lint/correctness/noSwitchDeclarations)


[error] 65-67: Other switch clauses can erroneously access this declaration.
Wrap the declaration in a block to restrict its access to the switch clause.

The declaration is defined in this switch clause:

Unsafe fix: Wrap the declaration in a block.

(lint/correctness/noSwitchDeclarations)


[error] 144-144: Other switch clauses can erroneously access this declaration.
Wrap the declaration in a block to restrict its access to the switch clause.

The declaration is defined in this switch clause:

Unsafe fix: Wrap the declaration in a block.

(lint/correctness/noSwitchDeclarations)


[error] 145-145: Other switch clauses can erroneously access this declaration.
Wrap the declaration in a block to restrict its access to the switch clause.

The declaration is defined in this switch clause:

Unsafe fix: Wrap the declaration in a block.

(lint/correctness/noSwitchDeclarations)

🔇 Additional comments (18)
frontend/tsconfig.vite.json (1)

18-22: Overriding lib drops everything that @tsconfig/node22 pre-configured – are you sure this is intended?

@tsconfig/node22/tsconfig.json ships with

"lib": ["es2022"]

By adding a new lib array you REPLACE (not merge) that list, so every ES-2022-only built-in (e.g. AggregateError, Awaited) vanishes from the compile target unless it is also present in "esnext".
If the goal is just to add DOM typings, consider extending the list instead of replacing it:

-    "lib": [
-      "esnext",
-      "dom"
-    ]
+    "lib": [
+      "es2022",
+      "esnext",
+      "dom"
+    ]

Please double-check that no server-side utilities rely on ES-2022 globals imported via this config.

.kiro/specs/wikibase-schema-editor/tasks.md (1)

33-33: Task completion appropriately documented.

The marking of task 6 as complete correctly reflects the implementation of the drag-and-drop composable functionality described in this PR.

frontend/.eslintrc-auto-import.json (1)

239-239: Correctly adds auto-import configuration for the new store.

The addition of useDragDropStore to the globals enables seamless usage across the frontend codebase without explicit imports, following the established auto-import pattern.

frontend/auto-imports.d.ts (2)

184-184: Proper TypeScript declaration for global store access.

The global constant declaration enables type-safe usage of useDragDropStore throughout the application.


542-542: Correct Vue component property declaration.

The component custom property declaration ensures useDragDropStore is available with proper typing in Vue component templates and instances.

frontend/src/types/drag-drop.ts (1)

5-10: Well-designed separation of concerns in interface definition.

The clarifying comment and simplified interface properly distinguish between local composable state and global store state. Retaining only isOverDropZone and dropFeedback as local UI state follows good architectural principles.

frontend/src/composables/__tests__/useDragDropContext.test.ts (6)

2-4: Proper test setup for store integration.

The addition of Pinia imports and store import correctly supports the new architecture where the composable delegates to the global store.


13-13: Correct Pinia initialization for testing.

Setting up Pinia in beforeEach ensures each test has a fresh store instance, following testing best practices.


33-39: Appropriate focus on local composable state.

The test correctly focuses on what the composable now owns (local drop zone state) rather than global drag state, reflecting the architectural separation of concerns.


72-74: Correct delegation to store for target management.

Using store.setAvailableTargets() instead of composable methods properly reflects that target management is now handled by the global store.


227-251: Well-structured store delegation testing.

The test correctly validates that target computation is delegated to the store while maintaining the same functional behavior.


264-297: Comprehensive method presence verification.

The new tests properly verify that both composable methods and store methods are available and functional, ensuring the integration works correctly.

frontend/src/stores/__tests__/drag-drop.store.test.ts (2)

1-53: Well-structured test setup with proper isolation.

The test setup correctly uses bun:test as per the coding guidelines and properly initializes a fresh Pinia instance for each test, ensuring proper test isolation. The mock data is comprehensive and covers various drop target scenarios.


55-424: Comprehensive test coverage for the drag-drop store.

The test suite thoroughly covers all aspects of the store including:

  • State initialization and transitions
  • Drag lifecycle management
  • Target validation with edge cases (nullable columns, length constraints, missing property IDs)
  • All computed properties
  • Data type compatibility mapping
  • Store reset functionality

The tests are well-organized and provide excellent coverage for the new global drag-drop state management.

frontend/src/composables/useDragDropContext.ts (2)

1-2: Correct integration with the global drag-drop store.

The composable properly imports and uses the useDragDropStore following the architectural pattern of using Pinia stores for global state management while keeping local state (isOverDropZone, dropFeedback) within the composable.

Also applies to: 68-69


77-136: Well-refactored drag lifecycle methods.

The methods correctly delegate global state management to the store while maintaining appropriate local state:

  • Good use of WeakMap for event listener cleanup
  • Proper separation between global state (in store) and local state (isOverDropZone, dropFeedback)
  • Clean integration with the store's actions
frontend/src/stores/drag-drop.store.ts (2)

1-29: Well-structured Pinia store implementation.

The store correctly uses the composition API pattern with proper reactive state management and computed properties. The structure follows Pinia best practices and aligns with the coding guidelines for using Pinia stores for global state.


80-106: Well-implemented store actions and exports.

The store actions follow the single responsibility principle and provide a clean API for managing drag-drop state. The $reset method properly clears all state, and the exports are comprehensive and well-organized.

Also applies to: 162-201

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

♻️ Duplicate comments (2)
frontend/src/stores/drag-drop.store.ts (2)

45-61: Fix switch statement variable declarations to prevent scope leakage.

Variables declared in switch cases without blocks can be accessed by other cases, causing potential scope issues.

Apply this fix to wrap the declarations in blocks:

    switch (target.type) {
      case 'label':
-     case 'alias': {
+     case 'alias': {
        const maxLength = target.type === 'label' ? 250 : 100
        const hasLongValues = draggedColumn.value.sampleValues?.some(
          (val) => val.length > maxLength,
        )
        if (hasLongValues) return false
        break
+     }
      case 'statement':
      case 'qualifier':
-     case 'reference': {
+     case 'reference': {
        if (!target.propertyId) return false
        break
+     }
    }

109-124: Fix switch statement variable declarations.

The same variable declaration issue exists here as well.

Apply this fix:

        switch (target.type) {
          case 'label':
-         case 'alias':
+         case 'alias': {
            const maxLength = target.type === 'label' ? 250 : 100
            const hasLongValues = column.sampleValues?.some((val) => val.length > maxLength)
            if (hasLongValues) return false
            break
+         }

          case 'statement':
          case 'qualifier':
-         case 'reference':
+         case 'reference': {
            if (!target.propertyId) return false
            break
+         }
        }
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c49733c and 1abccba.

📒 Files selected for processing (7)
  • frontend/.eslintrc-auto-import.json (3 hunks)
  • frontend/auto-imports.d.ts (6 hunks)
  • frontend/src/composables/__tests__/useSchemaApi.test.ts (2 hunks)
  • frontend/src/composables/useDragDropContext.ts (6 hunks)
  • frontend/src/stores/drag-drop.store.ts (1 hunks)
  • frontend/src/types/__tests__/drop-target-validation.test.ts (6 hunks)
  • frontend/src/utils/data-type-compatibility.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • frontend/.eslintrc-auto-import.json
  • frontend/auto-imports.d.ts
  • frontend/src/composables/useDragDropContext.ts
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{ts,tsx,js,jsx}

Instructions used from:

Sources:
📄 CodeRabbit Inference Engine

  • .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc
**/*.test.{ts,tsx,js,jsx}

Instructions used from:

Sources:
📄 CodeRabbit Inference Engine

  • .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc
**/*.{html,ts,tsx,css}

Instructions used from:

Sources:
📄 CodeRabbit Inference Engine

  • .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc
🧠 Learnings (5)
📓 Common learnings
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/**/*.{vue,ts} : Use Pinia stores for global state
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/composables/**/*.ts : Do not proxy or export Pinia store state/actions from composables
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.690Z
Learning: Applies to src/**/*.vue : Use Pinia for state management in all Vue components
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/composables/**/*.ts : Do not export store state from composables
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/**/*.vue : Use auto-imports for Vue, Pinia, composables, and utilities
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/**/*.vue : Use storeToRefs for state in components
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/composables/**/*.ts : Use composables for logic that is not global state
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/composables/**/*.ts : Place composables in the composables/ directory
frontend/src/composables/__tests__/useSchemaApi.test.ts (6)
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/composables/**/*.ts : Do not proxy or export Pinia store state/actions from composables
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/**/*.{vue,ts} : Use Pinia stores for global state
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/**/*.{vue,ts} : Use useApi composable (Elysia Eden) for all API calls
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/composables/**/*.ts : Do not export store state from composables
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/composables/**/*.ts : Use composables for logic that is not global state
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.690Z
Learning: Applies to src/**/*.vue : Use Pinia for state management in all Vue components
frontend/src/types/__tests__/drop-target-validation.test.ts (7)
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-07-20T14:13:40.125Z
Learning: Applies to **/*.test.{ts,tsx,js,jsx} : Use `bun test` instead of `jest` for running tests
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-07-20T14:13:40.126Z
Learning: For more information, read the official Bun documentation at https://bun.sh/docs or check `node_modules/bun-types/docs/**.md` if available locally
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-07-20T14:13:40.125Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Use `bun:sqlite` for SQLite instead of `better-sqlite3`
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-07-20T14:13:40.125Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Use `bun <file>` instead of `node <file>` or `ts-node <file>` for running TypeScript or JavaScript files
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-07-20T14:13:40.125Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Prefer `Bun.file` over `node:fs`'s readFile/writeFile
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-07-20T14:13:40.126Z
Learning: Applies to **/*.{tsx,jsx,js} : Import .css files directly in .tsx, .jsx, or .js files and Bun will handle them
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-07-20T14:13:40.125Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Use `Bun.$` (e.g., `Bun.$`ls``) instead of execa for running shell commands
frontend/src/utils/data-type-compatibility.ts (1)
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/**/*.{vue,ts} : Always use backend-inferred types for API data
frontend/src/stores/drag-drop.store.ts (5)
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/**/*.{vue,ts} : Use Pinia stores for global state
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/composables/**/*.ts : Do not proxy or export Pinia store state/actions from composables
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/composables/**/*.ts : Do not export store state from composables
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.690Z
Learning: Applies to src/**/*.vue : Use Pinia for state management in all Vue components
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/**/*.vue : Use storeToRefs for state in components
🧬 Code Graph Analysis (3)
frontend/src/types/__tests__/drop-target-validation.test.ts (1)
frontend/src/utils/data-type-compatibility.ts (1)
  • isDataTypeCompatible (39-45)
frontend/src/utils/data-type-compatibility.ts (1)
frontend/auto-imports.d.ts (1)
  • WikibaseDataType (362-362)
frontend/src/stores/drag-drop.store.ts (3)
frontend/auto-imports.d.ts (3)
  • ColumnInfo (362-362)
  • DragState (356-356)
  • DropTarget (356-356)
frontend/src/types/drag-drop.ts (2)
  • DragState (53-53)
  • DropTarget (35-42)
frontend/src/utils/data-type-compatibility.ts (1)
  • getCompatibleWikibaseTypes (29-31)
🪛 GitHub Actions: Run tests
frontend/src/composables/__tests__/useSchemaApi.test.ts

[error] 1-1: Unknown error reported in test file. No further details provided.

🪛 Biome (1.9.4)
frontend/src/stores/drag-drop.store.ts

[error] 113-113: Other switch clauses can erroneously access this declaration.
Wrap the declaration in a block to restrict its access to the switch clause.

The declaration is defined in this switch clause:

Unsafe fix: Wrap the declaration in a block.

(lint/correctness/noSwitchDeclarations)


[error] 114-114: Other switch clauses can erroneously access this declaration.
Wrap the declaration in a block to restrict its access to the switch clause.

The declaration is defined in this switch clause:

Unsafe fix: Wrap the declaration in a block.

(lint/correctness/noSwitchDeclarations)

🔇 Additional comments (7)
frontend/src/types/__tests__/drop-target-validation.test.ts (1)

2-2: Excellent refactoring to use centralized utility function.

The replacement of the local helper with the centralized isDataTypeCompatible utility function improves code reusability and maintainability. All test calls have been updated consistently to use the new function signature.

Also applies to: 78-78, 90-90, 102-102, 121-121, 133-133

frontend/src/utils/data-type-compatibility.ts (3)

7-22: Well-designed compatibility mapping with comprehensive coverage.

The DATA_TYPE_COMPATIBILITY_MAP provides thorough coverage of common database types and their Wikibase equivalents. The use of as const ensures type safety, and the mapping choices are logical (e.g., VARCHAR supporting multiple string-like types, numeric types mapping to quantity).


29-31: Robust helper function with proper defensive programming.

The function correctly handles case-insensitive lookups and provides a safe fallback to an empty array for unknown types.


39-45: Clean and efficient compatibility check implementation.

The function efficiently combines the type lookup with array intersection logic to determine compatibility.

frontend/src/stores/drag-drop.store.ts (3)

10-19: Excellent implementation of global drag-drop state management.

The store correctly centralizes drag-drop state using Pinia, following the retrieved learnings about using stores for global state. The reactive state variables are well-organized and cover all necessary aspects of drag-drop operations.


94-129: Well-implemented target validation logic with proper separation of concerns.

The calculateValidTargets function correctly uses the centralized utility function and implements comprehensive validation logic. The filtering approach is efficient and maintains good performance.


146-170: Proper store API design following Pinia composition patterns.

The returned interface correctly exposes state, computed properties, and actions, providing a clean API for components to consume. This aligns with Pinia best practices and the retrieved learnings about store usage.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1abccba and 79e6a02.

📒 Files selected for processing (4)
  • .github/workflows/test.yml (1 hunks)
  • frontend/src/composables/__tests__/useSchemaApi.test.ts (5 hunks)
  • frontend/src/composables/useSchemaApi.ts (1 hunks)
  • frontend/src/composables/useSchemaBuilder.ts (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • .github/workflows/test.yml
🚧 Files skipped from review as they are similar to previous changes (1)
  • frontend/src/composables/tests/useSchemaApi.test.ts
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{ts,tsx,js,jsx}

Instructions used from:

Sources:
📄 CodeRabbit Inference Engine

  • .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc
**/*.{html,ts,tsx,css}

Instructions used from:

Sources:
📄 CodeRabbit Inference Engine

  • .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc
🧠 Learnings (2)
📓 Common learnings
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/**/*.{vue,ts} : Use Pinia stores for global state
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/composables/**/*.ts : Do not proxy or export Pinia store state/actions from composables
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.690Z
Learning: Applies to src/**/*.vue : Use Pinia for state management in all Vue components
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/composables/**/*.ts : Do not export store state from composables
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/**/*.vue : Use auto-imports for Vue, Pinia, composables, and utilities
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/**/*.vue : Use storeToRefs for state in components
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/composables/**/*.ts : Use composables for logic that is not global state
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/composables/**/*.ts : Place composables in the composables/ directory
frontend/src/composables/useSchemaApi.ts (2)
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/**/*.{vue,ts} : Use useApi composable (Elysia Eden) for all API calls
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/composables/**/*.ts : Do not export store state from composables
🪛 GitHub Check: test
frontend/src/composables/useSchemaApi.ts

[failure] 20-20: TypeError: undefined is not an object (evaluating 'parsedSchema.id')

  at loadSchemaIntoStore (/home/runner/work/dataforge/dataforge/frontend/src/composables/useSchemaApi.ts:20:28)
  at <anonymous> (/home/runner/work/dataforge/dataforge/frontend/src/composables/useSchemaApi.ts:44:7)

[failure] 20-20: TypeError: undefined is not an object (evaluating 'parsedSchema.id')

  at loadSchemaIntoStore (/home/runner/work/dataforge/dataforge/frontend/src/composables/useSchemaApi.ts:20:28)
  at <anonymous> (/home/runner/work/dataforge/dataforge/frontend/src/composables/useSchemaApi.ts:92:7)

[failure] 20-20: TypeError: undefined is not an object (evaluating 'parsedSchema.id')

  at loadSchemaIntoStore (/home/runner/work/dataforge/dataforge/frontend/src/composables/useSchemaApi.ts:20:28)
  at <anonymous> (/home/runner/work/dataforge/dataforge/frontend/src/composables/useSchemaApi.ts:92:7)

[failure] 20-20: TypeError: undefined is not an object (evaluating 'parsedSchema.id')

  at loadSchemaIntoStore (/home/runner/work/dataforge/dataforge/frontend/src/composables/useSchemaApi.ts:20:28)
  at <anonymous> (/home/runner/work/dataforge/dataforge/frontend/src/composables/useSchemaApi.ts:69:7)

[failure] 20-20: TypeError: undefined is not an object (evaluating 'parsedSchema.id')

  at loadSchemaIntoStore (/home/runner/work/dataforge/dataforge/frontend/src/composables/useSchemaApi.ts:20:28)
  at <anonymous> (/home/runner/work/dataforge/dataforge/frontend/src/composables/useSchemaApi.ts:44:7)
🔇 Additional comments (2)
frontend/src/composables/useSchemaBuilder.ts (1)

114-114: LGTM! Property name consistency improvement.

The renaming from wikibaseUrl to wikibase aligns the parsed schema output with the internal property naming used in the schema structure, improving consistency across the codebase.

frontend/src/composables/useSchemaApi.ts (1)

23-23: Property rename aligns with schema builder changes.

The change from wikibaseUrl to wikibase maintains consistency with the property renaming in the schema builder composable.

Comment on lines 18 to 31
const parsedSchema = parseSchema(schema)

schemaStore.schemaId = parsedSchema.id
schemaStore.projectId = parsedSchema.projectId
schemaStore.schemaName = parsedSchema.name
schemaStore.wikibase = parsedSchema.wikibase
schemaStore.labels = parsedSchema.labels
schemaStore.descriptions = parsedSchema.descriptions
schemaStore.aliases = parsedSchema.aliases
schemaStore.statements = parsedSchema.statements
schemaStore.createdAt = parsedSchema.createdAt
schemaStore.updatedAt = parsedSchema.updatedAt
schemaStore.isDirty = false
schemaStore.lastSaved = new Date(updatedAt)
schemaStore.lastSaved = new Date(parsedSchema.updatedAt)
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Add null safety check for parsed schema result.

The refactoring to use a single parsedSchema variable improves readability and the property rename to wikibase maintains consistency. However, the static analysis reveals critical runtime errors where parsedSchema is undefined when accessing its properties.

Add a safety check to handle cases where parseSchema returns undefined:

 const loadSchemaIntoStore = (schema: WikibaseSchemaMapping) => {
   const parsedSchema = parseSchema(schema)
+  
+  if (!parsedSchema) {
+    console.error('Failed to parse schema:', schema)
+    return
+  }

   schemaStore.schemaId = parsedSchema.id
   schemaStore.projectId = parsedSchema.projectId
   schemaStore.schemaName = parsedSchema.name
   schemaStore.wikibase = parsedSchema.wikibase
   schemaStore.labels = parsedSchema.labels
   schemaStore.descriptions = parsedSchema.descriptions
   schemaStore.aliases = parsedSchema.aliases
   schemaStore.statements = parsedSchema.statements
   schemaStore.createdAt = parsedSchema.createdAt
   schemaStore.updatedAt = parsedSchema.updatedAt
   schemaStore.isDirty = false
   schemaStore.lastSaved = new Date(parsedSchema.updatedAt)
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const parsedSchema = parseSchema(schema)
schemaStore.schemaId = parsedSchema.id
schemaStore.projectId = parsedSchema.projectId
schemaStore.schemaName = parsedSchema.name
schemaStore.wikibase = parsedSchema.wikibase
schemaStore.labels = parsedSchema.labels
schemaStore.descriptions = parsedSchema.descriptions
schemaStore.aliases = parsedSchema.aliases
schemaStore.statements = parsedSchema.statements
schemaStore.createdAt = parsedSchema.createdAt
schemaStore.updatedAt = parsedSchema.updatedAt
schemaStore.isDirty = false
schemaStore.lastSaved = new Date(updatedAt)
schemaStore.lastSaved = new Date(parsedSchema.updatedAt)
const parsedSchema = parseSchema(schema)
if (!parsedSchema) {
console.error('Failed to parse schema:', schema)
return
}
schemaStore.schemaId = parsedSchema.id
schemaStore.projectId = parsedSchema.projectId
schemaStore.schemaName = parsedSchema.name
schemaStore.wikibase = parsedSchema.wikibase
schemaStore.labels = parsedSchema.labels
schemaStore.descriptions = parsedSchema.descriptions
schemaStore.aliases = parsedSchema.aliases
schemaStore.statements = parsedSchema.statements
schemaStore.createdAt = parsedSchema.createdAt
schemaStore.updatedAt = parsedSchema.updatedAt
schemaStore.isDirty = false
schemaStore.lastSaved = new Date(parsedSchema.updatedAt)
🧰 Tools
🪛 GitHub Check: test

[failure] 20-20: TypeError: undefined is not an object (evaluating 'parsedSchema.id')

  at loadSchemaIntoStore (/home/runner/work/dataforge/dataforge/frontend/src/composables/useSchemaApi.ts:20:28)
  at <anonymous> (/home/runner/work/dataforge/dataforge/frontend/src/composables/useSchemaApi.ts:44:7)

[failure] 20-20: TypeError: undefined is not an object (evaluating 'parsedSchema.id')

  at loadSchemaIntoStore (/home/runner/work/dataforge/dataforge/frontend/src/composables/useSchemaApi.ts:20:28)
  at <anonymous> (/home/runner/work/dataforge/dataforge/frontend/src/composables/useSchemaApi.ts:92:7)

[failure] 20-20: TypeError: undefined is not an object (evaluating 'parsedSchema.id')

  at loadSchemaIntoStore (/home/runner/work/dataforge/dataforge/frontend/src/composables/useSchemaApi.ts:20:28)
  at <anonymous> (/home/runner/work/dataforge/dataforge/frontend/src/composables/useSchemaApi.ts:92:7)

[failure] 20-20: TypeError: undefined is not an object (evaluating 'parsedSchema.id')

  at loadSchemaIntoStore (/home/runner/work/dataforge/dataforge/frontend/src/composables/useSchemaApi.ts:20:28)
  at <anonymous> (/home/runner/work/dataforge/dataforge/frontend/src/composables/useSchemaApi.ts:69:7)

[failure] 20-20: TypeError: undefined is not an object (evaluating 'parsedSchema.id')

  at loadSchemaIntoStore (/home/runner/work/dataforge/dataforge/frontend/src/composables/useSchemaApi.ts:20:28)
  at <anonymous> (/home/runner/work/dataforge/dataforge/frontend/src/composables/useSchemaApi.ts:44:7)
🤖 Prompt for AI Agents
In frontend/src/composables/useSchemaApi.ts around lines 18 to 31, the code
assigns properties from parsedSchema without checking if parsedSchema is
undefined, which can cause runtime errors. Add a null safety check after calling
parseSchema to verify parsedSchema is defined before accessing its properties.
If parsedSchema is undefined, handle the case appropriately, such as returning
early or setting default values, to prevent runtime exceptions.

@DaxServer DaxServer merged commit b090041 into main Jul 20, 2025
4 checks passed
@DaxServer DaxServer deleted the wikibase-editor-task6 branch July 20, 2025 15:47
@coderabbitai coderabbitai bot mentioned this pull request Aug 2, 2025
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