refactor: move pm adapter out of layout engine#3530
Conversation
Agent docs auditFound deterministic findings on 2 changed agent-doc item(s).
|
c1e9ccd to
bd5c875
Compare
There was a problem hiding this comment.
cubic analysis
4 issues found across 213 files
Linked issue analysis
Linked issue: SD-3222: Rendering: pm-adapter
| Status | Acceptance criteria | Notes |
|---|---|---|
| ✅ | pm-adapter lives outside layout-engine (packages/pm-adapter) | File paths and package metadata were updated to move the adapter out of layout-engine into packages/pm-adapter. |
| ✅ | Layout runtime packages do not import concrete adapters at runtime (Guard H) | Architecture tests were extended (Guard H) and many runtime consumers were changed to depend on the adapter contract rather than importing pm-adapter directly. |
| ✅ | Super-editor presentation path uses @superdoc/layout-adapter registry instead of direct toFlowBlocks imports | Presentation/editor code no longer imports toFlowBlocks directly and instead uses getLayoutDocumentAdapter()/register. |
| ✅ | Default ProseMirror adapter registers via @superdoc/pm-adapter/register | A register entry was added in the pm-adapter package and the register import is pulled in at startup/test setup to ensure a default adapter is present. |
| ✅ | Layout integration tests convert documents through the adapter contract helper | Tests now route conversions through a to-flow-blocks helper that calls getLayoutDocumentAdapter().toFlowBlocks, and many tests were updated to use it. |
Partial review: This PR has more than 50 files, so cubic reviewed the highest-priority files first. During the trial, paid plans get a higher file limit.
You can try an ultrareview to bypass the file limit, comment @cubic-dev-ai ultrareview. Learn more.
Fix all with cubic | Re-trigger cubic
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
7967dbc to
880370b
Compare
880370b to
017cf55
Compare
There was a problem hiding this comment.
1 issue found across 214 files (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="packages/layout-engine/tests/src/architecture-boundaries.test.ts">
<violation number="1" location="packages/layout-engine/tests/src/architecture-boundaries.test.ts:21">
P1: V1_ADAPTER_ROOT path has one extra `..` level — it resolves to `<monorepo-root>/super-editor/...` instead of `packages/super-editor/...`. Since `collectRuntimeSources` silently returns an empty array for a non-existent directory, all Guard B and Guard C tests will pass without actually scanning the v1 adapter source, giving false confidence in the architecture boundaries.</violation>
</file>
Tip: Review your code locally with the cubic CLI to iterate faster.
Partial review: This PR has more than 50 files, so cubic reviewed the highest-priority files first. During the trial, paid plans get a higher file limit.
You can try an ultrareview to bypass the file limit, comment @cubic-dev-ai ultrareview. Learn more.
Fix all with cubic | Re-trigger cubic
| // SD-3222: the v1 ProseMirror adapter now lives inside @superdoc/super-editor | ||
| // (it is v1 SuperEditor's projection from hidden PM state into FlowBlock[]), | ||
| // not in a standalone layout-engine package. | ||
| const V1_ADAPTER_ROOT = path.resolve(__dirname, '../../../../super-editor/src/editors/v1/core/layout-adapter'); |
There was a problem hiding this comment.
P1: V1_ADAPTER_ROOT path has one extra .. level — it resolves to <monorepo-root>/super-editor/... instead of packages/super-editor/.... Since collectRuntimeSources silently returns an empty array for a non-existent directory, all Guard B and Guard C tests will pass without actually scanning the v1 adapter source, giving false confidence in the architecture boundaries.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/layout-engine/tests/src/architecture-boundaries.test.ts, line 21:
<comment>V1_ADAPTER_ROOT path has one extra `..` level — it resolves to `<monorepo-root>/super-editor/...` instead of `packages/super-editor/...`. Since `collectRuntimeSources` silently returns an empty array for a non-existent directory, all Guard B and Guard C tests will pass without actually scanning the v1 adapter source, giving false confidence in the architecture boundaries.</comment>
<file context>
@@ -15,7 +15,10 @@ import fs from 'node:fs';
+// SD-3222: the v1 ProseMirror adapter now lives inside @superdoc/super-editor
+// (it is v1 SuperEditor's projection from hidden PM state into FlowBlock[]),
+// not in a standalone layout-engine package.
+const V1_ADAPTER_ROOT = path.resolve(__dirname, '../../../../super-editor/src/editors/v1/core/layout-adapter');
// ---------------------------------------------------------------------------
</file context>
| const V1_ADAPTER_ROOT = path.resolve(__dirname, '../../../../super-editor/src/editors/v1/core/layout-adapter'); | |
| const V1_ADAPTER_ROOT = path.resolve(__dirname, '../../../super-editor/src/editors/v1/core/layout-adapter'); |
No description provided.