#366 · Duration backgrounds with addresses up to 1,024 characters show
- timeline-app
- pull request
Fixes #365 A duration's background was silently missing when its address was longer than 256 characters: viewport bands (`durationOverview`) kept only strings that short. ## Changes - **Overview.** `durationOverview` keeps `http://` / `https://` strings of up to 1,024 characters (`OVERVIEW_URL_LIMIT`), still within the 4,096-character budget. Other strings keep the 256 limit. `BACKGROUND_URL_LIMIT` is now 1,024, and the duration dialog's note says "1,024". The desktop store's band projection (`BAND_COLUMNS` in `native-store/src/lib.rs`) applies the same rule. PostgreSQL doesn't derive bands itself: the server builds them with `durationOverview` (`avl.mjs`). - **Existing data.** `rebuildLongBackgrounds` (`server/store.mjs`) runs in `migrate.mjs` after `rebuildIndexes`. It finds timelines whose stored duration definitions have a web address of 257 to 1,024 characters, plus forks reading through to one (live or retired rows of their bases). It rebuilds those with `replace(..., { touch: false })`, as `rebuildIndexes` does. A new `oc_migrations` table records `long-backgrounds`, so the scan of every duration runs once. I used a marker rather than bumping `index_version`: re-running the query alone wouldn't be idempotent, because a timeline whose address doesn't fit the budget matches every time. Bumping the version would also rewrite, and notify, every timeline row. - **Warnings.** `POST /api/timelines`, `PUT /api/timelines/{id}`, `PUT /api/timelines/{id}/changes` and `POST /api/files/import` succeed, and when an enabled background plugin's address is longer than 1,024 characters they add `warnings: [{code: 'long-background', message, count, durations}]` (at most 100 IDs). When there's nothing to warn about, the response is unchanged. This is documented in `docs/api.md` ("Warnings") and in OpenAPI (`Warning`, `SavedTimeline`). The editor's JSON and `.och` imports add the same sentence to their toast (`longBackgroundsText` in `src/wording.ts`). - **Docs.** `docs/images.md` has a new "Image addresses" section. `docs/plugins.md`, `docs/durations.md` and `docs/administration.md` (the upgrade note) are updated too. ## Tests - `test/plugins.test.mjs`: a 300-character https address is kept, 1,024 is kept, 1,100 is dropped, a 300-character non-URL string is dropped, and the budget holds. Also `longBackgrounds` and the wording. - `native-store`: `bands_carry_web_addresses_of_at_most_1024_characters`. - New `test/long-backgrounds-postgres.mjs` covers: - API warnings on create, save, changes and file import. - A 300-character background drawn in the overview query. - An old-style band, in a timeline and in a fork reading through to it, fixed by the rebuild without touching `updated_at`. - A second run doing nothing, and a timeline without such an address left alone.
Sources
Open #366 · Duration backgrounds with addresses up to 1,024 characters show in the timeline