mirror of
https://github.com/fsolla/teqo.git
synced 2026-11-26 21:53:06 +00:00
CL9 — retire LIST_UNIFIED; always render OpsListPage
Drop the dual-path list flag so the eight staff list routes share one shell wiring path, matching the OH14 always-on hybrid cleanup.
This commit is contained in:
parent
4942e3d149
commit
224eaf5c47
19 changed files with 69 additions and 238 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,
|
||||
# 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):** **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
|
||||
|
||||
Status: travado (freshness audit 2026-08-01 — premissas confirmadas no repo)
|
||||
Atualizado em: 2026-08-01
|
||||
Status: implementado (flag `LIST_UNIFIED` retirada — CL9, 2026-08-02)
|
||||
Atualizado em: 2026-08-02
|
||||
Issue: #155
|
||||
Priority: P1
|
||||
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.
|
||||
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.
|
||||
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
|
||||
|
||||
|
|
@ -98,11 +98,10 @@ Estado **hoje** (não o contrato-alvo). Para sortModel / canonicalRedirect / col
|
|||
|
||||
## Critérios de aceite do projecto
|
||||
|
||||
1. Sem `LIST_UNIFIED`: e2e existentes idênticas a `main`.
|
||||
2. Com `LIST_UNIFIED=1`: cada lista migrada renderiza pela `OpsListPage` com paridade funcional/visível.
|
||||
3. URLs canónicas e saved filters municípios funcionam igual.
|
||||
4. `pnpm gate:fast` + e2e das listas verdes.
|
||||
5. Registry falha o build se faltar slug v1 ou coluna sem `label`.
|
||||
1. Cada lista v1 renderiza pela `OpsListPage` (sem dual-path / sem `LIST_UNIFIED`).
|
||||
2. URLs canónicas e saved filters municípios funcionam igual.
|
||||
3. `pnpm gate:fast` + e2e das listas verdes.
|
||||
4. Registry falha o build se faltar slug v1 ou coluna sem `label`.
|
||||
|
||||
## 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 |
|
||||
| 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 |
|
||||
| CL9 | — | [`cl9-list-unified-flag-cleanup.md`](cl9-list-unified-flag-cleanup.md) | CL8 (+ OH14) | ~0,5d |
|
||||
|
||||
## Dependência entre projectos
|
||||
|
||||
|
|
|
|||
|
|
@ -5,10 +5,6 @@ const allowedImageHost = process.env.NEXT_PUBLIC_SITE_URL || 'https://jorgesolla
|
|||
|
||||
const nextConfig = {
|
||||
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: {
|
||||
remotePatterns: [new URL(`${allowedImageHost}/**`)],
|
||||
},
|
||||
|
|
|
|||
|
|
@ -118,7 +118,6 @@ export default defineConfig({
|
|||
NEXT_DIST_DIR: '.next/e2e',
|
||||
PAYLOAD_SECRET: process.env.PAYLOAD_SECRET ?? 'test-only-secret-not-used-in-production',
|
||||
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 { CampaignListFooter } from '@/components/campaign/shared/CampaignListFooter'
|
||||
import { CampaignListPageHeader } from '@/components/campaign/shared/CampaignListPageHeader'
|
||||
import {
|
||||
CampaignListPendingBoundary,
|
||||
CampaignListResults,
|
||||
} from '@/components/campaign/shared/CampaignListPending'
|
||||
import { CampaignScopeBadge } from '@/components/campaign/shared/CampaignScopeBadge'
|
||||
import { OpsListPage } from '@/components/campaign/shared/OpsListPage'
|
||||
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 { SupporterListOverview } from '@/components/campaign/supporter/SupporterListOverview'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { resolveListUnifiedEnabled } from '@/lib/opsListRegistry/opsListFlag'
|
||||
import { isCampaignCoordinator, isCampaignUnrestricted } from '@/utilities/campaignAccess'
|
||||
import { readCampaignColumnVisibility } from '@/utilities/campaignColumnVisibilityCookie'
|
||||
import { requireCampaignPageActor } from '@/utilities/campaignPageActor'
|
||||
|
|
@ -91,7 +86,7 @@ export default async function SupportersPage({ searchParams }: SupportersPagePro
|
|||
/>
|
||||
) : null
|
||||
|
||||
const main = resolveListUnifiedEnabled() ? (
|
||||
const main = (
|
||||
<OpsListPage
|
||||
overview={overviewNode}
|
||||
toolbar={toolbarNode}
|
||||
|
|
@ -99,15 +94,6 @@ export default async function SupportersPage({ searchParams }: SupportersPagePro
|
|||
empty={null}
|
||||
footer={footerNode}
|
||||
/>
|
||||
) : (
|
||||
<CampaignListPendingBoundary>
|
||||
{toolbarNode}
|
||||
<CampaignListResults>
|
||||
{overviewNode}
|
||||
{tableNode}
|
||||
{footerNode}
|
||||
</CampaignListResults>
|
||||
</CampaignListPendingBoundary>
|
||||
)
|
||||
|
||||
return (
|
||||
|
|
|
|||
|
|
@ -8,15 +8,10 @@ import { OfflineBoundary } from '@/components/campaign/opsSync/OfflineBoundary'
|
|||
import { OpsListLocal } from '@/components/campaign/opsSync/OpsListLocal'
|
||||
import { CampaignListFooter } from '@/components/campaign/shared/CampaignListFooter'
|
||||
import { CampaignListPageHeader } from '@/components/campaign/shared/CampaignListPageHeader'
|
||||
import {
|
||||
CampaignListPendingBoundary,
|
||||
CampaignListResults,
|
||||
} from '@/components/campaign/shared/CampaignListPending'
|
||||
import { CampaignSearchForm } from '@/components/campaign/shared/CampaignSearchForm'
|
||||
import { OpsListPage } from '@/components/campaign/shared/OpsListPage'
|
||||
import { CampaignPageShell } from '@/components/campaign/shell/CampaignPageShell'
|
||||
import { CAMPAIGN_ADVISORS_HOME } from '@/lib/campaignPaths'
|
||||
import { resolveListUnifiedEnabled } from '@/lib/opsListRegistry/opsListFlag'
|
||||
import { advisorListHrefForPage, resolveAdvisorListUrl } from '@/utilities/advisor/advisorListUrl'
|
||||
import { loadAdvisorListPageData } from '@/utilities/advisorData'
|
||||
import { readCampaignColumnVisibility } from '@/utilities/campaignColumnVisibilityCookie'
|
||||
|
|
@ -88,7 +83,7 @@ export default async function AdvisorsPage({ searchParams }: AdvisorsPageProps)
|
|||
/>
|
||||
)
|
||||
|
||||
const main: ReactNode = resolveListUnifiedEnabled() ? (
|
||||
const main: ReactNode = (
|
||||
<OpsListPage
|
||||
overview={null}
|
||||
toolbar={toolbar}
|
||||
|
|
@ -96,14 +91,6 @@ export default async function AdvisorsPage({ searchParams }: AdvisorsPageProps)
|
|||
empty={null}
|
||||
footer={footerNode}
|
||||
/>
|
||||
) : (
|
||||
<CampaignListPendingBoundary>
|
||||
{toolbar}
|
||||
<CampaignListResults>
|
||||
{tableNode}
|
||||
{footerNode}
|
||||
</CampaignListResults>
|
||||
</CampaignListPendingBoundary>
|
||||
)
|
||||
|
||||
return (
|
||||
|
|
|
|||
|
|
@ -10,16 +10,11 @@ import { CampaignFilterChips } from '@/components/campaign/shared/CampaignFilter
|
|||
import { CampaignListEmptyState } from '@/components/campaign/shared/CampaignListEmptyState'
|
||||
import { CampaignListFooter } from '@/components/campaign/shared/CampaignListFooter'
|
||||
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 { OpsListPage } from '@/components/campaign/shared/OpsListPage'
|
||||
import { CampaignPageShell } from '@/components/campaign/shell/CampaignPageShell'
|
||||
import { Badge } from '@/components/ui/Badge'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { resolveListUnifiedEnabled } from '@/lib/opsListRegistry/opsListFlag'
|
||||
import {
|
||||
campaignDemandKindLabels,
|
||||
campaignDemandStatusLabels,
|
||||
|
|
@ -169,7 +164,7 @@ export default async function DemandsPage({ searchParams }: DemandsPageProps) {
|
|||
/>
|
||||
) : null
|
||||
|
||||
const main = resolveListUnifiedEnabled() ? (
|
||||
const main = (
|
||||
<OpsListPage
|
||||
overview={null}
|
||||
toolbar={statusChips}
|
||||
|
|
@ -177,14 +172,6 @@ export default async function DemandsPage({ searchParams }: DemandsPageProps) {
|
|||
empty={null}
|
||||
footer={footerNode}
|
||||
/>
|
||||
) : (
|
||||
<CampaignListPendingBoundary>
|
||||
{statusChips}
|
||||
<CampaignListResults>
|
||||
{tableNode}
|
||||
{footerNode}
|
||||
</CampaignListResults>
|
||||
</CampaignListPendingBoundary>
|
||||
)
|
||||
|
||||
return (
|
||||
|
|
|
|||
|
|
@ -8,11 +8,7 @@ import { OfflineBoundary } from '@/components/campaign/opsSync/OfflineBoundary'
|
|||
import { OpsListLocal } from '@/components/campaign/opsSync/OpsListLocal'
|
||||
import { CampaignListFooter } from '@/components/campaign/shared/CampaignListFooter'
|
||||
import { CampaignListPageHeader } from '@/components/campaign/shared/CampaignListPageHeader'
|
||||
import {
|
||||
CampaignListPendingBoundary,
|
||||
CampaignListResults,
|
||||
CampaignTransitionAnchor,
|
||||
} from '@/components/campaign/shared/CampaignListPending'
|
||||
import { CampaignTransitionAnchor } from '@/components/campaign/shared/CampaignListPending'
|
||||
import { CampaignListSheetProvider } from '@/components/campaign/shared/CampaignListSheetHost'
|
||||
import {
|
||||
CampaignTable,
|
||||
|
|
@ -39,7 +35,6 @@ import {
|
|||
} from '@/components/ui/Empty'
|
||||
import { resolveVisibleColumns } from '@/lib/campaignColumnVisibility'
|
||||
import type { MunicipalityPortfolioIndexEntry } from '@/lib/municipalityPortfolio'
|
||||
import { resolveListUnifiedEnabled } from '@/lib/opsListRegistry/opsListFlag'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { getAdvisorMunicipalityIds } from '@/utilities/campaignAccess'
|
||||
import { readCampaignColumnVisibility } from '@/utilities/campaignColumnVisibilityCookie'
|
||||
|
|
@ -264,7 +259,7 @@ export default async function StateDeputiesPage({ searchParams }: StateDeputiesP
|
|||
/>
|
||||
) : null
|
||||
|
||||
const main = resolveListUnifiedEnabled() ? (
|
||||
const main = (
|
||||
<OpsListPage
|
||||
overview={sortSummaryNode}
|
||||
toolbar={filters}
|
||||
|
|
@ -272,15 +267,6 @@ export default async function StateDeputiesPage({ searchParams }: StateDeputiesP
|
|||
empty={null}
|
||||
footer={footerNode}
|
||||
/>
|
||||
) : (
|
||||
<CampaignListPendingBoundary>
|
||||
{filters}
|
||||
<CampaignListResults>
|
||||
{sortSummaryNode}
|
||||
{tableNode}
|
||||
{footerNode}
|
||||
</CampaignListResults>
|
||||
</CampaignListPendingBoundary>
|
||||
)
|
||||
|
||||
return (
|
||||
|
|
|
|||
|
|
@ -16,11 +16,7 @@ import { OpsListLocal } from '@/components/campaign/opsSync/OpsListLocal'
|
|||
import { CampaignCopyableCell } from '@/components/campaign/shared/CampaignCopyableCell'
|
||||
import { CampaignListFooter } from '@/components/campaign/shared/CampaignListFooter'
|
||||
import { CampaignListPageHeader } from '@/components/campaign/shared/CampaignListPageHeader'
|
||||
import {
|
||||
CampaignListPendingBoundary,
|
||||
CampaignListResults,
|
||||
CampaignTransitionAnchor,
|
||||
} from '@/components/campaign/shared/CampaignListPending'
|
||||
import { CampaignTransitionAnchor } from '@/components/campaign/shared/CampaignListPending'
|
||||
import { CampaignListSheetProvider } from '@/components/campaign/shared/CampaignListSheetHost'
|
||||
import {
|
||||
CampaignTable,
|
||||
|
|
@ -50,7 +46,6 @@ import {
|
|||
resolvedPortfolioEntriesById,
|
||||
type MunicipalityPortfolioIndexEntry,
|
||||
} from '@/lib/municipalityPortfolio'
|
||||
import { resolveListUnifiedEnabled } from '@/lib/opsListRegistry/opsListFlag'
|
||||
import { formatBrazilianPhoneInput, whatsAppHrefForPhone } from '@/lib/phone'
|
||||
import { MAX_LEADERSHIP_MUNICIPALITIES } from '@/lib/schemas/leadership'
|
||||
import { cn } from '@/lib/utils'
|
||||
|
|
@ -422,7 +417,7 @@ export default async function LeadershipsPage({ searchParams }: LeadershipsPageP
|
|||
/>
|
||||
) : null
|
||||
|
||||
const main = resolveListUnifiedEnabled() ? (
|
||||
const main = (
|
||||
<OpsListPage
|
||||
overview={sortSummaryNode}
|
||||
toolbar={filters}
|
||||
|
|
@ -430,15 +425,6 @@ export default async function LeadershipsPage({ searchParams }: LeadershipsPageP
|
|||
empty={null}
|
||||
footer={footerNode}
|
||||
/>
|
||||
) : (
|
||||
<CampaignListPendingBoundary>
|
||||
{filters}
|
||||
<CampaignListResults>
|
||||
{sortSummaryNode}
|
||||
{tableNode}
|
||||
{footerNode}
|
||||
</CampaignListResults>
|
||||
</CampaignListPendingBoundary>
|
||||
)
|
||||
|
||||
return (
|
||||
|
|
|
|||
|
|
@ -1,7 +1,3 @@
|
|||
import {
|
||||
CampaignListPendingBoundary,
|
||||
CampaignListResults,
|
||||
} from '@/components/campaign/shared/CampaignListPending'
|
||||
import config from '@payload-config'
|
||||
import { redirect } from 'next/navigation'
|
||||
import { getPayload } from 'payload'
|
||||
|
|
@ -19,7 +15,6 @@ import { CampaignListPageHeader } from '@/components/campaign/shared/CampaignLis
|
|||
import { CampaignScopeBadge } from '@/components/campaign/shared/CampaignScopeBadge'
|
||||
import { OpsListPage } from '@/components/campaign/shared/OpsListPage'
|
||||
import { CampaignPageShell } from '@/components/campaign/shell/CampaignPageShell'
|
||||
import { resolveListUnifiedEnabled } from '@/lib/opsListRegistry/opsListFlag'
|
||||
import {
|
||||
isCampaignCoordinator,
|
||||
isCampaignStaff,
|
||||
|
|
@ -165,28 +160,16 @@ export default async function MunicipalitiesPage({ searchParams }: Municipalitie
|
|||
/>
|
||||
)
|
||||
|
||||
// Shared pieces; flag only switches the composition shell (CL3 tracer).
|
||||
// Provider wraps both paths the same way (outside the pending boundary).
|
||||
// Provider wraps outside the pending boundary (OpsListPage owns pending chrome).
|
||||
const main = wrapStaffListRegion(
|
||||
isStaffView,
|
||||
resolveListUnifiedEnabled() ? (
|
||||
<OpsListPage
|
||||
overview={overviewNode}
|
||||
toolbar={filters}
|
||||
table={tableNode}
|
||||
empty={null}
|
||||
footer={footerNode}
|
||||
/>
|
||||
) : (
|
||||
<CampaignListPendingBoundary>
|
||||
{filters}
|
||||
<CampaignListResults>
|
||||
{overviewNode}
|
||||
{tableNode}
|
||||
{footerNode}
|
||||
</CampaignListResults>
|
||||
</CampaignListPendingBoundary>
|
||||
),
|
||||
<OpsListPage
|
||||
overview={overviewNode}
|
||||
toolbar={filters}
|
||||
table={tableNode}
|
||||
empty={null}
|
||||
footer={footerNode}
|
||||
/>,
|
||||
)
|
||||
|
||||
return (
|
||||
|
|
|
|||
|
|
@ -8,17 +8,12 @@ import { OfflineBoundary } from '@/components/campaign/opsSync/OfflineBoundary'
|
|||
import { OpsListLocal } from '@/components/campaign/opsSync/OpsListLocal'
|
||||
import { CampaignListEmptyState } from '@/components/campaign/shared/CampaignListEmptyState'
|
||||
import { CampaignListFooter } from '@/components/campaign/shared/CampaignListFooter'
|
||||
import {
|
||||
CampaignListPendingBoundary,
|
||||
CampaignListResults,
|
||||
} from '@/components/campaign/shared/CampaignListPending'
|
||||
import { CampaignSearchForm } from '@/components/campaign/shared/CampaignSearchForm'
|
||||
import { CampaignTable, type CampaignTableColumn } from '@/components/campaign/shared/CampaignTable'
|
||||
import { OpsListPage } from '@/components/campaign/shared/OpsListPage'
|
||||
import { CampaignPageShell } from '@/components/campaign/shell/CampaignPageShell'
|
||||
import { Badge } from '@/components/ui/Badge'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { resolveListUnifiedEnabled } from '@/lib/opsListRegistry/opsListFlag'
|
||||
import { organizationKindLabels } from '@/lib/schemas/organization'
|
||||
import { readCampaignColumnVisibility } from '@/utilities/campaignColumnVisibilityCookie'
|
||||
import { requireCampaignPageActor } from '@/utilities/campaignPageActor'
|
||||
|
|
@ -135,7 +130,7 @@ export default async function OrganizationsPage({ searchParams }: OrganizationsP
|
|||
/>
|
||||
) : null
|
||||
|
||||
const main = resolveListUnifiedEnabled() ? (
|
||||
const main = (
|
||||
<OpsListPage
|
||||
overview={null}
|
||||
toolbar={toolbarNode}
|
||||
|
|
@ -143,14 +138,6 @@ export default async function OrganizationsPage({ searchParams }: OrganizationsP
|
|||
empty={null}
|
||||
footer={footerNode}
|
||||
/>
|
||||
) : (
|
||||
<CampaignListPendingBoundary>
|
||||
{toolbarNode}
|
||||
<CampaignListResults>
|
||||
{tableNode}
|
||||
{footerNode}
|
||||
</CampaignListResults>
|
||||
</CampaignListPendingBoundary>
|
||||
)
|
||||
|
||||
return (
|
||||
|
|
|
|||
|
|
@ -8,13 +8,8 @@ import { OfflineBoundary } from '@/components/campaign/opsSync/OfflineBoundary'
|
|||
import { OpsListLocal } from '@/components/campaign/opsSync/OpsListLocal'
|
||||
import { CampaignListFooter } from '@/components/campaign/shared/CampaignListFooter'
|
||||
import { CampaignListPageHeader } from '@/components/campaign/shared/CampaignListPageHeader'
|
||||
import {
|
||||
CampaignListPendingBoundary,
|
||||
CampaignListResults,
|
||||
} from '@/components/campaign/shared/CampaignListPending'
|
||||
import { OpsListPage } from '@/components/campaign/shared/OpsListPage'
|
||||
import { CampaignPageShell } from '@/components/campaign/shell/CampaignPageShell'
|
||||
import { resolveListUnifiedEnabled } from '@/lib/opsListRegistry/opsListFlag'
|
||||
import { readCampaignColumnVisibility } from '@/utilities/campaignColumnVisibilityCookie'
|
||||
import { requireCampaignPageActor } from '@/utilities/campaignPageActor'
|
||||
import { loadTerritoryOverviewPage } from '@/utilities/territory/loadTerritoryOverview'
|
||||
|
|
@ -64,7 +59,7 @@ export default async function TerritoriesPage({ searchParams }: TerritoriesPageP
|
|||
/>
|
||||
)
|
||||
|
||||
const main = resolveListUnifiedEnabled() ? (
|
||||
const main = (
|
||||
<OpsListPage
|
||||
overview={null}
|
||||
toolbar={filters}
|
||||
|
|
@ -72,14 +67,6 @@ export default async function TerritoriesPage({ searchParams }: TerritoriesPageP
|
|||
empty={null}
|
||||
footer={footerNode}
|
||||
/>
|
||||
) : (
|
||||
<CampaignListPendingBoundary>
|
||||
{filters}
|
||||
<CampaignListResults>
|
||||
{tableNode}
|
||||
{footerNode}
|
||||
</CampaignListResults>
|
||||
</CampaignListPendingBoundary>
|
||||
)
|
||||
|
||||
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 ?? '')
|
||||
|
|
@ -8,9 +8,6 @@ import { expect, test } from './fixtures/campaignE2EFixtures.js'
|
|||
* 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. */
|
||||
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()
|
||||
})
|
||||
})
|
||||
|
||||
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)
|
||||
})
|
||||
})
|
||||
|
|
|
|||
|
|
@ -9,45 +9,27 @@ const ROUTE_PAGES = {
|
|||
dobradinhas: join(process.cwd(), 'src/app/(campaign)/campanha/(app)/dobradinhas/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'),
|
||||
territorios: join(process.cwd(), 'src/app/(campaign)/campanha/(app)/territorios/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'),
|
||||
} as const
|
||||
|
||||
const expectOpsListPageWiring = (source: string) => {
|
||||
expect(source).toContain('resolveListUnifiedEnabled')
|
||||
expect(source).toContain('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)', () => {
|
||||
it('wires LIST_UNIFIED behind OpsListPage on the municipios route', () => {
|
||||
expectOpsListPageWiring(readFileSync(ROUTE_PAGES.municipios, 'utf8'))
|
||||
})
|
||||
})
|
||||
|
||||
describe('OpsListPage CL4 routes', () => {
|
||||
it.each(['liderancas', 'dobradinhas', 'demandas'] as const)(
|
||||
'wires LIST_UNIFIED behind OpsListPage on the %s route',
|
||||
describe('OpsListPage route wiring', () => {
|
||||
it.each(Object.keys(ROUTE_PAGES) as Array<keyof typeof ROUTE_PAGES>)(
|
||||
'always renders OpsListPage on the %s route',
|
||||
(route) => {
|
||||
expectOpsListPageWiring(readFileSync(ROUTE_PAGES[route], 'utf8'))
|
||||
},
|
||||
)
|
||||
})
|
||||
|
||||
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'))
|
||||
const source = readFileSync(ROUTE_PAGES[route], 'utf8')
|
||||
expectOpsListPageWiring(source)
|
||||
if (route === 'assessores') {
|
||||
expect(source).toContain('resolveAdvisorListUrl')
|
||||
}
|
||||
},
|
||||
)
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
import { describe, expect, it } from 'vitest'
|
||||
|
||||
import type { CampaignListId } from '@/lib/campaignColumnVisibility'
|
||||
import { resolveListUnifiedEnabled } from '@/lib/opsListRegistry/opsListFlag'
|
||||
import {
|
||||
getOpsListDomain,
|
||||
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) => {
|
||||
expect(source).toContain('resolveListUnifiedEnabled')
|
||||
expect(source).toContain('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)', () => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue