Add resumable OCC imports for existing Etherpad pads and Ownpad files
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 35/100
調査の方向性
OCC コマンドのエントリポイントと、issue で言及されている既存の Ownpad パーサーから始めます。共有インポート操作をマッピングする前に、#241 の作成フローに関する残りの作業と、#253 のロールバック処理を読んでください。完了とは、部分成功の明示的な報告、リカバリ、インデックス作成、重複処理、クリーンアップのステータスを備えた、永続的な plan/apply/resume ワークフローが実現していることを意味します。
索引モデルが issue の本文から書いたものです。
説明
Goal
Provide an administrator-controlled way to:
- Import existing pads from the currently configured Etherpad server, creating managed
.padfiles and bindings. - Discover and migrate existing Ownpad
.padfiles in bulk. - Store an initial content snapshot in canonical/imported files and request full-text indexing where available.
- Optionally move pads into isolated Etherpad groups and remove the originals after a successful migration.
Start with OCC commands. A future administration UI should use the same application services through background jobs.
Main decisions
- Existing-pad imports and Ownpad migration are separate workflows with shared operations for validation, copying, binding, snapshots and recovery.
- Protected pads are copied into one new Etherpad group per destination pad by default.
- The first implementation retains source pads.
- A later user-facing move option uses the same copying workflow, followed by controlled source deletion.
- Preserving an existing pad ID and group is a separate advanced adoption mode.
- Ownpad duplicate handling is automatic: migrate one canonical file and convert the others into regular copies containing a short placeholder, without copying the original content into them.
- Canonical selection is configurable and deterministic. Existing bindings take precedence.
- Imports must support preview, resumable execution and a structured result report.
Relationship to #241
This work is the intended next use case for #241, “Give a pad, its binding and its file one way of coming into being”.
As recorded in the current issue discussion, rollback handling was consolidated in #253. The remaining work is to make the different creation sequences explicit and consistently handled.
The import introduces additional combinations:
| Etherpad resource | Nextcloud resource |
|---|---|
| Newly provisioned pad | New file |
| Newly copied pad | New file |
| Newly copied pad | Existing Ownpad file |
| Adopted existing pad, in a later phase | New or existing file |
The shared implementation must distinguish these cases rather than assuming that every pad or file belongs to the current attempt.
Existing ordering differences remain valid. Creating a disposable new file and updating an existing file do not necessarily require the same order of binding and file writes. Complete the remaining #241 work by giving these differences one readable implementation and testing the existing creation flows against it; do not force every workflow into one fixed sequence.
Source deletion after a successful import is a separate finalization step, not rollback.
Two workflows, shared operations
Existing-pad import
Accept a CSV or JSON manifest with one entry per intended destination:
| Field | Purpose |
|---|---|
| Source pad ID | Existing pad on the configured Etherpad server |
| Target user | Nextcloud filesystem context |
| Target folder | Destination folder |
| File name | Name of the new .pad file |
| Import strategy | Initially copy; later move or adopt |
Each pad may have a different destination. Resolve and validate target folders during planning, record their identities, and revalidate them during execution. Existing destination files must not be overwritten automatically.
Repeated manifest entries or conflicting destinations must be reported. They do not implicitly request multiple independent copies.
Ownpad migration
Discover legacy .pad files through Nextcloud's file APIs and parse them using the existing Ownpad parser.
The scanner produces a migration plan before making changes. It must:
- Find legacy files even when their MIME type has not been updated.
- Deduplicate repeated appearances of the same Nextcloud file ID.
- Group different files pointing to the same source pad.
- Recognize existing bindings and partially completed migrations.
- Report unreadable files, unsupported storage and references to other Etherpad servers.
Migration updates existing files in place, retaining their file IDs, locations and shares. Record the original shortcut content and verify that each file has not changed since planning.
The scanner and manifest reader remain independent. Both use shared import operations, but file discovery and in-place conversion are not prerequisites for delivering the manifest importer.
Import strategies
Copy: default and first implementation
For each protected destination:
- Create a dedicated Etherpad group.
- Copy the source pad into that group under a new pad ID.
- Verify the destination and ensure that it is private.
- Create or update the Nextcloud file and binding using the appropriate sequence.
- Store an initial snapshot.
- Request indexing where available.
- Mark the entry complete.
Use Etherpad's history-preserving copyPad, rather than recreating the canonical pad from text or HTML. The API supports copying history and chat. The destination group must already exist, and copying must not overwrite an existing destination. Etherpad HTTP API
A new group alone is not sufficient proof that the destination is private: the copy operation carries pad state, including its public status. Protected imports must explicitly establish the intended destination visibility. Public pads must not be silently converted to a different access mode.
The source remains unchanged. Existing links continue to point to it, and subsequent edits to source and destination are independent.
Move: copy, complete the import, then delete the source
Expose “move” as a user-facing option without relying on Etherpad's movePad to coordinate the entire operation.
In the inspected implementation, movePad performs a copy followed by source removal. Nextcloud file and binding creation are outside that operation. Etherpad implementation
Our move sequence should therefore be:
- Establish a write pause for the source.
- Copy the pad.
- Complete and verify the Nextcloud file, binding and snapshot, and finish the planned duplicate conversions.
- Delete the explicitly selected source pad.
- Record completion or a pending cleanup failure.
The advantage is the deletion checkpoint: if Nextcloud setup fails, the source still exists. A long delay before deletion is optional, not inherently safer. Prefer immediate controlled cleanup after successful cutover when the original is intended to disappear.
If cleanup happens later, verify that:
- The destination pad, file and binding are still valid.
- The source has not changed since copying, including its chat state.
- Known unresolved Ownpad files or bindings do not still require the source.
- The source is explicitly included in the cleanup plan.
Changed sources remain untouched and are reported as conflicts. Do not overwrite an independently edited destination to resolve such a conflict automatically.
A last-minute revision check alone does not prevent edits between checking and deletion. Establish a reliable source write-pause mechanism before claiming a lossless move. A Nextcloud file lock alone does not stop Etherpad edits.
External uses and links cannot be discovered completely. Source deletion remains an explicit administrator decision. Delete source pads individually; do not automatically remove pre-existing source groups.
Adopt: preserve the existing ID and group
Defer this advanced mode until its permission and lifecycle rules are implemented.
Etherpad sessions authorize an entire group. Importing two pads from the same group does not make their Nextcloud permissions independent. Access to one editable pad can also authorize access to other known pads in that group, including group members outside the manifest. Future changes to Nextcloud sharing can widen this mismatch.
Adoption requires persistent lifecycle ownership rules:
- May deleting the Nextcloud file delete the original pad?
- May the application delete the original group?
- What should restore do?
These rules must survive the import job. Resource provenance alone is not sufficient authorization to delete something later. An adopted source must never enter cleanup intended for a newly provisioned group.
Ownpad duplicates: automatic conversion and canonical selection
Duplicate conversion is an integral part of Ownpad migration, not an optional mode.
For each group of files referencing the same source server and pad ID:
- Respect an existing binding.
- Otherwise, select one eligible canonical file using the configured strategy.
- Complete the canonical file's migration and verify its binding.
- Convert the remaining files into regular managed
.padcopies without their own bindings.
Preserve each duplicate's file ID, location and sharing. Store this initial text snapshot:
Original pad content was not copied.
This is deliberately a normal snapshot containing only the placeholder. Do not fetch or distribute the original pad's text, HTML, history or chat into these duplicate files.
Canonical selection
Initially support:
- Lowest Nextcloud file ID — default.
- Highest Nextcloud file ID.
- An explicit per-group selection in the migration plan.
An existing binding takes precedence over these strategies. Apply selection to the complete candidate group, not filesystem traversal order. Persist the result in the plan and retain it across retries.
File-ID order is a deterministic selection mechanism, not proof of content freshness, ownership or authorization.
Defer “most recently opened” until a reliable data source covering legacy Ownpad files is established. Modification time must not silently substitute for opening time.
Show the selected file's owner, location and sharing information in the plan. Canonical selection does not merge permissions or grant readers of duplicate files access to the canonical file.
Existing copy behavior
Copies must reference the canonical managed destination, including its new pad ID if import created a new Etherpad pad.
Users with current read access to the canonical file may choose “Open the original”. Users authorized to create a pad from a copy may also use the existing “Create a new pad from this file” action.
That action creates an independent pad initialized with the placeholder, with its own binding and, for protected pads, its own group. Users can replace the placeholder or paste content they wish to retain.
Do not introduce a special reference-file type or disable recovery. Existing copy lifecycle behavior applies. No special handling is required to suppress indexing of the placeholder.
Neither duplicate conversion nor recovery may fetch the original content to populate the copy. Possession of a legacy shortcut is not proof of access to the protected pad it names.
Only convert duplicates after canonical migration succeeds. If the selected canonical file fails or becomes invalid, leave the remaining files unchanged and report the problem rather than silently choosing another canonical file.
Execution and recovery
Provide a plan/apply/resume workflow with a durable run identifier.
Record at least:
- Source server and pad ID.
- Destination pad and group IDs.
- Target file or folder identity.
- Canonical selection and duplicate membership.
- Copy baseline and original Ownpad content where applicable.
- Resource provenance.
- Attempted and confirmed operations.
- Completion, failure, indexing and cleanup status.
There is no single transaction spanning Etherpad, Nextcloud files and the binding database. Execution must handle partial success explicitly:
- A timed-out copy may already have succeeded.
- A binding insert may have committed even if the caller received an error.
- A file may have changed since planning.
- A retry must not create another copy, change the canonical selection or overwrite subsequent user changes.
Use existing locking and uniqueness guarantees. Rollback may remove only resources owned by the attempt and only when their state makes removal safe.
Do not temporarily enable the global protected Ownpad import setting. Administrator-triggered import needs its own authorized entry point while ordinary file-opening behavior retains its existing policy.
Snapshots and full-text search
Fetch text and HTML for canonical/imported pads and store them through the existing pad-format services. Snapshot content and the recorded revision must describe the same state. Duplicate files receive only the placeholder described above.
Write through Nextcloud's file APIs so file metadata and listeners remain consistent.
Use the existing full-text indexing pipeline, respecting its permissions and storage settings. Do not write directly to Elasticsearch.
Report these states separately:
- File and binding completed, or duplicate copy converted.
- Snapshot stored.
- Indexing queued.
- Indexing completed, where observable.
- Indexing unavailable or failed.
A search outage must not roll back an otherwise valid import. Retrying indexing must not repeat the pad import.
Delivery plan
First large PR: shared foundation and usable OCC manifest import
Deliver:
- The remaining #241 work needed to represent resource provenance and the supported creation sequences.
- Integration with existing creation and rollback paths.
- Manifest-based imports from the configured Etherpad server.
- Copy-only execution, retaining originals.
- Dedicated groups for protected destinations.
- Per-pad destination user, folder and file name.
- Preview, durable execution state, resume and structured reports.
- Binding conflict and repeated-entry detection.
- Initial snapshots and integration with the available indexing pipeline.
Do not include source deletion, existing-group adoption or an administration UI. This gives administrators a usable import path while keeping destructive cutover behavior out of the first implementation.
Second PR: Ownpad discovery and in-place bulk migration
Add:
- Nextcloud-aware scanning and migration plans.
- Configurable canonical selection and per-group overrides.
- In-place canonical conversion preserving file identity and sharing.
- Automatic conversion of duplicates into regular copies with the placeholder.
- Original-content preservation and changed-file detection.
- Handling of existing bindings and interrupted migrations.
- Reporting of canonical migrations, converted duplicates, unresolved files and failures.
Reuse the first PR's copy, binding, snapshot and recovery operations and the existing viewer copy flow.
Third PR: controlled moves and source cleanup
Add:
- The write-pause and cutover procedure.
- Source-change detection, including chat.
- Cleanup preview and explicit source selection.
- Immediate cleanup after successful import or later cleanup by run ID.
- Resumable deletion with separate pending/conflict states.
Do not ship “safe move” based only on revision checks without addressing concurrent writes.
Later work
- Adoption under existing pad IDs and groups, including persistent lifecycle ownership.
- Administration UI backed by background jobs.
- Additional source servers and cross-server transfer.
- A “most recently opened” selection strategy if a reliable source of that information is established.
True aliases and automatic permission consolidation are outside this scope.
Acceptance and regression coverage
Prioritize behavior under partial failure:
- Retrying an interrupted import creates no duplicate destinations.
- Failed Nextcloud setup leaves the source intact.
- Existing destinations and unrelated bindings are never overwritten.
- Protected copies are private and use isolated groups.
- Canonical selection is deterministic, respects existing bindings and stays fixed across retries.
- Ownpad migration preserves file identity and detects concurrent changes.
- Duplicate conversion starts only after canonical migration succeeds.
- Duplicate files contain only the placeholder, not original content, and receive no binding during migration.
- Original lookup respects current read permissions.
- Recovery from a duplicate creates an independent pad initialized with the placeholder; it does not fetch original content.
- Source deletion refuses changed or unresolved entries and never removes an unrelated group.
- Canonical snapshots contain the imported content; indexing follows existing access rules.
- Failures after successful remote or database writes are recoverable.
The final report must distinguish imported pads, processed files, converted duplicates, unresolved entries, failures and pending cleanup or indexing. Converted duplicates are not additional actively bound Etherpad pads, and a run with unresolved entries must not be presented as a complete migration.
- 主要言語
- PHP
- スター
- 2
- フォーク
- 1
- 平均マージ
- 5時間 14分
- マージ済み PR(30日)
- 47
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
ether/etherpad-integration-for-nextcloud のほかの issue
-
Architectural review for 1.1.0: sessions/embed, viewer, .pad lifecycle (20 suggestions to triage)オープン
難易度 5/5 1週間以上 初心者へのやさしさ 15/100
ether/etherpad-integration-for-nextcloud#427 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
Fusion with ownpad ?オープン
難易度 5/5 1週間以上 初心者へのやさしさ 20/100
ether/etherpad-integration-for-nextcloud#344 ·
メンテナーはふだん 1 日以内に返信
-
enhancement priority:low
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
ether/etherpad-integration-for-nextcloud#98 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
enhancement needs-discussion priority:low
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
ether/etherpad-integration-for-nextcloud#79 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
documentation needs-discussion priority:medium
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
ether/etherpad-integration-for-nextcloud#78 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
ether/etherpad-integration-for-nextcloud の issue をすべて見る
似ている issue
-
Fix routes for adminオープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
area: tests area: user refactoring
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
nplhse/collaborative-ivena-statistics#1845 ·
メンテナーはふだん 1 日以内に返信
-
[Sync EN] filesystem: document the ValueError of fgets(), file_get_contents(), and touch() (#6167)オープンsync-en
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
メンテナーはふだん 1 日以内に返信
-
sync-en
難易度 1/5 1〜3時間 初心者へのやさしさ 88/100
メンテナーはふだん 2 日以内に返信
-
Перевод устарел
難易度 2/5 1〜3時間 初心者へのやさしさ 90/100
メンテナーはふだん 1 日以内に返信