Files
AgentCompany/builtin-skills/software-engineer/clean-architecture/references/bound-partial-boundaries.md
T
ZacharyZhang-NY e74dafcd36 Silence render-disposed spam, unbreak bundled skills, drop board wake
Three independently ugly bugs that all fed the same log flood:

* Electron's `WebFrameMain.send` writes every "Render frame was disposed"
  to stderr via `console.error`. When the worker fans a second
  agent-event past a reloading renderer, we produced thousands of
  identical lines and stalled the main loop on stderr I/O. Added a
  `mainFrame.detached` guard so the send is short-circuited before
  Electron's own catch block fires, and installed a targeted filter in
  `suppress-warnings.ts` (now actually imported from the entry point)
  so the specific `console.error("Error sending from webFrameMain:"…)`
  noise never reaches the terminal. Any other payload still surfaces.

* `dispatchAgentMessage` accepted the human-reader sentinel as a wake
  target when an agent replied to `__board__` — `wakeAgentIfPossible`
  then called `db.getAgent("__board__")`, threw, and the dispatcher
  kept repeating on every send. Strip `HUMAN_SENDER_ID` at
  `resolveMessageWakeTargets`, and keep a defense-in-depth guard in the
  heartbeat so a stray caller (future automation fan-out) cannot
  reintroduce the crash.

* Pi's skills loader rejects any SKILL.md whose frontmatter `name`
  diverges from its parent directory. The four bundled `my-writing-style`
  copies declared `name: writing-style-skill`, so every install emitted
  a warning and dropped the skill. They also lived as orphan gitlinks
  (mode 160000 without .gitmodules), and the global `*.md` gitignore
  hid every other SKILL.md from version control. Fixed the frontmatter
  to match the dir, converted the dangling submodules to plain trees,
  and allowlisted `builtin-skills/**/*.md` so a fresh clone carries the
  catalogue instead of silently losing it.
2026-04-20 08:13:48 -04:00

3.0 KiB

title, impact, impactDescription, tags
title impact impactDescription tags
Use Partial Boundaries When Full Separation is Premature MEDIUM-HIGH prepares for future without over-engineering now bound, partial-boundaries, pragmatism, yagni

Use Partial Boundaries When Full Separation is Premature

When you anticipate needing a boundary but the cost of full separation is too high, implement a partial boundary. This prepares for future separation without premature over-engineering.

Incorrect (no boundary when one might be needed):

# Tightly coupled - if we ever need to split, massive refactor
class ReportService:
    def generate_sales_report(self, start_date, end_date):
        # Direct database access
        conn = psycopg2.connect(DATABASE_URL)
        cursor = conn.cursor()
        cursor.execute("""
            SELECT * FROM sales
            WHERE date BETWEEN %s AND %s
        """, (start_date, end_date))

        # Direct PDF generation
        pdf = FPDF()
        for row in cursor.fetchall():
            pdf.cell(200, 10, txt=str(row))
        return pdf.output()

# Cannot split report generation from data access without rewriting

Correct (partial boundary - same component, prepared for split):

# Strategy 1: Facade pattern (simplest partial boundary)
class ReportingFacade:
    """Single entry point, internal implementation can be refactored later."""

    def generate_sales_report(self, request: ReportRequest) -> Report:
        data = self._fetch_data(request)
        return self._format_report(data, request.format)

    def _fetch_data(self, request):
        # Could become a separate DataAccess component later
        return self.repository.get_sales(request.start, request.end)

    def _format_report(self, data, format):
        # Could become a separate ReportRenderer component later
        if format == 'pdf':
            return PdfRenderer().render(data)
        return CsvRenderer().render(data)


# Strategy 2: Interface with single implementation
class SalesDataProvider(Protocol):
    def get_sales(self, start: date, end: date) -> list[Sale]: ...

class PostgresSalesProvider:
    def get_sales(self, start: date, end: date) -> list[Sale]:
        # Implementation here

# Both live in same component, but interface enables future split
# When split needed: move interface to one component, impl to another


# Strategy 3: One-dimensional boundary
# Skip reciprocal interface - simpler but weaker protection
class ReportGenerator:
    def __init__(self, data_provider: SalesDataProvider):
        self.data_provider = data_provider  # Depends on abstraction

# SalesDataProvider implementation knows about ReportGenerator
# Not fully decoupled, but good enough for now

When to use partial boundaries:

  • You suspect a boundary will be needed, but not yet
  • Team is small and deployment is unified
  • Cost of full boundary outweighs current benefits

Reference: Clean Architecture - Partial Boundaries