Conversation
Normalize created_by, created_at, updated_by, and updated_at out of both local and remote diff snapshots so that metadata-only changes (e.g. a different updater) do not appear as content differences. Add unit test for normalizeDiffMarkdown and an integration test that verifies file-mode diff reports no differences when only author metadata has changed.
Replace the raw ADF JSON dump in dry-run CREATE/UPDATE PAGE output with a human-readable Markdown preview converted via the forward converter. Empty bodies are shown as '(empty)' rather than a JSON skeleton. Falls back to indented ADF JSON only if conversion fails. Add TestRunPush_DryRunShowsMarkdownPreviewNotRawADF to assert the new behavior end-to-end.
Add detectDuplicatePageIDs to scan the space-wide PageIndex built during validate and fail early when two or more files claim the same Confluence page ID (a common rename-trap / copy-paste mistake). The check runs before the per-file validation loop so the error is reported immediately with a list of the conflicting paths. Add TestRunValidateTarget_BlocksDuplicatePageIDs (integration) and three unit tests for detectDuplicatePageIDs.
resolveForwardMediaType now falls back to extension-based detection (png, jpg, gif, svg, etc.) when the ADF media node does not carry an explicit type attribute. This restores correct ![]() rendering for images whose mediaType field is absent in the source ADF, fixing the TestForwardMediaHook and TestForwardMediaHook_FallbackByPageAndFilename regressions introduced in the Phase 2 attachment-link fix.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes six bugs and adds two quality-of-life improvements discovered during the Confluence sync CLI implementation review.
Changes
Bug Fixes
Fix workspace restore before auto pull-merge (
4505a67):cmd/push.gowas invokingrunPullwhile the push stash was not yet restored and was zeroingstashRef, risking loss of local workspace state during--on-conflict=pull-merge. The stash is now restored before invoking pull.Preserve attachment links through conversion (
eeb542b): Local markdown file links to attachments were being rewritten to image syntax (![]()) during conversion prep, causing non-image attachments to be lost or rendered incorrectly. Fixed by using pandocmedia-inlinespans to preserve file attachment links.Reduce noisy markdown escaping on pull (
2114708): The forward converter was over-escaping parentheses in markdown output (e.g. in links), creating unnecessary noise in pulled files.Fix media type inference regression (
93afbeb):resolveForwardMediaTypeinhooks.godefaulted to"file"whenMediaTypewas empty in an ADF node, even for images. Now infers the correct type from file extension (.png,.jpg,.gif,.webp, etc.) when type is absent.Quality-of-Life Improvements
Strip read-only metadata before diffing (
524a0dc):conf diffwas comparing raw local markdown (includingupdated_by,updated_at,created_by,created_atfrontmatter fields) against remote snapshots that don't carry those fields, producing false diffs for unchanged pages. These fields are now stripped before comparison.Show Markdown preview in dry-run output (
77fcc77):CreatePageandUpdatePageindry_run_remote.gowere dumping raw ADF JSON, which is hard to read. Dry-run output now shows a rendered Markdown preview viaconverter.Forward.Detect duplicate page IDs across files (
4ff1533): No cross-file check for duplicate Confluence page IDs existed. AddeddetectDuplicatePageIDsin the validate flow, called afterBuildPageIndexWithPending, to catch duplicateidvalues before any push.Testing
go test ./cmd/... ./internal/...go vet ./cmd/... ./internal/...clean.