Hacktoberfest 2026: as issues que os mantenedores marcaram para outubro, abertas e boas para iniciantes. Ver issues do Hacktoberfest

Overlay-base cache restore misses on cache backends that only prefix-match restoreKeys

Aberta Para iniciantes
#4,202 0 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
1/5
Tempo estimado
Menos de uma hora
Facilidade para iniciantes
90/100
Tipo de issue
Bug
Clareza
Claramente especificada
Status de atividade
Ativa
Stack de tecnologia
typescript
Domínio
ci-cd

Direção de pesquisa

Comece em src/overlay/caching.ts, por volta das linhas 290–302, onde downloadOverlayBaseDatabaseFromCache chama actionsCache.restoreCache passando o prefixo da chave como único argumento; compare com o caminho de upload logo acima, que grava codeql-overlay-base-database-<hash>-<sha>-<run_id>. A correção consiste em passar o mesmo prefixo como terceiro argumento (restoreKeys). Em seguida, execute os testes existentes de cache de overlays na suíte TypeScript para confirmar que não há regressões no comportamento atual do cache do GitHub. O trabalho estará concluído quando execuções de PR em backends que aceitam apenas prefixos puderem restaurar o cache e o comportamento em runners hospedados pelo GitHub continuar igual ao de hoje.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

Summary

downloadOverlayBaseDatabaseFromCache restores the overlay-base database by passing the key prefix as the primary key, with no restoreKeys:

https://github.com/github/codeql-action/blob/d208ec71e39ae46397cbf6569bef8439b9aab974/src/overlay/caching.ts#L290-L302

actionsCache.restoreCache(
  [dbLocation],
  cacheRestoreKeyPrefix,
  undefined,
  { segmentTimeoutInMs: 3000 },
)

This depends on the primary key matching by prefix. GitHub's cache service does that, but some Actions-cache-compatible backends only prefix-match restoreKeys. One example is the transparent cache on Blacksmith runners. On those backends, PR runs can never restore the overlay-base database, even though default-branch runs upload it successfully. Every PR run then falls back to a full analysis.

What we see

Default-branch run, on the same runner type:

Setting overlay database mode to overlay-base with caching because we are analyzing the default branch.
Uploading overlay-base database to Actions cache with key codeql-overlay-base-database-1-<hash>-python-2.27.1-<sha>-<run_id>-1
Successfully uploaded overlay-base database from /home/runner/_work/_temp/codeql_databases

Pull request run:

Setting overlay database mode to overlay with caching because we are analyzing a pull request.
Looking in Actions cache for overlay-base database with restore key codeql-overlay-base-database-1-<hash>-python-2.27.1-
No overlay-base database found in Actions cache
No overlay-base database found in cache, reverting overlay database mode to none.
Minimal reproduction of the backend difference

A cache entry saved as probe-<run_id>-full, then restored in a later job on the same branch with actions/cache/restore@v4:

Restore GitHub-hosted runner Blacksmith runner
key: probe-<run_id>- (prefix as the primary key, like this action) hit miss
key: probe-<run_id>-nomatch, restore-keys: probe-<run_id>- hit hit
Suggested fix

Also pass the prefix as a restore key:

actionsCache.restoreCache(
  [dbLocation],
  cacheRestoreKeyPrefix,
  [cacheRestoreKeyPrefix],
  { segmentTimeoutInMs: 3000 },
)

On GitHub's cache this matches exactly the same entries as today, since the prefix is tried first either way. On backends that only prefix-match restore keys, overlay analysis starts working.

Environment
  • github/codeql-action/init and analyze @v4, CodeQL bundle 2.27.1
  • build-mode: none, languages python and javascript-typescript
  • Third-party hosted runners (Blacksmith) whose actions/cache calls go to their own cache backend
Linguagem predominante
TypeScript
Estrelas
1.7k
Forks
494
Merge médio
1d 10h
PRs com merge (30d)
52

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de github/codeql-action

Todas as issues de github/codeql-action

Issues semelhantes

Mais issues de TypeScript

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.