Skip to content

Kilo Tracker 1.2.0

Choose a tag to compare

@ramondevries ramondevries released this 17 Oct 23:02
· 72 commits to main since this release

The public chart gets a look of its own, a few fixes, a native-speaker review of the Finnish translation, and a much larger test suite.

New

  • The public chart keeps its own theme and range. In Settings → Public chart, the "Dark mode" switch and the "Chart range" menu are now saved with the page's other settings. Before, they only rewrote the link. Without ?theme= or ?range= in its address, the public page uses these saved settings, so switching your own dark mode no longer changes how your public chart looks. The link and the embed code always include ?theme=light or ?theme=dark, plus &range=… when a range is chosen. An address that already has them still takes precedence, so existing embeds keep working. After the upgrade, every existing public chart starts with its owner's current dark mode, so none changes how it looks.

Fixes

  • The public chart's link on the settings page now wraps onto the next line, instead of running past the edge of the card.
  • Saving a weight, switching dark mode and choosing a chart range no longer give a server error (500) when the request is malformed: a JSON body that isn't an object, or a date or range that isn't text. They now answer "Invalid request.", "Invalid date." or "Invalid range." and change nothing. Only a signed-in user with a valid form token could send such a request.
  • A weight sent as a JSON number is now checked the same way as typed text. true, NaN, Infinity and negative numbers are refused; true used to be saved as 1 kg. The dashboard always sends text, so this only affects other clients.

Translations

  • Finnish was reviewed by a native speaker, @camille-neonilla (#16). Thank you!
  • One new message, "Invalid request.", is machine-translated into all 14 languages. In Finnish, that one entry is marked for review again.

Development

  • Browser tests. The dashboard and the public chart are now tested in a real Chromium with Playwright, in tests/e2e/. The tests cover saving a day, the question about an unusual weight, Undo, the note editor, the "today" prompt, the range buttons, dark mode and the session-expired dialog. They fail on any JavaScript error or Content-Security-Policy violation. They are optional (requirements-e2e.txt, then pytest -m e2e) and run in a CI job of their own.
  • Coverage in CI. coverage is now in requirements-dev.txt. CI reports branch coverage (97 %) and fails below 95 %.
  • A faster, broader test suite. It runs in about 80 seconds instead of three minutes, because the tests hash sign-in codes cheaply while production keeps scrypt. New tests check that every page except the public ones needs a sign-in, along with the chart calculations, the database query counts and many error paths.
  • Less duplicated code. A code-duplication audit and a complexity audit led to shared helpers: the emailed codes in one module (app/codes.py), shared form templates, and common import and height functions. Nothing visible changes.

Upgrading

Make a backup of the database first. On the first start, two new migrations run automatically:

  • 0002 adds the public chart's theme, copied from each user's current dark mode;
  • 0003 adds its saved range.

Then, after git pull:

  1. pip install -U -r requirements.txt (the requirements haven't changed since 1.1.4);
  2. pybabel compile -d translations (there is a new message);
  3. restart the app.

Afterwards, the About page shows v1.2.0, and SELECT * FROM alembic_version gives 0003.

Full changelog: v1.1.4...v1.2.0