Repository navigation
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved critical defects can terminate the host on database connection failures, persist stale data during concurrent imports, and expose sensitive records through unencrypted remote connections.
9 open issues
Require verified TLS for remote PostgreSQL connections · New Handle errors on checked-out PostgreSQL clients · New Serialize imports before reading thread state · New Remove UPDATE on append-only memory history · New Pass the PostgreSQL runtime credential to Hub commands · New Bound connection and pool checkout wait times · New Warn callers to verify outcomes after uncertain commits · New Use READ COMMITTED for writer and migration transactions · New Test memory versions and redaction with the runtime login · New
1 file not reviewed
packages/learning/package-lock.json: Generated file
What changed in this PR
Adds PostgreSQL storage to the learning package for shared installations, while keeping schema migrations separate from runtime access. SQLite remains the default.
Changes:
- Adds a PostgreSQL provider with scoped write locks, memory-version checks, and redaction.
- Adds a privileged migration command and environment-based connection configuration.
- Adds database tests, CI support, and operator guidance for permissions and deletion retention.
| File | Description |
|---|---|
packages/learning/test-database/postgres.test.mjs |
Adds conformance, migration, permissions, connection, concurrency, and index tests. |
packages/learning/src/providers/postgres.mjs |
Implements PostgreSQL storage and redaction. |
packages/learning/src/providers/postgres-database.mjs |
Adds migrations, schema checks, pooling, and sanitized errors. |
packages/learning/src/errors.mjs |
Broadens the commit-outcome documentation beyond disk failures; no behavior change. |
packages/learning/src/config.mjs |
Supports selecting PostgreSQL with an environment-supplied runtime URL. |
packages/learning/src/cli.mjs |
Adds the separate migrate command. |
packages/learning/README.md |
Documents PostgreSQL setup, permissions, testing, and retention. |
packages/learning/package.json |
Adds the optional driver and database-test command. |
packages/learning/package-lock.json |
Locks the PostgreSQL driver and its dependencies. |
packages/learning/index.mjs |
Exports the PostgreSQL provider. |
packages/learning/index.d.mts |
Declares the provider’s TypeScript interface. |
packages/learning/contracts/v1/provider-manifest.schema.json |
Expands accepted destination formats, including bracketed IPv6 addresses. |
docs/adr/0001-learning-extension-architecture.md |
Records PostgreSQL as a built-in shared-storage option. |
.github/workflows/learning-ci.yml |
Adds a PostgreSQL service and runs database tests. |
Review effort: Max (adaptive)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 836fcecf-e7a9-4975-acd2-bf761098f711
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 836fcecf-e7a9-4975-acd2-bf761098f711
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 836fcecf-e7a9-4975-acd2-bf761098f711
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 836fcecf-e7a9-4975-acd2-bf761098f711
nshki
force-pushed
the
nshki/feat/learning/postgres-provider
branch
from
November 25, 2026 19:16
6aaff57 to
af09950
Compare
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.


Why
Shared installations need to store learnings in PostgreSQL without giving the running application permission to change the database schema.
What changes
The learning package can use PostgreSQL as a memory provider. It keeps records in its own schema, locks writes by repository, and checks learning versions before updating them. SQLite remains the default.
An operator runs
replica-learning migratewith a separate migration connection before using the runtime connection. The guide explains the required permissions and how PostgreSQL backups and old row versions affect deletion.Storybook screenshots
Not applicable; this does not change story presentation.