Skip to content

(CF-56) Feat/shared distribution list - #53

Merged
wentz-s merged 1 commit into
devfrom
feat/shared-distribution-list
Oct 16, 2026
Merged

wentz-s merged 1 commit into
devfrom
feat/shared-distribution-list

Conversation

@wentz-s

@wentz-s wentz-s commented Oct 15, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

The list of linked distributions belonged to a browser: it lived in localStorage, so another browser, another device or another account landed on the connect screen even when distributions were already linked. That is also why a viewer was asked to connect a distribution (CF-54). It could not do so either, since creating a target is editor-only.

The list is now the team's: it is the API's target registry (GET /targets), loaded each time the console loads.

Console

  • One list for everyone. Whoever signs in, from any browser, sees the same distributions. Linking adds one for everyone; unlinking (DELETE /targets/{id}, registry only — the rules table is untouched and the distribution stays live) removes it for everyone.
  • Selection stays personal. Which distribution is selected is kept in the browser under the signed-in user's Cognito sub (their email if the token has none), so switching changes nothing for anyone else and the next person on the same browser never inherits it. If the selected one was unlinked by a teammate, the console falls back to the first.
  • Unlinking moves to the next distribution, or to the link screen when it was the last one. If a teammate already unlinked it, that counts as done.
  • Unlinked mid-session. A hosts load that answers "unknown target" reloads the list instead of failing for good, and that distribution — like one unlinked from this page — is dropped from the list for the rest of the page session, so a list that has not caught up yet cannot bring it back.
  • Link screen only appears on its own when the team has no distribution. A list that fails to load is an error with Try again, never the link screen.
  • Viewers see the shared list read-only: no form on the link screen (they are told to ask an editor), Link distribution disabled, no Unlink section and Save changes disabled in Settings.
  • Settings now saves onto the distribution's own target (PUT) instead of registering a new one. It also keeps the redirect function ARN, which it used to show empty and drop on save.
  • The localStorage keys the list used to live in are deleted on load. Nothing is migrated: the console was not live yet.
  • The Settings modal scrolls when it is taller than the window.

Link / Unlink wording (CF-57)

Every Connect / Connected / Connecting / Disconnect that refers to a distribution is now Link / Linked / Linking / Unlink, with the strings from the ticket. The Unlink section says the distribution stays live and its rules keep running at the edge, that it is removed for everyone, and where the user lands.

API

A target is now one linked distribution, named after its distribution ID. POST and PUT /targets refuse a name already taken (409 TARGET_EXISTS, "<name>" is already linked); an ID and its ARN count as the same name. They no longer refuse a second target on the same table: two distributions served by one rules table are two linked distributions. Before, the second one silently reused the first one's target and name.

Things to know

  • Existing registries may hold duplicates. On dev, changing the table in Settings registered a new target and left the old one behind, under the same name. Once this is deployed, those show up as duplicate rows for everyone, and saving Settings on one answers "That distribution is already linked" until an editor unlinks the extra one. Worth checking GET /targets on the sandbox environments after the deploy.
  • The country check with two distributions on one table judges a rule against the selected distribution only. That was already the case before; this makes the setup a supported one, so it may deserve its own ticket.
  • docs/screenshots/console-connect.png in the README still shows the old wording.

Tests

Lint, typecheck, generate:api:check, unit tests (edge 145, API 680, UI 586) and Playwright 167/167, all green. The e2e API stub now keeps its targets as a registry would (create, rename, delete), and new specs cover a viewer's read-only console, unlinking (next one, last one, refused), a selection unlinked by a teammate before and during a session (including a list that still returns it), two distributions on one table, linking one a teammate already linked, and two users keeping their own selection on one browser.

Ticket

CF-56, CF-54, CF-57

Checklist

  • CI is green (lint, typecheck, schemas)
  • If the rule shape changed: shared/ schemas and their shared/examples/ were updated together (n/a)
  • If the rule shape changed and the console API exists (step 2): its OpenAPI spec $refs the updated schemas — no inline redefinition (n/a)
  • The module still takes no input about, and creates no, aws_cloudfront_distribution (except under examples/)

@wentz-s
wentz-s merged commit 9036d09 into dev Oct 16, 2026
5 checks passed
@wentz-s
wentz-s deleted the feat/shared-distribution-list branch October 16, 2026 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant