Repository navigation
Check the lifecycle cases the trash and team folders promise - #317
Conversation
The new pad starts its revisions anew, under a file whose snapshot counted the old pad's: a sync that compared the two would take what is written into the new pad for nothing new. After each way a lost pad is made anew, the recovery and the restore, what is then written into it reaches the file with an ordinary sync, answered `updated`.
Under 1.1.0-beta.1 the trash deleted the pad, and the file came back naming a pad nobody has, with no row. Beta 2 is the first update for those installations: such a file restored is opened at once, on a new pad made from its content.
- A public pad in the trash still opens by its link and takes what is written into it; the restore brings that back with the pad, and the next sync writes it into the file. - With `delete_pad_with_file` off, a file deleted for good leaves its pad, counted as pending; switched back on, the job deletes it. - A file moved from a home into a team folder and back crosses storages twice: it keeps its id and its pad, and the job takes nothing. - A single file in a team folder's trash keeps its pad, gets it back when restored, and takes it when deleted from there.
A protected pad loses its sessions when its file goes to the trash, and the docs promise that whoever still has it open writes no more from the next change on. A viewer types into the pad, the file goes to the trash, and what it types next does not reach the pad. A helper types into the editor four frames down.
250 pads in one folder, more than one of the job's batches of 200, go to the trash with it and are deleted from there. One settle takes them all and a later run finds nothing more. Like the other folder cases it is skipped on Nextcloud 34 up to 34.0.4, which reports a removed folder's files under the wrong ids; it runs on 32 and 33.
- The public pad in the trash is typed into by its link, from a browser without a Nextcloud session: Etherpad answers any /p/ address with 200, and the API takes any pad, so neither showed the link still works. - The move between a home and a team folder compares the pending deletes before and after: a row wrongly marked as gone keeps its pad and opens as before, and only that count shows it. - The open editor waits several times what its first change needed, three seconds at least, before it says the second never came. - The switch is put back as the admin had it, unset if it was, through the provisioning API's delete. - The open editor's file is deleted afterwards if the test stopped before the trash. - The Etherpad frames are built in one place for every helper.
`as typeof payload` took the `null` the variable was declared with, and every field read after it was `never`: three strict errors, without effect only because Playwright does not check types.
|
ⓘ Qodo reviews are paused because the subscription is no longer active. Ask your workspace admin to reactivate the subscription to resume reviews. Manage billing |
PR Summary by QodoCover pad lifecycle across trash, restore, and permanent deletion
AI Description
Diagram
High-Level Assessment
Files changed (6)
|
Code Review by Qodo
1. Public pad tests fail on Docker HTTPS
|
| const written = `written while in the trash ${Date.now()}` | ||
| try { | ||
| await deleteViaDav(name) | ||
| const visitor = await browser.newContext({ storageState: { cookies: [], origins: [] } }) |
There was a problem hiding this comment.
1. Public pad tests fail on docker https 🐞 Bug ☼ Reliability
browser.newContext() creates the visitor context without the ignoreHTTPSErrors option configured for the normal Playwright context. When the test opens the Docker stack’s HTTPS pad URL, its locally minted certificate can stop navigation before the public-pad behavior is tested.
Agent Prompt
## Issue description
The new unauthenticated visitor context omits the certificate option needed to open the Docker stack’s HTTPS Etherpad URL.
## Fix Focus Areas
- tests/e2e/specs/pad-gone-for-good.spec.ts[237-242]
- tests/e2e/playwright.config.ts[98-104]
## Recommended Fix
Pass `ignoreHTTPSErrors` to the visitor’s `browser.newContext()` using the same `E2E_IGNORE_HTTPS_ERRORS` setting as the Playwright configuration, while keeping certificate errors fatal for other targets.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
There was a problem hiding this comment.
Not applied. In Playwright Test, a context a test opens with browser.newContext() takes the config's use options, ignoreHTTPSErrors among them; the options passed here replace only storageState. The visitor context opens the Docker stack's pad over HTTPS: this test passed against the stack locally, on Nextcloud 34 and 32.0.9, and in all three e2e jobs of this PR's run on 67974de, Etherpad 3 included, on a runner whose browser does not trust the stack's CA. public-share-view.spec.ts has opened the same stack from plain browser.newContext() contexts all along.
…o run - The switch is only flipped where deleting is on already: switched on and settled at once, it would delete every pad an admin who has it off is keeping. A non-admin account skips it like the rest. - The sync after a pad made anew checks the file counts the new pad's revisions, and the old pad has more than the new one reaches: kept at the old count, the file would have passed before. The beta.1 restore runs that check too. - The public pad in the trash is checked to be kept before its link is visited, which would make it anew, and what it held before the trash has to come back with what was written in it. - The move into the team folder is tried again while its mount is not there yet; the counts that are the instance's, pending deletes and a later settle, are held exact only on a throwaway stack. - The open editor's round trip is timed from the keys, not the editor's load, and its wait is capped. - The many-pads case retries a create under a new name, checks the pads ten at a time, and leaves no folder behind when it stops early; the team trash case leaves no file or trash entry. - padOfFile() and restoreAppConfig() are shared helpers; the legacy spec puts back an unset key as unset.
New e2e cases for what the lifecycle of a
.padfile promises now that a pad lives until its file is deleted for good: the promises no spec checked yet (docs/deleting-pads.md). Every case passes against the app as it is; no app code changed.Two terms from that page: the job is the background job that deletes the pads of files gone for good, and a settle is one run of it from the admin's pending check (
settle-pending), which the specs use instead of waiting for cron.Trash and restore
pad-trash-restore.spec.ts): a protected pad loses its sessions, and what the editor types next does not reach the pad. The test waits several times what the first change needed to arrive, three seconds at least. Observed, not asserted: Etherpad 2 refuses the change without telling the writer, and the page keeps showing what was typed. That Etherpad tells the writer nothing is Etherpad's; what this app could show instead is left for later.pad-gone-for-good.spec.ts) is typed into by its link, from a browser without a Nextcloud session, and takes what is written. The restore brings that back with the pad, and the next sync writes it into the file. A visit to a public pad's address makes the pad anew if it is gone, so the trash is checked to have kept it before the visit, and what it held before the trash has to come back too.pad-lost.spec.ts), whose pad and row went with that trash, gets a new pad from its content when it is restored, and opens on it at once.A pad made anew from its file
What is written into a pad made anew, by the recovery, by a restore, or by the restore of a file from 1.1.0-beta.1, reaches the file with an ordinary sync, answered
updated(pad-lost.spec.ts). The new pad counts its revisions anew, below the old pad's count: the file has to take the new pad's count with it, and the test checks that against Etherpad. The old pad is given more revisions than the new one reaches, so a file that kept the old count would take what is written into the new pad for nothing new.Team folders and
delete_pad_with_fileIn
pad-gone-for-good.spec.ts:delete_pad_with_fileoff, a file deleted for good leaves its pad, counted as a pending delete. Switched back on, the job deletes it. The admin's value is put back afterwards, or removed if there was none. The case runs only where deleting is on already: switched on and settled at once, it would delete every pad an admin who has it off is keeping.Many pads at once
A folder of 250 pads, more than one of the job's batches of 200, goes to the trash and is deleted from there: one settle takes them all, and on a throwaway stack a later run finds nothing more. A create that fails is tried again under a new name, and a run that stops early takes its folder past the trash. Like the other folder cases it is skipped on Nextcloud 34 up to 34.0.4, which reports a removed folder's files under the wrong ids (nextcloud/server#63998), so it runs on 32.0.9 and 33.
Helpers
typeInEtherpad()types into the editor of the pad the viewer shows, four frames down;typeInEtherpadPage()into a pad opened by its own address. The Etherpad frames are built in one place for these and the display-name check.restoreAppConfig()puts back a value as it was read, removing it over the provisioning API (deleteAppConfig()) if it was not set.pad-legacy-group-boundary.spec.tsuses it too, and no longer leaves an empty key behind.padOfFile()is the pad a file opens on, for the specs that asked the open the same way in three places.Verification