Repository navigation
fix(ci): guard de teclado do AiPanel independente de CRLF - #4
Merged
Merged
Conversation
O job windows-latest falhava em 'AI SQL runs only from one click handler'. O teste recortava o corpo de onKeyDown procurando a string literal '\n }\n', que nunca casa com checkout CRLF (core.autocrlf=true no runner). O indexOf retornava -1, o slice(keyStart, -1) devolvia o resto do arquivo e o assert encontrava o runApproved() de outro trecho. - read() normaliza CRLF para LF antes das guardas de texto-fonte - a extracao do handler valida o delimitador em vez de fatiar ate o EOF - .gitattributes fixa eol=lf, deixando Linux e Windows com a mesma arvore Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
HyperTechDevelopment
deleted the
hypertechdevelopment-scaling-parakeet
branch
November 3, 2026 11:49
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.
Problema
Os jobs
CI / verify (windows-latest, 22)eCI / verify (windows-latest, 24)falhavam, enquantoubuntu-latestpassava.Causa raiz
O teste
scripts/ai-safety.test.mjsrecortava o corpo deonKeyDown()com uma busca por string literal em LF:No Windows o checkout é CRLF (
core.autocrlf=trueno runner e o repositório não tinha.gitattributes). O arquivo real contém\r\n }\r\n, então:indexOf('\n }\n')retornava-1;slice(keyStart, -1)descartava o último caractere, não o terminador — devolvia o restante do arquivo (25.788 caracteres em vez de 975);runApproved(...)de outro ponto do componente, e a guarda "no keyboard shortcut runs AI SQL" falhava sem que houvesse qualquer regressão de segurança.Era uma falha de portabilidade do teste, não do código de produção.
Correção
read()normaliza CRLF → LF antes das guardas de texto-fonte, tornando a suíte independente de plataforma e de configuração do git.assert.ok(keyEnd > keyStart)) em vez de fatiar silenciosamente até o EOF..gitattributesfixaeol=lf(e marca binários / CRLF para scripts Windows), para que Linux e Windows rendam a mesma árvore.Verificação
Suíte completa do CI executada localmente no Windows (checkout CRLF), com a mesma ordem do workflow:
typechecktest:safetytest:securitytest:firebirdtest:firebird-catalogtest:serial-queuetest:multi-dbtest:ai-datatest:read-onlyai-safetybuildTeste de mutação: injetar um
runApproved()dentro deonKeyDowncontinua sendo detectado pela guarda — o teste segue protegendo o comportamento, agora de forma multiplataforma.