Skip to content

Refactor clipboard persistence to keep infrastructure exports factory-only - #1466

Merged
marcuscastelo merged 3 commits into
rc/v0.16.0from
copilot/refactor-clipboard-infrastructure
Mar 24, 2026
Merged

marcuscastelo merged 3 commits into
rc/v0.16.0from
copilot/refactor-clipboard-infrastructure

Conversation

Copilot AI commented Mar 24, 2026 •

Copy link
Copy Markdown
Contributor

This refactor tightens the clipboard module boundary by removing infrastructure type exports and exposing only persistence factories from the infrastructure layer. The shared persistence contract now lives outside infra so callers can depend on the abstraction without importing implementation-adjacent exports.

  • What changed

    • Moved the ClipboardPersistence contract into a dedicated domain type:
      • src/modules/clipboard/domain/clipboardPersistence.ts
    • Updated clipboardPersistence.ts to consume that shared contract internally while exporting only:
      • createLocalStoragePersistence
      • createNoOpPersistence
  • Call-site updates

    • Updated clipboardStore.ts to import the shared persistence contract from the domain layer instead of infrastructure.
    • Updated clipboard store tests to use the shared contract directly, keeping test mocks aligned with the public abstraction.
  • Resulting boundary

    • Infrastructure now exposes factories only.
    • Store and tests depend on a stable clipboard persistence contract, not on infra exports.
import { type ClipboardPersistence } from '~/modules/clipboard/domain/clipboardPersistence'
import { createNoOpPersistence } from '~/modules/clipboard/infrastructure/clipboardPersistence'

export type ClipboardStoreConfig = {
  maxEntries?: number
  persistence?: ClipboardPersistence
}

const store = createClipboardStore({
  persistence: createNoOpPersistence(),
})

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • test.supabase.co
    • Triggering command: /opt/hostedtoolcache/node/24.14.0/x64/bin/node /opt/hostedtoolcache/node/24.14.0/x64/bin/node --conditions node --conditions development /home/REDACTED/work/macroflows/macroflows/node_modules/.pnpm/tinypool@1.1.1/node_modules/tinypool/dist/entry/process.js (dns block)
    • Triggering command: /opt/hostedtoolcache/node/24.14.0/x64/bin/node /opt/hostedtoolcache/node/24.14.0/x64/bin/node --conditions node --conditions development /home/REDACTED/work/macroflows/macroflows/node_modules/.pnpm/tinypool@1.1.1/node_modules/tinypool/dist/entry/process.js --local k/_temp/ghcca-node/node/bin/node gpg.program (dns block)
    • Triggering command: /opt/hostedtoolcache/node/24.14.0/x64/bin/node /opt/hostedtoolcache/node/24.14.0/x64/bin/node --conditions node --conditions development /home/REDACTED/work/macroflows/macroflows/node_modules/.pnpm/tinypool@1.1.1/node_modules/tinypool/dist/entry/process.js sh k/_temp/ghcca-node/node/bin/node ules/.pnpm/tinypwc (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>clipboard: Encapsulate infra exports — export only factories</issue_title>
<issue_description>## Summary

Refactor the clipboard module infrastructure to encapsulate implementation details: export only factory functions and keep helper functions file-local.

Part of #1403

Scope / Representative files

  • src/modules/clipboard/infrastructure/clipboardPersistence.ts

Deliverables & Acceptance Criteria

  • Only factory exports, call-site updates, TypeScript/lint/tests pass.
    </issue_description>

<agent_instructions>pnpm check always green</agent_instructions>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@vercel

vercel Bot commented Mar 24, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
macroflows Ready Ready Preview, Comment Mar 24, 2026 8:53pm

Copilot AI and others added 2 commits March 24, 2026 20:47
Copilot AI changed the title [WIP] Refactor clipboard module to only export factory functions Refactor clipboard persistence to keep infrastructure exports factory-only Mar 24, 2026
Copilot AI requested a review from marcuscastelo March 24, 2026 20:51
@marcuscastelo
marcuscastelo marked this pull request as ready for review March 24, 2026 20:52
Copilot AI review requested due to automatic review settings March 24, 2026 20:52

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Refactors the clipboard module boundary so application code depends on a domain-level persistence contract, while the infrastructure layer exposes only persistence factory functions.

Changes:

  • Introduced ClipboardPersistence as a domain contract (src/modules/clipboard/domain/clipboardPersistence.ts).
  • Removed infrastructure type exports and updated infra to consume the domain contract internally.
  • Updated clipboard store and its tests to import the persistence contract from the domain layer.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
src/modules/clipboard/infrastructure/clipboardPersistence.ts Stops exporting the persistence type; uses the domain contract and keeps infra exports factory-only.
src/modules/clipboard/domain/clipboardPersistence.ts Adds the shared ClipboardPersistence contract in the domain layer.
src/modules/clipboard/application/store/clipboardStore.ts Updates the store to depend on the domain persistence contract type.
src/modules/clipboard/application/store/tests/clipboardStore.test.ts Updates tests to mock the domain persistence contract directly.

@marcuscastelo
marcuscastelo merged commit 609eb92 into rc/v0.16.0 Mar 24, 2026
10 checks passed
@marcuscastelo
marcuscastelo deleted the copilot/refactor-clipboard-infrastructure branch March 24, 2026 21:15

This branch was successfully deployed

1 active deployment
Preview — b5302b70 Deployed Mar 24, 2026 by vercel[bot]
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.

clipboard: Encapsulate infra exports — export only factories

3 participants