Skip to content

Add checksum in index, and improve cache logic#27

Merged
jetelain merged 8 commits into
mainfrom
index-reliability
May 2, 2026
Merged

Add checksum in index, and improve cache logic#27
jetelain merged 8 commits into
mainfrom
index-reliability

Conversation

@jetelain

@jetelain jetelain commented May 2, 2026

Copy link
Copy Markdown
Owner

This PR adds:

  • SHA256 checksum in index file, to check file integrity before loading
  • cache for index file of http databases to improve performance
  • automatic retry for http downloads to improve reliability

@jetelain jetelain self-assigned this May 2, 2026
@jetelain jetelain requested a review from Copilot May 2, 2026 11:19

Copilot AI left a comment

Copy link
Copy Markdown

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 introduces optional SHA-256 checksums into DEM database indexing to verify cell integrity before loading, and adds an on-disk cache strategy for index.json in HTTP-backed databases to reduce repeated downloads.

Changes:

  • Add SHA-256 support in index entries and validate downloads against expected hashes during cell load.
  • Add index.json disk caching for DemHttpStorage with a configurable freshness duration.
  • Update DemUtility to support index building/updating and checksum verification workflows, plus add/expand tests around hashing and caching.

Reviewed changes

Copilot reviewed 19 out of 19 changed files in this pull request and generated 18 comments.

Show a summary per file
File Description
MapToolkit/Databases/WellKnownDatabases.cs Adjusts default User-Agent string used for HTTP database access.
MapToolkit/Databases/Sha256Helper.cs Adds streaming SHA-256 compute/verify helper used by storages.
MapToolkit/Databases/IDemStorage.cs Extends storage interface with async load + SHA retrieval hooks.
MapToolkit/Databases/DemHttpStorage.cs Adds index caching + checksum-aware download/load behavior.
MapToolkit/Databases/DemFileSystemStorage.cs Adds async index build with SHA-256 + checksum verification on load.
MapToolkit/Databases/DemDatabaseFileInfos.cs Persists optional SHA-256 per cell entry in the index.
MapToolkit/Databases/DemDatabaseEntry.cs Plumbs expected SHA-256 into storage load calls.
MapToolkit/Databases/DemDatabase.cs Propagates SHA-256 from index into runtime entries.
MapToolkit/DataCells/DemDataCellMetadata.cs Adds legacy JSON property names for backward compatibility.
MapToolkit.Test/Databases/WellKnownDatabasesTest.cs Clears default HTTP cache to stabilize tests.
MapToolkit.Test/Databases/Sha256HelperTest.cs Adds unit tests for SHA-256 helper.
MapToolkit.Test/Databases/DemHttpStorageTest.cs Adds tests for HTTP caching and checksum behavior.
MapToolkit.Test/Databases/DemFileSystemStorageTest.cs Adds tests for filesystem SHA-256 retrieval.
MapToolkit.Test/Databases/DemDatabaseTest.cs Updates mocks to use LoadAsync.
MapToolkit.Test/Databases/DemDatabaseEntryTest.cs Updates mocks to use LoadAsync.
DemUtility/Properties/launchSettings.json Adds/updates local and CDN “index/update/check” launch profiles.
DemUtility/ProgressReport.cs Removes custom progress reporter (replaced by progress tracking).
DemUtility/Program.cs Reworks CLI; adds update-index/check commands; integrates progress tracking.
DemUtility/DemUtility.csproj Switches CLI dependencies and changes target framework.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread MapToolkit/DataCells/DemDataCellMetadata.cs Outdated
Comment thread MapToolkit.Test/Databases/DemHttpStorageTest.cs Outdated
Comment thread DemUtility/Properties/launchSettings.json Outdated
Comment thread DemUtility/Properties/launchSettings.json Outdated
Comment thread DemUtility/Properties/launchSettings.json Outdated
Comment thread MapToolkit/Databases/DemHttpStorage.cs
Comment thread DemUtility/Program.cs
Comment thread MapToolkit/Databases/DemFileSystemStorage.cs Outdated
Comment thread MapToolkit/Databases/Sha256Helper.cs Outdated
Comment thread DemUtility/Program.cs Outdated
jetelain and others added 4 commits May 2, 2026 13:28
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 22 out of 22 changed files in this pull request and generated 6 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread MapToolkit/Databases/IDemStorage.cs Outdated
Comment thread MapToolkit/Databases/DemFileSystemStorage.cs
Comment thread MapToolkit/Databases/DemHttpStorage.cs
Comment thread DemUtility/DemUtility.csproj
Comment thread MapToolkit.Test/Databases/DemHttpStorageTest.cs
Comment thread MapToolkit.Test/Databases/DemHttpStorageTest.cs Outdated
jetelain and others added 2 commits May 2, 2026 14:02
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 22 out of 22 changed files in this pull request and generated 6 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread DemUtility/Program.cs
Comment thread DemUtility/DemUtility.csproj
Comment thread MapToolkit.Test/Databases/DemHttpStorageTest.cs
Comment thread MapToolkit.Test/Databases/WellKnownDatabasesTest.cs
Comment thread MapToolkit/Databases/DemHttpStorage.cs
Comment thread DemUtility/Program.cs
@jetelain jetelain marked this pull request as ready for review May 2, 2026 13:41
@jetelain jetelain merged commit d44aeeb into main May 2, 2026
1 check passed
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.

2 participants