refactor: adopt shared export-name converter for Layer Metadata (MAPCO-10823)#104
Open
razbroc wants to merge 2 commits into
Open
refactor: adopt shared export-name converter for Layer Metadata (MAPCO-10823)#104razbroc wants to merge 2 commits into
razbroc wants to merge 2 commits into
Conversation
…#103) Replaces Overseer's private convertObjectKeysToSnakeCase with the shared convertKeysToExportColumns from @map-colonies/raster-shared, so the Layer Metadata and Layer Parts export tables derive snake_case column names from one source. Behavior-preserving: the metadata feature has no resolutionDegree key (it uses maxResolutionDeg/minResolutionDeg), so the converter's override does not change Overseer's output. Removes the duplicated util and bumps raster-shared to ^8.3.0-alpha.0. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors Overseer’s Layer Metadata export to stop using a private camelCase→snake_case converter and instead use the shared export-name converter from @map-colonies/raster-shared, removing the duplicated local util (and its unit spec).
Changes:
- Replaced
convertObjectKeysToSnakeCaseusage in the export job handler with@map-colonies/raster-shared’s converter. - Removed the local
src/utils/db/dbUtils.tsconverter and its unit test. - Bumped
@map-colonies/raster-sharedto^8.3.0-alpha.0.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| tests/unit/utils/dbUtils.spec.ts | Removes unit tests for the deleted local snake_case converter. |
| src/utils/db/dbUtils.ts | Removes the duplicated local convertObjectKeysToSnakeCase utility. |
| src/job/models/export/exportJobHandler.ts | Uses the shared raster-shared key-to-column converter when generating GPKG metadata properties. |
| package.json | Updates the raster-shared dependency version to pick up the shared converter implementation. |
Comments suppressed due to low confidence (1)
src/job/models/export/exportJobHandler.ts:355
createGpkgMetadatanow relies onconvertKeysToGpkgColumns, but the existing unit tests for ExportJobHandler don’t assert the resulting column/property key names (they useexpect.any(Object)for the metadata passed toogr2ogr). To preserve the acceptance criterion (“column names unchanged”), add a test that verifies specific key conversions for Layer Metadata (e.g.,maxResolutionDeg->max_resolution_deg,minResolutionDeg->min_resolution_deg) and that no unexpected renames occur.
private createGpkgMetadata(feature: Feature<Polygon | MultiPolygon, GpkgArtifactProperties>): Feature<Polygon | MultiPolygon> {
const snakeCaseProps = convertKeysToGpkgColumns(feature.properties);
return {
...feature,
properties: snakeCaseProps,
};
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
8
to
12
| CallbacksStatus, | ||
| CleanupData, | ||
| convertKeysToGpkgColumns, | ||
| ExportFinalizeFullProcessingParams, | ||
| ExportFinalizeType, |
Comment on lines
49
to
53
| "@map-colonies/mc-utils": "^6.0.1", | ||
| "@map-colonies/prometheus": "^1.0.0", | ||
| "@map-colonies/raster-shared": "^8.1.0", | ||
| "@map-colonies/raster-shared": "^8.3.0-alpha.0", | ||
| "@map-colonies/read-pkg": "^1.0.0", | ||
| "@map-colonies/schemas": "^1.18.0", |
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.
What
Replaces Overseer's private
convertObjectKeysToSnakeCasewith the sharedconvertKeysToExportColumnsfrom@map-colonies/raster-shared, so the Layer Metadata and Layer Parts export tables derive snake_case column names from one source. Removes the duplicated util (and its spec).Behavior-preserving
The metadata feature has no
resolutionDegreekey (it usesmaxResolutionDeg/minResolutionDeg), so the converter's lone override never fires — Overseer's output columns are unchanged. Verified: full unit suite 191/191, export handler 17/17, typecheck clean.@map-colonies/raster-sharedwith the export-name converter (MapColonies/raster-shared#212). Dependency bumped to^8.3.0-alpha.0; merge/npm ciafter that publishes.Closes #103
🤖 Generated with Claude Code