Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 18 additions & 18 deletions cmd/diff_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ func TestRunDiff_FileModeShowsContentChanges(t *testing.T) {
localFile := filepath.Join(spaceDir, "root.md")
writeMarkdown(t, localFile, fs.MarkdownDocument{
Frontmatter: fs.Frontmatter{
Title: "Root",
ID: "1",
Space: "ENG",
Title: "Root",
ID: "1",

Version: 1,
ConfluenceLastModified: "2026-02-01T10:00:00Z",
},
Expand Down Expand Up @@ -95,9 +95,9 @@ func TestRunDiff_SpaceModeNoDifferences(t *testing.T) {

writeMarkdown(t, filepath.Join(spaceDir, "root.md"), fs.MarkdownDocument{
Frontmatter: fs.Frontmatter{
Title: "Root",
ID: "1",
Space: "ENG",
Title: "Root",
ID: "1",

Version: 2,
ConfluenceLastModified: "2026-02-01T11:00:00Z",
},
Expand Down Expand Up @@ -163,9 +163,9 @@ func TestRunDiff_ReportsBestEffortWarnings(t *testing.T) {
localFile := filepath.Join(spaceDir, "root.md")
writeMarkdown(t, localFile, fs.MarkdownDocument{
Frontmatter: fs.Frontmatter{
Title: "Root",
ID: "1",
Space: "ENG",
Title: "Root",
ID: "1",

Version: 1,
ConfluenceLastModified: "2026-02-01T10:00:00Z",
},
Expand Down Expand Up @@ -222,9 +222,9 @@ func TestRunDiff_FolderListFailureFallsBackToPageHierarchy(t *testing.T) {
localFile := filepath.Join(spaceDir, "root.md")
writeMarkdown(t, localFile, fs.MarkdownDocument{
Frontmatter: fs.Frontmatter{
Title: "Root",
ID: "1",
Space: "ENG",
Title: "Root",
ID: "1",

Version: 1,
ConfluenceLastModified: "2026-02-01T10:00:00Z",
},
Expand Down Expand Up @@ -328,9 +328,9 @@ func TestNormalizeDiffMarkdown_StripsReadOnlyMetadata(t *testing.T) {
t.Parallel()
doc := fs.MarkdownDocument{
Frontmatter: fs.Frontmatter{
Title: "My Page",
ID: "42",
Space: "ENG",
Title: "My Page",
ID: "42",

Version: 3,
CreatedBy: "alice@example.com",
CreatedAt: "2026-01-01T00:00:00Z",
Expand Down Expand Up @@ -393,9 +393,9 @@ func TestRunDiff_FileModeIgnoresMetadataOnlyChanges(t *testing.T) {
localFile := filepath.Join(spaceDir, "root.md")
writeMarkdown(t, localFile, fs.MarkdownDocument{
Frontmatter: fs.Frontmatter{
Title: "Root",
ID: "1",
Space: "ENG",
Title: "Root",
ID: "1",

Version: 2,
UpdatedBy: "old-user@example.com",
UpdatedAt: "2026-01-01T00:00:00Z",
Expand Down
10 changes: 10 additions & 0 deletions cmd/dry_run_remote.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ func (d *dryRunPushRemote) GetPage(ctx context.Context, pageID string) (confluen
}

func (d *dryRunPushRemote) GetContentStatus(ctx context.Context, pageID string) (string, error) {
if strings.HasPrefix(pageID, "dry-run-") {
return "", nil
}
return d.inner.GetContentStatus(ctx, pageID)
}

Expand All @@ -48,6 +51,9 @@ func (d *dryRunPushRemote) DeleteContentStatus(ctx context.Context, pageID strin
}

func (d *dryRunPushRemote) GetLabels(ctx context.Context, pageID string) ([]string, error) {
if strings.HasPrefix(pageID, "dry-run-") {
return nil, nil
}
return d.inner.GetLabels(ctx, pageID)
}

Expand Down Expand Up @@ -200,6 +206,10 @@ func (d *dryRunPushRemote) CreateFolder(ctx context.Context, input confluence.Fo
}, nil
}

func (d *dryRunPushRemote) ListFolders(ctx context.Context, opts confluence.FolderListOptions) (confluence.FolderListResult, error) {
return d.inner.ListFolders(ctx, opts)
}

func (d *dryRunPushRemote) MovePage(ctx context.Context, pageID string, targetID string) error {
fmt.Fprintf(d.out, "[DRY-RUN] MOVE PAGE (PUT %s/wiki/rest/api/content/%s/move/append/%s)\n\n", d.domain, pageID, targetID)
return nil
Expand Down
12 changes: 6 additions & 6 deletions cmd/pull_context_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,9 @@ func TestRunPull_ForcePullRefreshesEntireSpace(t *testing.T) {
}
writeMarkdown(t, filepath.Join(spaceDir, "root.md"), fs.MarkdownDocument{
Frontmatter: fs.Frontmatter{
Title: "Root",
ID: "1",
Space: "ENG",
Title: "Root",
ID: "1",

Version: 1,
ConfluenceLastModified: "2026-02-01T08:00:00Z",
},
Expand Down Expand Up @@ -297,9 +297,9 @@ func TestRunPull_ForceFlagRejectedForFileTarget(t *testing.T) {
filePath := filepath.Join(spaceDir, "root.md")
writeMarkdown(t, filePath, fs.MarkdownDocument{
Frontmatter: fs.Frontmatter{
Title: "Root",
ID: "1",
Space: "ENG",
Title: "Root",
ID: "1",

Version: 1,
ConfluenceLastModified: "2026-02-01T08:00:00Z",
},
Expand Down
6 changes: 3 additions & 3 deletions cmd/pull_stash_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@ func TestRunPull_DiscardLocalFailureRestoresLocalChanges(t *testing.T) {

writeMarkdown(t, filepath.Join(spaceDir, "root.md"), fs.MarkdownDocument{
Frontmatter: fs.Frontmatter{
Title: "Root",
ID: "1",
Space: "ENG",
Title: "Root",
ID: "1",

Version: 1,
ConfluenceLastModified: "2026-02-01T08:00:00Z",
},
Expand Down
30 changes: 15 additions & 15 deletions cmd/pull_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ func TestRunPull_RestoresScopedStashAndCreatesTag(t *testing.T) {

writeMarkdown(t, filepath.Join(spaceDir, "root.md"), fs.MarkdownDocument{
Frontmatter: fs.Frontmatter{
Title: "Root",
ID: "1",
Space: "ENG",
Title: "Root",
ID: "1",

Version: 1,
ConfluenceLastModified: "2026-02-01T08:00:00Z",
},
Expand Down Expand Up @@ -131,9 +131,9 @@ func TestRunPull_FailureCleanupPreservesStateFile(t *testing.T) {

writeMarkdown(t, filepath.Join(spaceDir, "root.md"), fs.MarkdownDocument{
Frontmatter: fs.Frontmatter{
Title: "Root",
ID: "1",
Space: "ENG",
Title: "Root",
ID: "1",

Version: 1,
ConfluenceLastModified: "2026-02-01T08:00:00Z",
},
Expand Down Expand Up @@ -228,9 +228,9 @@ func TestRunPull_NoopDoesNotCreateTag(t *testing.T) {

baselineDoc := fs.MarkdownDocument{
Frontmatter: fs.Frontmatter{
Title: "Root",
ID: "1",
Space: "ENG",
Title: "Root",
ID: "1",

Version: 2,
CreatedBy: "User author-1",
CreatedAt: "2026-02-01T10:00:00Z",
Expand Down Expand Up @@ -322,9 +322,9 @@ func TestRunPull_RecreatesMissingSpaceDirWithoutRestoringDeletionStash(t *testin
}
writeMarkdown(t, filepath.Join(spaceDir, "Root.md"), fs.MarkdownDocument{
Frontmatter: fs.Frontmatter{
Title: "Root",
ID: "1",
Space: "ENG",
Title: "Root",
ID: "1",

Version: 1,
ConfluenceLastModified: "2026-02-01T08:00:00Z",
},
Expand Down Expand Up @@ -396,9 +396,9 @@ func TestRunPull_DraftSpaceListing(t *testing.T) {
// Page 10 is known locally as a draft
writeMarkdown(t, filepath.Join(spaceDir, "draft.md"), fs.MarkdownDocument{
Frontmatter: fs.Frontmatter{
Title: "Draft Page",
ID: "10",
Space: "ENG",
Title: "Draft Page",
ID: "10",

Version: 1,
Status: "draft",
},
Expand Down
12 changes: 6 additions & 6 deletions cmd/push_conflict_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ func TestRunPush_ConflictPolicies(t *testing.T) {

writeMarkdown(t, filepath.Join(spaceDir, "root.md"), fs.MarkdownDocument{
Frontmatter: fs.Frontmatter{
Title: "Root",
ID: "1",
Space: "ENG",
Title: "Root",
ID: "1",

Version: 1,
ConfluenceLastModified: "2026-02-01T10:00:00Z",
},
Expand Down Expand Up @@ -119,9 +119,9 @@ func TestRunPush_PullMergeRestoresStashedWorkspaceBeforePull(t *testing.T) {

writeMarkdown(t, rootPath, fs.MarkdownDocument{
Frontmatter: fs.Frontmatter{
Title: "Root",
ID: "1",
Space: "ENG",
Title: "Root",
ID: "1",

Version: 1,
ConfluenceLastModified: "2026-02-01T10:00:00Z",
},
Expand Down
8 changes: 3 additions & 5 deletions cmd/push_dryrun_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ func TestRunPush_DryRunDoesNotMutateFrontmatter(t *testing.T) {
writeMarkdown(t, newFile, fs.MarkdownDocument{
Frontmatter: fs.Frontmatter{
Title: "New page",
Space: "ENG",
},
Body: "new content\n",
})
Expand Down Expand Up @@ -105,7 +104,6 @@ func TestRunPush_DryRunShowsMarkdownPreviewNotRawADF(t *testing.T) {
writeMarkdown(t, newFile, fs.MarkdownDocument{
Frontmatter: fs.Frontmatter{
Title: "Preview page",
Space: "ENG",
},
Body: "hello dry-run\n",
})
Expand Down Expand Up @@ -152,9 +150,9 @@ func TestRunPush_PreflightShowsPlanWithoutRemoteWrites(t *testing.T) {

writeMarkdown(t, filepath.Join(spaceDir, "root.md"), fs.MarkdownDocument{
Frontmatter: fs.Frontmatter{
Title: "Root",
ID: "1",
Space: "ENG",
Title: "Root",
ID: "1",

Version: 1,
ConfluenceLastModified: "2026-02-01T10:00:00Z",
},
Expand Down
12 changes: 6 additions & 6 deletions cmd/push_snapshot_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ func TestRunPush_UsesStagedTrackedSnapshotContent(t *testing.T) {

writeMarkdown(t, rootPath, fs.MarkdownDocument{
Frontmatter: fs.Frontmatter{
Title: "Root",
ID: "1",
Space: "ENG",
Title: "Root",
ID: "1",

Version: 1,
ConfluenceLastModified: "2026-02-01T10:00:00Z",
},
Expand Down Expand Up @@ -68,9 +68,9 @@ func TestRunPush_UsesUnstagedTrackedSnapshotContent(t *testing.T) {

writeMarkdown(t, rootPath, fs.MarkdownDocument{
Frontmatter: fs.Frontmatter{
Title: "Root",
ID: "1",
Space: "ENG",
Title: "Root",
ID: "1",

Version: 1,
ConfluenceLastModified: "2026-02-01T10:00:00Z",
},
Expand Down
37 changes: 18 additions & 19 deletions cmd/push_stash_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ func TestRunPush_IncludesUntrackedAssetsFromWorkspaceSnapshot(t *testing.T) {

writeMarkdown(t, filepath.Join(spaceDir, "root.md"), fs.MarkdownDocument{
Frontmatter: fs.Frontmatter{
Title: "Root",
ID: "1",
Space: "ENG",
Title: "Root",
ID: "1",

Version: 1,
ConfluenceLastModified: "2026-02-01T10:00:00Z",
},
Expand Down Expand Up @@ -70,9 +70,9 @@ func TestRunPush_FailureRetainsSnapshotAndSyncBranch(t *testing.T) {

writeMarkdown(t, filepath.Join(spaceDir, "root.md"), fs.MarkdownDocument{
Frontmatter: fs.Frontmatter{
Title: "Root",
ID: "1",
Space: "ENG",
Title: "Root",
ID: "1",

Version: 1,
ConfluenceLastModified: "2026-02-01T10:00:00Z",
},
Expand Down Expand Up @@ -135,9 +135,9 @@ func TestRunPush_PreservesOutOfScopeChanges(t *testing.T) {

writeMarkdown(t, filepath.Join(spaceDir, "root.md"), fs.MarkdownDocument{
Frontmatter: fs.Frontmatter{
Title: "Root",
ID: "1",
Space: "ENG",
Title: "Root",
ID: "1",

Version: 1,
ConfluenceLastModified: "2026-02-01T10:00:00Z",
},
Expand Down Expand Up @@ -195,7 +195,6 @@ func TestRunPush_DoesNotWarnForSyncedUntrackedFilesInStash(t *testing.T) {
writeMarkdown(t, newPagePath, fs.MarkdownDocument{
Frontmatter: fs.Frontmatter{
Title: "New Page",
Space: "ENG",
},
Body: "New page content\n",
})
Expand Down Expand Up @@ -251,9 +250,9 @@ func TestRunPush_FileTargetRestoresUnsyncedScopedTrackedChangesFromStash(t *test
secondaryPath := filepath.Join(spaceDir, "secondary.md")
writeMarkdown(t, secondaryPath, fs.MarkdownDocument{
Frontmatter: fs.Frontmatter{
Title: "Secondary",
ID: "2",
Space: "ENG",
Title: "Secondary",
ID: "2",

Version: 1,
ConfluenceLastModified: "2026-02-01T10:00:00Z",
},
Expand All @@ -275,9 +274,9 @@ func TestRunPush_FileTargetRestoresUnsyncedScopedTrackedChangesFromStash(t *test
rootPath := filepath.Join(spaceDir, "root.md")
writeMarkdown(t, rootPath, fs.MarkdownDocument{
Frontmatter: fs.Frontmatter{
Title: "Root",
ID: "1",
Space: "ENG",
Title: "Root",
ID: "1",

Version: 1,
ConfluenceLastModified: "2026-02-01T10:00:00Z",
},
Expand All @@ -286,9 +285,9 @@ func TestRunPush_FileTargetRestoresUnsyncedScopedTrackedChangesFromStash(t *test

writeMarkdown(t, secondaryPath, fs.MarkdownDocument{
Frontmatter: fs.Frontmatter{
Title: "Secondary",
ID: "2",
Space: "ENG",
Title: "Secondary",
ID: "2",

Version: 1,
ConfluenceLastModified: "2026-02-01T10:00:00Z",
},
Expand Down
Loading