Skip to content

docs: add design spec for change detection and conflict resolution#9

Open
sumedhdk22 wants to merge 7 commits into
GoogleCloudPlatform:mainfrom
sumedhdk22:checksum-design
Open

docs: add design spec for change detection and conflict resolution#9
sumedhdk22 wants to merge 7 commits into
GoogleCloudPlatform:mainfrom
sumedhdk22:checksum-design

Conversation

@sumedhdk22

@sumedhdk22 sumedhdk22 commented May 26, 2026

Copy link
Copy Markdown
Contributor

Summary

This pull request introduces the architectural design specification for local change detection and remote conflict resolution in the Metadata as Code tool (kcmd).

The proposed design balances performance, minimal remote network footprint, and workspace cleanliness while ensuring local changes are safely synchronized without data loss.

Key Proposals & Architecture Details

  • State Database (.catalog_state.json): Recommends a single, flat, system-managed JSON state database at the workspace root (Option A) over directory-mirroring or co-located checksum files to maximize Node.js native parsing speed and minimize clutter.
  • Pull Workflow & Safety Guard: Details a strict "dirty workspace guard" that aborts local pull updates if untracked or unpushed modifications are present. Includes semantic normalization logic (recursive alphabetical key sorting, standardized whitespaces, and column order preservation in table schemas) to ensure checksums are resilient to formatting-only changes.
  • Push Workflow: Outlines a scale-aware, lookup-based push sequence utilizing custom views and a throttled concurrency pool to avoid socket exhaustion, protected by an all-or-nothing integrity guard.
  • Conflict Resolution Matrix: Defines exact system actions (Safe to Pull, Safe to Delete Locally, Safe to Push, Safe to Delete Remotely, Safe to Create) for all combinations of local, remote, and missing aspect states.
  • Dry Run (--dry-run) Mechanics: Fully specifies the pull/push dry-run workflows to safely preview local workspace modifications or remote mutation sequences without executing actual disk writes or remote API mutations.

Comment thread toolbox/mdcode/docs/checksum_design.md Outdated
Comment thread toolbox/mdcode/docs/checksum_design.md Outdated
Comment thread toolbox/mdcode/docs/checksum_design.md Outdated
Comment thread toolbox/mdcode/docs/checksum_design.md Outdated
Comment thread toolbox/mdcode/docs/checksum_design.md Outdated
Comment thread toolbox/mdcode/docs/features/checksum.md
Comment thread toolbox/mdcode/docs/checksum_design.md Outdated
Comment thread toolbox/mdcode/docs/checksum_design.md Outdated
Comment thread toolbox/mdcode/docs/checksum_design.md Outdated
Comment thread toolbox/mdcode/docs/checksum_design.md Outdated
Comment thread toolbox/mdcode/docs/checksum_design.md Outdated
Comment thread toolbox/mdcode/docs/checksum_design.md Outdated
Comment thread toolbox/mdcode/docs/checksum_design.md Outdated
Comment thread toolbox/mdcode/docs/checksum_design.md Outdated
Comment thread toolbox/mdcode/docs/checksum_design.md Outdated
Comment thread toolbox/mdcode/docs/checksum_design.md Outdated
Comment thread toolbox/mdcode/docs/checksum_design.md Outdated
Comment thread toolbox/mdcode/docs/checksum_design.md Outdated
Comment thread toolbox/mdcode/docs/checksum_design.md Outdated
Comment thread toolbox/mdcode/docs/checksum_design.md Outdated
@nikhilk

nikhilk commented May 30, 2026

Copy link
Copy Markdown
Collaborator

Nit -- could you please move this to docs/features/checksum.md -- to keep the top-level directory somewhat clean.

@sumedhdk22

Copy link
Copy Markdown
Contributor Author

@nikhilk , I have updated the design with fine-grained change isolation. PTAL.

Comment thread toolbox/mdcode/docs/features/checksum.md Outdated
Comment thread toolbox/mdcode/docs/features/checksum.md Outdated
Comment thread toolbox/mdcode/docs/features/checksum.md Outdated
Comment thread toolbox/mdcode/docs/features/checksum.md Outdated
Comment thread toolbox/mdcode/docs/features/checksum.md Outdated
Comment thread toolbox/mdcode/docs/features/checksum.md Outdated
Comment thread toolbox/mdcode/docs/features/checksum.md Outdated
Comment thread toolbox/mdcode/docs/features/checksum.md Outdated
Comment thread toolbox/mdcode/docs/features/checksum.md Outdated
Comment thread toolbox/mdcode/docs/features/checksum.md
Comment thread toolbox/mdcode/docs/features/checksum.md Outdated
Comment thread toolbox/mdcode/docs/features/checksum.md Outdated
Comment thread toolbox/mdcode/docs/features/checksum.md Outdated
Comment thread toolbox/mdcode/docs/features/checksum.md Outdated
Comment thread toolbox/mdcode/docs/features/checksum.md Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants