Repository navigation
fix(google-search): bloqueia temas eleitorais antes da busca [CHATR-294] - #190
Merged
Merged
Conversation
Em 09/10/2026 o chatbot informou o número eleitoral de um candidato à Presidência e disse não encontrar o do outro. A diferença veio do ranking do Google, não de regra, e nenhuma camada barrava o tema. - Filtro determinístico no topo de get_google_search, antes do Typesense e do Gemini. Strategy: AllowAll, Blacklist, Whitelist e Composite; a whitelist (regex) decide o que entra e a blacklist sempre pode vetar. - Blacklist por palavra inteira sobre texto normalizado (sem acento, caixa, pontuação e caracteres invisíveis): candidatos do 2º turno (TSE) e termos eleitorais, em query_filter.yaml versionado. - Query barrada recebe texto fixo, igual para qualquer candidato, como sucesso (não isError). Motivo e termo vão para span, BigQuery e log. - Dataset rotulado de 260 queries e runner offline/MCP em src/tests/e2e/filtro_query; decisões em docs/decisions/CHATR-294-filtro-eleitoral.md. - pyyaml declarada explicitamente (já vinha transitiva, sem CVE). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
🚦 PR Quality Gate Summary
📊 Coverage
✅ All quality checks passed |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Filtro de temas eleitorais na busca do MCP
O que foi feito
get_google_search, antes do Typesense e do Gemini.query_filter.yaml.isError.search.filter.*no span, linha comsource=query_filterno BigQuery e log por bloqueio.src/tests/e2e/filtro_query/: 260/260.docs/decisions/CHATR-294-filtro-eleitoral.md.Motivo
Impacto
google_search.web_search_surkaiedharma_search_toolestão desligadas em produção (EXCLUDED_TOOLS).pyyaml6.0.3, sem CVE. O bump das transitivas com CVE herdadas damainvai em PR próprio.Enquanto a whitelist não for entregue
Antes do deploy em produção
🤖 Generated with Claude Code