Pictures: avatar and logo tiles load eagerly with no size, and their stamped addresses are cached for only a day #1158
Labels
No labels
accessibility
authentication
breaking change
bug
documentation
enhancement
interface
internationalisation
observability
performance
security
tier
1
tier
2
tier
3
tier/4
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Postulo/postulo#1158
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What exists today
core/templatetags/postulo.py:289-318_tile()draws a picture as<span class="avatar ..."><img src="..." alt=""></span>: noloading="lazy", nodecoding="async", unlike the flag tags in the same file (lines 197-240). It is used by{% avatar %}(354-368) and{% company_logo %}(371-387), which appear on every board card (applications/partials/application_card.html:40), in company and application tables, and in the masthead.The addresses are stamped:
avatar_url()(336-342) adds?v=<profile.updated_at>andlogo_url()(345-350)?v=<company.logo_fetched_at>, so a new picture is a new address. Yet both views answerCache-Control: private, max-age=86400(accounts/views.py:388,jobs/views.py:1493), so after a day each one is asked for again. The ledger said "versioned logos cached only a day"; that holds for avatars too.What would change
_tile()addsloading="lazy" decoding="async"to its<img>, andwidth/heightmatching the box is not needed because the box is sized by its classes. The masthead's own avatar is above the fold and is fetched at once either way (lazy images in view load immediately).private, max-age=31536000, immutablewhen the request carries avequal to the current stamp, and keep today's day-long answer otherwise (a request with no or an old stamp).logo_url's stamp has one-second resolution andjobs/merging.py:641copies another company's stamp onto the kept one; neither lets an old picture be served under a new address, but a test should pin that a changed logo changes the address.What it saves or protects
small: long tables and boards of companies stop fetching off-screen logos on load, and a returning browser stops revalidating every logo and avatar once a day
Accessibility
none: the tiles are decorative (
alt="", beside the name); the layout must not shift, which the tile's fixed size classes already ensure.tests/test_avatars.pyandtests/test_logos.pycover the markup and the responsesDecided by the maintainer (2026-10-31)
stamped avatars and logos: private, max-age one year; loading=lazy and decoding=async on tiles
Decisions
no-storeon pages, #787, is about pages, not these).Found by the efficiency and reliability audit of 2026-10-30 (finding A15; index postulo/postulo#1108). Checked against
mainatdaee30b15(2026-10-30).