generate-fixtures: configurable asset store (local folder or Flysystem) with a content-hash manifest and pruning
Mantenedores costumam responder em até 1 dia
Um pull request relacionado já foi integrado.
- #466 de @silverbackdan — integrado
Avaliação
- Dificuldade
- 5/5
- Tempo estimado
- Mais de uma semana
- Facilidade para iniciantes
- 10/100
Direção de pesquisa
Start with the generator behind generate-fixtures and the scaffold that loads files with new File(__DIR__ . '/assets/<name>'), then the bundle config under silverback_api_components.fixtures.assets. Pull request #466 is already open against this issue, so check its state before starting. Done means a settled design for the manifest, the store abstraction, and pruning, which needs maintainer agreement first.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
generate-fixtures writes every stored file next to the scaffold (assets/), and the scaffold loads each one with new File(__DIR__ . '/assets/<name>'). For a real site that becomes a lot of binary in the repo.
Cymru Kitchens is the example: 710 images, 275 MB.
- Committed: it more than doubles the git history permanently, and
api/srcis copied into the php image. - Excluded from the image:
.dockerignorebreaks a fixture load in a pod. - Git LFS: works, but it is a git-host choice the bundle shouldn't depend on.
The memory side of loading real-size snapshots is #460.
Proposal
1. The scaffold refers to files by content
- The generator writes a manifest alongside the class, with one entry per file: sha256, size, mime type, original name, and the uploadable field it came from.
- The class refers to a file by its hash, never a path.
- Files are stored under content-hash names. An unchanged image keeps its name across regenerations, so diffs only show real changes, and a file used twice is stored once.
2. The location is bundle config, read by both generate and load
silverback_api_components:
fixtures:
assets:
store: local # local | flysystem
path: '%kernel.project_dir%/fixtures/assets' # local
adapter: gcloud # flysystem: one of the app's adapters
prefix: fixtures/ # flysystem
generate-fixtureswrites the files to the configured store and writes the manifest.doctrine:fixtures:loadresolves each hash through the same store.- The class doesn't say where files live, so the same scaffold can load from a local folder for a developer and from a bucket in CI or a review app (
storefrom an env var). - Command options override the config for one-off runs (
--assets-store,--assets-dir). - Generating needs write access to the store, and loading needs read access. A Flysystem store reuses the app's existing adapters.
- Default: a folder next to the scaffold, as today. Small sites and existing scaffolds keep working, and small sites can still just commit their assets.
3. Pruning follows the manifest
- Local folder: generating rewrites the manifest and deletes any file in the folder it no longer references, so the folder always matches the class.
- Flysystem: a command such as
fixtures:prune-assetsdeletes objects under the prefix that no kept manifest references. "Kept" means the current manifest plus any listed (or recent) ones, so a branch still on an older snapshot can load. Hash names make this safe: an object is either referenced or it isn't. - Pruning git history is out of scope. Using a Flysystem store keeps large files out of history in the first place.
4. Optional size cap for development (--max-dimension)
- Downscale images on export, e.g. to 2400 px, the widest variant, so nothing visible changes. This would cut a site like CK's assets a lot.
- Off by default, because the default should stay byte-identical to production. The fixed-point check (generate, load, generate again: byte-identical) holds with it off.
Use on Cymru Kitchens
A Flysystem store pointed at a fixtures/ prefix in the existing media bucket, the manifest in git, and nothing large in the repo or the image. CK's snapshot is generated and verified, and it's waiting on this and #460.
- Linguagem predominante
- PHP
- Estrelas
- 32
- Forks
- 8
- Merge médio
- 58min
- PRs com merge (30d)
- 147
Preparar o ambiente
Este projeto não oferece contêiner de desenvolvimento, Dockerfile nem guia de contribuição, então a configuração fica por sua conta: comece pelo README e veja nosso guia da primeira contribuição para os passos gerais.
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de components-web-app/api-components-bundle
-
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 30/100
components-web-app/api-components-bundle#333 · 3 comentários ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 48/100
components-web-app/api-components-bundle#325 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 52/100
components-web-app/api-components-bundle#259 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 48/100
components-web-app/api-components-bundle#186 ·
Mantenedores costumam responder em até 1 dia
Todas as issues de components-web-app/api-components-bundle
Issues semelhantes
-
needs triage
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
-
loginWithCustomTokenExchange() fails when an organization is configuredTalvez já em andamento @awss1i assumiu hoje. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 65/100
auth0/auth0-PHP#883 · 1 comentário ·
Mantenedores costumam responder em até 2 dias
-
type/bug
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 75/100
flarum/framework#5231 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
major-release
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 67/100
Intervention/image#1553 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
omegaup/omegaup#10353 · 1 comentário ·
Mantenedores costumam responder em até 5 dias