Skip to content

Conversation

@pyramation
Copy link
Contributor

@pyramation pyramation commented Dec 24, 2025

Flatten packages structure and rename ctx functions

Summary

This PR makes three main changes to simplify the codebase:

  1. Flattened package structure: Moved all 21 packages from nested category directories to a flat packages/* structure. Previously packages were organized under packages/utils/*, packages/security/*, packages/data-types/*, etc. Now all packages live directly under packages/.

  2. Renamed ctx JWT accessor functions: Renamed ctx.user_id()ctx.uid() and ctx.user_agent()ctx.uagent() in the jwt-claims package to provide a more succinct API. Added documentation comments to all JWT claim functions in ctx, jwt_public, and jwt_private schemas.

  3. Removed unused jwt_public.current_group_ids() function: Per user request, removed the group_ids function since group/org membership is not handled at the JWT level in this project.

Updated workspace configuration files (pnpm-workspace.yaml, pgpm.json) to reflect the simplified flat structure.

Updates since last revision

  • Fixed CI workflow (.github/workflows/ci.yml) to use flat package paths in the test matrix (e.g., jwt-claims instead of security/jwt-claims)
  • Updated pnpm-lock.yaml to reflect new package locations
  • Removed jwt_public.current_group_ids() function and all related files (deploy/revert/verify SQL, tests, README documentation)

Review & Testing Checklist for Human

  • Verify ctx function renames are correct: The pgpm.plan file was updated to rename change identifiers from schemas/ctx/procedures/user_id to schemas/ctx/procedures/uid. If there are any existing database deployments, this could cause migration issues.
  • Verify group_ids removal is intentional: The jwt_public.current_group_ids() function was completely removed. Confirm this is desired and no code depends on it.
  • Test workspace resolution: Run pnpm install and verify all 21 packages are correctly discovered with the new flat structure
  • Run package tests: Execute pnpm test to verify the packages still work after restructuring

Recommended test plan:

pnpm install
pnpm test
# If you have a test database, verify pgpm deploy works

Notes

  • The bundled SQL file packages/jwt-claims/sql/pgpm-jwt-claims--0.15.2.sql was updated with the new function names, comments, and group_ids removal
  • All file moves were detected as renames by git (100% similarity) - no content was lost
  • User confirmed there are no downstream users, so the breaking changes to ctx functions and group_ids removal are acceptable
  • CI workflow matrix updated to match new flat package structure

Link to Devin run: https://app.devin.ai/sessions/b46e88cf5be04982894f8e94948174e6
Requested by: Dan Lynch (@pyramation)

@devin-ai-integration
Copy link

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@devin-ai-integration devin-ai-integration bot force-pushed the devin/1766539340-flatten-packages branch from 1a73204 to 9f69485 Compare December 24, 2025 02:05
- Flatten all nested packages to packages/ root level
- Update pnpm-workspace.yaml and pgpm.json for flat structure
- Rename ctx.user_id() to ctx.uid() and ctx.user_agent() to ctx.uagent()
- Add comments to all JWT claim functions in ctx, jwt_public, and jwt_private schemas
- Update pgpm.plan and bundled SQL files accordingly

Co-Authored-By: Dan Lynch <pyramation@gmail.com>
- Update CI workflow matrix to use flat package paths (e.g., jwt-claims instead of security/jwt-claims)
- Update pnpm-lock.yaml to reflect new package locations

Co-Authored-By: Dan Lynch <pyramation@gmail.com>
- Remove deploy/revert/verify SQL files for current_group_ids
- Update pgpm.plan to remove the change entry
- Update bundled SQL file to remove the function
- Update tests to remove group_ids references
- Update README to remove group_ids documentation

Co-Authored-By: Dan Lynch <pyramation@gmail.com>
@devin-ai-integration devin-ai-integration bot force-pushed the devin/1766539340-flatten-packages branch from 9f69485 to 1cb8818 Compare December 24, 2025 02:09
@pyramation pyramation closed this Dec 24, 2025
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.

2 participants