Skip to content

fix(schema): widen filename columns from VARCHAR(500) to TEXT#150

Open
Tet-9 wants to merge 1 commit into
entrius:testfrom
Tet-9:fix/134-filename-varchar-to-text
Open

fix(schema): widen filename columns from VARCHAR(500) to TEXT#150
Tet-9 wants to merge 1 commit into
entrius:testfrom
Tet-9:fix/134-filename-varchar-to-text

Conversation

@Tet-9
Copy link
Copy Markdown
Contributor

@Tet-9 Tet-9 commented May 30, 2026

Summary

pr_files.filename, pr_files.previous_filename, and pr_file_contents.filename were defined as VARCHAR(500). Valid Git file paths can exceed 500 characters, causing Postgres to reject PR file ingestion with value too long for type character varying(500), leaving affected PRs without file metadata or scoring data.

Root Cause

The schema used a fixed VARCHAR(500) for Git file paths, but GitHub can return file paths longer than 500 characters from /pulls/:number/files. The ingestion path passes file.filename directly to the DB with no truncation or validation.

Changes

  • packages/db/08_pr_files.sql: filename and previous_filename widened to TEXT
  • packages/db/09_pr_file_contents.sql: filename widened to TEXT
  • packages/db/26_alter_filename_to_text.sql: migration for existing deployments
  • packages/das/src/entities/PrFile.entity.ts: @PrimaryColumn type explicitly set to "text"
  • packages/das/src/entities/PrFileContent.entity.ts: @PrimaryColumn type explicitly set to "text"

Testing

Lint confirmed only pre-existing errors in cache.module.ts, unrelated to this change.

Fixes #134

pr_files.filename, pr_files.previous_filename, and
pr_file_contents.filename were defined as VARCHAR(500). Valid Git file
paths can exceed 500 characters, causing Postgres to reject PR file
ingestion with 'value too long for type character varying(500)', leaving
affected PRs without scoring data.

Changes:
- packages/db/08_pr_files.sql: filename and previous_filename -> TEXT
- packages/db/09_pr_file_contents.sql: filename -> TEXT
- packages/db/26_alter_filename_to_text.sql: migration for existing deployments
- PrFile.entity.ts: @PrimaryColumn type explicitly set to 'text'
- PrFileContent.entity.ts: @PrimaryColumn type explicitly set to 'text'

Fixes entrius#134
@xiao-xiao-mao xiao-xiao-mao Bot added the bug Something isn't working label May 30, 2026
@Tet-9
Copy link
Copy Markdown
Contributor Author

Tet-9 commented May 30, 2026

@anderdc , you may please review this now 🫡

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Critical: PR File Ingestion Fails for Valid Git Paths Longer Than 500 Characters

1 participant