Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

generate-fixtures: configurable asset store (local folder or Flysystem) with a content-hash manifest and pruning

クローズ
#462 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

関連するプルリクエストがすでにマージされています。

  • #466 @silverbackdan による — マージ済み

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
10/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
活発
技術スタック
docker, php, symfony
領域
backend

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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/src is copied into the php image.
  • Excluded from the image: .dockerignore breaks 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-fixtures writes the files to the configured store and writes the manifest. doctrine:fixtures:load resolves 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 (store from 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-assets deletes 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.

主要言語
PHP
スター
32
フォーク
8
平均マージ
1時間 1分
マージ済み PR(30日)
193

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

components-web-app/api-components-bundle のほかの issue

components-web-app/api-components-bundle の issue をすべて見る

似ている issue

PHP の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。