generate-fixtures: write byte-identical assets once in the default assets/ output
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 48/100
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:
StoredFileExporterkeys what it has written by the content's sha256. Content it has already written returns the existing name, so everynew 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 twonew 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
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from components-web-app/api-components-bundle
-
Codecov project status fails before the Behat coverage upload landsPossibly taken @silverbackdan claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 20/100
components-web-app/api-components-bundle#472 ·
Maintainers usually reply within 1 day
-
Fixture builder: accept a PageBuilder or PageDataBuilder as the target of linkRoute(), linkIri() and redirect(to:)Possibly taken @silverbackdan claimed this today. Open
Difficulty 4/5 3-5 days Newbie friendliness 15/100
components-web-app/api-components-bundle#471 ·
Maintainers usually reply within 1 day
-
Component groups: a maximum number of components (e.g. exactly one CTA)Possibly taken @silverbackdan claimed this today. Open
Difficulty 4/5 3-5 days Newbie friendliness 20/100
components-web-app/api-components-bundle#464 · 1 comment ·
Maintainers usually reply within 1 day
-
generate-fixtures: configurable asset store (local folder or Flysystem) with a content-hash manifest and pruningPossibly taken @silverbackdan claimed this 1 day ago. Open
Difficulty 5/5 Over a week Newbie friendliness 10/100
components-web-app/api-components-bundle#462 · 1 comment ·
Maintainers usually reply within 1 day
-
generate-fixtures drops a redirect on a route that also has a pagePossibly taken @silverbackdan claimed this today. Open
Difficulty 4/5 3-5 days Newbie friendliness 25/100
components-web-app/api-components-bundle#461 ·
Maintainers usually reply within 1 day
All issues in components-web-app/api-components-bundle
Similar issues
-
major-release
Difficulty 1/5 Under an hour Newbie friendliness 67/100
Intervention/image#1553 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
omegaup/omegaup#10353 · 1 comment ·
Maintainers usually reply within 5 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 61/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
effort: low graphiql ide impact: low scope: code quality type: chore
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
wp-graphql/wp-graphql#4486 ·
Maintainers usually reply within 1 day