Skip to content

release: dev → main — pgserve auth + tsvector QA fix#52

Merged
namastex888 merged 3 commits intomainfrom
dev
Mar 31, 2026
Merged

release: dev → main — pgserve auth + tsvector QA fix#52
namastex888 merged 3 commits intomainfrom
dev

Conversation

@namastex888
Copy link
Copy Markdown
Collaborator

@namastex888 namastex888 commented Mar 31, 2026

Summary

Hotfix release: two bugs found during QA of the pgserve storage feature.

Fixes (PR #51)

  1. pgserve auth: Connection string needed postgres:postgres credentials — pgserve uses password auth by default
  2. tsvector size limit: PostgreSQL tsvector caps at 1MB input. JSONL lines >1MB crashed ingestion. Fixed with left(content, 500000) in the GENERATED column.

QA Evidence

  • 26MB JSONL (8651 records) ingests successfully
  • pg_search() returns results from large context
  • All 191 tests pass
  • No regressions on small context workflows

Summary by CodeRabbit

  • Chores
    • Patch version released (0.260331.2)
    • Optimized full-text search performance

github-actions Bot and others added 3 commits March 31, 2026 15:14
Two bugs found during QA with 26MB JSONL:

1. pgserve uses password auth (default: postgres/postgres) but the
   connection string had no credentials. Fix: add user:pass to URI.

2. PostgreSQL tsvector has a 1MB input limit. JSONL lines >1MB caused
   "string is too long for tsvector" error. Fix: use left(content, 500000)
   in the GENERATED column to cap tsvector input at 500K chars.
fix(storage): pgserve auth credentials + tsvector size limit
@namastex888 namastex888 merged commit 1ef5a7b into main Mar 31, 2026
6 checks passed
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 31, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: bf8e4fce-342c-48db-99ad-18b7954b0885

📥 Commits

Reviewing files that changed from the base of the PR and between 5f940a2 and 27aa554.

📒 Files selected for processing (3)
  • package.json
  • src/storage.ts
  • src/version.ts

📝 Walkthrough

Walkthrough

Version bump to 0.260331.2 across package metadata. Storage layer updated to truncate content to 500,000 characters for full-text search indexing and connection string modified to use explicit PostgreSQL credentials with IP address instead of localhost.

Changes

Cohort / File(s) Summary
Version Updates
package.json, src/version.ts
Version constant and package version incremented from 0.260331.1 to 0.260331.2.
Database Storage Configuration
src/storage.ts
Full-text search index now operates on truncated content (left(content, 500000)); connection string changed from localhost to explicit credentials and 127.0.0.1 (postgresql://postgres:postgres@127.0.0.1:${port}/${database}).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A tiny hop in version space,
From point-one to point-two we race,
Content truncated to keep it lean,
And credentials now explicit, seen,
Small changes, but deliberate and true!

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dev

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request increments the package version and introduces a truncation limit of 500,000 characters for full-text search indexing to prevent errors with large content. It also updates the database connection string to use explicit credentials and a loopback IP address. Review feedback points out that the schema change will not be applied to existing installations due to the 'IF NOT EXISTS' clause and identifies a security risk regarding the hardcoded database credentials.

Comment thread src/storage.ts
session_id TEXT,
content TEXT NOT NULL,
content_tsvector TSVECTOR GENERATED ALWAYS AS (to_tsvector('english', content)) STORED
content_tsvector TSVECTOR GENERATED ALWAYS AS (to_tsvector('english', left(content, 500000))) STORED
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The CREATE TABLE IF NOT EXISTS statement (line 26) will not update the schema for users who already have the records table initialized (e.g., in persistent mode). Consequently, the content_tsvector column will retain its old definition without the left() truncation, and ingestion of large content will still fail. Since ingest() already truncates this table, you might consider ensuring the schema is updated by dropping and recreating the column or the table during the initialization phase.

Comment thread src/storage.ts
/** Connection string for the running pgserve instance */
get connectionString(): string {
return `postgresql://localhost:${this.port}/${RLMX_DB}`;
return `postgresql://postgres:postgres@127.0.0.1:${this.port}/${RLMX_DB}`;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security-high high

Hardcoding credentials (postgres:postgres) in the connection string is a security risk and reduces flexibility. It is recommended to use environment variables (e.g., process.env.PGUSER, process.env.PGPASSWORD) or include these in the StorageConfig to allow for custom configurations.

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