refactor(OH6): reuse OH2 resolveOpsHybridEnabled

Drop the temporary opsSync flag helper now that lib/campaignOps landed
on main; keep next.config env inlining for the client island.
This commit is contained in:
Cursor Agent 2026-08-01 22:24:51 +00:00
parent a78170c4f9
commit 5f0943bff3
No known key found for this signature in database
3 changed files with 1 additions and 24 deletions

View file

@ -13,7 +13,7 @@ Responsável: —
## Freshness audit (2026-08-01)
- OH1 (#164) `done`/`in-prod`. Paths e assinaturas (`estimateVotesRecord`, `PledgeEstimateForm`, `estimateVotesSchema`, `estimatedAt` no hook) batem.
- `OPS_HYBRID` / `lib/campaignOps` ainda não existem (OH2 #163 in-progress em paralelo) — OH6 lê `OPS_HYBRID` via `next.config` `env` + helper local em `opsSync/` (sem abrir o pacote OH2).
- OH2 (#163) mergeou durante a entrega — OH6 reusa `resolveOpsHybridEnabled` de `lib/campaignOps/opsHybridFlag.ts` + `OPS_HYBRID` via `next.config` `env`.
- `@tanstack/offline-transactions@1.0.42` exige collection TanStack DB — tracer usa `localOnlyCollectionOptions` (OH7 troca pelo mirror).
## Premissas

View file

@ -1,11 +0,0 @@
/**
* OH6 tracer — compile-time `OPS_HYBRID` reader for the estimate outbox island.
* OH2 owns the canonical `src/lib/campaignOps/opsHybridFlag.ts`; this local
* helper avoids opening that package while OH2 lands in parallel.
*/
export const resolveOpsHybridEnabled = (
env: NodeJS.ProcessEnv | Record<string, string | undefined> = process.env,
): boolean => {
const raw = env.OPS_HYBRID?.trim().toLowerCase()
return raw === '1' || raw === 'true'
}

View file

@ -5,7 +5,6 @@ import {
resolveEstimateTransactionPledgeKey,
toOpsEstimateOutboxRow,
} from '@/components/campaign/opsSync/opsEstimateOutboxModel'
import { resolveOpsHybridEnabled } from '@/components/campaign/opsSync/opsHybridEnabled'
import type { OfflineTransaction } from '@tanstack/offline-transactions'
const tx = (id: string, pledgeId: number, createdAtMs: number): OfflineTransaction =>
@ -52,14 +51,3 @@ describe('opsEstimateOutboxModel (OH6)', () => {
})
})
})
describe('resolveOpsHybridEnabled (OH6)', () => {
it('accepts 1/true and rejects absent/other values', () => {
expect(resolveOpsHybridEnabled({ OPS_HYBRID: '1' })).toBe(true)
expect(resolveOpsHybridEnabled({ OPS_HYBRID: 'true' })).toBe(true)
expect(resolveOpsHybridEnabled({ OPS_HYBRID: 'TRUE' })).toBe(true)
expect(resolveOpsHybridEnabled({ OPS_HYBRID: '0' })).toBe(false)
expect(resolveOpsHybridEnabled({ OPS_HYBRID: '' })).toBe(false)
expect(resolveOpsHybridEnabled({})).toBe(false)
})
})