Skip to content

feat(pdm): serve size checks from an mTLS count endpoint - #139

Merged
prdai merged 1 commit into
mainfrom
feat/pdm-count-endpoint
Nov 26, 2026
Merged

prdai merged 1 commit into
mainfrom
feat/pdm-count-endpoint

Conversation

@prdai

@prdai prdai commented Nov 25, 2026 •

Copy link
Copy Markdown
Member

what changed

  • Both PDM services gain GET /count, a metadata-only endpoint that returns the seeded record count for an algorithm and stops early when ?size= is supplied.
  • Rads exposes /count on its public HTTP API. Secure exposes it on a separate HTTP API bound only to an mTLS custom domain (pdm-mtls.sr.secure-rads.org), with the default execute-api endpoint disabled.
  • Execution-service size validation calls PDM /count instead of Querying the PDM DynamoDB table. Both execution-service roles lose dynamodb:Query on PDM.
  • Secure execution-service gains ssm:GetParameter for the client cert/key and kms:Decrypt scoped by kms:ViaService=ssm, then calls the mTLS domain with a client certificate fetched at cold start.
  • The secure PDM stack creates a versioned truststore bucket, count API/stage/route/permission, mTLS domain and mapping, and outputs PdmMtlsHost, PdmMtlsRegionalDomainName, and PdmTruststoreBucketName.
  • Added secure/pdm-service/Makefile targets gen-client-cert and store-client-cert, plus docs for the two-phase deploy.

why

The execution-service had direct DynamoDB access to PDM only for the size fallback, because nothing writes RecordCount. Asking PDM for the count keeps the guard while removing broad table access. The secure call is mTLS so PDM trusts only the execution-service client certificate. Rads stays on plain HTTPS because it is the fully-trusted baseline.

verification

  • bun run typecheck and bun run lint pass in both pdm-service trees and both execution-service trees.
  • serverless package succeeds for both PDM services and both execution services. The secure PDM template contains CountLambdaFunction, CountHttpApi, CountIntegration, CountRoute, CountLambdaPermission, and CountApiCustomDomain.
  • Not deployed or exercised against AWS. The truststore upload, SSM parameters, and DNS record are manual bootstrap steps.

notes

  • Deploy order: deploy PDM once without truststoreVersionId, run make gen-client-cert and make store-client-cert, upload the public cert to the truststore, redeploy with the S3 version, create the pdm-mtls.sr.secure-rads.org CNAME, then deploy execution-service with the PdmMtlsHost output.
  • kms:Decrypt for SSM uses key/* with kms:ViaService=ssm. Narrow it if a dedicated SSM key is used.
  • /count returns only a count and no personal data. It accepts optional size as an early-stop lower bound.
  • Standalone, based on main; not stacked on feat(pdm): use one DynamoDB table per algorithm #136 or perf(pdm): batch record queries into larger pages #137.

Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

Co-authored-by: Codex <codex@openai.com>
@prdai
prdai marked this pull request as ready for review November 26, 2026 01:34
@prdai
prdai merged commit 9355dfe into main Nov 26, 2026
14 checks 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.

1 participant