Add major.minor document versioning

Introduce a two-part version scheme (major.minor) for documents.
Drafts start at 0.1 and increment minor on each new draft. Publishing
as minor keeps the current version, publishing as major bumps to the
next major.0. Both current_published_major and current_published_minor
are tracked on the document for exact version lookups.

Signatures and approval quorums aggregate across all versions sharing
the same major number using CTE joins. Approval page mutations spread
the decision fragment so Relay updates the version row state without
requiring a page refresh.

GraphQL, MCP, and service layer expose separate publishMajor and
publishMinor mutations instead of a single mutation with a type enum.

Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
This commit is contained in:
Sacha Al Himdani
2026-03-27 19:57:58 +01:00
parent c5a412ea41
commit 68bc8cf59a
31 changed files with 877 additions and 417 deletions

View File

@@ -218,7 +218,8 @@ type (
DocumentData struct {
Title string
Content string
Version int
Major int
Minor int
Classification Classification
Approvers []string
Description string

View File

@@ -39,7 +39,7 @@ func TestRenderHTML(t *testing.T) {
data: DocumentData{
Title: "Test Document",
Content: "# Main Title\n\nThis is **bold** text with *italic* formatting.",
Version: 1,
Major: 1,
Classification: ClassificationPublic,
Approvers: []string{"John Doe"},
PublishedAt: &now,
@@ -57,7 +57,7 @@ func TestRenderHTML(t *testing.T) {
"<h1>Main Title</h1>",
"<strong>bold</strong>",
"<em>italic</em>",
"<td>1</td>",
"<td>1.0</td>",
"PUBLIC",
"John Doe",
"Alice Smith",
@@ -383,7 +383,7 @@ func BenchmarkGenerateHTML(b *testing.B) {
data := DocumentData{
Title: "Benchmark Document",
Content: "# Title\n\nThis is **bold** text with *italic* formatting.\n\n- Item 1\n- Item 2",
Version: 1,
Major: 1,
Classification: ClassificationPublic,
Approvers: []string{"John Doe"},
PublishedAt: &now,

View File

@@ -404,7 +404,7 @@
{{- end}}
<tr>
<td>Version:</td>
<td>{{.Version}}</td>
<td>{{.Major}}.{{.Minor}}</td>
</tr>
{{- if .PublishedAt}}
<tr>