Skip to content

Refactor toast settings to expose only an application-facing runtime API - #1470

Merged
marcuscastelo merged 5 commits into
rc/v0.16.0from
copilot/refactor-toast-module-infra
Mar 24, 2026
Merged

marcuscastelo merged 5 commits into
rc/v0.16.0from
copilot/refactor-toast-module-infra

Conversation

Copilot AI commented Mar 24, 2026 •

Copy link
Copy Markdown
Contributor

The toast settings module was leaking infrastructure-level runtime helpers directly to consumers. This change narrows the boundary so infrastructure exports only a factory, while the application layer owns the default runtime API used by the UI and tests.

  • Infrastructure boundary

    • Reworked src/modules/toast/infrastructure/toastSettings.ts to export only createToastSettingsStore().
    • Moved get/update/reset operations inside the factory so they are no longer infrastructure exports.
    • Dropped the exported per-field setter helpers from the infrastructure surface.
  • Application runtime wrapper

    • Added src/modules/toast/application/toastSettings.ts as the public runtime entrypoint.
    • Instantiates the default store once and exposes:
      • getToastSettings()
      • updateToastSettings()
      • resetToastSettings()
  • Consumer updates

    • Retargeted the settings UI to import toast settings operations from the application layer instead of infrastructure.
    • Updated toast settings tests to use the application-facing runtime API.
  • Test coverage adjustment

    • Replaced direct coverage of removed helper exports with a store isolation test that exercises the new factory boundary.
// infrastructure
export function createToastSettingsStore() {
  return {
    getToastSettings,
    updateToastSettings,
    resetToastSettings,
  }
}

// application
const toastSettingsStore = createToastSettingsStore()

export function getToastSettings() {
  return toastSettingsStore.getToastSettings()
}

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)

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>toast: Encapsulate infra exports — export only factories</issue_title>
<issue_description>## Summary

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

Part of #1403

Scope / Representative files

  • src/modules/toast/infrastructure/toastSettings.ts

Deliverables & Acceptance Criteria

  • Only factories exported, call-sites updated, 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 9:12pm

Copilot AI and others added 3 commits March 24, 2026 20:47
Copilot AI changed the title [WIP] Refactor toast module to encapsulate infra exports Refactor toast settings to expose only an application-facing runtime API 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 toast settings module to better enforce layering: infrastructure now exposes only a store factory, while the application layer provides the default runtime API consumed by UI and tests.

Changes:

  • Changed toastSettings infrastructure module to export only createToastSettingsStore() (moving get/update/reset inside the factory).
  • Added an application-layer runtime wrapper (getToastSettings, updateToastSettings, resetToastSettings) backed by a single default store instance.
  • Updated the settings UI and tests to consume the application-facing API and adjusted test coverage accordingly.

Reviewed changes

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

File Description
src/sections/settings/components/ToastSettings.tsx Retargets UI imports to the application-layer toast settings runtime API.
src/modules/toast/tests/toastSettings.test.ts Updates tests to use the application API and adds a factory-boundary isolation test.
src/modules/toast/infrastructure/toastSettings.ts Encapsulates settings operations inside a factory and removes infra-level helper exports.
src/modules/toast/application/toastSettings.ts Adds the public runtime entrypoint that owns the default store instance.

Comment thread src/modules/toast/tests/toastSettings.test.ts Outdated
Comment thread src/modules/toast/infrastructure/toastSettings.ts Outdated
@marcuscastelo

Copy link
Copy Markdown
Owner

Encontrei uma lacuna no boundary final: ainda exporta ToastSettings not found. Pelo contrato desta issue, esse arquivo deveria expor só a factory () e manter os demais detalhes fora da infraestrutura. Sugestão: mover para um arquivo de tipo/domínio compartilhado ou para a camada de application e fazer exportar apenas a factory. Hoje o runtime ficou bem encapsulado, mas o type export ainda deixa a infraestrutura com API pública além da factory.

@marcuscastelo

Copy link
Copy Markdown
Owner

Encontrei uma lacuna no boundary final: o arquivo src/modules/toast/infrastructure/toastSettings.ts ainda exporta o tipo ToastSettings. Pelo contrato desta issue, esse arquivo deveria expor so a factory createToastSettingsStore e manter os demais detalhes fora da infrastructure. Sugestao: mover ToastSettings para um arquivo de tipo compartilhado ou para a camada de application, deixando toastSettings.ts com apenas a factory como API publica. O runtime ficou bem encapsulado; o ponto que falta e so remover esse type export da infrastructure.

@marcuscastelo
marcuscastelo merged commit 0484f44 into rc/v0.16.0 Mar 24, 2026
5 checks passed
@marcuscastelo
marcuscastelo deleted the copilot/refactor-toast-module-infra branch March 24, 2026 21:14

This branch was successfully deployed

1 active deployment
Preview — 913f45fb 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.

toast: Encapsulate infra exports — export only factories

3 participants