Skip to content

feat(pages): technical names for application pages (step 5, separable) - #50

Open
rubenvdlinde wants to merge 1 commit into
stack/r4-grid-pagesfrom
stack/r5-page-technical-names
Open

rubenvdlinde wants to merge 1 commit into
stack/r4-grid-pagesfrom
stack/r5-page-technical-names

Conversation

@rubenvdlinde

Copy link
Copy Markdown
Collaborator

Step 5 of the page rework (follows the review on nextcloud#3075). Our own ask on top of nextcloud#3100, kept separate so upstream can leave it out. Stacked on #49.

What

  • tables_contexts_page.technical_name: required, unique per application (tables_ctx_page_name_uq on context_id, technical_name). Two migrations: add the column and backfill (start pages dashboard, other pages from their title, else page_<id>, duplicates get _2, _3), then make it NOT NULL and unique. App version 2.4.0-dev.6.
  • TechnicalNameHelper carried over from the earlier stack.
  • API: POST .../pages and PATCH .../pages/{pageId} accept technicalName; a new page without one gets one from its title. Pages return technicalName. 400 for an invalid name (^[a-z][a-z0-9_]*$, at most 200 characters) or one another page of the application uses, also when a concurrent write hits the unique index.
  • New applications name their start page dashboard.
  • Re-import: scheme/import takes the scheme's pages; a page updates the application's page with the same technical name (title, emoji, description, widgets replaced, sources remapped through the node UUIDs), other pages are added, pages the scheme does not name stay. The user migration import names its pages uniquely.
  • Page form: a technical name field (optional for a new page, required when editing).
  • OpenAPI regenerated.

Tests

  • tests/unit/Helper/TechnicalNameHelperTest.php: OK (14 tests, 20 assertions)
  • tests/unit/Migration/Version2400Date20261016000002Test.php (backfill): OK (3 tests, 4 assertions)
  • tests/unit/Service/PageServiceTest.php: OK (32 tests, 86 assertions) (generated, given, invalid, taken, unique-index race, own name kept)
  • tests/unit/Service/ContextPagesRoundTripTest.php (real DB, incl. naming on import and scheme pages matched by technical name): OK (4 tests, 18 assertions)
  • tests/unit/Controller/ContextPageControllerTest.php: OK (13 tests, 23 assertions); tests/unit/Db/ContextMapperTest.php: OK (1 test, 5 assertions)
  • whole unit suite: OK (445 tests, 904 assertions)
  • Live upgrade on a dev.5 instance: existing pages backfilled (dashboard, overview, shared_overview, ...), column NOT NULL with the unique index.
  • npx playwright test playwright/e2e/context-grid-pages.spec.ts --timeout=120000 (1600 px): 6 passed (1.3m), incl. a generated name and a 400 for a taken name.
  • composer cs:check: no files; psalm: no errors; npm run lint: 0 errors, 1 inherited warning (src/store/store.js:176); npm run stylelint: clean.

Prepared in the Conduction fork for porting upstream by @remko48. Prepared with Claude Code.

Every page gets a required technical name, unique within its application:
start pages are "dashboard", new pages get one from their title unless one
is given. Existing pages are backfilled. The page API accepts and returns
it and answers 400 for an invalid or taken name. Importing a scheme into
an application updates the page with the same technical name and adds the
others; a user migration import names its pages uniquely.

Separate from nextcloud#3100 so it can be left out upstream.

Assisted-by: ClaudeCode:claude-opus-5-5
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