Skip to content

Implement mapping edit core for order 4 - #4

Merged
riwindypj-maker merged 2 commits into
mainfrom
codex/implementation-order-4
Jul 24, 2026
Merged

riwindypj-maker merged 2 commits into
mainfrom
codex/implementation-order-4

Conversation

@riwindypj-maker

@riwindypj-maker riwindypj-maker commented Jul 24, 2026

Copy link
Copy Markdown
Owner

Summary

  • packages/contracts / packages/application でマッピング編集コア(グラフ接続検証・Undo/Redo・自動整列・軽量評価)を追加し、順序 4 を完了扱いに更新した
  • UnusedBlock を出力辺の有無ではなく出力項目への到達可能性で判定するようにし、中間デッドエンドも警告対象にした
  • macOS ホストに @dagrejs/dagre を直接依存し、Metro からリンク先パッケージ経由でも解決できるようにした

Test plan

  • cd packages/application && npm test が GRAPH-001〜006 / E001〜E005 を含む全件でパスする
  • UnusedBlock の到達可能性ケース(入力→A→B で出力未接続)で A/B 両方に警告が付くことを確認する
  • cd apps/macos && npm ci 後に node_modules/@dagrejs/dagre が存在し、autoLayout の import が解決できることを確認する
  • ドキュメントの順序 4 ステータス更新が実装内容と一致していることを確認する

Made with Cursor

Summary by CodeRabbit

  • 新機能
    • CSVマッピング編集のセッション基盤を追加し、グラフ検証・軽量評価、自動レイアウト、Undo/Redo を利用可能にしました。
    • 仕様(ブロック/ノード/エラー・重大度)の共通契約を整備しました。
  • テスト
    • グラフ正常系・異常系(エラー/警告)・Undo/Redo の統合テストを追加しました。
  • ドキュメント
    • 実装計画と設計ドキュメントの順序・ブロッカー条件を更新しました。
  • 構成/運用
    • .gitignore を追加し、macOS 向けの開発設定とローカル依存を調整しました。

… and host dagre resolution.

Add contracts/application graph editing, fix unused-block detection by output reachability, and wire macOS to resolve @dagrejs/dagre after npm ci.

Co-authored-by: Cursor <cursoragent@cursor.com>
@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 88022fc3-3673-4611-9ac4-c695a3ac581a

📥 Commits

Reviewing files that changed from the base of the PR and between b9566c8 and d779f04.

📒 Files selected for processing (3)
  • packages/application/jest.config.js
  • packages/application/src/graph/model.ts
  • packages/application/src/graph/validation.ts
🚧 Files skipped from review as they are similar to previous changes (3)
  • packages/application/jest.config.js
  • packages/application/src/graph/validation.ts
  • packages/application/src/graph/model.ts

📝 Walkthrough

Walkthrough

マッピング編集向けに、共有グラフ契約、可変グラフモデル、検証・評価・自動整列、Undo/Redo を含む MappingSession を追加した。Jest 統合テスト、macOS Metro のモノレポ設定、関連する実装計画と仕様書も更新した。

Changes

マッピング編集基盤

Layer / File(s) Summary
グラフ契約とパッケージ定義
packages/contracts/src/*, packages/contracts/package.json, packages/contracts/tsconfig.json
ノード、辺、ブロック、エラー、スナップショット、コマンド結果の共有型とパッケージ設定を追加した。
グラフ操作、検証、評価、自動整列
packages/application/src/graph/*, packages/application/src/layout/*
グラフ編集、循環検出、Join 順序管理、問題検証、軽量評価、自動レイアウトを実装した。
セッション状態と Undo/Redo
packages/application/src/session/*, packages/application/src/index.ts, packages/application/package.json, packages/application/tsconfig.json, packages/application/jest.config.js
MappingSession に編集操作、履歴、一時 UI 状態、評価、スナップショット、問題取得 API を追加した。
グラフ動作と履歴の統合テスト
packages/application/__tests__/*
正規系・異常系のグラフ操作、Join、出力順、履歴、入力列差し替えを検証した。
macOS 連携と実装計画更新
apps/macos/metro.config.js, apps/macos/package.json, .gitignore, docs/*
Metro のモノレポ解決設定と依存関係を更新し、生成物除外設定および実装工程・仕様記述を更新した。

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Editor
  participant MappingSession
  participant GraphModel
  participant validateGraph
  participant evaluateGraph
  Editor->>MappingSession: グラフ編集操作
  MappingSession->>GraphModel: ノード・辺を更新
  GraphModel-->>MappingSession: CommandResult
  MappingSession->>validateGraph: 検証を実行
  validateGraph-->>MappingSession: GraphIssue[]
  Editor->>MappingSession: 入力値で評価
  MappingSession->>evaluateGraph: グラフを評価
  evaluateGraph-->>MappingSession: 出力値 Map
Loading

Possibly related PRs

  • riwindypj-maker/CSVMapper#2: C++ 側のグラフ評価、DAG 処理、Join 順序の実装と、今回の TypeScript 実装が対応している。
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 変更内容の中心である順序4のマッピング編集コア実装を簡潔に表しており、contracts/application の追加と関連テストにも整合しています。
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/implementation-order-4

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 5

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/application/jest.config.js`:
- Around line 3-6: Update the Jest configuration to include `@csvmapper/contracts`
in the transform scope by exempting it from the default node_modules
transformIgnorePatterns, so its TypeScript entry point is processed by the
existing ts-jest preset.

In `@packages/application/src/graph/model.ts`:
- Around line 216-228: Update moveNodes to validate every NodeId in positions
before mutating any node positions, returning UnknownNode immediately for an
invalid ID; only after validation succeeds should it apply all rounded
coordinates, preserving the CommandFailure contract that failed commands leave
state unchanged.
- Around line 346-400: Update the missing-endpoint validation in addEdgeInternal
to return GraphErrorCode.UnknownNode instead of GraphErrorCode.TerminalMismatch
when either fromNode or toNode is absent. Preserve the existing error message
and all other edge-validation behavior.
- Around line 273-305: Update setJoinInputOrder so it completes all
orderedEdgeIds validation, including membership, duplicates, and edge existence,
before changing any edge.joinOrder values. After validation succeeds, apply the
new joinOrder values in a separate pass; every failure path must leave the graph
state unchanged.

In `@packages/application/src/graph/validation.ts`:
- Around line 58-89: Normalize output names with trim before duplicate detection
and storage in the outputNames map within the output-node validation flow. Keep
the existing empty-name validation based on the trimmed value, and ensure names
differing only by leading or trailing whitespace are reported as
DuplicateOutputName.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: bd5795de-19dc-43d1-ad21-641526d78211

📥 Commits

Reviewing files that changed from the base of the PR and between 8e81a7c and b9566c8.

⛔ Files ignored due to path filters (3)
  • apps/macos/package-lock.json is excluded by !**/package-lock.json
  • packages/application/package-lock.json is excluded by !**/package-lock.json
  • packages/contracts/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (28)
  • .gitignore
  • apps/macos/metro.config.js
  • apps/macos/package.json
  • docs/implementation-plan.md
  • docs/specs/design/application-architecture.md
  • docs/specs/modules/processing-core.md
  • packages/application/__tests__/graph-error.test.ts
  • packages/application/__tests__/graph-normal.test.ts
  • packages/application/__tests__/graph-undo.test.ts
  • packages/application/jest.config.js
  • packages/application/package.json
  • packages/application/src/graph/evaluate.ts
  • packages/application/src/graph/model.ts
  • packages/application/src/graph/validation.ts
  • packages/application/src/index.ts
  • packages/application/src/layout/autoLayout.ts
  • packages/application/src/session/history.ts
  • packages/application/src/session/store.ts
  • packages/application/tsconfig.json
  • packages/contracts/package.json
  • packages/contracts/src/blocks.ts
  • packages/contracts/src/edges.ts
  • packages/contracts/src/ids.ts
  • packages/contracts/src/index.ts
  • packages/contracts/src/issues.ts
  • packages/contracts/src/nodes.ts
  • packages/contracts/src/snapshot.ts
  • packages/contracts/tsconfig.json

Comment thread packages/application/jest.config.js
Comment thread packages/application/src/graph/model.ts
Comment thread packages/application/src/graph/model.ts
Comment thread packages/application/src/graph/model.ts
Comment thread packages/application/src/graph/validation.ts
Co-authored-by: Cursor <cursoragent@cursor.com>
@riwindypj-maker
riwindypj-maker merged commit 4687fa7 into main Jul 24, 2026
1 check passed
@riwindypj-maker
riwindypj-maker deleted the codex/implementation-order-4 branch July 24, 2026 02:26
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