Repository navigation
fix(documents): doc create/update content conversion and archive-before-delete - #22
Merged
Merged
Conversation
…, archive before delete (PLANECLI-7) - doc create crashed constructing CreatePage: description_html is a required SDK field with no default, and --content bodies were wrapped in a single paragraph tag. CreatePage now always carries description_html (an empty paragraph when no content is given), and --content/--body text goes through the shared body_to_html converter (blank lines split paragraphs, single newlines become br tags, bare URLs become anchors, backticks become code tags, fenced blocks become pre-wrapped code) — the same conversion the comment commands use on integration-main. - doc update reuses the same converter and guards --content with is not None so an explicitly empty value still reaches the API. - doc delete now PATCHes archived_at (today, YYYY-MM-DD) and verifies the response actually carries it before DELETEing: the API only deletes archived pages and silently ignores unknown fields, so a bare DELETE left documents alive with no error.
Resolve conflicts in documents.py (keep the branch's body_to_html and archive-before-delete) and test_documents.py (keep main's create tests, add the branch's, drop the branch's duplicate empty-content test).
…alves#21) doc delete: - Accept any non-null archived_at, not only today's date, so a page the server archived with another date or a timestamp still gets deleted. - Translate HTTP and JSON failures of the archive PATCH and the DELETE into the CLI's exit codes instead of a traceback. - Say so when the DELETE fails after the archive: the page stays archived. - --help now says the delete is permanent; cite ADR-0007. Converter (utils/body_html.py): - Split fenced blocks before paragraphs, so a fence next to text is never wrapped in a paragraph; accept info strings such as c++ and CRLF. - Split code spans before linkifying, so URLs inside them stay text. - Keep a closing paren that balances one inside a URL. - Empty content gives an empty paragraph, as when --content is omitted. content_text keeps line and paragraph breaks and unescapes entities.
…lves#21) The PATCH archived_at path is not proven on any server. On a self-hosted Community Edition server the page URL allows only GET: PATCH and DELETE answer 405 and POST .../archive/ answers 404. doc delete goes back to a plain DELETE and keeps the HTTP error translation, so a 405 exits with code 4 instead of a traceback. Archiving moves to a separate issue.
Owner
|
Thanks for this PR. I pushed four commits to your branch, so please pull before you push again:
Which Plane version or build did you test the delete flow on? If you can answer on #36, it would settle what the CLI should call. The PR description no longer matches the code: it mentions archive-before-delete, 17 new cases, and comment commands sharing the converter. I will use this title when merging: |
This was referenced Nov 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes three independent
docwrite-path defects (#21):doc createcrash — always passdescription_htmlwhen constructingCreatePage(it is a required pydantic field). With--content, the body now goes through a proper HTML conversion instead of a single<p>wrapper. (Superset of fix(documents): pass description_html when constructing CreatePage #10 — same fix for the constructor, plus the conversion below.)utils/body_html.py(body_to_html()): blank-line paragraphs, single newlines →<br/>, bare URLs → anchors (trailing punctuation excluded), backticks →<code>(escaped), fenced blocks →<pre><code>. Same conversion logic the comment commands use.doc deleteno-op — archive first by PATCHingarchived_at(today,YYYY-MM-DD), verify the response actually carriesarchived_at(verify-write pattern; refuse to delete otherwise), then DELETE.Also fixes
doc updateto treat--content ""as intentional (is not Noneinstead of truthiness).Test Scenarios
uv run pytest -q— 197 passed, including 17 new cases (converter units, create/update payloads, archive-before-delete ordering, refuse-to-delete when archiving does not stick).ruff check/ruff format --checkclean on touched files.References
description_htmlconstructor fix); happy to rebase if fix(documents): pass description_html when constructing CreatePage #10 lands first.