Skip to content

[FEAT] - PDF, UX, Docker and CI - #4

Merged
buguno merged 63 commits into
masterfrom
feat/pdf-ux-docker-ci
Nov 26, 2026
Merged

buguno merged 63 commits into
masterfrom
feat/pdf-ux-docker-ci

Conversation

@buguno

@buguno buguno commented Nov 26, 2026

Copy link
Copy Markdown
Owner

Summary

Adds direct PDF downloads, a round of UI/UX and accessibility fixes checked against measured contrast, a hardened container image, and the CI/CD around it: tests on pull requests, a multi-architecture image published to ghcr.io, and automated versions and changelog.

Features

  • PDF downloads. The shopping list (/shopping/pdf/) and a kit's checklist (/kits/<id>/pdf/) download as A4 PDFs with a box to tick on each line, a total, long names cut with an ellipsis, and the table header repeated on every page. The writer (apps/core/pdf.py) uses no library: standard Helvetica (not embedded, widths in pdf_metrics.py) and Windows-1252 text. It adds no dependency and no RAM, which matters on a Raspberry Pi, but it only does simple tables. This replaces the print buttons.

UI/UX and accessibility

Reviewed against the ui-ux-pro-max skill, with contrast measured instead of guessed.

  • Contrast. Muted text was 2.85:1 in the light theme and 4.06:1 in the dark one; white on emerald-600 buttons was 3.77:1. All text is now at least 4.5:1: stone-500 is darkened, muted text is text-stone-500 dark:text-stone-400, and filled buttons are emerald-700.
  • Keyboard and screen readers. Skip link and <main id="main"> on every page; the active menu link has aria-current="page"; table headers are <th scope="col">; decorative bars, rings, the donut and the heat map are aria-hidden (their numbers are text next to them); error messages are announced as alerts. A global focus ring keeps the focused control clear of the sticky top bar.
  • Mobile drawer. It is inert while closed, so Tab never lands on invisible links; the menu button keeps aria-expanded and focus returns to it on close.
  • Forms. Required marker, help text and error ids, aria-invalid and aria-describedby (set by StyledFormMixin), and an error summary with links when more than one field fails. Login and setup now show the error of each field. The forms on the item page shared ids (id_quantity repeated); each now has its own prefix.
  • Touch and motion. 44 px targets on small screens; prefers-reduced-motion is respected; forms disable their submit button after sending (htmx forms use hx-disabled-elt), so a stock entry cannot be made twice.

Container image

  • Runs as an unprivileged system user (uid and gid 10001: no home, no shell, no password), not uid 1000.
  • The code belongs to root and is read-only for the app user; the app only writes to /tmp and /dev/shm, so it runs with --read-only --tmpfs /tmp, with --cap-drop ALL, and with an arbitrary uid.
  • The health check follows GUNICORN_BIND. OCI labels added. docs/ and .claude/ stay out of the image.
  • New DOCKER.md, a registry-style page: Compose and docker run examples, every environment variable, tags, ports, permissions, Raspberry Pi notes and upgrading. The Compose example was run as written.
  • Checked locally (arm64): uid 10001, read-only code, Django starts with a read-only filesystem and uid 4242, GnuPG backups round-trip in both cases, and the container reaches healthy, migrates and serves the setup page and static files.

CI/CD

Workflow Runs on What it does
tests.yaml called by the others, or by hand Lint, Tailwind freshness check and the test suite. One definition; Python and Tailwind versions live in its env: block.
pull-request.yaml pull requests into master Only the tests. Nothing is built or published.
publish.yaml push to master, v* tags, by hand Tests again, then builds the image, smoke-tests it and publishes linux/amd64 + linux/arm64 to ghcr.io.
release.yaml push to master release-please keeps a release pull request with the next version (in pyproject.toml) and the changelog; merging it tags vX.Y.Z and starts publish.yaml for the tag.
  • Tags published: edge and sha-<commit> from master; X.Y.Z, X.Y and latest from a release. Pre-releases get only their own tag.
  • Publishing is switched by the repository variable PUBLISH_IMAGE (already set to true on buguno/vault). Without it, for example on a fork, the image is built and smoke-tested but not pushed, and the run shows a notice.
  • No GitHub secrets are used: CI values are throwaway literals and the only credential is the built-in GITHUB_TOKEN.
  • Dependabot now also updates GitHub Actions and the Docker base image.
  • master is protected by a repository ruleset (no deletion, no force push, merge only through a pull request with the check tests / 🧪 Lint and tests passing). The release pull request is opened with the built-in token, which GitHub does not test, so release.yaml runs pull-request.yaml (now also runnable by hand) on its branch to report that check.
  • The commit type drives the version (feat is minor, fix is patch, ! is major), so it is documented in CLAUDE.md and the README.

Setup needed on GitHub

  1. Settings, Actions, General, Workflow permissions: tick Allow GitHub Actions to create and approve pull requests, or release-please cannot open its pull request.
  2. After the first image is published, open the package (profile, Packages, vault) and change its visibility to Public. Confirm that the repository has write access under Manage Actions access.
  3. Already done (ruleset master protection, no bypass): master cannot be deleted or force-pushed, and changes only arrive through a pull request whose check tests / 🧪 Lint and tests passed. That name must stay in sync with tests.yaml and the caller job in pull-request.yaml.

Other changes

  • .claude/ (the skills folder) is excluded from ruff and from the image, and is not part of this pull request.
  • .editorconfig: two-space indentation for HTML and CSS, matching the templates.
  • Translations for the new texts; the compiled catalog is committed.
  • README and CLAUDE.md document all of the above.

Tests

  • 620 tests, 100% coverage (statements and branches), stable across random orders.
  • New: the PDF writer (structure, offsets table, encoding, escaping, pagination, totals, truncation), the shopping and kit PDFs, and a suite for the accessibility rules, including one that fails if the menu links lose their layout classes.
  • ruff is clean and poetry css-check is up to date.

Review notes

  • The workflows have not run on GitHub yet; their YAML is valid and each step was run by hand locally. The first pull request exercises tests.yaml; publish.yaml and release.yaml only run after the merge.
  • The release pull request is opened with the built-in token, so GitHub does not run the pull-request tests on it; release.yaml dispatches them on its branch. This is the least tested part: if the check does not show up on the release pull request, run gh workflow run pull-request.yaml --ref release-please--branches--master once and open an issue.
  • The first changelog will list the whole history, since there is no previous tag. .release-please-manifest.json starts at 1.0.0, so the first release computes 1.1.0.
  • PDFs support Windows-1252 text only (Portuguese and English); other characters print as ?.

@buguno buguno self-assigned this Nov 26, 2026
@buguno buguno added documentation Improvements or additions to documentation enhancement New feature or request labels Nov 26, 2026
@buguno
buguno merged commit eb33023 into master Nov 26, 2026
2 checks passed
@buguno
buguno deleted the feat/pdf-ux-docker-ci branch November 26, 2026 02:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant