fix(documents): doc create/update content conversion and archive-before-delete - #22
Open
Liewzheng wants to merge 1 commit into
Open
fix(documents): doc create/update content conversion and archive-before-delete#22Liewzheng wants to merge 1 commit into
Liewzheng wants to merge 1 commit into
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.
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.