mirror of
https://github.com/fsolla/teqo.git
synced 2026-11-27 06:13:06 +00:00
Merge pull request #231 from fsolla/cursor/retire-list-unified-flag
CL9 — retire LIST_UNIFIED; always OpsListPage
This commit is contained in:
commit
1b7caf7cf5
22 changed files with 103 additions and 262 deletions
|
|
@ -35,7 +35,3 @@ CAMPAIGN_EMAIL_FROM_NAME=Campanha Jorge Solla
|
||||||
|
|
||||||
# Note: the automated test suite ignores this file and reads .env.test instead,
|
# Note: the automated test suite ignores this file and reads .env.test instead,
|
||||||
# and only ever runs against a database whose name ends with "_test".
|
# and only ever runs against a database whose name ends with "_test".
|
||||||
|
|
||||||
# Unified list factory (CL*). Compile-time; set to 1/true to render lists via OpsListPage.
|
|
||||||
# Absent or 0 keeps the legacy list shells. See docs/plans/lista-unificada-campanha-spec.md
|
|
||||||
LIST_UNIFIED=
|
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,8 @@ Conteúdo movido do `AGENTS.md` em 2026-07-30 (fatiamento do paradigma de agente
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
**Recently resolved (2026-08-02):** **CL9** — removida flag compile-time `LIST_UNIFIED`: 8 rotas de lista sempre via `OpsListPage`; apagados `opsListFlag.ts` / env / Playwright; spec-mãe `lista-unificada-campanha-spec.md` em **implementado**. Plano: [`cl9-list-unified-flag-cleanup.md`](docs/plans/cl9-list-unified-flag-cleanup.md).
|
||||||
|
|
||||||
**Recently resolved (2026-08-02):** **OH14** (Issue #175) — removida flag compile-time `OPS_HYBRID`: sync híbrido sempre ON para staff (`isStaffCampaignRole` no layout); ramificações legacy OFF apagadas nos forms/controles; e2e offline em CI sem env; spec-mãe `ops-hibrido-rsc-local-spec.md` em **implementado** com receita de nova write offline. Plano: [`oh14-flag-cleanup.md`](docs/plans/oh14-flag-cleanup.md).
|
**Recently resolved (2026-08-02):** **OH14** (Issue #175) — removida flag compile-time `OPS_HYBRID`: sync híbrido sempre ON para staff (`isStaffCampaignRole` no layout); ramificações legacy OFF apagadas nos forms/controles; e2e offline em CI sem env; spec-mãe `ops-hibrido-rsc-local-spec.md` em **implementado** com receita de nova write offline. Plano: [`oh14-flag-cleanup.md`](docs/plans/oh14-flag-cleanup.md).
|
||||||
|
|
||||||
**Recently resolved (2026-08-02):** **OH13** (Issue #176) — writes CAS por domínio: `baseUpdatedAt` + `*Cas` em leadership / demand transition / activity update / stateDeputy vínculos; helper `assertCampaignDocCas`; outbox `opsDomainOutbox` com Manter/Usar nos forms; flag OFF intacto. Plano: [`oh13-domain-writes-cas.md`](docs/plans/oh13-domain-writes-cas.md).
|
**Recently resolved (2026-08-02):** **OH13** (Issue #176) — writes CAS por domínio: `baseUpdatedAt` + `*Cas` em leadership / demand transition / activity update / stateDeputy vínculos; helper `assertCampaignDocCas`; outbox `opsDomainOutbox` com Manter/Usar nos forms; flag OFF intacto. Plano: [`oh13-domain-writes-cas.md`](docs/plans/oh13-domain-writes-cas.md).
|
||||||
|
|
|
||||||
28
docs/plans/cl9-list-unified-flag-cleanup.md
Normal file
28
docs/plans/cl9-list-unified-flag-cleanup.md
Normal file
|
|
@ -0,0 +1,28 @@
|
||||||
|
# CL9 — Limpeza da flag `LIST_UNIFIED`
|
||||||
|
|
||||||
|
Status: implementado
|
||||||
|
Atualizado em: 2026-08-02
|
||||||
|
Issue: —
|
||||||
|
Priority: P2
|
||||||
|
Model: composer-2.5
|
||||||
|
Impeccable: A — N/A (limpeza)
|
||||||
|
Appetite: ~0,5 dia eng
|
||||||
|
Depends: CL8, OH14
|
||||||
|
Responsável: —
|
||||||
|
|
||||||
|
## Decisão
|
||||||
|
|
||||||
|
**Remover a flag e manter só `OpsListPage`.** Justificativa: as 8 rotas v1 já migraram (CL3–CL8); dual-path só aumentava complexidade; prod ainda em desenvolvimento (mesmo critério OH14). Sem Issue GitHub — chore directo pós-CL8.
|
||||||
|
|
||||||
|
## Entrega
|
||||||
|
|
||||||
|
- Apagado `resolveListUnifiedEnabled` / `opsListFlag.ts` / `LIST_UNIFIED` (`next.config`, `.env.example`, Playwright).
|
||||||
|
- 8 pages de lista sempre renderizam `<OpsListPage …/>` (sem ternário OFF / `CampaignListPendingBoundary` legado na rota).
|
||||||
|
- Pins unit/e2e sem gate de env; saved filters municípios cobertos pelo suite principal.
|
||||||
|
- Spec-mãe `lista-unificada-campanha-spec.md` → `Status: implementado`.
|
||||||
|
|
||||||
|
## Fases verificáveis
|
||||||
|
|
||||||
|
- [x] pages + config + delete flag
|
||||||
|
- [x] tests + docs + CHANGELOG
|
||||||
|
- [x] `pnpm gate:fast` + knip + cycles
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
# Lista unificada `/campanha` — spec-mãe e critérios
|
# Lista unificada `/campanha` — spec-mãe e critérios
|
||||||
|
|
||||||
Status: travado (freshness audit 2026-08-01 — premissas confirmadas no repo)
|
Status: implementado (flag `LIST_UNIFIED` retirada — CL9, 2026-08-02)
|
||||||
Atualizado em: 2026-08-01
|
Atualizado em: 2026-08-02
|
||||||
Issue: #155
|
Issue: #155
|
||||||
Priority: P1
|
Priority: P1
|
||||||
Model: cursor-grok-4.5-high
|
Model: cursor-grok-4.5-high
|
||||||
|
|
@ -13,9 +13,9 @@ Responsável: —
|
||||||
|
|
||||||
1. Factory = prólogo de página + render com slots; não unifica where/sort/paginação.
|
1. Factory = prólogo de página + render com slots; não unifica where/sort/paginação.
|
||||||
2. `atividades` fica fora da factory (cards + tabs próprios) — **não** entra em `opsListDomains`.
|
2. `atividades` fica fora da factory (cards + tabs próprios) — **não** entra em `opsListDomains`.
|
||||||
3. `assessores` e `territorios` precisam de pré-work antes de migrar (CL5a / CL6a).
|
3. `assessores` e `territorios` precisavam de pré-work antes de migrar (CL5a / CL6a) — feito.
|
||||||
4. Saved filters só municípios; allowlist `CampaignListId` para seletor de colunas.
|
4. Saved filters só municípios; allowlist `CampaignListId` para seletor de colunas.
|
||||||
5. Flag `LIST_UNIFIED` via env (`resolveListUnifiedEnabled` em CL2); URLs públicas intactas.
|
5. URLs públicas intactas. Flag `LIST_UNIFIED` **retirada** (CL9): as 8 rotas sempre usam `OpsListPage`.
|
||||||
|
|
||||||
## Objetivos
|
## Objetivos
|
||||||
|
|
||||||
|
|
@ -98,11 +98,10 @@ Estado **hoje** (não o contrato-alvo). Para sortModel / canonicalRedirect / col
|
||||||
|
|
||||||
## Critérios de aceite do projecto
|
## Critérios de aceite do projecto
|
||||||
|
|
||||||
1. Sem `LIST_UNIFIED`: e2e existentes idênticas a `main`.
|
1. Cada lista v1 renderiza pela `OpsListPage` (sem dual-path / sem `LIST_UNIFIED`).
|
||||||
2. Com `LIST_UNIFIED=1`: cada lista migrada renderiza pela `OpsListPage` com paridade funcional/visível.
|
2. URLs canónicas e saved filters municípios funcionam igual.
|
||||||
3. URLs canónicas e saved filters municípios funcionam igual.
|
3. `pnpm gate:fast` + e2e das listas verdes.
|
||||||
4. `pnpm gate:fast` + e2e das listas verdes.
|
4. Registry falha o build se faltar slug v1 ou coluna sem `label`.
|
||||||
5. Registry falha o build se faltar slug v1 ou coluna sem `label`.
|
|
||||||
|
|
||||||
## Index de planos filhos
|
## Index de planos filhos
|
||||||
|
|
||||||
|
|
@ -117,6 +116,7 @@ Números GitHub (#156–#162) **não** seguem a ordem de execução (CL5=#160, C
|
||||||
| CL6 | #159 | [`cl6-territorios-factory.md`](cl6-territorios-factory.md) | CL3 (+ CL6a bloqueia CL6b) | ~2d |
|
| CL6 | #159 | [`cl6-territorios-factory.md`](cl6-territorios-factory.md) | CL3 (+ CL6a bloqueia CL6b) | ~2d |
|
||||||
| CL7 | #161 | [`cl7-apoiadores-organizacoes.md`](cl7-apoiadores-organizacoes.md) | CL3 | ~1–1,5d |
|
| CL7 | #161 | [`cl7-apoiadores-organizacoes.md`](cl7-apoiadores-organizacoes.md) | CL3 | ~1–1,5d |
|
||||||
| CL8 | #162 | [`cl8-contrato-cleanup.md`](cl8-contrato-cleanup.md) | CL4–CL7 | ~1d |
|
| CL8 | #162 | [`cl8-contrato-cleanup.md`](cl8-contrato-cleanup.md) | CL4–CL7 | ~1d |
|
||||||
|
| CL9 | — | [`cl9-list-unified-flag-cleanup.md`](cl9-list-unified-flag-cleanup.md) | CL8 (+ OH14) | ~0,5d |
|
||||||
|
|
||||||
## Dependência entre projectos
|
## Dependência entre projectos
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,10 +5,6 @@ const allowedImageHost = process.env.NEXT_PUBLIC_SITE_URL || 'https://jorgesolla
|
||||||
|
|
||||||
const nextConfig = {
|
const nextConfig = {
|
||||||
distDir: process.env.NEXT_DIST_DIR || '.next',
|
distDir: process.env.NEXT_DIST_DIR || '.next',
|
||||||
// CL*: compile-time flag inlined for client islands; absent/`0` keeps legacy list shells.
|
|
||||||
env: {
|
|
||||||
LIST_UNIFIED: process.env.LIST_UNIFIED ?? '',
|
|
||||||
},
|
|
||||||
images: {
|
images: {
|
||||||
remotePatterns: [new URL(`${allowedImageHost}/**`)],
|
remotePatterns: [new URL(`${allowedImageHost}/**`)],
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -118,7 +118,6 @@ export default defineConfig({
|
||||||
NEXT_DIST_DIR: '.next/e2e',
|
NEXT_DIST_DIR: '.next/e2e',
|
||||||
PAYLOAD_SECRET: process.env.PAYLOAD_SECRET ?? 'test-only-secret-not-used-in-production',
|
PAYLOAD_SECRET: process.env.PAYLOAD_SECRET ?? 'test-only-secret-not-used-in-production',
|
||||||
NEXT_PUBLIC_SITE_URL: process.env.NEXT_PUBLIC_SITE_URL ?? baseURL,
|
NEXT_PUBLIC_SITE_URL: process.env.NEXT_PUBLIC_SITE_URL ?? baseURL,
|
||||||
LIST_UNIFIED: process.env.LIST_UNIFIED ?? '',
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -9,10 +9,6 @@ import { OpsListLocal } from '@/components/campaign/opsSync/OpsListLocal'
|
||||||
import { CampaignListEmptyState } from '@/components/campaign/shared/CampaignListEmptyState'
|
import { CampaignListEmptyState } from '@/components/campaign/shared/CampaignListEmptyState'
|
||||||
import { CampaignListFooter } from '@/components/campaign/shared/CampaignListFooter'
|
import { CampaignListFooter } from '@/components/campaign/shared/CampaignListFooter'
|
||||||
import { CampaignListPageHeader } from '@/components/campaign/shared/CampaignListPageHeader'
|
import { CampaignListPageHeader } from '@/components/campaign/shared/CampaignListPageHeader'
|
||||||
import {
|
|
||||||
CampaignListPendingBoundary,
|
|
||||||
CampaignListResults,
|
|
||||||
} from '@/components/campaign/shared/CampaignListPending'
|
|
||||||
import { CampaignScopeBadge } from '@/components/campaign/shared/CampaignScopeBadge'
|
import { CampaignScopeBadge } from '@/components/campaign/shared/CampaignScopeBadge'
|
||||||
import { OpsListPage } from '@/components/campaign/shared/OpsListPage'
|
import { OpsListPage } from '@/components/campaign/shared/OpsListPage'
|
||||||
import { CampaignPageShell } from '@/components/campaign/shell/CampaignPageShell'
|
import { CampaignPageShell } from '@/components/campaign/shell/CampaignPageShell'
|
||||||
|
|
@ -20,7 +16,6 @@ import { SupporterFilters } from '@/components/campaign/supporter/SupporterFilte
|
||||||
import { SupporterList } from '@/components/campaign/supporter/SupporterList'
|
import { SupporterList } from '@/components/campaign/supporter/SupporterList'
|
||||||
import { SupporterListOverview } from '@/components/campaign/supporter/SupporterListOverview'
|
import { SupporterListOverview } from '@/components/campaign/supporter/SupporterListOverview'
|
||||||
import { Button } from '@/components/ui/button'
|
import { Button } from '@/components/ui/button'
|
||||||
import { resolveListUnifiedEnabled } from '@/lib/opsListRegistry/opsListFlag'
|
|
||||||
import { isCampaignCoordinator, isCampaignUnrestricted } from '@/utilities/campaignAccess'
|
import { isCampaignCoordinator, isCampaignUnrestricted } from '@/utilities/campaignAccess'
|
||||||
import { readCampaignColumnVisibility } from '@/utilities/campaignColumnVisibilityCookie'
|
import { readCampaignColumnVisibility } from '@/utilities/campaignColumnVisibilityCookie'
|
||||||
import { requireCampaignPageActor } from '@/utilities/campaignPageActor'
|
import { requireCampaignPageActor } from '@/utilities/campaignPageActor'
|
||||||
|
|
@ -91,7 +86,7 @@ export default async function SupportersPage({ searchParams }: SupportersPagePro
|
||||||
/>
|
/>
|
||||||
) : null
|
) : null
|
||||||
|
|
||||||
const main = resolveListUnifiedEnabled() ? (
|
const main = (
|
||||||
<OpsListPage
|
<OpsListPage
|
||||||
overview={overviewNode}
|
overview={overviewNode}
|
||||||
toolbar={toolbarNode}
|
toolbar={toolbarNode}
|
||||||
|
|
@ -99,15 +94,6 @@ export default async function SupportersPage({ searchParams }: SupportersPagePro
|
||||||
empty={null}
|
empty={null}
|
||||||
footer={footerNode}
|
footer={footerNode}
|
||||||
/>
|
/>
|
||||||
) : (
|
|
||||||
<CampaignListPendingBoundary>
|
|
||||||
{toolbarNode}
|
|
||||||
<CampaignListResults>
|
|
||||||
{overviewNode}
|
|
||||||
{tableNode}
|
|
||||||
{footerNode}
|
|
||||||
</CampaignListResults>
|
|
||||||
</CampaignListPendingBoundary>
|
|
||||||
)
|
)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
||||||
|
|
@ -8,15 +8,10 @@ import { OfflineBoundary } from '@/components/campaign/opsSync/OfflineBoundary'
|
||||||
import { OpsListLocal } from '@/components/campaign/opsSync/OpsListLocal'
|
import { OpsListLocal } from '@/components/campaign/opsSync/OpsListLocal'
|
||||||
import { CampaignListFooter } from '@/components/campaign/shared/CampaignListFooter'
|
import { CampaignListFooter } from '@/components/campaign/shared/CampaignListFooter'
|
||||||
import { CampaignListPageHeader } from '@/components/campaign/shared/CampaignListPageHeader'
|
import { CampaignListPageHeader } from '@/components/campaign/shared/CampaignListPageHeader'
|
||||||
import {
|
|
||||||
CampaignListPendingBoundary,
|
|
||||||
CampaignListResults,
|
|
||||||
} from '@/components/campaign/shared/CampaignListPending'
|
|
||||||
import { CampaignSearchForm } from '@/components/campaign/shared/CampaignSearchForm'
|
import { CampaignSearchForm } from '@/components/campaign/shared/CampaignSearchForm'
|
||||||
import { OpsListPage } from '@/components/campaign/shared/OpsListPage'
|
import { OpsListPage } from '@/components/campaign/shared/OpsListPage'
|
||||||
import { CampaignPageShell } from '@/components/campaign/shell/CampaignPageShell'
|
import { CampaignPageShell } from '@/components/campaign/shell/CampaignPageShell'
|
||||||
import { CAMPAIGN_ADVISORS_HOME } from '@/lib/campaignPaths'
|
import { CAMPAIGN_ADVISORS_HOME } from '@/lib/campaignPaths'
|
||||||
import { resolveListUnifiedEnabled } from '@/lib/opsListRegistry/opsListFlag'
|
|
||||||
import { advisorListHrefForPage, resolveAdvisorListUrl } from '@/utilities/advisor/advisorListUrl'
|
import { advisorListHrefForPage, resolveAdvisorListUrl } from '@/utilities/advisor/advisorListUrl'
|
||||||
import { loadAdvisorListPageData } from '@/utilities/advisorData'
|
import { loadAdvisorListPageData } from '@/utilities/advisorData'
|
||||||
import { readCampaignColumnVisibility } from '@/utilities/campaignColumnVisibilityCookie'
|
import { readCampaignColumnVisibility } from '@/utilities/campaignColumnVisibilityCookie'
|
||||||
|
|
@ -88,7 +83,7 @@ export default async function AdvisorsPage({ searchParams }: AdvisorsPageProps)
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
|
||||||
const main: ReactNode = resolveListUnifiedEnabled() ? (
|
const main: ReactNode = (
|
||||||
<OpsListPage
|
<OpsListPage
|
||||||
overview={null}
|
overview={null}
|
||||||
toolbar={toolbar}
|
toolbar={toolbar}
|
||||||
|
|
@ -96,14 +91,6 @@ export default async function AdvisorsPage({ searchParams }: AdvisorsPageProps)
|
||||||
empty={null}
|
empty={null}
|
||||||
footer={footerNode}
|
footer={footerNode}
|
||||||
/>
|
/>
|
||||||
) : (
|
|
||||||
<CampaignListPendingBoundary>
|
|
||||||
{toolbar}
|
|
||||||
<CampaignListResults>
|
|
||||||
{tableNode}
|
|
||||||
{footerNode}
|
|
||||||
</CampaignListResults>
|
|
||||||
</CampaignListPendingBoundary>
|
|
||||||
)
|
)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
||||||
|
|
@ -10,16 +10,11 @@ import { CampaignFilterChips } from '@/components/campaign/shared/CampaignFilter
|
||||||
import { CampaignListEmptyState } from '@/components/campaign/shared/CampaignListEmptyState'
|
import { CampaignListEmptyState } from '@/components/campaign/shared/CampaignListEmptyState'
|
||||||
import { CampaignListFooter } from '@/components/campaign/shared/CampaignListFooter'
|
import { CampaignListFooter } from '@/components/campaign/shared/CampaignListFooter'
|
||||||
import { CampaignListPageHeader } from '@/components/campaign/shared/CampaignListPageHeader'
|
import { CampaignListPageHeader } from '@/components/campaign/shared/CampaignListPageHeader'
|
||||||
import {
|
|
||||||
CampaignListPendingBoundary,
|
|
||||||
CampaignListResults,
|
|
||||||
} from '@/components/campaign/shared/CampaignListPending'
|
|
||||||
import { CampaignTable, type CampaignTableColumn } from '@/components/campaign/shared/CampaignTable'
|
import { CampaignTable, type CampaignTableColumn } from '@/components/campaign/shared/CampaignTable'
|
||||||
import { OpsListPage } from '@/components/campaign/shared/OpsListPage'
|
import { OpsListPage } from '@/components/campaign/shared/OpsListPage'
|
||||||
import { CampaignPageShell } from '@/components/campaign/shell/CampaignPageShell'
|
import { CampaignPageShell } from '@/components/campaign/shell/CampaignPageShell'
|
||||||
import { Badge } from '@/components/ui/Badge'
|
import { Badge } from '@/components/ui/Badge'
|
||||||
import { Button } from '@/components/ui/button'
|
import { Button } from '@/components/ui/button'
|
||||||
import { resolveListUnifiedEnabled } from '@/lib/opsListRegistry/opsListFlag'
|
|
||||||
import {
|
import {
|
||||||
campaignDemandKindLabels,
|
campaignDemandKindLabels,
|
||||||
campaignDemandStatusLabels,
|
campaignDemandStatusLabels,
|
||||||
|
|
@ -169,7 +164,7 @@ export default async function DemandsPage({ searchParams }: DemandsPageProps) {
|
||||||
/>
|
/>
|
||||||
) : null
|
) : null
|
||||||
|
|
||||||
const main = resolveListUnifiedEnabled() ? (
|
const main = (
|
||||||
<OpsListPage
|
<OpsListPage
|
||||||
overview={null}
|
overview={null}
|
||||||
toolbar={statusChips}
|
toolbar={statusChips}
|
||||||
|
|
@ -177,14 +172,6 @@ export default async function DemandsPage({ searchParams }: DemandsPageProps) {
|
||||||
empty={null}
|
empty={null}
|
||||||
footer={footerNode}
|
footer={footerNode}
|
||||||
/>
|
/>
|
||||||
) : (
|
|
||||||
<CampaignListPendingBoundary>
|
|
||||||
{statusChips}
|
|
||||||
<CampaignListResults>
|
|
||||||
{tableNode}
|
|
||||||
{footerNode}
|
|
||||||
</CampaignListResults>
|
|
||||||
</CampaignListPendingBoundary>
|
|
||||||
)
|
)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
||||||
|
|
@ -8,11 +8,7 @@ import { OfflineBoundary } from '@/components/campaign/opsSync/OfflineBoundary'
|
||||||
import { OpsListLocal } from '@/components/campaign/opsSync/OpsListLocal'
|
import { OpsListLocal } from '@/components/campaign/opsSync/OpsListLocal'
|
||||||
import { CampaignListFooter } from '@/components/campaign/shared/CampaignListFooter'
|
import { CampaignListFooter } from '@/components/campaign/shared/CampaignListFooter'
|
||||||
import { CampaignListPageHeader } from '@/components/campaign/shared/CampaignListPageHeader'
|
import { CampaignListPageHeader } from '@/components/campaign/shared/CampaignListPageHeader'
|
||||||
import {
|
import { CampaignTransitionAnchor } from '@/components/campaign/shared/CampaignListPending'
|
||||||
CampaignListPendingBoundary,
|
|
||||||
CampaignListResults,
|
|
||||||
CampaignTransitionAnchor,
|
|
||||||
} from '@/components/campaign/shared/CampaignListPending'
|
|
||||||
import { CampaignListSheetProvider } from '@/components/campaign/shared/CampaignListSheetHost'
|
import { CampaignListSheetProvider } from '@/components/campaign/shared/CampaignListSheetHost'
|
||||||
import {
|
import {
|
||||||
CampaignTable,
|
CampaignTable,
|
||||||
|
|
@ -39,7 +35,6 @@ import {
|
||||||
} from '@/components/ui/Empty'
|
} from '@/components/ui/Empty'
|
||||||
import { resolveVisibleColumns } from '@/lib/campaignColumnVisibility'
|
import { resolveVisibleColumns } from '@/lib/campaignColumnVisibility'
|
||||||
import type { MunicipalityPortfolioIndexEntry } from '@/lib/municipalityPortfolio'
|
import type { MunicipalityPortfolioIndexEntry } from '@/lib/municipalityPortfolio'
|
||||||
import { resolveListUnifiedEnabled } from '@/lib/opsListRegistry/opsListFlag'
|
|
||||||
import { cn } from '@/lib/utils'
|
import { cn } from '@/lib/utils'
|
||||||
import { getAdvisorMunicipalityIds } from '@/utilities/campaignAccess'
|
import { getAdvisorMunicipalityIds } from '@/utilities/campaignAccess'
|
||||||
import { readCampaignColumnVisibility } from '@/utilities/campaignColumnVisibilityCookie'
|
import { readCampaignColumnVisibility } from '@/utilities/campaignColumnVisibilityCookie'
|
||||||
|
|
@ -264,7 +259,7 @@ export default async function StateDeputiesPage({ searchParams }: StateDeputiesP
|
||||||
/>
|
/>
|
||||||
) : null
|
) : null
|
||||||
|
|
||||||
const main = resolveListUnifiedEnabled() ? (
|
const main = (
|
||||||
<OpsListPage
|
<OpsListPage
|
||||||
overview={sortSummaryNode}
|
overview={sortSummaryNode}
|
||||||
toolbar={filters}
|
toolbar={filters}
|
||||||
|
|
@ -272,15 +267,6 @@ export default async function StateDeputiesPage({ searchParams }: StateDeputiesP
|
||||||
empty={null}
|
empty={null}
|
||||||
footer={footerNode}
|
footer={footerNode}
|
||||||
/>
|
/>
|
||||||
) : (
|
|
||||||
<CampaignListPendingBoundary>
|
|
||||||
{filters}
|
|
||||||
<CampaignListResults>
|
|
||||||
{sortSummaryNode}
|
|
||||||
{tableNode}
|
|
||||||
{footerNode}
|
|
||||||
</CampaignListResults>
|
|
||||||
</CampaignListPendingBoundary>
|
|
||||||
)
|
)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
||||||
|
|
@ -16,11 +16,7 @@ import { OpsListLocal } from '@/components/campaign/opsSync/OpsListLocal'
|
||||||
import { CampaignCopyableCell } from '@/components/campaign/shared/CampaignCopyableCell'
|
import { CampaignCopyableCell } from '@/components/campaign/shared/CampaignCopyableCell'
|
||||||
import { CampaignListFooter } from '@/components/campaign/shared/CampaignListFooter'
|
import { CampaignListFooter } from '@/components/campaign/shared/CampaignListFooter'
|
||||||
import { CampaignListPageHeader } from '@/components/campaign/shared/CampaignListPageHeader'
|
import { CampaignListPageHeader } from '@/components/campaign/shared/CampaignListPageHeader'
|
||||||
import {
|
import { CampaignTransitionAnchor } from '@/components/campaign/shared/CampaignListPending'
|
||||||
CampaignListPendingBoundary,
|
|
||||||
CampaignListResults,
|
|
||||||
CampaignTransitionAnchor,
|
|
||||||
} from '@/components/campaign/shared/CampaignListPending'
|
|
||||||
import { CampaignListSheetProvider } from '@/components/campaign/shared/CampaignListSheetHost'
|
import { CampaignListSheetProvider } from '@/components/campaign/shared/CampaignListSheetHost'
|
||||||
import {
|
import {
|
||||||
CampaignTable,
|
CampaignTable,
|
||||||
|
|
@ -50,7 +46,6 @@ import {
|
||||||
resolvedPortfolioEntriesById,
|
resolvedPortfolioEntriesById,
|
||||||
type MunicipalityPortfolioIndexEntry,
|
type MunicipalityPortfolioIndexEntry,
|
||||||
} from '@/lib/municipalityPortfolio'
|
} from '@/lib/municipalityPortfolio'
|
||||||
import { resolveListUnifiedEnabled } from '@/lib/opsListRegistry/opsListFlag'
|
|
||||||
import { formatBrazilianPhoneInput, whatsAppHrefForPhone } from '@/lib/phone'
|
import { formatBrazilianPhoneInput, whatsAppHrefForPhone } from '@/lib/phone'
|
||||||
import { MAX_LEADERSHIP_MUNICIPALITIES } from '@/lib/schemas/leadership'
|
import { MAX_LEADERSHIP_MUNICIPALITIES } from '@/lib/schemas/leadership'
|
||||||
import { cn } from '@/lib/utils'
|
import { cn } from '@/lib/utils'
|
||||||
|
|
@ -422,7 +417,7 @@ export default async function LeadershipsPage({ searchParams }: LeadershipsPageP
|
||||||
/>
|
/>
|
||||||
) : null
|
) : null
|
||||||
|
|
||||||
const main = resolveListUnifiedEnabled() ? (
|
const main = (
|
||||||
<OpsListPage
|
<OpsListPage
|
||||||
overview={sortSummaryNode}
|
overview={sortSummaryNode}
|
||||||
toolbar={filters}
|
toolbar={filters}
|
||||||
|
|
@ -430,15 +425,6 @@ export default async function LeadershipsPage({ searchParams }: LeadershipsPageP
|
||||||
empty={null}
|
empty={null}
|
||||||
footer={footerNode}
|
footer={footerNode}
|
||||||
/>
|
/>
|
||||||
) : (
|
|
||||||
<CampaignListPendingBoundary>
|
|
||||||
{filters}
|
|
||||||
<CampaignListResults>
|
|
||||||
{sortSummaryNode}
|
|
||||||
{tableNode}
|
|
||||||
{footerNode}
|
|
||||||
</CampaignListResults>
|
|
||||||
</CampaignListPendingBoundary>
|
|
||||||
)
|
)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,3 @@
|
||||||
import {
|
|
||||||
CampaignListPendingBoundary,
|
|
||||||
CampaignListResults,
|
|
||||||
} from '@/components/campaign/shared/CampaignListPending'
|
|
||||||
import config from '@payload-config'
|
import config from '@payload-config'
|
||||||
import { redirect } from 'next/navigation'
|
import { redirect } from 'next/navigation'
|
||||||
import { getPayload } from 'payload'
|
import { getPayload } from 'payload'
|
||||||
|
|
@ -19,7 +15,6 @@ import { CampaignListPageHeader } from '@/components/campaign/shared/CampaignLis
|
||||||
import { CampaignScopeBadge } from '@/components/campaign/shared/CampaignScopeBadge'
|
import { CampaignScopeBadge } from '@/components/campaign/shared/CampaignScopeBadge'
|
||||||
import { OpsListPage } from '@/components/campaign/shared/OpsListPage'
|
import { OpsListPage } from '@/components/campaign/shared/OpsListPage'
|
||||||
import { CampaignPageShell } from '@/components/campaign/shell/CampaignPageShell'
|
import { CampaignPageShell } from '@/components/campaign/shell/CampaignPageShell'
|
||||||
import { resolveListUnifiedEnabled } from '@/lib/opsListRegistry/opsListFlag'
|
|
||||||
import {
|
import {
|
||||||
isCampaignCoordinator,
|
isCampaignCoordinator,
|
||||||
isCampaignStaff,
|
isCampaignStaff,
|
||||||
|
|
@ -165,28 +160,16 @@ export default async function MunicipalitiesPage({ searchParams }: Municipalitie
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
|
||||||
// Shared pieces; flag only switches the composition shell (CL3 tracer).
|
// Provider wraps outside the pending boundary (OpsListPage owns pending chrome).
|
||||||
// Provider wraps both paths the same way (outside the pending boundary).
|
|
||||||
const main = wrapStaffListRegion(
|
const main = wrapStaffListRegion(
|
||||||
isStaffView,
|
isStaffView,
|
||||||
resolveListUnifiedEnabled() ? (
|
<OpsListPage
|
||||||
<OpsListPage
|
overview={overviewNode}
|
||||||
overview={overviewNode}
|
toolbar={filters}
|
||||||
toolbar={filters}
|
table={tableNode}
|
||||||
table={tableNode}
|
empty={null}
|
||||||
empty={null}
|
footer={footerNode}
|
||||||
footer={footerNode}
|
/>,
|
||||||
/>
|
|
||||||
) : (
|
|
||||||
<CampaignListPendingBoundary>
|
|
||||||
{filters}
|
|
||||||
<CampaignListResults>
|
|
||||||
{overviewNode}
|
|
||||||
{tableNode}
|
|
||||||
{footerNode}
|
|
||||||
</CampaignListResults>
|
|
||||||
</CampaignListPendingBoundary>
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
||||||
|
|
@ -8,17 +8,12 @@ import { OfflineBoundary } from '@/components/campaign/opsSync/OfflineBoundary'
|
||||||
import { OpsListLocal } from '@/components/campaign/opsSync/OpsListLocal'
|
import { OpsListLocal } from '@/components/campaign/opsSync/OpsListLocal'
|
||||||
import { CampaignListEmptyState } from '@/components/campaign/shared/CampaignListEmptyState'
|
import { CampaignListEmptyState } from '@/components/campaign/shared/CampaignListEmptyState'
|
||||||
import { CampaignListFooter } from '@/components/campaign/shared/CampaignListFooter'
|
import { CampaignListFooter } from '@/components/campaign/shared/CampaignListFooter'
|
||||||
import {
|
|
||||||
CampaignListPendingBoundary,
|
|
||||||
CampaignListResults,
|
|
||||||
} from '@/components/campaign/shared/CampaignListPending'
|
|
||||||
import { CampaignSearchForm } from '@/components/campaign/shared/CampaignSearchForm'
|
import { CampaignSearchForm } from '@/components/campaign/shared/CampaignSearchForm'
|
||||||
import { CampaignTable, type CampaignTableColumn } from '@/components/campaign/shared/CampaignTable'
|
import { CampaignTable, type CampaignTableColumn } from '@/components/campaign/shared/CampaignTable'
|
||||||
import { OpsListPage } from '@/components/campaign/shared/OpsListPage'
|
import { OpsListPage } from '@/components/campaign/shared/OpsListPage'
|
||||||
import { CampaignPageShell } from '@/components/campaign/shell/CampaignPageShell'
|
import { CampaignPageShell } from '@/components/campaign/shell/CampaignPageShell'
|
||||||
import { Badge } from '@/components/ui/Badge'
|
import { Badge } from '@/components/ui/Badge'
|
||||||
import { Button } from '@/components/ui/button'
|
import { Button } from '@/components/ui/button'
|
||||||
import { resolveListUnifiedEnabled } from '@/lib/opsListRegistry/opsListFlag'
|
|
||||||
import { organizationKindLabels } from '@/lib/schemas/organization'
|
import { organizationKindLabels } from '@/lib/schemas/organization'
|
||||||
import { readCampaignColumnVisibility } from '@/utilities/campaignColumnVisibilityCookie'
|
import { readCampaignColumnVisibility } from '@/utilities/campaignColumnVisibilityCookie'
|
||||||
import { requireCampaignPageActor } from '@/utilities/campaignPageActor'
|
import { requireCampaignPageActor } from '@/utilities/campaignPageActor'
|
||||||
|
|
@ -135,7 +130,7 @@ export default async function OrganizationsPage({ searchParams }: OrganizationsP
|
||||||
/>
|
/>
|
||||||
) : null
|
) : null
|
||||||
|
|
||||||
const main = resolveListUnifiedEnabled() ? (
|
const main = (
|
||||||
<OpsListPage
|
<OpsListPage
|
||||||
overview={null}
|
overview={null}
|
||||||
toolbar={toolbarNode}
|
toolbar={toolbarNode}
|
||||||
|
|
@ -143,14 +138,6 @@ export default async function OrganizationsPage({ searchParams }: OrganizationsP
|
||||||
empty={null}
|
empty={null}
|
||||||
footer={footerNode}
|
footer={footerNode}
|
||||||
/>
|
/>
|
||||||
) : (
|
|
||||||
<CampaignListPendingBoundary>
|
|
||||||
{toolbarNode}
|
|
||||||
<CampaignListResults>
|
|
||||||
{tableNode}
|
|
||||||
{footerNode}
|
|
||||||
</CampaignListResults>
|
|
||||||
</CampaignListPendingBoundary>
|
|
||||||
)
|
)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
||||||
|
|
@ -8,13 +8,8 @@ import { OfflineBoundary } from '@/components/campaign/opsSync/OfflineBoundary'
|
||||||
import { OpsListLocal } from '@/components/campaign/opsSync/OpsListLocal'
|
import { OpsListLocal } from '@/components/campaign/opsSync/OpsListLocal'
|
||||||
import { CampaignListFooter } from '@/components/campaign/shared/CampaignListFooter'
|
import { CampaignListFooter } from '@/components/campaign/shared/CampaignListFooter'
|
||||||
import { CampaignListPageHeader } from '@/components/campaign/shared/CampaignListPageHeader'
|
import { CampaignListPageHeader } from '@/components/campaign/shared/CampaignListPageHeader'
|
||||||
import {
|
|
||||||
CampaignListPendingBoundary,
|
|
||||||
CampaignListResults,
|
|
||||||
} from '@/components/campaign/shared/CampaignListPending'
|
|
||||||
import { OpsListPage } from '@/components/campaign/shared/OpsListPage'
|
import { OpsListPage } from '@/components/campaign/shared/OpsListPage'
|
||||||
import { CampaignPageShell } from '@/components/campaign/shell/CampaignPageShell'
|
import { CampaignPageShell } from '@/components/campaign/shell/CampaignPageShell'
|
||||||
import { resolveListUnifiedEnabled } from '@/lib/opsListRegistry/opsListFlag'
|
|
||||||
import { readCampaignColumnVisibility } from '@/utilities/campaignColumnVisibilityCookie'
|
import { readCampaignColumnVisibility } from '@/utilities/campaignColumnVisibilityCookie'
|
||||||
import { requireCampaignPageActor } from '@/utilities/campaignPageActor'
|
import { requireCampaignPageActor } from '@/utilities/campaignPageActor'
|
||||||
import { loadTerritoryOverviewPage } from '@/utilities/territory/loadTerritoryOverview'
|
import { loadTerritoryOverviewPage } from '@/utilities/territory/loadTerritoryOverview'
|
||||||
|
|
@ -64,7 +59,7 @@ export default async function TerritoriesPage({ searchParams }: TerritoriesPageP
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
|
||||||
const main = resolveListUnifiedEnabled() ? (
|
const main = (
|
||||||
<OpsListPage
|
<OpsListPage
|
||||||
overview={null}
|
overview={null}
|
||||||
toolbar={filters}
|
toolbar={filters}
|
||||||
|
|
@ -72,14 +67,6 @@ export default async function TerritoriesPage({ searchParams }: TerritoriesPageP
|
||||||
empty={null}
|
empty={null}
|
||||||
footer={footerNode}
|
footer={footerNode}
|
||||||
/>
|
/>
|
||||||
) : (
|
|
||||||
<CampaignListPendingBoundary>
|
|
||||||
{filters}
|
|
||||||
<CampaignListResults>
|
|
||||||
{tableNode}
|
|
||||||
{footerNode}
|
|
||||||
</CampaignListResults>
|
|
||||||
</CampaignListPendingBoundary>
|
|
||||||
)
|
)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
||||||
|
|
@ -1,11 +0,0 @@
|
||||||
/**
|
|
||||||
* CL2 — feature flag for the unified list factory (CL3+).
|
|
||||||
*
|
|
||||||
* When disabled, existing list routes keep their current implementation.
|
|
||||||
*/
|
|
||||||
|
|
||||||
const TRUTHY = new Set(['1', 'true'])
|
|
||||||
|
|
||||||
export const resolveListUnifiedEnabled = (
|
|
||||||
env: Record<string, string | undefined> = process.env,
|
|
||||||
): boolean => TRUTHY.has(env.LIST_UNIFIED ?? '')
|
|
||||||
|
|
@ -32,10 +32,13 @@ test.describe('Municípios — shell (OH8)', () => {
|
||||||
|
|
||||||
await campaign.login(page, coordinator.email!, coordinator.password)
|
await campaign.login(page, coordinator.email!, coordinator.password)
|
||||||
await page.goto(`${campaign.baseURL}/campanha/municipios`)
|
await page.goto(`${campaign.baseURL}/campanha/municipios`)
|
||||||
await expect(page.getByRole('heading', { name: 'Municípios', exact: true })).toBeVisible()
|
await expect(
|
||||||
await expect(page.getByLabel('Buscar município')).toBeVisible()
|
page.getByRole('heading', { name: 'Municípios', exact: true }).first(),
|
||||||
await expect(page.getByText(/\d+ municípios encontrados/)).toBeVisible()
|
).toBeVisible()
|
||||||
await expect(page.getByRole('link', { name: 'Ir para a próxima página' })).toBeVisible()
|
await expect(page.getByLabel('Buscar município').first()).toBeVisible()
|
||||||
|
// OfflineBoundary dual-path can leave RSC + Local markers in the tree (OH14 flake).
|
||||||
|
await expect(page.getByText(/\d+ municípios encontrados/).first()).toBeVisible()
|
||||||
|
await expect(page.getByRole('link', { name: 'Ir para a próxima página' }).first()).toBeVisible()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -119,7 +122,7 @@ test.describe('Municípios — jornadas por papel', () => {
|
||||||
// unique, unambiguous string rather than a bare "5.000" substring —
|
// unique, unambiguous string rather than a bare "5.000" substring —
|
||||||
// that also matches the (opacity-0 but DOM-visible) hover-preview span.
|
// that also matches the (opacity-0 but DOM-visible) hover-preview span.
|
||||||
await expect(page.getByText('Otimista: 5.000').first()).toBeVisible()
|
await expect(page.getByText('Otimista: 5.000').first()).toBeVisible()
|
||||||
await expect(page.getByText(`Assessoria: ${advisor.name}`)).toBeVisible()
|
await expect(page.getByText(`Assessoria: ${advisor.name}`).first()).toBeVisible()
|
||||||
})
|
})
|
||||||
|
|
||||||
test('coordinator assigns an advisor from the list combobox with auto-save (B27)', async ({
|
test('coordinator assigns an advisor from the list combobox with auto-save (B27)', async ({
|
||||||
|
|
|
||||||
|
|
@ -47,15 +47,14 @@ test.describe('OH9/OH11 campaign ops offline', () => {
|
||||||
})
|
})
|
||||||
|
|
||||||
await campaign.login(page, advisor.email!, advisor.password)
|
await campaign.login(page, advisor.email!, advisor.password)
|
||||||
await page.goto(`${campaign.baseURL}/campanha/municipios/${municipality.slug}`)
|
const syncResponse = page.waitForResponse(
|
||||||
await expect(page.getByRole('heading', { name: municipality.name })).toBeVisible()
|
|
||||||
|
|
||||||
// Wait for ops-sync so the mirror has this município before airplane mode.
|
|
||||||
await page.waitForResponse(
|
|
||||||
(response) =>
|
(response) =>
|
||||||
response.url().includes('/campanha/api/ops-sync') && response.request().method() === 'GET',
|
response.url().includes('/campanha/api/ops-sync') && response.request().method() === 'GET',
|
||||||
{ timeout: 30_000 },
|
{ timeout: 30_000 },
|
||||||
)
|
)
|
||||||
|
await page.goto(`${campaign.baseURL}/campanha/municipios/${municipality.slug}`)
|
||||||
|
await expect(page.getByRole('heading', { name: municipality.name }).first()).toBeVisible()
|
||||||
|
await syncResponse
|
||||||
await waitForCampaignServiceWorker(page)
|
await waitForCampaignServiceWorker(page)
|
||||||
|
|
||||||
await page.context().setOffline(true)
|
await page.context().setOffline(true)
|
||||||
|
|
@ -103,19 +102,19 @@ test.describe('OH9/OH11 campaign ops offline', () => {
|
||||||
})
|
})
|
||||||
|
|
||||||
await campaign.login(page, advisor.email!, advisor.password)
|
await campaign.login(page, advisor.email!, advisor.password)
|
||||||
await page.goto(`${campaign.baseURL}/campanha/municipios/${municipality.slug}`)
|
const syncResponse = page.waitForResponse(
|
||||||
await expect(page.getByRole('heading', { name: municipality.name })).toBeVisible()
|
|
||||||
|
|
||||||
await page.waitForResponse(
|
|
||||||
(response) =>
|
(response) =>
|
||||||
response.url().includes('/campanha/api/ops-sync') && response.request().method() === 'GET',
|
response.url().includes('/campanha/api/ops-sync') && response.request().method() === 'GET',
|
||||||
{ timeout: 30_000 },
|
{ timeout: 30_000 },
|
||||||
)
|
)
|
||||||
|
await page.goto(`${campaign.baseURL}/campanha/municipios/${municipality.slug}`)
|
||||||
|
await expect(page.getByRole('heading', { name: municipality.name }).first()).toBeVisible()
|
||||||
|
await syncResponse
|
||||||
await waitForCampaignServiceWorker(page)
|
await waitForCampaignServiceWorker(page)
|
||||||
|
|
||||||
await page.context().setOffline(true)
|
await page.context().setOffline(true)
|
||||||
|
|
||||||
await expect(page.getByRole('heading', { name: municipality.name })).toBeVisible()
|
await expect(page.getByRole('heading', { name: municipality.name }).first()).toBeVisible()
|
||||||
await page.getByLabel('Média', { exact: true }).fill('42')
|
await page.getByLabel('Média', { exact: true }).fill('42')
|
||||||
await page.getByLabel('Justificativa').fill('OH11 offline na estrada.')
|
await page.getByLabel('Justificativa').fill('OH11 offline na estrada.')
|
||||||
await page.getByRole('button', { name: 'Salvar estimativa' }).click()
|
await page.getByRole('button', { name: 'Salvar estimativa' }).click()
|
||||||
|
|
@ -145,14 +144,14 @@ test.describe('OH12 municipality list Local', () => {
|
||||||
fixtures.touchMunicipality(municipality.id)
|
fixtures.touchMunicipality(municipality.id)
|
||||||
|
|
||||||
await campaign.login(page, advisor.email!, advisor.password)
|
await campaign.login(page, advisor.email!, advisor.password)
|
||||||
await page.goto(`${campaign.baseURL}/campanha/municipios`)
|
const syncResponse = page.waitForResponse(
|
||||||
await expect(page.getByRole('heading', { name: 'Municípios' })).toBeVisible()
|
|
||||||
|
|
||||||
await page.waitForResponse(
|
|
||||||
(response) =>
|
(response) =>
|
||||||
response.url().includes('/campanha/api/ops-sync') && response.request().method() === 'GET',
|
response.url().includes('/campanha/api/ops-sync') && response.request().method() === 'GET',
|
||||||
{ timeout: 30_000 },
|
{ timeout: 30_000 },
|
||||||
)
|
)
|
||||||
|
await page.goto(`${campaign.baseURL}/campanha/municipios`)
|
||||||
|
await expect(page.getByRole('heading', { name: 'Municípios' }).first()).toBeVisible()
|
||||||
|
await syncResponse
|
||||||
await waitForCampaignServiceWorker(page)
|
await waitForCampaignServiceWorker(page)
|
||||||
|
|
||||||
await page.context().setOffline(true)
|
await page.context().setOffline(true)
|
||||||
|
|
@ -160,9 +159,11 @@ test.describe('OH12 municipality list Local', () => {
|
||||||
page.getByText('Edição na lista disponível quando estiveres online.'),
|
page.getByText('Edição na lista disponível quando estiveres online.'),
|
||||||
).toBeVisible()
|
).toBeVisible()
|
||||||
|
|
||||||
const search = page.getByLabel('Buscar município')
|
// Prefer the Local search input — OfflineBoundary swap can leave the RSC
|
||||||
|
// `#municipality-search` in the tree briefly (OH14 strict-mode flake).
|
||||||
|
const search = page.locator('#municipality-search-local')
|
||||||
await search.fill(municipality.name)
|
await search.fill(municipality.name)
|
||||||
await expect(page.getByRole('link', { name: municipality.name })).toBeVisible({
|
await expect(page.getByRole('link', { name: municipality.name }).first()).toBeVisible({
|
||||||
timeout: 15_000,
|
timeout: 15_000,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -172,7 +173,7 @@ test.describe('OH12 municipality list Local', () => {
|
||||||
await expect(
|
await expect(
|
||||||
page.getByText('Edição na lista disponível quando estiveres online.'),
|
page.getByText('Edição na lista disponível quando estiveres online.'),
|
||||||
).toBeVisible()
|
).toBeVisible()
|
||||||
await expect(page.getByRole('link', { name: municipality.name })).toBeVisible()
|
await expect(page.getByRole('link', { name: municipality.name }).first()).toBeVisible()
|
||||||
await expect(page.getByText('Indicadores indisponíveis offline.')).toBeVisible()
|
await expect(page.getByText('Indicadores indisponíveis offline.')).toBeVisible()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -8,9 +8,6 @@ import { expect, test } from './fixtures/campaignE2EFixtures.js'
|
||||||
* there must not be read as a regression here.
|
* there must not be read as a regression here.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const listUnifiedEnabled =
|
|
||||||
process.env.LIST_UNIFIED === '1' || process.env.LIST_UNIFIED?.toLowerCase() === 'true'
|
|
||||||
|
|
||||||
/** 416 whole municipalities — deep enough that `?page=2` is a real page. */
|
/** 416 whole municipalities — deep enough that `?page=2` is a real page. */
|
||||||
const SAVED_RECORTE = '/campanha/municipios?priority=alta'
|
const SAVED_RECORTE = '/campanha/municipios?priority=alta'
|
||||||
|
|
||||||
|
|
@ -132,31 +129,3 @@ test.describe('Filtros salvos de Municípios', () => {
|
||||||
await expect(page.getByRole('link', { name: SAVED_NAME })).toBeVisible()
|
await expect(page.getByRole('link', { name: SAVED_NAME })).toBeVisible()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
test.describe('Filtros salvos com LIST_UNIFIED (CL8)', () => {
|
|
||||||
test.skip(
|
|
||||||
!listUnifiedEnabled,
|
|
||||||
'Set LIST_UNIFIED=1 on the e2e webServer to run the unified-list tracer.',
|
|
||||||
)
|
|
||||||
|
|
||||||
test('saved filters stay intact behind OpsListPage', async ({ campaign, page }) => {
|
|
||||||
test.slow()
|
|
||||||
|
|
||||||
const { fixtures } = campaign
|
|
||||||
const coordinator = await fixtures.createCampaignUser('coordinator', {
|
|
||||||
name: fixtures.value('Coordenadora Filtros Unificados'),
|
|
||||||
})
|
|
||||||
|
|
||||||
await campaign.login(page, coordinator.email!, coordinator.password)
|
|
||||||
await page.goto(SAVED_RECORTE)
|
|
||||||
await page.getByRole('button', { name: 'Salvar filtro', exact: true }).click()
|
|
||||||
await page.getByLabel('Nome do filtro').fill(SAVED_NAME)
|
|
||||||
await page.getByRole('button', { name: 'Salvar', exact: true }).click()
|
|
||||||
|
|
||||||
const shortcut = page.getByRole('link', { name: SAVED_NAME })
|
|
||||||
await expect(shortcut).toBeVisible()
|
|
||||||
await shortcut.click()
|
|
||||||
await expect(page).toHaveURL(SAVED_RECORTE, NAVIGATION)
|
|
||||||
await expect(shortcut).toHaveAttribute('aria-current', 'page', NAVIGATION)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
|
||||||
|
|
@ -68,13 +68,15 @@ describe('access-control per-request memo', () => {
|
||||||
const coordinator = await fixtures.createCampaignUser('coordinator')
|
const coordinator = await fixtures.createCampaignUser('coordinator')
|
||||||
const municipality = await fixtures.getMunicipality()
|
const municipality = await fixtures.getMunicipality()
|
||||||
|
|
||||||
|
const leadershipIds: number[] = []
|
||||||
for (let index = 0; index < 3; index += 1) {
|
for (let index = 0; index < 3; index += 1) {
|
||||||
const contact = await fixtures.createContact()
|
const contact = await fixtures.createContact()
|
||||||
await fixtures.createLeadership({
|
const leadership = await fixtures.createLeadership({
|
||||||
contact: contact.id,
|
contact: contact.id,
|
||||||
municipalities: [municipality.id],
|
municipalities: [municipality.id],
|
||||||
supportStatus: 'engajado',
|
supportStatus: 'engajado',
|
||||||
})
|
})
|
||||||
|
leadershipIds.push(leadership.id)
|
||||||
}
|
}
|
||||||
|
|
||||||
const { result, count } = await countStatements('from "campaign_user"', () =>
|
const { result, count } = await countStatements('from "campaign_user"', () =>
|
||||||
|
|
@ -84,12 +86,16 @@ describe('access-control per-request memo', () => {
|
||||||
// field-level access checks across every populated relation.
|
// field-level access checks across every populated relation.
|
||||||
depth: 1,
|
depth: 1,
|
||||||
limit: 25,
|
limit: 25,
|
||||||
|
// Scope to this test's rows — an unscoped find can pick up other suites'
|
||||||
|
// leaderships with `user` set and inflate the campaign_user SQL count via
|
||||||
|
// populate (not via the actor memo).
|
||||||
|
where: { id: { in: leadershipIds } },
|
||||||
user: coordinator,
|
user: coordinator,
|
||||||
overrideAccess: false,
|
overrideAccess: false,
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
expect(result.docs.length).toBeGreaterThan(0)
|
expect(result.docs).toHaveLength(3)
|
||||||
// One read for the whole operation. Before the fix this was in the hundreds
|
// One read for the whole operation. Before the fix this was in the hundreds
|
||||||
// and grew with rows × populated fields.
|
// and grew with rows × populated fields.
|
||||||
expect(count).toBe(1)
|
expect(count).toBe(1)
|
||||||
|
|
|
||||||
|
|
@ -9,45 +9,27 @@ const ROUTE_PAGES = {
|
||||||
dobradinhas: join(process.cwd(), 'src/app/(campaign)/campanha/(app)/dobradinhas/page.tsx'),
|
dobradinhas: join(process.cwd(), 'src/app/(campaign)/campanha/(app)/dobradinhas/page.tsx'),
|
||||||
demandas: join(process.cwd(), 'src/app/(campaign)/campanha/(app)/demandas/page.tsx'),
|
demandas: join(process.cwd(), 'src/app/(campaign)/campanha/(app)/demandas/page.tsx'),
|
||||||
assessores: join(process.cwd(), 'src/app/(campaign)/campanha/(app)/assessores/page.tsx'),
|
assessores: join(process.cwd(), 'src/app/(campaign)/campanha/(app)/assessores/page.tsx'),
|
||||||
|
territorios: join(process.cwd(), 'src/app/(campaign)/campanha/(app)/territorios/page.tsx'),
|
||||||
apoiadores: join(process.cwd(), 'src/app/(campaign)/campanha/(app)/apoiadores/page.tsx'),
|
apoiadores: join(process.cwd(), 'src/app/(campaign)/campanha/(app)/apoiadores/page.tsx'),
|
||||||
organizacoes: join(process.cwd(), 'src/app/(campaign)/campanha/(app)/organizacoes/page.tsx'),
|
organizacoes: join(process.cwd(), 'src/app/(campaign)/campanha/(app)/organizacoes/page.tsx'),
|
||||||
} as const
|
} as const
|
||||||
|
|
||||||
const expectOpsListPageWiring = (source: string) => {
|
const expectOpsListPageWiring = (source: string) => {
|
||||||
expect(source).toContain('resolveListUnifiedEnabled')
|
|
||||||
expect(source).toContain('OpsListPage')
|
expect(source).toContain('OpsListPage')
|
||||||
expect(source).toContain("from '@/components/campaign/shared/OpsListPage'")
|
expect(source).toContain("from '@/components/campaign/shared/OpsListPage'")
|
||||||
expect(source).toContain("from '@/lib/opsListRegistry/opsListFlag'")
|
expect(source).not.toContain('resolveListUnifiedEnabled')
|
||||||
|
expect(source).not.toContain('opsListFlag')
|
||||||
}
|
}
|
||||||
|
|
||||||
describe('OpsListPage municipios tracer (CL3)', () => {
|
describe('OpsListPage route wiring', () => {
|
||||||
it('wires LIST_UNIFIED behind OpsListPage on the municipios route', () => {
|
it.each(Object.keys(ROUTE_PAGES) as Array<keyof typeof ROUTE_PAGES>)(
|
||||||
expectOpsListPageWiring(readFileSync(ROUTE_PAGES.municipios, 'utf8'))
|
'always renders OpsListPage on the %s route',
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
describe('OpsListPage CL4 routes', () => {
|
|
||||||
it.each(['liderancas', 'dobradinhas', 'demandas'] as const)(
|
|
||||||
'wires LIST_UNIFIED behind OpsListPage on the %s route',
|
|
||||||
(route) => {
|
(route) => {
|
||||||
expectOpsListPageWiring(readFileSync(ROUTE_PAGES[route], 'utf8'))
|
const source = readFileSync(ROUTE_PAGES[route], 'utf8')
|
||||||
},
|
expectOpsListPageWiring(source)
|
||||||
)
|
if (route === 'assessores') {
|
||||||
})
|
expect(source).toContain('resolveAdvisorListUrl')
|
||||||
|
}
|
||||||
describe('OpsListPage assessores (CL5)', () => {
|
|
||||||
it('wires LIST_UNIFIED behind OpsListPage on the assessores route', () => {
|
|
||||||
const source = readFileSync(ROUTE_PAGES.assessores, 'utf8')
|
|
||||||
expectOpsListPageWiring(source)
|
|
||||||
expect(source).toContain('resolveAdvisorListUrl')
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
describe('OpsListPage CL7 routes', () => {
|
|
||||||
it.each(['apoiadores', 'organizacoes'] as const)(
|
|
||||||
'wires LIST_UNIFIED behind OpsListPage on the %s route',
|
|
||||||
(route) => {
|
|
||||||
expectOpsListPageWiring(readFileSync(ROUTE_PAGES[route], 'utf8'))
|
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
import { describe, expect, it } from 'vitest'
|
import { describe, expect, it } from 'vitest'
|
||||||
|
|
||||||
import type { CampaignListId } from '@/lib/campaignColumnVisibility'
|
import type { CampaignListId } from '@/lib/campaignColumnVisibility'
|
||||||
import { resolveListUnifiedEnabled } from '@/lib/opsListRegistry/opsListFlag'
|
|
||||||
import {
|
import {
|
||||||
getOpsListDomain,
|
getOpsListDomain,
|
||||||
opsListDomains,
|
opsListDomains,
|
||||||
|
|
@ -111,21 +110,3 @@ describe('opsListRegistry v1', () => {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('resolveListUnifiedEnabled', () => {
|
|
||||||
it('is false when LIST_UNIFIED is absent', () => {
|
|
||||||
expect(resolveListUnifiedEnabled({})).toBe(false)
|
|
||||||
expect(resolveListUnifiedEnabled({ LIST_UNIFIED: undefined })).toBe(false)
|
|
||||||
})
|
|
||||||
|
|
||||||
it('is true for "1" and "true"', () => {
|
|
||||||
expect(resolveListUnifiedEnabled({ LIST_UNIFIED: '1' })).toBe(true)
|
|
||||||
expect(resolveListUnifiedEnabled({ LIST_UNIFIED: 'true' })).toBe(true)
|
|
||||||
})
|
|
||||||
|
|
||||||
it('is false for "0" and other values', () => {
|
|
||||||
expect(resolveListUnifiedEnabled({ LIST_UNIFIED: '0' })).toBe(false)
|
|
||||||
expect(resolveListUnifiedEnabled({ LIST_UNIFIED: 'false' })).toBe(false)
|
|
||||||
expect(resolveListUnifiedEnabled({ LIST_UNIFIED: 'yes' })).toBe(false)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
|
||||||
|
|
@ -11,10 +11,10 @@ const routePagePath = (routePath: string): string => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const expectOpsListFactoryWiring = (source: string) => {
|
const expectOpsListFactoryWiring = (source: string) => {
|
||||||
expect(source).toContain('resolveListUnifiedEnabled')
|
|
||||||
expect(source).toContain('OpsListPage')
|
expect(source).toContain('OpsListPage')
|
||||||
expect(source).toContain("from '@/components/campaign/shared/OpsListPage'")
|
expect(source).toContain("from '@/components/campaign/shared/OpsListPage'")
|
||||||
expect(source).toContain("from '@/lib/opsListRegistry/opsListFlag'")
|
expect(source).not.toContain('resolveListUnifiedEnabled')
|
||||||
|
expect(source).not.toContain('opsListFlag')
|
||||||
}
|
}
|
||||||
|
|
||||||
describe('opsListRegistry v1 routes (CL8)', () => {
|
describe('opsListRegistry v1 routes (CL8)', () => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue