Skip to content

Stats validation restrictions - #1215

Merged
anders-kane merged 5 commits into
masterfrom
stats-validation-restrictions
Nov 16, 2026
Merged

anders-kane merged 5 commits into
masterfrom
stats-validation-restrictions

Conversation

@anders-kane

Copy link
Copy Markdown
Contributor

This pull request introduces a comprehensive validation system for statistics query parameters in the FeatureServer package, improves the release workflow for reliability and repeatability, and updates documentation and tests to reflect these changes.

FeatureServer statistics validation:

  • Added validateStatisticsParams and validateStatisticsRequest helpers to enforce strict validation of outStatistics and groupByFieldsForStatistics parameters, ensuring only allowed field names and statistic types are used. Validation throws a 400 error on failure and is performed before query processing and when using FeatureServer directly. [1] [2] [3]
  • Updated the FeatureServer README to document the new validation behavior and usage patterns for validateStatisticsRequest.
  • Added a comprehensive test suite covering valid and invalid cases for statistics parameter validation.
  • Updated code examples and field names in the README for consistency with validation rules.

Release workflow improvements:

  • Refactored the release workflow to split jobs into setup, release-npm, release-github, and cleanup for better reliability and atomicity. Dependencies are archived and restored across jobs, npm publishing is idempotent, and package-lock updates are committed only if they change. [1] [2]
  • Documented the new release workflow and troubleshooting tips in CONTRIBUTING.md.

GitHub release script enhancements:

  • Improved the GitHub release script to only create releases for tags that do not already have a GitHub release, preventing duplicate releases. [1] [2] [3] [4]

Other updates:

  • Minor code and documentation improvements for clarity and consistency in statistics handling and examples. [1] [2]

@github-actions

Copy link
Copy Markdown
Contributor

Coverage Report (change vs master)

File Path Statements Branches Functions Lines
packages/featureserver/src/index.js 100.0 green
vs
100.0 green
100.0 green
vs
100.0 green
100.0 green
vs
100.0 green
100.0 green
vs
100.0 green
packages/featureserver/src/helpers/index.js 100.0 green
vs
100.0 green
100.0 green
vs
100.0 green
100.0 green
vs
100.0 green
100.0 green
vs
100.0 green
packages/featureserver/src/helpers/validate-statistics-params.js 100.0 green
vs
100.0 green
100.0 green
vs
100.0 green
100.0 green
vs
100.0 green
100.0 green
vs
100.0 green
packages/featureserver/src/helpers/fields/statistics-fields.js 97.3 yellowGreen
vs
97.3 yellowGreen
80.0 orange
vs
76.0 orange
100.0 green
vs
100.0 green
97.1 yellowGreen
vs
97.1 yellowGreen
packages/featureserver/src/query/index.js 100.0 green
vs
100.0 green
100.0 green
vs
100.0 green
100.0 green
vs
100.0 green
100.0 green
vs
100.0 green
packages/output-geoservices/src/index.js 100.0 green
vs
100.0 green
100.0 green
vs
100.0 green
100.0 green
vs
100.0 green
100.0 green
vs
100.0 green

Copilot AI 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.

🟡 Changes recommended

A required changeset is missing for both affected packages, so the release workflow will not version or publish the runtime changes, leaving the validation unavailable to published-package consumers.

1 open issue
What changed in this PR

This PR adds statistics-parameter validation to FeatureServer and integrates it into GeoServices before provider data is fetched. It also restructures publishing to support retries after partial release failures.

Changes:

  • Validate statistic types, field names, and parameter shapes for direct and GeoServices queries.
  • Add validation tests and document request handling and error responses.
  • Split release jobs, reuse dependencies, skip existing GitHub releases, and conditionally commit lockfile updates.
File Description
test/​gh-release.spec.js Tests release selection, retries, and failure propagation.
packages/​output-geoservices/​src/​index.spec.js Tests validation before provider calls and parameter precedence.
packages/​output-geoservices/​src/​index.js Validates statistics before fetching provider data.
packages/​output-geoservices/​README.md Documents early validation and ArcGIS error responses.
packages/​featureserver/​src/​query/​index.spec.js Tests query validation and statistics rendering.
packages/​featureserver/​src/​query/​index.js Validates statistics before query processing.
packages/​featureserver/​src/​index.spec.js Checks the new public validator export.
packages/​featureserver/​src/​index.js Exports validateStatisticsRequest.
packages/​featureserver/​src/​helpers/​validate-statistics-params.spec.js Covers accepted and rejected statistics parameters.
packages/​featureserver/​src/​helpers/​validate-statistics-params.js Implements shared statistics validation.
packages/​featureserver/​src/​helpers/​index.js Exports the validation helpers.
packages/​featureserver/​src/​helpers/​fields/​statistics-fields.js Adds whitespace only; no behavior change.
packages/​featureserver/​README.md Documents validation and updates statistics examples.
gh-release.js Skips existing releases and exports the runner for testing.
CONTRIBUTING.md Documents release stages and retry guidance.
.github/​workflows/​release.yml Separates setup, publishing, GitHub releases, and cleanup.

Review effort: Balanced

@changeset-bot

changeset-bot Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 2fa7dd7

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@koopjs/output-geoservices Minor
@koopjs/featureserver Minor
@koopjs/koop-core Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@anders-kane
anders-kane merged commit 81df362 into master Nov 16, 2026
7 checks passed
@anders-kane
anders-kane deleted the stats-validation-restrictions branch November 16, 2026 19:07
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