Skip to content

Commit e728048

Browse files
committed
Flag Hocuspocus client/server major version skew in CI
The provider (frontend) and server (extension) live in separate dependabot ecosystems and bump independently, so they can silently drift across a major. A soft-warning sticky PR comment surfaces a major mismatch for review without blocking, since Hocuspocus supports a one-major skew in both directions.
1 parent 4730f4c commit e728048

2 files changed

Lines changed: 124 additions & 0 deletions

File tree

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: "Hocuspocus / Version skew"
2+
3+
on:
4+
pull_request:
5+
types: [opened, reopened, synchronize]
6+
paths:
7+
- 'frontend/package.json'
8+
- 'extensions/op-blocknote-hocuspocus/package.json'
9+
10+
permissions:
11+
contents: read # to fetch code (actions/checkout)
12+
pull-requests: write # to comment on the PR
13+
14+
jobs:
15+
version-skew:
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
21+
with:
22+
persist-credentials: false
23+
24+
- name: Compare Hocuspocus client and server major versions
25+
id: skew
26+
run: ./script/ci/hocuspocus_version_skew.sh
27+
28+
- name: Add comment if versions skew
29+
if: steps.skew.outputs.skew == 'true'
30+
uses: marocchino/sticky-pull-request-comment@d4d6b0936434b21bc8345ad45a440c5f7d2c40ff # v3
31+
with:
32+
header: hocuspocus-version-skew
33+
message: |
34+
> [!WARNING]
35+
> The Hocuspocus client and server are on different major versions.
36+
37+
- `@hocuspocus/provider` (client, frontend): **${{ steps.skew.outputs.provider_range }}**
38+
- `@hocuspocus/server` (server, op-blocknote-hocuspocus extension): **${{ steps.skew.outputs.server_range }}**
39+
40+
The client ships with the core app; the server ships as the separately deployed
41+
`openproject/hocuspocus` image, so they can drift independently.
42+
43+
A one-major skew is supported by Hocuspocus in both directions and is fine as a
44+
temporary state while the two halves are realigned. Two or more majors apart is not
45+
supported. Please confirm this skew is intentional, or bump the lagging side.
46+
- name: Skew check passed
47+
if: steps.skew.outputs.skew != 'true'
48+
uses: marocchino/sticky-pull-request-comment@d4d6b0936434b21bc8345ad45a440c5f7d2c40ff # v3
49+
with:
50+
header: hocuspocus-version-skew
51+
delete: true
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
#!/bin/bash
2+
#-- copyright
3+
# OpenProject is a project management system.
4+
# Copyright (C) the OpenProject GmbH
5+
#
6+
# This program is free software; you can redistribute it and/or
7+
# modify it under the terms of the GNU General Public License version 3.
8+
#
9+
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
10+
# Copyright (C) 2006-2013 Jean-Philippe Lang
11+
# Copyright (C) 2010-2013 the ChiliProject Team
12+
#
13+
# This program is free software; you can redistribute it and/or
14+
# modify it under the terms of the GNU General Public License
15+
# as published by the Free Software Foundation; either version 2
16+
# of the License, or (at your option) any later version.
17+
#
18+
# This program is distributed in the hope that it will be useful,
19+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
20+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21+
# GNU General Public License for more details.
22+
#
23+
# You should have received a copy of the GNU General Public License
24+
# along with this program; if not, write to the Free Software
25+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
26+
#
27+
# See doc/COPYRIGHT.rdoc for more details.
28+
#++
29+
30+
# Compares the major version of the Hocuspocus client (@hocuspocus/provider, in
31+
# the frontend) against the server (@hocuspocus/server, in the op-blocknote-hocuspocus
32+
# extension). The client ships with the core app; the server ships as the separately
33+
# built and deployed openproject/hocuspocus image, and the two live in separate
34+
# dependabot ecosystems that can never be grouped — so they bump independently and
35+
# can silently drift. This flags a major mismatch for human review. It never fails
36+
# the build: Hocuspocus supports a one-major skew in both directions, so a mismatch
37+
# is a heads-up, not a blocker.
38+
39+
set -e
40+
41+
PROVIDER_RANGE=$(jq -r '.dependencies["@hocuspocus/provider"] // empty' frontend/package.json)
42+
SERVER_RANGE=$(jq -r '.dependencies["@hocuspocus/server"] // empty' extensions/op-blocknote-hocuspocus/package.json)
43+
44+
if [ -z "$PROVIDER_RANGE" ] || [ -z "$SERVER_RANGE" ]; then
45+
echo "::warning::Could not read @hocuspocus/provider or @hocuspocus/server version; skipping skew check."
46+
exit 0
47+
fi
48+
49+
# Strip a leading range operator (^, ~, >=, etc.) and take the major version.
50+
major() {
51+
echo "$1" | sed -E 's/^[^0-9]*//' | cut -d. -f1
52+
}
53+
54+
PROVIDER_MAJOR=$(major "$PROVIDER_RANGE")
55+
SERVER_MAJOR=$(major "$SERVER_RANGE")
56+
57+
echo "@hocuspocus/provider (client): ${PROVIDER_RANGE} (major ${PROVIDER_MAJOR})"
58+
echo "@hocuspocus/server (server): ${SERVER_RANGE} (major ${SERVER_MAJOR})"
59+
60+
{
61+
echo "provider_range=${PROVIDER_RANGE}"
62+
echo "server_range=${SERVER_RANGE}"
63+
echo "provider_major=${PROVIDER_MAJOR}"
64+
echo "server_major=${SERVER_MAJOR}"
65+
} >> "${GITHUB_OUTPUT:-/dev/stdout}"
66+
67+
if [ "$PROVIDER_MAJOR" != "$SERVER_MAJOR" ]; then
68+
echo "Major version skew detected between Hocuspocus client and server."
69+
echo "skew=true" >> "${GITHUB_OUTPUT:-/dev/stdout}"
70+
else
71+
echo "Hocuspocus client and server are on the same major version."
72+
echo "skew=false" >> "${GITHUB_OUTPUT:-/dev/stdout}"
73+
fi

0 commit comments

Comments
 (0)