Skip to content

Align backend composition API with edit_<object>() naming and role-based Haru helper classes#22

Draft
Copilot wants to merge 4 commits into
mainfrom
copilot/refactor-backend-interface
Draft

Align backend composition API with edit_<object>() naming and role-based Haru helper classes#22
Copilot wants to merge 4 commits into
mainfrom
copilot/refactor-backend-interface

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 25, 2026

The backend composition API used *_edit_methods() naming and generic helper class names, which diverged from the requested convention. This update aligns edit accessors to edit_<object>() and renames composed Haru objects to classes that explicitly describe what they manage.

  • Backend interface naming

    • Renamed IDocraftRenderingBackend accessors from:
      • line_edit_methods(), shape_edit_methods(), text_edit_methods(), image_edit_methods(), page_edit_methods()
    • To:
      • edit_line(), edit_shape(), edit_text(), edit_image(), edit_page()
    • Kept getter semantics as const ...() const.
  • Haru composed object naming

    • Replaced nested *EditMethods classes with role-specific classes:
      • LineHaruBackend, ShapeHaruBackend, TextHaruBackend, ImageHaruBackend, PageHaruBackend.
    • Updated construction/member wiring accordingly.
  • Call site and contract alignment

    • Updated all usages across document context, mock backend, and Haru backend tests to the new accessor names.
    • Updated contributor docs that referenced the old *_edit_methods() pattern.

Example (new style):

class IDocraftRenderingBackend {
public:
    [[nodiscard]] virtual const std::shared_ptr<IDocraftTextRenderingBackend>& edit_text() const = 0;
};

class DocraftHaruBackend : public IDocraftRenderingBackend {
public:
    class TextHaruBackend;
    [[nodiscard]] const std::shared_ptr<IDocraftTextRenderingBackend>& edit_text() const override;
};

Copilot AI linked an issue May 25, 2026 that may be closed by this pull request
Copilot AI changed the title [WIP] Refactor backend interface for better maintainability Refactor backend contracts to composition-based edit-method accessors May 25, 2026
Copilot finished work on behalf of Cadons May 25, 2026 22:02
Copilot AI requested a review from Cadons May 25, 2026 22:02
Copilot AI changed the title Refactor backend contracts to composition-based edit-method accessors Align backend composition API with edit_<object>() naming and role-based Haru helper classes May 26, 2026
Copilot finished work on behalf of Cadons May 26, 2026 05:58
@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
32.2% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

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.

backend interface refactoring

2 participants