🚜 feat: Support Native PostgreSQL Tool Favorites (#18032)

* 🚜 feat: Support Native PostgreSQL Tool Favorites

* fix: Guard PostgreSQL Reconciliation and Connection Leases

* fix: Scope Favorites Erasure Fences to Deletion Attempts

* fix: Preserve Account Erasure Ownership Until Cancellation Completes

* fix: Reject Unsupported PostgreSQL Command Flags Before Connecting

* fix: Keep Command Validation Compatible With the TypeScript Target

* fix: Keep Migration Previews Read-Only and Preserve Erasure Recovery Identity

* fix: Fence Erasure Recovery Across Tenant and Ownership Changes

* fix: Isolate Migration Dependencies and Keep Mongo Scans Outside Transactions

* fix: Inject PostgreSQL Backend Factories at Composition Roots

* ci: Shard Complete Mutation Work Without Relaxing the Aggregate Gate

---------

Co-authored-by: Lia <lia@librechat.ai>
This commit is contained in:
lia-by-librechat[bot] 2026-11-11 12:07:07 -05:00 • committed by GitHub
parent dbe9f16a20
commit 42219ec8e9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
60 changed files with 6433 additions and 112 deletions

View file

@ -54,6 +54,7 @@ jobs:
outputs:
workspaces: ${{ steps.select.outputs.workspaces }}
hasChanges: ${{ steps.select.outputs.hasChanges }}
postgresChanged: ${{ steps.postgres.outputs.changed }}
steps:
- uses: actions/checkout@v5
with:
@ -69,13 +70,56 @@ jobs:
QUALITY_SCOPE: ${{ inputs.scope || 'data-schemas' }}
run: node scripts/quality/changes.mts --base "$QUALITY_BASE" --head "$QUALITY_HEAD" --scope "$QUALITY_SCOPE"
- name: Select PostgreSQL schema and lifecycle changes
id: postgres
run: |
if git diff --name-only "$QUALITY_BASE...$QUALITY_HEAD" | grep -Eq '^(packages/data-schemas/src/(postgres/|types/favorite|methods/(favorite|index))|packages/api/src/app/(persistence|postgres)|packages/data-provider/src/config|api/(models/index|server/(index|experimental))|config/(postgres|delete-user)|packages/data-schemas/jest.postgres|package-lock.json|.github/workflows/change-quality.yml)'; then
echo 'changed=true' >> "$GITHUB_OUTPUT"
fi
postgres:
name: PostgreSQL 16 contracts and readiness
needs: [select]
if: needs.select.outputs.postgresChanged == 'true'
runs-on: ubuntu-latest
timeout-minutes: 15
services:
postgres:
image: postgres:16-alpine
env:
POSTGRES_HOST_AUTH_METHOD: trust
ports: ['5432:5432']
options: >-
--health-cmd "pg_isready -U postgres"
--health-interval 5s
--health-timeout 5s
--health-retries 5
env:
PG_TEST_URL: postgresql://postgres@127.0.0.1:5432/postgres
NODE_OPTIONS: --max-old-space-size=6144
steps:
- uses: actions/checkout@v5
with:
ref: ${{ env.QUALITY_HEAD }}
persist-credentials: false
- uses: actions/setup-node@v5
with:
node-version: '24.22.1'
cache: npm
- run: npm ci
- run: npm run build:data-provider && npm run build:data-schemas && npm run build:api
- run: npm run test:postgres --workspace packages/data-schemas
- run: npx --no-install jest src/app/persistence.spec.ts src/app/postgres.spec.ts src/favorites/handlers.spec.ts src/user/erasure.spec.ts --coverage=false --runInBand
working-directory: packages/api
- run: npx --no-install jest --config config/jest.config.js --runTestsByPath config/__tests__/delete-user.recovery.spec.js --coverage=false --runInBand
reports:
name: ${{ matrix.check == 'risk' && 'Change risk' || 'Mutation testing' }} (${{ matrix.workspace }})
name: ${{ matrix.report.check == 'risk' && format('Change risk ({0})', matrix.workspace) || format('Mutation shard {0}/3 ({1})', matrix.report.shard, matrix.workspace) }}
needs: [select, verify]
if: needs.select.outputs.hasChanges == 'true'
runs-on: ubuntu-latest
# Whole edited database functions can produce thousands of mutation cases.
timeout-minutes: ${{ matrix.check == 'mutation' && 240 || 45 }}
timeout-minutes: ${{ matrix.report.check == 'mutation' && 240 || 45 }}
defaults:
run:
working-directory: source
@ -83,7 +127,11 @@ jobs:
fail-fast: false
matrix:
workspace: ${{ fromJSON(needs.select.outputs.workspaces) }}
check: [risk, mutation]
report:
- { check: risk, shard: 0 }
- { check: mutation, shard: 1 }
- { check: mutation, shard: 2 }
- { check: mutation, shard: 3 }
services:
redis:
image: redis:7-alpine
@ -93,7 +141,18 @@ jobs:
--health-interval 5s
--health-timeout 5s
--health-retries 5
postgres:
image: postgres:16-alpine
env:
POSTGRES_HOST_AUTH_METHOD: trust
ports: ['5432:5432']
options: >-
--health-cmd "pg_isready -U postgres"
--health-interval 5s
--health-timeout 5s
--health-retries 5
env:
PG_TEST_URL: postgresql://postgres@127.0.0.1:5432/postgres
REDIS_URI: redis://127.0.0.1:6379
NODE_OPTIONS: --max-old-space-size=6144
steps:
@ -138,15 +197,59 @@ jobs:
- name: Generate advisory report
env:
QUALITY_WORKSPACE: ${{ matrix.workspace }}
QUALITY_CHECK: ${{ matrix.check }}
run: >-
node ../tooling/scripts/quality/run.mts --base "$QUALITY_BASE" --head "$QUALITY_HEAD"
--workspace "$QUALITY_WORKSPACE" --check "$QUALITY_CHECK"
QUALITY_CHECK: ${{ matrix.report.check }}
QUALITY_SHARD: ${{ matrix.report.shard && format('{0}/3', matrix.report.shard) || '' }}
run: |
args=()
if [ -n "$QUALITY_SHARD" ]; then args+=(--shard "$QUALITY_SHARD"); fi
node ../tooling/scripts/quality/run.mts --base "$QUALITY_BASE" --head "$QUALITY_HEAD" \
--workspace "$QUALITY_WORKSPACE" --check "$QUALITY_CHECK" "${args[@]}"
- name: Upload reports
if: always()
uses: actions/upload-artifact@v6
with:
name: change-${{ matrix.check }}-${{ matrix.workspace }}-${{ github.event.pull_request.head.sha || github.sha }}
path: source/coverage/changes/${{ matrix.workspace }}/${{ matrix.check }}/
name: change-${{ matrix.report.check }}-${{ matrix.workspace }}${{ matrix.report.shard && format('-shard-{0}', matrix.report.shard) || '' }}-${{ env.QUALITY_HEAD }}
path: source/coverage/changes/${{ matrix.workspace }}/${{ matrix.report.check }}/
if-no-files-found: warn
retention-days: 14
mutation:
name: Mutation testing (${{ matrix.workspace }})
needs: [select, reports]
if: always() && needs.select.result == 'success' && needs.select.outputs.hasChanges == 'true'
runs-on: ubuntu-latest
timeout-minutes: 5
strategy:
fail-fast: false
matrix:
workspace: ${{ fromJSON(needs.select.outputs.workspaces) }}
steps:
- uses: actions/checkout@v5
with:
ref: ${{ github.sha }}
persist-credentials: false
- uses: actions/setup-node@v5
with:
node-version: '24.22.1'
- uses: actions/download-artifact@v7
with:
pattern: change-mutation-${{ matrix.workspace }}-shard-*-${{ env.QUALITY_HEAD }}
path: mutation-reports
- name: Verify all mutation shards
env:
QUALITY_WORKSPACE: ${{ matrix.workspace }}
run: >-
node scripts/quality/aggregate.mts --directory mutation-reports --head "$QUALITY_HEAD"
--workspace "$QUALITY_WORKSPACE" --count 3
--output "coverage/changes/$QUALITY_WORKSPACE/mutation"
- name: Require successful report jobs
env:
REPORT_RESULT: ${{ needs.reports.result }}
run: test "$REPORT_RESULT" = success
- uses: actions/upload-artifact@v6
if: always()
with:
name: change-mutation-${{ matrix.workspace }}-${{ env.QUALITY_HEAD }}
path: coverage/changes/${{ matrix.workspace }}/mutation/
if-no-files-found: warn
retention-days: 14