Files
webtecnica a064d59be9 fix(update): a conferência de isolamento só cobra regra de tabela que existe (#1897)
Sem o módulo de honorários instalado, a atualização parava no meio com o
CRM de pé no aviso vermelho "REGRAS DE ISOLAMENTO AUSENTES" e as 8 regras de
honorarios_contratos/honorarios_parcelas listadas como faltando. Não faltavam:
estão escritas DENTRO do corpo de public.fn_honorarios_provisionar() no
baseline.sql, função que só executa quando alguém chama
fn_modulo_instalar('honorarios', …) — criar a função não cria tabela nenhuma
(migration 0480 / ADR-0002). O conferidor do update.sh montava a lista esperada
lendo todo `create policy … on public.X` do texto do arquivo, inclusive o que
estava dentro da função. Sem o módulo as tabelas não existem, a recriação
responde `relation does not exist`, a segunda conferência acusa as mesmas 8 e o
script saía em 1 com o sistema parado. Era a atualização inteira de toda
instalação sem o módulo.

A conferência agora só cobra policy cuja tabela já existe em `public` — medida
no banco (pg_class), não no texto. Cobre os próximos módulos da ADR-0002 sem
caçar `$f$`/`$$`. Não afrouxa: policy de tabela existente que sumir do banco
continua derrubando a atualização. Se a consulta de tabelas vier vazia (banco
fora do ar) nada é filtrado e o aviso continua saindo — ele nunca fica mudo.

Prova: tests/shell/regras-isolamento-sem-modulo.test.sh, 16 provas em 4 casos
(instalação sem o módulo, tabela existente sem a regra, módulo instalado, banco
fora do ar) — cobre o falso positivo das #1893, #1897 e #1899.

Closes #1893
Refs #1899
Refs #1897
2026-09-29 01:35:22 -03:00

159 lines
8.5 KiB
JSON

{
"name": "deskcomm-crm",
"version": "0.1.0",
"private": true,
"description": "DeskcommCRM — sistema operacional de vendas open source com agentes de IA nativos e WhatsApp (WAHA). Self-hosted, multi-tenant, LGPD by-design.",
"engines": {
"node": ">=22"
},
"scripts": {
"dev": "next dev",
"dev:webpack": "next dev",
"build": "next build",
"build:webpack": "next build",
"start": "next start",
"lint": "eslint .",
"format": "prettier --write \"**/*.{ts,tsx,md,json,css}\"",
"format:check": "prettier --check \"**/*.{ts,tsx,md,json,css}\"",
"typecheck": "tsc --noEmit -p tsconfig.typecheck.json",
"db:migrate": "echo 'TODO: wire supabase db push or pg-migrate' && exit 0",
"db:reset": "supabase db reset",
"test:e2e": "playwright test",
"e2e:build": "bash scripts/e2e-build.sh",
"e2e:env": "bash scripts/gerar-env-e2e.sh",
"test:journeys": "playwright test -c tests/journeys/playwright.config.ts",
"test:unit": "vitest run",
"cercas": "vitest run --project cercas",
"test:db": "bash scripts/test-db.sh",
"test:db:update": "bash scripts/test-update-com-dados.sh",
"test:shell": "bash tests/shell/update-guard.test.sh && bash hostgator-setup-kit/test-validators.sh && bash tests/shell/baseline-reaplica-apos-disputa.test.sh && bash tests/shell/dono-do-projeto.test.sh && bash tests/shell/scheduler-entrypoint.test.sh && bash tests/shell/cron-sem-crontab-previo.test.sh && bash tests/shell/senha-do-cron-vazada.test.sh && bash tests/shell/owner-id-por-email.test.sh && bash tests/shell/deskcomm-contribuir.test.sh && bash tests/shell/colisao-de-migration.test.sh && bash tests/shell/test-db-recusa-sem-vitest.test.sh && bash tests/shell/guard-hooks-atualizados.test.sh && bash tests/shell/hooks-nao-acusam-a-main.test.sh && bash tests/shell/merge-auto-commit-passa-pelos-guards.test.sh && bash tests/shell/env-e2e-porta-do-stack.test.sh && bash tests/shell/instalar-guias.test.sh && bash tests/shell/arquitetura-kit.test.sh && bash tests/shell/guarda-arm-nao-mata-a-recuperacao.test.sh && bash tests/shell/guarda-arm-so-considera-instalacao-real.test.sh && bash tests/shell/extensao-nao-instala.test.sh && bash tests/shell/atualizacao-para-quem-fala-com-o-banco.test.sh && bash tests/shell/desinstalar-docker.test.sh && bash tests/shell/stack-local.test.sh && bash tests/shell/e2e-build-recusa-sem-next.test.sh && bash tests/shell/smoke-llm-recusa-sem-tsx.test.sh && bash tests/shell/waha-backup-volume.test.sh && bash tests/shell/single-server-installer.test.sh && bash tests/shell/single-server-operacao.test.sh && bash tests/shell/ubuntu-production-installer.test.sh && bash tests/shell/atualizacao-de-fora-nao-pula-o-backup.test.sh && bash tests/shell/release-publicada-nao-maior-tag.test.sh && bash tests/shell/regras-isolamento-sem-modulo.test.sh",
"test:invariants": "bash scripts/test-db.sh",
"lint:channels": "tsx scripts/lint-channels.ts",
"lint:role-rank": "tsx scripts/lint-role-rank.ts",
"checar:colisao-de-migration": "bash scripts/checar-colisao-de-migration.sh",
"skills:sync": "tsx scripts/sincronizar-skills.ts",
"release:conferir": "tsx scripts/cortar-release.ts",
"release:cortar": "tsx scripts/cortar-release.ts --escrever",
"release:acervo-cabe": "tsx scripts/acervo-cabe-na-tela.ts",
"gov:verify": "pnpm typecheck && pnpm lint && pnpm lint:channels && pnpm lint:role-rank && pnpm test:unit",
"worker": "tsx --env-file-if-exists=.env --env-file-if-exists=.env.local workers/agent-worker/main.ts",
"local:up": "bash scripts/local-stack.sh up",
"local:down": "bash scripts/local-stack.sh down",
"local:status": "bash scripts/local-stack.sh status",
"local:logs": "bash scripts/local-stack.sh logs",
"dev:crons": "tsx --env-file-if-exists=.env --env-file-if-exists=.env.local scripts/dev-crons.ts",
"flywheel:judge": "tsx --env-file-if-exists=.env --env-file-if-exists=.env.local scripts/flywheel-judge-live.ts"
},
"dependencies": {
"@ai-sdk/anthropic": "^4.0.16",
"@ai-sdk/google": "^4.0.18",
"@ai-sdk/openai": "^4.0.73",
"@emoji-mart/data": "^1.2.1",
"@emoji-mart/react": "^1.1.1",
"@hello-pangea/dnd": "^18.0.1",
"@hookform/resolvers": "^5.9.1",
"@modelcontextprotocol/sdk": "^1.30.1",
"@phosphor-icons/react": "^2.1.10",
"@radix-ui/react-alert-dialog": "^1.1.23",
"@radix-ui/react-avatar": "^1.2.6",
"@radix-ui/react-dialog": "^1.1.23",
"@radix-ui/react-dropdown-menu": "^2.1.24",
"@radix-ui/react-label": "^2.1.15",
"@radix-ui/react-popover": "^1.1.23",
"@radix-ui/react-scroll-area": "^1.2.18",
"@radix-ui/react-select": "^2.3.7",
"@radix-ui/react-separator": "^1.1.15",
"@radix-ui/react-slot": "^1.3.3",
"@radix-ui/react-switch": "^1.3.7",
"@radix-ui/react-tabs": "^1.1.21",
"@radix-ui/react-tooltip": "^1.2.16",
"@react-pdf/renderer": "^4.9.0",
"@sentry/nextjs": "^11",
"@supabase/ssr": "^0.12.7",
"@supabase/supabase-js": "^2.117.1",
"@tanstack/react-query": "^5.103.2",
"@tanstack/react-query-devtools": "^5.103.2",
"@tanstack/react-virtual": "^3.14.13",
"@upstash/redis": "^1.39.0",
"@xyflow/react": "^12.11.6",
"ai": "^7.0.112",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.1",
"date-fns": "^4.4.0",
"fflate": "^0.8.3",
"gpt-tokenizer": "^4.0.0",
"import-in-the-middle": "^3.5.1",
"ipaddr.js": "^2.5.0",
"jsonc-parser": "^3.3.1",
"lucide-react": "^1.47.0",
"next": "^16.3.6",
"next-themes": "^0.4.6",
"nodemailer": "10.0.10",
"pdfjs-dist": "^6.3.289",
"pg": "^8.23.0",
"qrcode": "^1.5.4",
"react": "^19.3.0",
"react-dom": "^19.3.0",
"react-hook-form": "^7.88.0",
"react-hotkeys-hook": "^5.3.3",
"recharts": "^3.10.1",
"require-in-the-middle": "^8.0.1",
"resend": "^6.28.1",
"sonner": "^2.0.8",
"tailwind-merge": "^3.7.0",
"web-push": "^3.6.7",
"ws": "^8.21.3",
"zod": "^4.6.5"
},
"devDependencies": {
"@axe-core/playwright": "^4.13.0",
"@playwright/test": "^1.63.0",
"@tailwindcss/postcss": "^4",
"@testing-library/jest-dom": "^7.0.1",
"@testing-library/react": "^16.3.3",
"@testing-library/user-event": "^14.6.7",
"@types/jest": "^29.5.13",
"@types/jsdom": "^30.0.0",
"@types/node": "^22.20.4",
"@types/nodemailer": "^8.0.1",
"@types/pg": "^8.23.1",
"@types/qrcode": "^1.5.6",
"@types/react": "^19.3.0",
"@types/react-dom": "^19.3.0",
"@types/web-push": "^3.6.4",
"@types/ws": "^8.18.1",
"@vitest/coverage-v8": "^4.1.11",
"eslint": "^10.11.0",
"eslint-config-next": "^16.2.10",
"jsdom": "30.0.1",
"postcss": "^8.5.28",
"prettier": "^3.9.9",
"prettier-plugin-tailwindcss": "^0.8.1",
"tailwindcss": "^4.3.3",
"tsx": "^4.23.15",
"typescript": "^6.0.3",
"typescript-eslint": "^8.70.1",
"vite": "^8.3.0",
"vitest": "^4.1.11"
},
"packageManager": "pnpm@9.15.9",
"//jsdom": "Fixado em 30.0.1 de propósito (sem ^). O jsdom 30.1 guarda a implementação do Blob num campo privado (#impl), e o ambiente jsdom do vitest (makeCompatBlob) lê o Blob pela 1ª símbolo da instância: com 30.1.x, URL.createObjectURL(file) e FormData/Request com File lançam `Cannot read properties of undefined (reading '_buffer')` — 4 casos da suíte (composer-attach x2, composer-colar-imagem, upload-templates-media-security). Upstream: vitest-dev/vitest#11336, aberta e sem conserto em nenhuma release (5.0.2 ainda quebra). Tire o pin quando o vitest instalado trouxer o conserto; o sinal é esses 4 casos verdes com jsdom 30.1+. Rastreio: melgarafael/DeskcommCRM#1745.",
"pnpm": {
"//overrides": "Pisos de versão para dependência TRANSITIVA com advisory. Não é atalho: `pnpm update <pkg>` só casa o padrão contra o package.json (hono/js-yaml/nanoid não estão lá, e não se movem), e `pnpm update` sem alvo reescreve 29 ranges diretas e arrasta 139 pacotes. Override é a única ferramenta que move transitiva sem arrastar o mundo. Os seletores com `@<major>` são LOAD-BEARING: o lock tem duas árvores de brace-expansion (1.x e 5.x) e duas de path-to-regexp (6.x e 8.x); sem o escopo, o override rebaixa a árvore nova para a antiga — em silêncio, com `pnpm audit` ainda verde.",
"overrides": {
"postcss": "^8.5.28",
"sharp": "^0.35.0",
"hono": "^4.13.5",
"js-yaml": "^4.3.2",
"brace-expansion@1": "^1.1.18",
"path-to-regexp@6": "^6.3.0",
"fast-uri": "^3.1.7",
"qs": "^6.16.0",
"browserslist": "^4.28.8"
},
"patchedDependencies": {
"@react-pdf/hyphenate": "patches/@react-pdf__hyphenate.patch"
}
}
}