page-save-origin-semantics

Explain origin-based revision checks for GROWI page save operations.

1.5k|242|Updated Feb 16, 2017
One-click install
npx skills add https://github.com/growilabs/growi --skill page-save-origin-semantics
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: page-save-origin-semantics
Source: https://github.com/growilabs/growi/tree/main/apps/app/.claude/skills/learned/page-save-origin-semantics
Command: npx skills add https://github.com/growilabs/growi --skill page-save-origin-semantics

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This document clarifies how GROWI decides when to enforce revision validation versus bypassing it during page saves, preventing accidental breakage of collaborative editing (Yjs) semantics and avoiding stale-revision errors.

Core Features & Use Cases

  • Two-stage origin check: Explains the frontend decision to send or omit revisionId and the backend isUpdatable() logic that enforces or bypasses revision checks based on request origin and latest revision origin.
  • Origin semantics and strength matrix: Describes origin values (editor, view, undefined), the rule set where editor-origin can bypass checks against view/editor latest revisions, and when strict revision matching is required.
  • Server-side fallback pattern: Recommends fetching previousRevision from currentPage.revision when revisionId is not provided so diff detection and other features remain functional.
  • Use cases: Implementing save/update API handlers, debugging save conflicts, adding features that need previous revision data without breaking Yjs collaborative editing.

Quick Start

Ask the guide to explain when the frontend should include revisionId and how the backend isUpdatable check evaluates origin combinations so you can implement a safe server-side fallback for previousRevision.

Frequently Asked Questions about page-save-origin-semantics

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I prevent save conflicts in collaborative editing with Yjs?

To prevent collaborative editing save conflicts, implement a two-stage origin check. The frontend decides whether to include revisionId, while the backend uses isUpdatable() logic to enforce or bypass revision validation based on request origin and the latest revision origin.

How does backend revision handling work when revisionId is omitted?

Backend revision handling applies an origin strength matrix evaluating editor, view, or undefined origins. Editor-origin saves can bypass strict checks against view or editor latest revisions, while other origin combinations require strict revision matching to prevent conflicts.

How do I fetch previousRevision when revisionId is not provided by the frontend?

Fetch previousRevision using a server-side fallback pattern by retrieving it from currentPage.revision. This ensures diff detection and related features remain functional even when the frontend omits revisionId during collaborative editing save operations.

Why does GROWI separate conflict detection from diff detection?

GROWI separates conflict detection from diff detection to preserve Yjs collaborative editing semantics. The two-stage check validates revision origin strength first, then the server-side fallback retrieves previousRevision data so diff detection functions independently without breaking collaboration.

When should strict revision checks be enforced versus bypassed in page save operations?

Strict revision checks should be enforced for non-editor origin combinations, while checks can be bypassed when editor-origin saves are evaluated against view or editor latest revisions. This origin strength matrix preserves collaborative editing flows while preventing stale-revision errors.

Can I add page save features that need previous revision data without breaking Yjs?

Yes, you can add page save features requiring previous revision data without breaking Yjs by implementing the server-side fallback pattern to fetch previousRevision from currentPage.revision when revisionId is not provided by the frontend during collaborative editing operations.