Repository navigation
fix(core): use integer, not int32, for pagination fields - #1422
Open
SnowboardTechie wants to merge 4 commits into
Open
SnowboardTechie wants to merge 4 commits into
SnowboardTechie wants to merge 4 commits into
Conversation
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
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
This branch has not been deployed
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.
Summary
From Core 0.6.0,
pageandpageSizeon the pagination request models, andpageonPaginatedResultsInfo, areintegerinstead ofint32. Every pagination field now has the same width as the other counts in Core, and the 0.6.0 spec no longer carries amaximum: 2147483647/format: int32that no implementation, template orcg check specenforces. 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 fiveint32fields becomeinteger, each with@Versioning.typeChangedFrom(CommonGrants.Versions.v0_6, int32). The HTTPstatus: int32on the response models is untouched.lib/ts-sdk/__tests__/schemas/zod/pagination.spec.ts: thepage: 2147483648case onPaginatedResultsInfomoves from a tracked divergence to an ordinary agree case, and [Core] Use integer, not int32, for pagination fields #1196 leaves theknownDivergencesset.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 sharedPaginatedQueryParams/PaginatedBodyParamsschemas 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 sayspage/pageSizelack a.max()bound.lib/ts-sdk/src/schemas/zod/award-routes.ts: the award-route pagination schemas dropINT32_MAXand their.max()calls;page/pageSizekeep.int().min(1)and their defaults.award-routes.spec.tsadds a case where Zod and the emitted Core schema both accept2147483648on the list request, search request and list response pagination.lib/python-sdk/common_grants_sdk/schemas/pydantic/requests/award.py:_Pagedropsle=_INT32_MAX(the response's_AwdPaginationInfo.pagereuses it).test_award_routes.pynow expects pages above int32 to be accepted, and theaward_fixtures.pyconformance fixture usespageSize: 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.website/public/openapi/openapi.0.6.0.yaml(fiveformat: int32lines removed) andwebsite/public/schemas/yaml/Paginated{Query,Body}Params.yaml,PaginatedResultsInfo.yaml(maximumremoved,minimum: 1kept).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.tspuses@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,@minValueand default values with no diagnostics.To verify:
pnpm --filter website run typespec, thengit status --short website/publicprints nothing.git diff --stat origin/CORE-v0.6.0 -- website/public/openapi/lists onlyopenapi.0.6.0.yaml.grep -c "format: int32" website/public/openapi/openapi.0.6.0.yamlprints2: both are HTTPstatus(0.5.0 has 7).pnpm --filter @common-grants/core run ciandpnpm --filter @common-grants/sdk run ci.pnpm --filter @common-grants/sdk run typespec, then inlib/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):
pnpm --filter @common-grants/core run cipnpm --filter @common-grants/sdk run cimake checks,make test,make check-award-schema,make check-opportunity-schema,make buildpnpm --filter website run check:quickstartspnpm publish --dry-runinlib/corevalidate). Locally: lint, format, types, astro check, 1225 tests and build pass; spelling passes with a gitignored localAGENTS.mdexcludedRelease note: the squash touches
lib/core,lib/ts-sdkandlib/python-sdk, so release-please cuts a patch for@common-grants/core,@common-grants/sdkandcommon-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.