add GitHub Actions workflow for Postgres memory tests#95
Conversation
|
@Siddhant-K-code, this is first on the resolution, going forward i will work on the core implementation on PostgreSQL. Do let me know if there are any conflicts with this plan |
Siddhant-K-code
left a comment
There was a problem hiding this comment.
Thanks for picking up #74! A CI workflow is the right starting point, but this PR can't merge without the actual implementation alongside it.
Blockers
go test -tags=postgres ./...will find nothing to run -- there's nopostgres.goorpostgres_test.goinpkg/memory/. The workflow would either silently pass (no-op) or fail. Please include the implementation in this PR.- Issue #74 has specific requirements before merging:
OnLifecycleEventmust be implemented (not a no-op), and the//go:build postgrestag is needed to keep the default binary lean (pgx adds ~5MB).
Workflow issues
- Actions are unpinned (
actions/checkout@v4,actions/setup-go@v4). The repo pins all actions to full commit SHAs -- please match that convention. - The "Wait for Postgres" step is redundant -- the service container already has
--health-cmd pg_isreadywith retries. Remove it.
Happy to review again once postgres.go, postgres_test.go, and the lifecycle event implementation are included.
…tgresStore tests - Removed `buildCacheBoundaryHint` and `buildSensitivityMetadata` functions from SQLiteStore as they were not utilized. - Introduced comprehensive test suite for PostgresStore covering core functionalities, including storing, recalling, forgetting, and expiring memories. - Added tests for lifecycle events, deduplication, and TTL handling in PostgresStore.
|
@Siddhant-K-code PTAL |
| --health-interval 5s --health-timeout 5s --health-retries 5 | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 |
There was a problem hiding this comment.
Wrong action version — actions/checkout v6 doesn't exist.
The current stable release is v4. This SHA either belongs to a different action or was fabricated. Use the correct pin:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2Or simply actions/checkout@v4 if you're not pinning by SHA.
There was a problem hiding this comment.
@Siddhant-K-code this is the same checkout version used in the CI.yml
| - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | ||
|
|
||
| - name: Set up Go | ||
| uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0 |
There was a problem hiding this comment.
Same issue — actions/setup-go v6 doesn't exist. Current stable is v5.
- uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0There was a problem hiding this comment.
Points to the same commit hash used in the ci.yml to setup go 1.24. Would you want me to downgrade this?
| env: | ||
| POSTGRES_DSN: postgres://postgres:postgres@localhost:5432/distill_test?sslmode=disable | ||
| run: | | ||
| go test -tags=postgres ./... -v |
There was a problem hiding this comment.
This will pass vacuously right now — there are no *_test.go files with the postgres build tag yet, so go test -tags=postgres ./... runs zero postgres-specific tests and exits 0.
That's fine for a draft, but worth noting: the CI green light here doesn't mean the implementation is tested. Tests need to land before this workflow is meaningful.
There was a problem hiding this comment.
@Siddhant-K-code The postgres_test.go ( ref ) is present with the postgres tag, go running the tag will run the required test suite for postgres package.
| go 1.24.0 | ||
|
|
||
| require ( | ||
| github.com/jackc/pgx/v5 v5.7.2 |
There was a problem hiding this comment.
pgx/v5 is added as an unconditional direct dependency, but the Postgres code is behind a //go:build postgres tag.
This means every default build — including CI, local dev, and releases — downloads and links pgx even when Postgres support isn't used. That's unnecessary bloat for users who only need SQLite.
Options:
- Accept it (simplest — pgx is a well-maintained library and the overhead is small).
- Move pgx to an
indirectcomment with a note explaining it's only active with-tags=postgres.
Either way, please add a comment in the PR description explaining the decision so it's not a surprise to reviewers.
| @@ -150,19 +157,12 @@ go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.40.0 h1:MzfofMZN8ulNqob | |||
| go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.40.0/go.mod h1:E73G9UFtKRXrxhBsHtG00TB5WxX57lpsQzogDkqBTz8= | |||
There was a problem hiding this comment.
Unrelated change — the OTel v1.43.0 removals in this file don't belong in this PR.
These are a rebase artifact from PR #75 (the Go version fix). Please rebase onto main to drop them — they make the diff harder to review and have nothing to do with Postgres support.
There was a problem hiding this comment.
Merged latest main into this branch
|
|
||
| // buildCacheBoundaryHint derives a hint from recalled memories. | ||
| // Entries with relevance >= 0.7 are treated as stable this turn. | ||
| func buildCacheBoundaryHint(memories []RecalledMemory) *CacheBoundaryHint { |
There was a problem hiding this comment.
These two helpers are only used by postgres.go — why are they in the shared helpers.go?
buildCacheBoundaryHint and buildSensitivityMetadata are not called by sqlite.go. Adding them to a shared file without a shared consumer is confusing — a reader of helpers.go will wonder where they're used.
Move them into postgres.go, or (better) call them from sqlite.go too so the SQLite backend gets the same behaviour. The SQLite Recall path likely has the same gap.
There was a problem hiding this comment.
Both these methods were being used in sqlite.go ref and also were needed in postgres.go, hence I moved them to helpers.go
| CREATE INDEX IF NOT EXISTS idx_memories_referenced ON memories(last_referenced); | ||
| CREATE INDEX IF NOT EXISTS idx_memories_expired ON memories(expired); | ||
| ` | ||
| _, err := ps.dbPool.Exec(context.Background(), schema) |
There was a problem hiding this comment.
Run each DDL statement separately, not as one concatenated string.
When multiple statements are batched into a single Exec, a failure mid-way gives you an error message that doesn't tell you which statement failed. Separate calls make failures obvious:
stmts := []string{
`CREATE TABLE IF NOT EXISTS memories (...)`,
`CREATE TABLE IF NOT EXISTS memory_tags (...)`,
`CREATE INDEX IF NOT EXISTS idx_memory_tags_tag ON ...`,
// ...
}
for _, s := range stmts {
if _, err := ps.dbPool.Exec(ctx, s); err != nil {
return err
}
}|
Good start on the Postgres backend. Since this is a draft I'm not blocking, but flagging the things that need to be fixed before it's ready to merge. Must fix before merge
Worth addressing before merge
Known / expected for a draft
|
|
@Siddhant-K-code have addressed the review comments' PTAL |
|
@Siddhant-K-code is this feature for the project still being actively pursued? Wanted to confirm to dig deeper into the project. Thank you! |
|
Hey @AmitKarnam, I've been occupied with multiple things at the moment, will come back to review it ASAP! |
Plan to work on Issue #74 . Starting with a CI workflow, will continue with
postgres.goandpostgres_test.goin thememorypackage▎ pgx/v5 is a direct dependency in go.mod even though Postgres support is gated behind //go:build postgres. The Go module system doesn't support build-tag-conditional dependencies, so this is intentional — it's a small overhead accepted in exchange for keeping the module structure simple. A separate module would be needed to fully isolate it.