Skip to content

🐛 fix(pages): use page.description_json in track_page_version#9281

Open
cosmic-fire-eng wants to merge 1 commit into
makeplane:previewfrom
cosmic-fire-eng:fix/page-version-description-json
Open

🐛 fix(pages): use page.description_json in track_page_version#9281
cosmic-fire-eng wants to merge 1 commit into
makeplane:previewfrom
cosmic-fire-eng:fix/page-version-description-json

Conversation

@cosmic-fire-eng

@cosmic-fire-eng cosmic-fire-eng commented Jun 21, 2026

Copy link
Copy Markdown

track_page_version reads page.description when populating a PageVersion. The description field no longer exists on the Page model (only description_json / description_binary / description_html / description_stripped), so every invocation raises AttributeError: 'Page' object has no attribute 'description'. Because the task body is wrapped in except Exception: log_exception(e); return, the failure is swallowed and no version is ever written — page version-history silently stops working with no user-visible error.

Fix: use page.description_json (the current field) in both the update-existing-version and create-new-version paths.

Tests: adds apps/api/plane/tests/unit/bg_tasks/test_page_version_task.py covering: the create path persists description_json; an in-place update within the timeout window; the no-op case when description_html is unchanged; a fresh version after PAGE_VERSION_TASK_TIMEOUT; and a sentinel asserting Page has no bare description attribute. With the old page.description, the persistence tests fail (0 versions written); after the fix they pass.

Summary by CodeRabbit

Release Notes

  • Bug Fixes

    • Fixed page version tracking to correctly capture and preserve the complete description content and formatting when recording page changes and edits.
  • Tests

    • Added unit tests to validate accurate handling of page descriptions in version history, covering creation of new versions, in-place updates, and scenarios where descriptions remain unchanged.

track_page_version read page.description when populating a PageVersion.
The description field was removed from the Page model, so every invocation
raised AttributeError: 'Page' object has no attribute 'description'. Because
the task body is wrapped in except Exception: log_exception(e); return, the
failure was swallowed and no version was ever written — page version-history
silently stopped working with no user-visible error.

Use page.description_json (the current field) in both the update-existing
and create-new version paths, and add unit tests covering the create path,
in-place update, the no-op case, post-timeout new version, and a sentinel
asserting Page has no bare description attribute.

Co-Authored-By: Claude <noreply@anthropic.com>
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@coderabbitai

coderabbitai Bot commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 14f0d676-aa8b-4342-be07-658ad06a38d0

📥 Commits

Reviewing files that changed from the base of the PR and between 4a0746b and e8cd003.

📒 Files selected for processing (2)
  • apps/api/plane/bgtasks/page_version_task.py
  • apps/api/plane/tests/unit/bg_tasks/test_page_version_task.py

📝 Walkthrough

Walkthrough

The Celery task track_page_version previously read page.description (a removed field) when persisting description_json onto PageVersion rows. Both the update and create code paths are corrected to read page.description_json. A new unit test module is added with four behavioral tests and a sentinel test guarding against this field-name regression.

Changes

PageVersion description_json fix and tests

Layer / File(s) Summary
Fix description_json field reads and add unit tests
apps/api/plane/bgtasks/page_version_task.py, apps/api/plane/tests/unit/bg_tasks/test_page_version_task.py
Both write paths in track_page_version (in-place update at line 45 and new-version creation at line 63) now source description_json from page.description_json instead of the removed page.description attribute. The new test module covers first-edit creation, same-user in-place update within timeout, noop on unchanged HTML, fresh version after timeout, and a sentinel test asserting Page.description does not exist.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐇 A field by wrong name caused a silent despair,
description was gone — but the code didn't care!
Now description_json flows true through each path,
And tests stand as guards against similar wrath.
Hop hop, little fix, you're precisely correct! 🌿

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive The PR description comprehensively explains the bug, the fix, and the test coverage, but does not follow the required template structure with sections like Type of Change, Test Scenarios, and References. Restructure the description to match the template with explicit sections for Type of Change, Test Scenarios, and References to improve clarity and consistency.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: fixing the track_page_version function to use page.description_json instead of the non-existent page.description field.
Docstring Coverage ✅ Passed Docstring coverage is 85.71% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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.

2 participants