Skip to content

Refactor rendering backend to explicit capability composition#24

Draft
Copilot wants to merge 3 commits into
mainfrom
copilot/refactor-backend-architecture
Draft

Refactor rendering backend to explicit capability composition#24
Copilot wants to merge 3 commits into
mainfrom
copilot/refactor-backend-architecture

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 28, 2026

The backend API still relied on inherited capability chains and a monolithic Haru implementation, which kept line/text/shape/page/image concerns more coupled than intended. This change moves the backend contract to explicit capability accessors and reshapes the Haru backend into composed internal capability components while preserving existing rendering behavior.

  • Backend contract

    • Make capability interfaces standalone and chain-free.
    • Change IDocraftRenderingBackend from an inheritance aggregator to a root contract exposing explicit capability accessors:
      • line_rendering() / edit_line_rendering()
      • text_rendering() / edit_text_rendering()
      • shape_rendering() / edit_shape_rendering()
      • image_rendering() / edit_image_rendering()
      • page_rendering() / edit_page_rendering()
  • Haru backend composition

    • Split Haru backend responsibilities into focused internal components for text, line, shape, image, and page capabilities.
    • Keep DocraftHaruBackend as the single integration point and route capability access through composed objects instead of implementing every primitive directly on the root class.
  • Backend wiring

    • Update backend cache initialization to bind capabilities through root accessors instead of cross-casting the root backend to sub-interfaces.
    • Keep document/context integration unchanged at the orchestration level while making capability retrieval explicit internally.
  • Renderer and painter migration

    • Update affected renderers/painters to request the exact capabilities they use instead of relying on inherited methods leaking across interfaces.
    • Separate shape-state usage from line drawing where the old interface chain previously hid that boundary.
  • Coverage and docs

    • Add accessor wiring coverage for const vs mutable capability access and shared underlying component identity.
    • Refresh backend API/contributor docs to describe the composition model and explicit accessor pattern.
const auto *line = backend.line_rendering();
auto *shape = backend.edit_shape_rendering();
auto *page = backend.edit_page_rendering();

Copilot AI changed the title [WIP] Refactor backend architecture to improve capability isolation Refactor rendering backend to explicit capability composition May 28, 2026
Copilot finished work on behalf of Cadons May 28, 2026 21:34
Copilot AI requested a review from Cadons May 28, 2026 21:34
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.

Refactor backend architecture: replace interface chain with independent capability interfaces and composed backend

2 participants