Repository navigation
fix(service-rate): resolve parcel box images after production fingerprinting - #370
Merged
Merged
Conversation
…rinting
Production console builds fingerprint .png files, so boxes/small.png ships
as boxes/small-<hash>.png. broccoli-asset-rev rewrites literal asset URLs to
the hashed names, but it cannot rewrite the interpolated
/engines-dist/images/boxes/{{parcelFee.size}}.png, so the request misses and
the server answers with index.html.
Add a parcel-box-image helper that maps each size to a literal URL the
fingerprinter can rewrite, and use it in the service rate form and details.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #370 +/- ##
===========================================
Coverage 100.00% 100.00%
Complexity 12379 12379
===========================================
Files 600 600
Lines 46496 46496
===========================================
Hits 46496 46496
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
In the published console (
fleetbase/fleetbase-console:v0.7.68), the parcel fee section of the service rate form and details panel shows broken images./engines-dist/images/boxes/small.pngreturns the console'sindex.html(HTTP 200,text/html).Cause
The asset path itself is correct. Because the engine is lazy, ember-engines moves its public tree under
engines-dist/, andmergeWithPublicTreeputsassets/at the root of that tree, so the boxes really do land inengines-dist/images/boxes/.The problem is fingerprinting. The console's production build runs broccoli-asset-rev, which fingerprints
png,jpg,gif,js,cssandmapby default. The v0.7.68 image ships:broccoli-asset-rev rewrites asset URLs that appear as literal strings in JS, CSS and HTML. It can't rewrite
/engines-dist/images/boxes/{{parcelFee.size}}.pngbecause the file name is only built at runtime. The shippedengine.jsstill contains the bare/engines-dist/images/boxes/prefix, so the request misses and nginx's SPA fallback servesindex.html.Fix
A new
parcel-box-imagehelper maps each size to a literal URL, so the fingerprinter rewrites each one to its hashed name. Unknown sizes fall back to the medium box. Bothservice-rate/form.hbsandservice-rate/details.hbsuse it.Other
/engines-dist/images/...referencesI checked these against the shipped v0.7.68
engine.jsandengine.css. None needs a change:map-marker.png(widget/live-fleet.hbs)map-marker-bfdcdde0….pngbuilding-marker.png(several)building-marker-aa16d468….pngdrawing-controls-spritesheet-inverted.png(fleetops-engine.css)url(), rewritten to its hashed namedrawing-controls-spritesheet.svg(fleetops-engine.css)svgisn't fingerprinted, served as istelematics/providers/default.webp(resource-descriptors/connectivity.js)webpisn't fingerprinted, served as isUnrelated, but found during the audit:
map/google-live-map.jsfalls back to/engines-dist/images/driver-marker.pngand/engines-dist/images/vehicle-marker.png. Neither file exists in this package or in the published image, so those fallbacks are broken in every build. This PR leaves them alone.Testing
I didn't run a local build. CI covers the new integration test (
tests/integration/helpers/parcel-box-image-test.js). The fingerprint rewrite only happens in a production console build, so the end-to-end check is a showcase capture without thecapture/fixtures/boxesoverride.