Skip to content

refactor: move pm adapter out of layout engine#3530

Open
VladaHarbour wants to merge 6 commits into
mainfrom
sd-3222_pm-adapter-refactor
Open

refactor: move pm adapter out of layout engine#3530
VladaHarbour wants to merge 6 commits into
mainfrom
sd-3222_pm-adapter-refactor

Conversation

@VladaHarbour
Copy link
Copy Markdown
Contributor

No description provided.

@VladaHarbour VladaHarbour self-assigned this May 27, 2026
@VladaHarbour VladaHarbour requested a review from a team as a code owner May 27, 2026 15:39
@linear-code
Copy link
Copy Markdown

linear-code Bot commented May 27, 2026

SD-3222

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 27, 2026

Agent docs audit

Found deterministic findings on 2 changed agent-doc item(s).

AGENTS.md (101 lines)

  • 2 broken path ref(s)

Broken path refs:

  • core/layout-adapter/
  • src/editors/v1/core/layout-adapter

packages/layout-engine/AGENTS.md (167 lines)

  • 2 broken path ref(s)

Broken path refs:

  • core/layout-adapter/converters/
  • src/editors/v1/core/layout-adapter

Deterministic L1 only: no AI, no Bash, no secrets. Semantic L2/L3 audit runs weekly on main. Policy: agent-docs-policy.md.

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

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

Comment thread packages/pm-adapter/tsconfig.json Outdated
Comment thread packages/layout-adapter/src/registry.ts Outdated
Comment thread packages/layout-engine/tests/src/architecture-boundaries.test.ts Outdated
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@VladaHarbour VladaHarbour force-pushed the sd-3222_pm-adapter-refactor branch from 7967dbc to 880370b Compare May 29, 2026 14:45
@VladaHarbour VladaHarbour force-pushed the sd-3222_pm-adapter-refactor branch from 880370b to 017cf55 Compare May 29, 2026 16:22
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

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');
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot May 30, 2026

Choose a reason for hiding this comment

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

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>
Suggested change
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');
Fix with Cubic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants