Skip to content

feat: Add checkpoint loading for Contentstack sync initialization - #75

Merged
aman19K merged 5 commits into
developmentfrom
feat/DX-3244
Jul 3, 2025
Merged

feat: Add checkpoint loading for Contentstack sync initialization#75
aman19K merged 5 commits into
developmentfrom
feat/DX-3244

Conversation

@aman19K

@aman19Kaman19K commented Jul 3, 2025

Copy link
Copy Markdown
Contributor

This PR introduces checkpoint file support during the Contentstack sync initialization. Key updates include:

  • Added loadCheckpoint function to read existing sync token from a hidden file.
  • Implemented readHiddenFile utility to safely read and parse JSON from disk.
  • Integrated checkpoint loading into the init lifecycle to resume sync from the last known state.
  • Added fallback logic to look for a default .checkpoint file if none is found at the specified path.

These changes enhance resiliency and efficiency by enabling sync resume capabilities, reducing redundant content fetching on service restarts

@aman19K
aman19K requested a review from a team as a code ownerJuly 3, 2025 03:53
@aman19K
aman19K requested review from Copilot and removed request for a teamJuly 3, 2025 03:53

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for reading and applying checkpoint files during the Contentstack sync initialization to resume from the last known state and avoid redundant fetches.

  • Introduces loadCheckpoint and readHiddenFile functions for loading and parsing a JSON checkpoint.
  • Hooks checkpoint loading into the init lifecycle with fallback logic to a default file path.
  • Expands config schema with checkpoint options and bumps the package version.

Reviewed Changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 3 comments.

FileDescription
src/core/plugins.tsAdded try/catch around plugin loading to surface errors.
src/core/index.tsImplemented loadCheckpoint, readHiddenFile, and integrated checkpoint logic into init.
src/config.tsAdded checkpoint settings (enabled, filePath, preserve).
package.jsonUpdated version from 2.0.11 to 2.1.0.
Comments suppressed due to low confidence (3)

src/core/index.ts:84

  • The variable checkPointConfig has inconsistent capitalization; consider renaming it to checkpointConfig for consistency with the interface name.
 const checkPointConfig: ICheckpoint = config.checkpoint

src/core/index.ts:122

  • There are no unit tests covering the new loadCheckpoint and readHiddenFile behaviors; consider adding tests for successful load, fallback, missing file, and parse errors.
const loadCheckpoint = (checkPointConfig: ICheckpoint, paths: any): void => {

src/core/index.ts:54

  • The preserve flag in ICheckpoint is neither documented nor implemented; add comments or implement its behavior, and correct formatting to preserve: boolean.
 preserve:boolean

Comment threadsrc/core/index.ts Outdated
Comment threadsrc/core/index.ts Outdated
Comment threadsrc/core/index.ts Outdated
aman19Kand others added 3 commits July 3, 2025 09:24
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

@harshithad0703harshithad0703 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@aman19K
aman19K merged commit 5899cd9 into developmentJul 3, 2025
Sign up for freeto 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

@aman19K@harshithad0703