Skip to content

Linger is An Open-Source Personal Agent That Runs Fully on Your PC. We aim to break Big Tech’s grip on AI by bringing powerful local AI to everyday computers through efficient model–harness co-design, so everyone can run their own.

test(teamhub): run the scanned-flag migration test in the migration history suite

muterCfe4627c31b49
diff --git a/apps/teamhub/migrations/00871_drop_scanned_document_texts.sql b/apps/teamhub/migrations/00871_drop_scanned_document_texts.sql
index c83f17c8..a19a8b31 100644
--- a/apps/teamhub/migrations/00871_drop_scanned_document_texts.sql
+++ b/apps/teamhub/migrations/00871_drop_scanned_document_texts.sql
@@ -1,10 +1,12 @@
-- +goose Up
-- Document texts come only from text layers, never from OCR, so a ready PDF
-- text always has one and the scanned flag goes away; a PDF without text is
--- still rejected from the Wiki as scanned. Texts OCR wrote are converted once
--- to what the normalizer gives now: a PDF read by OCR alone has no text and a
--- raster image is unsupported. Memory's hourly reconciliation then drops any
--- of them it indexed.
+-- still rejected from the Wiki as scanned. Texts that came from OCR alone are
+-- converted once: a PDF read by OCR alone has no text and a raster image is
+-- unsupported, and Memory's hourly reconciliation drops any of them it
+-- indexed. A PDF with a text layer keeps its stored text, including lines OCR
+-- added for its image areas, until a new Version replaces it; nothing is
+-- normalized again.
UPDATE document_texts
SET status = 'no_text', markdown = '', markdown_sha256 = NULL,
search_text = '', longest_line_bytes = 0, updated_at = clock_timestamp()
diff --git a/apps/teamhub/tests/integration/drop_scanned_document_texts_migration_test.go b/apps/teamhub/tests/integration/drop_scanned_document_texts_migration_test.go
index 16964eb8..816976d5 100644
--- a/apps/teamhub/tests/integration/drop_scanned_document_texts_migration_test.go
+++ b/apps/teamhub/tests/integration/drop_scanned_document_texts_migration_test.go
@@ -1,3 +1,5 @@
+//go:build integration_migration_history
+
package integration_test
import (
@@ -5,30 +7,22 @@ import (
"os"
"testing"
- "github.com/jackc/pgx/v5"
"github.com/jackc/pgx/v5/pgxpool"
- "github.com/jackc/pgx/v5/stdlib"
"github.com/pressly/goose/v3"
)
-// Texts OCR wrote before the scanned flag was dropped are converted to what
-// the normalizer gives now, so a scan stays out of the Wiki and an image has
-// no searchable text; SVG and ordinary texts are untouched.
+// Texts that came from OCR alone are converted before the scanned flag is
+// dropped, so a scan stays out of the Wiki and an image has no searchable
+// text; SVG and ordinary texts are untouched.
func TestDropScannedDocumentTextsConvertsOCRTexts(t *testing.T) {
- allowParallelIntegrationTest(t)
ctx := context.Background()
- databaseURL := newIntegrationDatabaseWithoutSkills(t)
- config, err := pgx.ParseConfig(databaseURL)
- if err != nil {
- t.Fatal(err)
- }
- db := stdlib.OpenDB(*config)
- t.Cleanup(func() { _ = db.Close() })
- provider, err := goose.NewProvider(goose.DialectPostgres, db, os.DirFS("../../migrations"))
+ databaseURL := newEmptyDatabase(t, "drop_scanned")
+ db := openMigrationTestDatabase(t, databaseURL)
+ provider, err := goose.NewProvider(goose.DialectPostgres, db, os.DirFS(teamHubMigrationDirectory(t)))
if err != nil {
t.Fatal(err)
}
- if _, err := provider.DownTo(ctx, 870); err != nil {
+ if _, err := provider.UpTo(ctx, 870); err != nil {
t.Fatal(err)
}
insertUnifiedDocumentIdentityFixture(t, ctx, db)