Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

generate-fixtures: write byte-identical assets once in the default assets/ output

Open
#469 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
48/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
php, symfony
Domain
tooling

Research direction

Start with StoredFileExporter, which writes the assets/ files that generate-fixtures emits, and check how it names files today. Read UploadableFileManager::persistFiles() to confirm it only reads the source through a stream. Run GenerateFixturesCommandTest and generate_fixtures_round_trip.feature to see the current output. Done means identical content is written once under a sha256-keyed name, name clashes with different content still get -2, -3, and the round trip regenerates byte for byte.

Written by the indexing model from the issue text.

Description

generate-fixtures writes one file under assets/ per uploadable field, even when the stored files are byte-identical. On bcio (2.0.0-alpha.22), 76 exported assets (4.8 MB) hold only 20 distinct contents (1.0 MB). One SVG is written 20 times, as phppopacd.svg, phppopacd-2.svg and so on. The stored files really are separate uploads of the same image.

The content-hash store from #462 / #466 already writes each distinct content once, but it is opt-in. The default assets/ output should do the same:

  • StoredFileExporter keys what it has written by the content's sha256. Content it has already written returns the existing name, so every new File(__DIR__ . '/assets/…') for that content points at one file.
  • A name clash with different content still gets -2, -3…
  • The first file in site-map order names the shared asset, so a reload stores the later resources under that slug. Regenerating after the reload gives the same file, so it is still a fixed point.
  • Sharing is safe on load: UploadableFileManager::persistFiles() reads the source through a stream and never moves it.

Proposed tests:

  • GenerateFixturesCommandTest: two resources with identical bytes under different stored names give one asset and two new File() lines naming it. Different bytes under one name still give -2.
  • Round trip (generate_fixtures_round_trip.feature): a site with two identical uploads reloads with both files present and regenerates byte for byte.

Reported by the bcio session. This would save 79% of bcio's assets, and probably a good share of Cymru Kitchens' 275 MB.

Dominant language
PHP
Stars
32
Forks
8
Avg merge
40m
Merged PRs (30d)
133

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from components-web-app/api-components-bundle

All issues in components-web-app/api-components-bundle

Similar issues

More PHP issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.