Skip to content

fix(core): use integer, not int32, for pagination fields - #1422

Open
SnowboardTechie wants to merge 4 commits into
CORE-v0.6.0from
bryan/1196-pagination-integer
Open

SnowboardTechie wants to merge 4 commits into
CORE-v0.6.0from
bryan/1196-pagination-integer

Conversation

@SnowboardTechie

@SnowboardTechie SnowboardTechie commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

From Core 0.6.0, page and pageSize on the pagination request models, and page on PaginatedResultsInfo, are integer instead of int32. Every pagination field now has the same width as the other counts in Core, and the 0.6.0 spec no longer carries a maximum: 2147483647 / format: int32 that no implementation, template or cg check spec enforces. Published versions 0.1.0 to 0.5.0 are unchanged.

The SDKs' award routes were the one place that copied the cap. They now accept the same range as Core 0.6.0, so no SDK rejects a page the protocol allows.

Changes proposed

  • lib/core/lib/core/pagination.tsp: the five int32 fields become integer, each with @Versioning.typeChangedFrom(CommonGrants.Versions.v0_6, int32). The HTTP status: int32 on the response models is untouched.
  • lib/ts-sdk/__tests__/schemas/zod/pagination.spec.ts: the page: 2147483648 case on PaginatedResultsInfo moves from a tracked divergence to an ordinary agree case, and [Core] Use integer, not int32, for pagination fields #1196 leaves the knownDivergences set.
  • lib/ts-sdk/__tests__/schemas/zod/shared-defects.spec.ts: the same value was also tracked (under [Core] Resolve opportunity API nullability mismatches between SDKs and protocol #1192) as a divergence on the shared PaginatedQueryParams/PaginatedBodyParams schemas that the award routes fork. The harness failed once Core widened, so it is now an agree case there too, and the header comment no longer says page/pageSize lack a .max() bound.
  • lib/ts-sdk/src/schemas/zod/award-routes.ts: the award-route pagination schemas drop INT32_MAX and their .max() calls; page/pageSize keep .int().min(1) and their defaults. award-routes.spec.ts adds a case where Zod and the emitted Core schema both accept 2147483648 on the list request, search request and list response pagination.
  • lib/python-sdk/common_grants_sdk/schemas/pydantic/requests/award.py: _Page drops le=_INT32_MAX (the response's _AwdPaginationInfo.page reuses it). test_award_routes.py now expects pages above int32 to be accepted, and the award_fixtures.py conformance fixture uses pageSize: 2147483648.
  • lib/ts-sdk/__tests__/schemas/zod/awards-coverage-inventory.md: no longer lists the shared schemas' missing int32 bound as a divergence, or says the award routes bound pagination at int32.
  • Generated: website/public/openapi/openapi.0.6.0.yaml (five format: int32 lines removed) and website/public/schemas/yaml/Paginated{Query,Body}Params.yaml, PaginatedResultsInfo.yaml (maximum removed, minimum: 1 kept).

Context for reviewers

Versioning approach. The issue noted Core hadn't versioned a type change before. It has once: lib/core/lib/core/filters/numeric.tsp uses @typeChangedFrom(v0_3, ...) to widen a union. This PR follows that precedent and is the first use on a scalar field. TypeSpec 1.17 accepts it alongside @query, @pageIndex/@pageSize, @minValue and default values with no diagnostics.

To verify:

  1. pnpm --filter website run typespec, then git status --short website/public prints nothing.
  2. git diff --stat origin/CORE-v0.6.0 -- website/public/openapi/ lists only openapi.0.6.0.yaml.
  3. grep -c "format: int32" website/public/openapi/openapi.0.6.0.yaml prints 2: both are HTTP status (0.5.0 has 7).
  4. pnpm --filter @common-grants/core run ci and pnpm --filter @common-grants/sdk run ci.
  5. Python SDK: pnpm --filter @common-grants/sdk run typespec, then in lib/python-sdk, make test && make check-award-schema.

Additional information

Checks run locally on this branch (the Core and website checks before the SDK commit, which doesn't touch either):

Check Result
pnpm --filter @common-grants/core run ci Pass
pnpm --filter @common-grants/sdk run ci Pass (706 tests)
Python SDK: make checks, make test, make check-award-schema, make check-opportunity-schema, make build Pass (1272 tests; award schema check 48 cases, 0 mismatches)
pnpm --filter website run check:quickstarts Pass
pnpm publish --dry-run in lib/core Pass
Website checks Pass in CI (validate). Locally: lint, format, types, astro check, 1225 tests and build pass; spelling passes with a gitignored local AGENTS.md excluded

Release note: the squash touches lib/core, lib/ts-sdk and lib/python-sdk, so release-please cuts a patch for @common-grants/core, @common-grants/sdk and common-grants-sdk, each with this PR's title in its changelog. The SDK change is a widening: anything they accepted before is still accepted. The SDK READMEs still describe the award models as following Core v0.5; only the pagination bound follows 0.6.

From 0.6.0, page and pageSize on PaginatedQueryParams and
PaginatedBodyParams, and page on PaginatedResultsInfo, are integer.
@typeChangedFrom(v0_6, int32) keeps 0.1.0-0.5.0 unchanged.

The TypeScript SDK parity harness now treats a page above the int32
range as agreement in both the pagination and shared-defects specs.

Fixes #1196
@github-actions github-actions Bot added website Issues related to the website core Issues related to @common-grants/core library sdk Issue or PR related to our SDKs typescript Issue or PR related to TypeScript tooling ts-sdk Related to TypeScript SDK labels Nov 20, 2026
@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

🚀 Website Preview Deployed!

Preview your changes at: https://pr-1422-common-grants.agile6.workers.dev

Built from commit 0f026fa

Core 0.6.0 widens page and pageSize to integer. The award routes in both
SDKs copied Core 0.5's int32 bound, so they would reject pages the
protocol allows. Remove the cap in TypeScript and Python and pin
agreement above int32 in both SDKs' tests.

Refs #1196
@github-actions github-actions Bot added python Issue or PR related to Python tooling py-sdk Related to Python SDK labels Nov 20, 2026
@SnowboardTechie SnowboardTechie linked an issue Nov 20, 2026 that may be closed by this pull request
4 tasks
@SnowboardTechie
SnowboardTechie marked this pull request as ready for review November 20, 2026 17:05

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Issues related to @common-grants/core library py-sdk Related to Python SDK python Issue or PR related to Python tooling sdk Issue or PR related to our SDKs ts-sdk Related to TypeScript SDK typescript Issue or PR related to TypeScript tooling website Issues related to the website

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Core] Use integer, not int32, for pagination fields

1 participant