fix: PostgreSQL search function type mismatches and auto-detect embed…#798
fix: PostgreSQL search function type mismatches and auto-detect embed…#798IM-21-DEV wants to merge 3 commits intocoleam00:mainfrom
Conversation
…ding dimensions Fixes multiple critical bugs in PostgreSQL search functions: 1. Type Mismatches: - VARCHAR → TEXT for url and source_id columns - FLOAT → DOUBLE PRECISION for similarity scores - Fixes 'structure of query does not match function result type' errors 2. Hardcoded Embedding Dimensions: - Removed vector(1536) constraints from wrapper functions - Added auto-detection using vector_dims() function - Now supports all dimensions: 384, 768, 1024, 1536, 3072 3. Missing Permissions (migration 011): - Added RLS policies for archon_page_metadata table - Added GRANT statements for all roles - Fixes 'permission denied for table' errors Benefits: - Works with ANY embedding model (Google 768-dim, OpenAI 1536-dim, etc.) - Future-proof for new embedding dimensions - No backend code changes required - Type-safe function calls Affected functions: - hybrid_search_archon_crawled_pages - hybrid_search_archon_crawled_pages_multi - hybrid_search_archon_code_examples - hybrid_search_archon_code_examples_multi - match_archon_crawled_pages - match_archon_crawled_pages_multi - match_archon_code_examples - match_archon_code_examples_multi Files modified: - migration/complete_setup.sql - migration/0.1.0/002_add_hybrid_search_tsvector.sql - migration/0.1.0/011_add_page_metadata_table.sql 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
WalkthroughReplaces fixed-dimension embeddings with generic VECTOR in hybrid search wrappers, auto-detects embedding dimension via vector_dims, and delegates to dimension-aware multi-functions; standardizes return types (url -> TEXT, similarity -> DOUBLE PRECISION). Adds RLS, policies, grants, and an updated_at trigger for archon_page_metadata. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant Client
participant Wrapper as Wrapper (hybrid_search_...)
participant DBfunc as vector_dims()
participant Multi as Multi-variant Function
participant DB as DB (embedding_* cols)
Client->>Wrapper: call(query_embedding VECTOR, query_text?, ...)
Wrapper->>DBfunc: vector_dims(query_embedding)
DBfunc-->>Wrapper: detected_dimension
Wrapper->>Multi: invoke(query_embedding, detected_dimension, query_text?, ...)
Multi->>DB: SELECT FROM embedding_<detected_dimension> (dynamic SQL)
DB-->>Multi: rows with similarity (double precision)
Multi-->>Client: merged results (url TEXT, similarity DOUBLE PRECISION, [match_type/rank_score])
note right of Multi: dynamic selection of embedding column and full-text/vector merge
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (4)
migration/complete_setup.sql (3)
402-408: Return type updates look good (TEXT url, DOUBLE PRECISION similarity). Align base table columns too.Functions now return url TEXT and similarity DOUBLE PRECISION. Underlying tables still define url as VARCHAR (Lines 204, 252). Recommend widening those to TEXT for consistency and to avoid implicit casts in every call.
Apply in this file’s table definitions:
- url VARCHAR NOT NULL, + url TEXT NOT NULL,Do this for:
- archon_crawled_pages.url (around Line 204)
- archon_code_examples.url (around Line 252)
Also applies to: 451-457, 477-484, 526-534, 560-567, 607-615, 696-704, 807-815
460-465: Auto-detect via vector_dims is good; consider using helper and fix outdated comments.
- You introduced detect_embedding_dimension() and get_embedding_column_name() but wrappers manually use vector_dims and multi-fns repeat a CASE. Consider:
- Using detect_embedding_dimension(query_embedding) in wrappers.
- Using get_embedding_column_name(embedding_dimension) in multi-fns to remove duplicated CASE logic.
- Comments labeling these as “Legacy ... defaults to 1536D” are now inaccurate; they auto-detect. Update docstrings.
Also applies to: 537-543, 677-683, 818-824
426-441: Dynamic SQL and parameter mapping LGTM. One minor: name final LIMIT param to avoid confusion.$2 is used both as vector limit and the final combined LIMIT. Since $2 == match_count, it works. Renaming max_vector_results to final_limit (or passing match_count separately) reduces coupling.
Also applies to: 502-517, 592-656, 729-795
migration/0.1.0/002_add_hybrid_search_tsvector.sql (1)
80-145: Dynamic SQL paths look correct; small naming refinement suggested.Final LIMIT uses $2 (vector limit), equal to match_count. Consider passing match_count as the final limit directly or renaming variable to final_limit to avoid future coupling errors.
Also applies to: 217-285
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
migration/0.1.0/002_add_hybrid_search_tsvector.sql(4 hunks)migration/0.1.0/011_add_page_metadata_table.sql(1 hunks)migration/complete_setup.sql(8 hunks)
🔇 Additional comments (2)
migration/0.1.0/002_add_hybrid_search_tsvector.sql (2)
49-56: Return type standardization LGTM (TEXT url, DOUBLE PRECISION similarity).Matches the PR goal of type-safe returns; avoids FLOAT precision surprises and VARCHAR limitations.
Also applies to: 185-193
38-46: Vector type and auto-dimension detection are correct and future-proof.Using generic VECTOR plus vector_dims() in wrappers cleanly supports multiple embedding sizes without backend changes.
Also applies to: 174-182, 286-294, 146-173, 306-314
…iple - Change service_role policy from TO public to TO service_role - Change authenticated policy from FOR ALL to FOR SELECT (read-only) - Change GRANT for anon/authenticated from ALL to SELECT - Addresses CodeRabbit security review comments
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (4)
migration/0.1.0/011_add_page_metadata_table.sql (4)
72-74: Consider FORCE RLS to prevent owner-bypass.Add FORCE ROW LEVEL SECURITY so even table owners don’t bypass RLS (non‑superusers).
Apply:
ALTER TABLE archon_page_metadata ENABLE ROW LEVEL SECURITY; +ALTER TABLE archon_page_metadata FORCE ROW LEVEL SECURITY;
84-90: Verify authenticated read scope (currently all rows).USING (true) exposes every row to all authenticated users. If you’re multi‑tenant, restrict by source/ownership (e.g., join to a membership/ACL table) or add a predicate keyed by auth.uid()/org.
Example pattern (adjust to your ACL tables):
CREATE POLICY "Allow authenticated to read permitted pages" ON archon_page_metadata FOR SELECT TO authenticated USING ( EXISTS ( SELECT 1 FROM source_memberships m WHERE m.source_id = archon_page_metadata.source_id AND m.user_id = auth.uid() ) );
91-97: Remove anon GRANT or add a matching RLS policy.anon currently has GRANT SELECT but no RLS policy, so it still cannot read. Keep it intentional by removing the GRANT to avoid confusion; or add an explicit anon policy if public read is desired.
GRANT ALL ON TABLE archon_page_metadata TO postgres; -GRANT SELECT ON TABLE archon_page_metadata TO anon; GRANT SELECT ON TABLE archon_page_metadata TO authenticated; GRANT ALL ON TABLE archon_page_metadata TO service_role;
72-97: updated_at won’t auto‑refresh; add a trigger.updated_at has DEFAULT now() but won’t change on UPDATEs. Add a small trigger to keep it accurate.
-- Function (idempotent) CREATE OR REPLACE FUNCTION archon_set_updated_at() RETURNS trigger AS $$ BEGIN NEW.updated_at = NOW(); RETURN NEW; END; $$ LANGUAGE plpgsql; -- Trigger (create if missing) DO $$ BEGIN IF NOT EXISTS ( SELECT 1 FROM pg_trigger WHERE tgname = 'trg_archon_page_metadata_set_updated_at' ) THEN CREATE TRIGGER trg_archon_page_metadata_set_updated_at BEFORE UPDATE ON archon_page_metadata FOR EACH ROW EXECUTE FUNCTION archon_set_updated_at(); END IF; END; $$;
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
migration/0.1.0/011_add_page_metadata_table.sql(1 hunks)
🔇 Additional comments (1)
migration/0.1.0/011_add_page_metadata_table.sql (1)
75-83: RLS posture tightened correctly (public → service_role).Good fix. Full access is limited to service_role with explicit policy; matches least‑privilege intent.
Security Improvements (addresses CodeRabbit review): - Remove anon GRANT from archon_page_metadata (no matching RLS policy) - Add updated_at trigger for automatic timestamp updates on UPDATE - Document intentional security decisions (least privilege) Update-Resistant Fix Scripts: - Add 01.Update-Fix/ directory with complete fix documentation - ARCHON-FIX-COMPLETE-WITH-MATCH-TYPE.sql: Main search function fixes - ARCHON-FIX-SECURITY-RLS-POLICIES.sql: Security and trigger fixes - APPLY-VIA-SUPABASE-SQL-EDITOR.sql: UI-optimized fix script - test_rag_search.py: Automated verification script Documentation: - ARCHON-BUG-ANALYSIS.md: Root cause analysis and fault attribution - ARCHON-RAG-FIX-COMPLETE-SUMMARY.md: Complete fix summary - README.md: Usage instructions for post-update fixes This commit ensures: ✅ All fixes can be re-applied after git pull ✅ Security best practices (RLS + GRANTs + Triggers) ✅ Comprehensive documentation for troubleshooting ✅ Automated testing for verification Co-authored-by: CodeRabbit <noreply@coderabbit.ai>
There was a problem hiding this comment.
Actionable comments posted: 4
🧹 Nitpick comments (2)
01.Update-Fix/README.md (1)
1-149: Documentation looks comprehensive.The README provides clear usage instructions, file catalog, bug descriptions, and verification examples. The static analysis hints regarding markdown formatting (missing language specifiers in code blocks) are optional improvements rather than critical issues.
If desired, add language specifiers to fenced code blocks to improve syntax highlighting:
-``` +```text ERROR: structure of query does not match function result type01.Update-Fix/test_rag_search.py (1)
12-94: Basic test coverage is adequate.The test validates HTTP response, required fields, and basic type checking for similarity_score. This should catch the major regressions the PR addresses (type mismatches, missing fields).
Consider adding explicit validation for the DOUBLE PRECISION fix:
# Verify similarity_score uses double precision (8 bytes) sim = result.get('similarity_score') if sim is not None: # In Python, float is always double precision (8 bytes) # but we can verify it's not truncated to 4-byte precision assert isinstance(sim, float), f"Expected float, got {type(sim)}" # Optionally check for precision indicators (e.g., many decimal places)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (12)
01.Update-Fix/APPLY-VIA-SUPABASE-SQL-EDITOR.sql(1 hunks)01.Update-Fix/ARCHON-BUG-ANALYSIS.md(1 hunks)01.Update-Fix/ARCHON-FIX-COMPLETE-WITH-MATCH-TYPE.sql(1 hunks)01.Update-Fix/ARCHON-FIX-GRANTS-ONLY.sql(1 hunks)01.Update-Fix/ARCHON-FIX-HYBRID-SEARCH-DOUBLE-PRECISION.sql(1 hunks)01.Update-Fix/ARCHON-FIX-PAGE-METADATA-PERMISSIONS.sql(1 hunks)01.Update-Fix/ARCHON-FIX-SEARCH-FUNCTIONS-COMPLETE.sql(1 hunks)01.Update-Fix/ARCHON-FIX-SECURITY-RLS-POLICIES.sql(1 hunks)01.Update-Fix/ARCHON-RAG-FIX-COMPLETE-SUMMARY.md(1 hunks)01.Update-Fix/README.md(1 hunks)01.Update-Fix/test_rag_search.py(1 hunks)migration/0.1.0/011_add_page_metadata_table.sql(1 hunks)
🧰 Additional context used
🪛 LanguageTool
01.Update-Fix/ARCHON-BUG-ANALYSIS.md
[grammar] ~1-~1: Ersetze das Satzzeichen
Context: # Archon RAG Bug Analysis - Root Cause Report ## TL;DR - Was ist p...
(QB_NEW_DE_OTHER_ERROR_IDS_REPLACEMENT_PUNCTUATION_DASH_–)
[grammar] ~1-~1: Hier könnte ein Fehler sein.
Context: ...hon RAG Bug Analysis - Root Cause Report ## TL;DR - Was ist passiert? **KOMBINATION...
(QB_NEW_DE)
[grammar] ~3-~3: Ersetze das Satzzeichen
Context: ...AG Bug Analysis - Root Cause Report ## TL;DR - Was ist passiert? **KOMBINATION aus Us...
(QB_NEW_DE_OTHER_ERROR_IDS_REPLACEMENT_PUNCTUATION_DASH_–)
[grammar] ~3-~3: Hier könnte ein Fehler sein.
Context: ...use Report ## TL;DR - Was ist passiert? **KOMBINATION aus User Error + Original Gi...
(QB_NEW_DE)
[grammar] ~5-~5: Ergänze ein Satzzeichen
Context: ... KOMBINATION aus User Error + Original Git Bugs 1. ✅ User hatte VARCHAR→TEXT...
(QB_NEW_DE_OTHER_ERROR_IDS_MISSING_PUNCTUATION_ORIGINALDASHGITDASHBUGS)
[grammar] ~5-~5: Ergänze ein Satzzeichen
Context: ...OMBINATION aus User Error + Original Git Bugs** 1. ✅ User hatte VARCHAR→TEXT Fix...
(QB_NEW_DE_OTHER_ERROR_IDS_MISSING_PUNCTUATION_ORIGINALDASHGITDASHBUGS)
[grammar] ~5-~5: Hier könnte ein Fehler sein.
Context: ...ATION aus User Error + Original Git Bugs** 1. ✅ User hatte VARCHAR→TEXT Fix am 2025-09...
(QB_NEW_DE)
[grammar] ~7-~7: Ergänze ein Leerzeichen
Context: ... + Original Git Bugs** 1. ✅ User hatte VARCHAR→TEXT Fix am 2025-09-30 bereits gemacht und d...
(QB_NEW_DE_OTHER_ERROR_IDS_MISSING_ORTHOGRAPHY_SPACE)
[grammar] ~8-~8: Ersetze das Satzzeichen
Context: ...rn wurden diese Fixes NICHT angewendet ("minimal updates - nur .env") 3. ❌ Mehrere Bugs ...
(QB_NEW_DE_OTHER_ERROR_IDS_REPLACEMENT_PUNCTUATION_QUOTE_„)
[grammar] ~8-~8: Hier könnte ein Fehler sein.
Context: ... diese Fixes NICHT angewendet ("minimal updates - nur .env") 3. ❌ Mehrere Bugs existier...
(QB_NEW_DE)
[grammar] ~8-~8: Ersetze das Satzzeichen
Context: ...ixes NICHT angewendet ("minimal updates - nur .env") 3. ❌ Mehrere Bugs existieren im O...
(QB_NEW_DE_OTHER_ERROR_IDS_REPLACEMENT_PUNCTUATION_DASH_–)
[grammar] ~8-~8: Ersetze das Satzzeichen
Context: ...CHT angewendet ("minimal updates - nur .env") 3. ❌ Mehrere Bugs existieren im Origin...
(QB_NEW_DE_OTHER_ERROR_IDS_REPLACEMENT_PUNCTUATION_QUOTE_L_DOUBLE_QUOT)
[grammar] ~9-~9: Ergänze ein Satzzeichen
Context: ...3. ❌ Mehrere Bugs existieren im Original Git Repo und wurden nie gefixt --- ## ...
(QB_NEW_DE_OTHER_ERROR_IDS_MISSING_PUNCTUATION_ORIGINALDASHGITDASHREPO)
[grammar] ~9-~9: Ergänze ein Satzzeichen
Context: ... Mehrere Bugs existieren im Original Git Repo und wurden nie gefixt --- ## Deta...
(QB_NEW_DE_OTHER_ERROR_IDS_MISSING_PUNCTUATION_ORIGINALDASHGITDASHREPO)
[grammar] ~9-~9: Hier könnte ein Fehler sein.
Context: ... Original Git Repo und wurden nie gefixt --- ## Detaillierte Analyse ### Issue 1: VARCH...
(QB_NEW_DE)
[grammar] ~13-~13: Hier könnte ein Fehler sein.
Context: ...nie gefixt --- ## Detaillierte Analyse ### Issue 1: VARCHAR → TEXT (Dokumentiert, a...
(QB_NEW_DE)
[grammar] ~15-~15: Hier könnte ein Fehler sein.
Context: ...XT (Dokumentiert, aber nicht angewendet) **Status in CLAUDE-ARCHON-UPDATE.md (Secti...
(QB_NEW_DE)
[grammar] ~17-~17: Ergänze ein Wort
Context: ...Dokumentiert, aber nicht angewendet) **Status in CLAUDE-ARCHON-UPDATE.md (Section 5)*...
(QB_NEW_DE_OTHER_ERROR_IDS_MISSING_NOUN)
[grammar] ~17-~17: Entferne ein Satzzeichen
Context: ...in CLAUDE-ARCHON-UPDATE.md (Section 5)**: PostgreSQL Hybrid Search Functions Type Fix (2025-09-30) - Changed all "url VARCHAR" to "url TEXT" in RETURNS TABLE - Update-Resistant: ⚠️ MEDIUM - Migration files can be overwritten - Action Required: When updating, check migration files and replace VARCHAR with TEXT Was passiert ist: - User hatte diesen ...
(QB_NEW_DE_OTHER_ERROR_IDS_UNNECESSARY_PUNCTUATION_COLON)
[grammar] ~25-~25: Entferne ein Wort
Context: ...e VARCHAR with TEXT ``` Was passiert ist: - User hatte diesen Fix am 30.09.2025 g...
(QB_NEW_DE_OTHER_ERROR_IDS_UNNECESSARY_NOUN)
[grammar] ~26-~26: Ergänze ein Satzzeichen
Context: ...: - User hatte diesen Fix am 30.09.2025 gemacht ✅ - Beim DB Restore gestern: "minimal u...
(QB_NEW_DE_OTHER_ERROR_IDS_MISSING_PUNCTUATION_PERIOD)
[grammar] ~27-~27: Ergänze ein Satzzeichen
Context: ...en Fix am 30.09.2025 gemacht ✅ - Beim DB Restore gestern: "minimal updates - nur ...
(QB_NEW_DE_OTHER_ERROR_IDS_MISSING_PUNCTUATION_DBDASHRESTORE)
[grammar] ~27-~27: Ersetze das Satzzeichen
Context: ...25 gemacht ✅ - Beim DB Restore gestern: "minimal updates - nur .env" ❌ - Fix wurde NICHT...
(QB_NEW_DE_OTHER_ERROR_IDS_REPLACEMENT_PUNCTUATION_QUOTE_„)
[grammar] ~27-~27: Ersetze das Satzzeichen
Context: ...im DB Restore gestern: "minimal updates - nur .env" ❌ - Fix wurde NICHT angewende...
(QB_NEW_DE_OTHER_ERROR_IDS_REPLACEMENT_PUNCTUATION_DASH_–)
[grammar] ~27-~27: Ersetze das Satzzeichen
Context: ...estore gestern: "minimal updates - nur .env" ❌ - Fix wurde NICHT angewendet ❌ **Sch...
(QB_NEW_DE_OTHER_ERROR_IDS_REPLACEMENT_PUNCTUATION_QUOTE_L_DOUBLE_QUOTPERIOD)
[grammar] ~28-~28: Ergänze ein Satzzeichen
Context: ...updates - nur .env" ❌ - Fix wurde NICHT angewendet ❌ Schuld: 🔴 USER ERROR - Doku...
(QB_NEW_DE_OTHER_ERROR_IDS_MISSING_PUNCTUATION_PERIOD)
[grammar] ~28-~28: Hier könnte ein Fehler sein.
Context: ...r .env" ❌ - Fix wurde NICHT angewendet ❌ Schuld: 🔴 USER ERROR - Dokumentie...
(QB_NEW_DE)
[grammar] ~30-~30: Entferne ein Wort
Context: ...nv" ❌ - Fix wurde NICHT angewendet ❌ Schuld: 🔴 USER ERROR - Dokumentierter Fix ...
(QB_NEW_DE_OTHER_ERROR_IDS_UNNECESSARY_NOUN)
[grammar] ~30-~30: Ersetze das Satzzeichen
Context: ...wendet ❌ Schuld: 🔴 USER ERROR - Dokumentierter Fix nicht angewendet **...
(QB_NEW_DE_OTHER_ERROR_IDS_REPLACEMENT_PUNCTUATION_DASH_DOKUMENTIERTER_–_DOKUMENTIERTER)
[grammar] ~30-~30: Hier könnte ein Fehler sein.
Context: ...ndet ❌ Schuld: 🔴 USER ERROR - Dokumentierter Fix nicht angewendet **Original Git St...
(QB_NEW_DE)
[grammar] ~30-~30: Hier könnte ein Fehler sein.
Context: ...** - Dokumentierter Fix nicht angewendet Original Git Status (HEAD: commit 3f08...
(QB_NEW_DE)
[grammar] ~32-~32: Ergänze ein Satzzeichen
Context: ...tierter Fix nicht angewendet Original Git Status (HEAD: commit 3f0815b): ```...
(QB_NEW_DE_OTHER_ERROR_IDS_MISSING_PUNCTUATION_ORIGINALDASHGITDASHSTATUS)
[grammar] ~32-~32: Ergänze ein Satzzeichen
Context: ...ter Fix nicht angewendet Original Git Status (HEAD: commit 3f0815b): ```bash...
(QB_NEW_DE_OTHER_ERROR_IDS_MISSING_PUNCTUATION_ORIGINALDASHGITDASHSTATUS)
[grammar] ~32-~32: Hier könnte ein Fehler sein.
Context: ...nal Git Status** (HEAD: commit 3f0815b): bash $ git show HEAD:migration/complete_setup.sql | grep "url VARCHAR" url VARCHAR # ❌ BUG existiert im Original Git! Schuld: 🔴 AUCH GIT BUG - VARCHAR ...
(QB_NEW_DE)
[grammar] ~38-~38: Entferne ein Wort
Context: ...❌ BUG existiert im Original Git! ``` Schuld: 🔴 AUCH GIT BUG - VARCHAR existiert...
(QB_NEW_DE_OTHER_ERROR_IDS_UNNECESSARY_NOUN)
[grammar] ~38-~38: Hier könnte ein Fehler sein.
Context: ...rt im Original Git! ``` Schuld: 🔴 AUCH GIT BUG - VARCHAR existiert im Or...
(QB_NEW_DE)
[grammar] ~38-~38: Passe das Symbol an
Context: ... Git! ``` Schuld: 🔴 AUCH GIT BUG - VARCHAR existiert im Original Repo -...
(QB_NEW_DE_OTHER_ERROR_IDS_REPLACEMENT_OTHER)
[grammar] ~38-~38: Hier könnte ein Fehler sein.
Context: ...t! ``` Schuld: 🔴 AUCH GIT BUG - VARCHAR existiert im Original Repo ---...
(QB_NEW_DE)
[grammar] ~38-~38: Ergänze ein Satzzeichen
Context: ...IT BUG** - VARCHAR existiert im Original Repo --- ### Issue 2: Hardcoded vector...
(QB_NEW_DE_OTHER_ERROR_IDS_MISSING_PUNCTUATION_ORIGINALDASHREPO)
[grammar] ~38-~38: Hier könnte ein Fehler sein.
Context: ...G** - VARCHAR existiert im Original Repo --- ### Issue 2: Hardcoded vector(1536) Dimensio...
(QB_NEW_DE)
[grammar] ~42-~42: Entferne ein Leerzeichen
Context: ...--- ### Issue 2: Hardcoded vector(1536) Dimension **Original Git (commit 85bd6b...
(QB_NEW_DE_OTHER_ERROR_IDS_UNNECESSARY_ORTHOGRAPHY_SPACE)
[grammar] ~42-~42: Hier könnte ein Fehler sein.
Context: ...ssue 2: Hardcoded vector(1536) Dimension **Original Git (commit 85bd6bc - September...
(QB_NEW_DE)
[grammar] ~44-~44: Ersetze das Satzzeichen
Context: ...mension Original Git (commit 85bd6bc - September 2025): ```sql CREATE OR REP...
(QB_NEW_DE_OTHER_ERROR_IDS_REPLACEMENT_PUNCTUATION_DASH_–)
[grammar] ~44-~44: Hier könnte ein Fehler sein.
Context: ...Git (commit 85bd6bc - September 2025)**: sql CREATE OR REPLACE FUNCTION hybrid_search_archon_crawled_pages( query_embedding vector(1536), -- ❌ HARDCODED! ... ) Problem: - Wrapper function ruft `_mul...
(QB_NEW_DE)
[grammar] ~52-~52: Passe das Symbol an
Context: ...❌ HARDCODED! ... ) ``` Problem: - Wrapper function ruft _multi mit hardcoded dimension=1...
(QB_NEW_DE_OTHER_ERROR_IDS_REPLACEMENT_OTHER)
[grammar] ~53-~53: Korrigiere das Wort
Context: ...*: - Wrapper function ruft _multi mit hardcoded dimension=1536 - Aber User nutzt Google...
(QB_NEW_DE_OTHER_ERROR_IDS_REPLACEMENT_ORTHOGRAPHY_SPELLING)
[grammar] ~53-~53: Korrigiere das Wort
Context: ...er function ruft _multi mit hardcoded dimension=1536 - Aber User nutzt Google text-embedding...
(QB_NEW_DE_OTHER_ERROR_IDS_REPLACEMENT_ORTHOGRAPHY_SPELLING)
[grammar] ~54-~54: Hier könnte ein Fehler sein.
Context: ...- Aber User nutzt Google text-embedding-004 = 768 dimensions - → Sucht in `embeddin...
(QB_NEW_DE)
[grammar] ~54-~54: Bessere die Wortform aus
Context: ...er User nutzt Google text-embedding-004 = 768 dimensions - → Sucht in embedding_1536 Spalte (N...
(QB_NEW_DE_OTHER_ERROR_IDS_REPLACEMENT_NOUN_FORM)
[grammar] ~55-~55: Entferne ein Leerzeichen
Context: ...dimensions - → Sucht in embedding_1536 Spalte (NULL) statt embedding_768 (DAT...
(QB_NEW_DE_OTHER_ERROR_IDS_UNNECESSARY_ORTHOGRAPHY_SPACE)
[grammar] ~55-~55: Hier könnte ein Fehler sein.
Context: ...alte (NULL) statt embedding_768 (DATA) Dokumentiert?: ❌ NEIN - nicht in CLAUD...
(QB_NEW_DE)
[grammar] ~57-~57: Ergänze ein Wort
Context: ... (NULL) statt embedding_768 (DATA) Dokumentiert?: ❌ NEIN - nicht in CLAUDE-ARCHON-UPDA...
(QB_NEW_DE_OTHER_ERROR_IDS_MISSING_NOUN)
[grammar] ~57-~57: Ersetze das Satzzeichen
Context: ...dding_768` (DATA) Dokumentiert?: ❌ NEIN - nicht in CLAUDE-ARCHON-UPDATE.md **Fix ...
(QB_NEW_DE_OTHER_ERROR_IDS_REPLACEMENT_PUNCTUATION_DASH_–)
[grammar] ~57-~57: Korrigiere das Wort
Context: ... NEIN - nicht in CLAUDE-ARCHON-UPDATE.md Fix existiert im Git?: ❌ NEIN - Bug ...
(QB_NEW_DE_OTHER_ERROR_IDS_REPLACEMENT_ORTHOGRAPHY_SPACE)
[grammar] ~58-~58: Ersetze das Satzzeichen
Context: ...-UPDATE.md Fix existiert im Git?: ❌ NEIN - Bug existiert bis HEAD Schuld: 🔴 ...
(QB_NEW_DE_OTHER_ERROR_IDS_REPLACEMENT_PUNCTUATION_DASH_–)
[grammar] ~58-~58: Hier könnte ein Fehler sein.
Context: ... Git?**: ❌ NEIN - Bug existiert bis HEAD Schuld: 🔴 ORIGINAL GIT BUG - Nie ...
(QB_NEW_DE)
[grammar] ~60-~60: Entferne ein Wort
Context: ...?**: ❌ NEIN - Bug existiert bis HEAD Schuld: 🔴 ORIGINAL GIT BUG - Nie gefixt -...
(QB_NEW_DE_OTHER_ERROR_IDS_UNNECESSARY_NOUN)
[grammar] ~60-~60: Hier könnte ein Fehler sein.
Context: ...AD Schuld: 🔴 ORIGINAL GIT BUG - Nie gefixt --- ### Issue 3: FLOAT vs ...
(QB_NEW_DE)
[grammar] ~60-~60: Hier könnte ein Fehler sein.
Context: ...**: 🔴 ORIGINAL GIT BUG - Nie gefixt --- ### Issue 3: FLOAT vs DOUBLE PRECISION **Or...
(QB_NEW_DE)
[grammar] ~64-~64: Ergänze ein Satzzeichen
Context: ...* - Nie gefixt --- ### Issue 3: FLOAT vs DOUBLE PRECISION **Original Git (HEAD)...
(QB_NEW_DE_OTHER_ERROR_IDS_MISSING_PUNCTUATION_VSPERIOD)
[grammar] ~64-~64: Hier könnte ein Fehler sein.
Context: ... ### Issue 3: FLOAT vs DOUBLE PRECISION Original Git (HEAD): ```sql RETURNS TA...
(QB_NEW_DE)
[grammar] ~66-~66: Hier könnte ein Fehler sein.
Context: ...UBLE PRECISION Original Git (HEAD): sql RETURNS TABLE ( ... similarity FLOAT, -- ❌ FLOAT = REAL (4 bytes) match_type TEXT ) Problem: - PostgreSQL ts_rank_cd() r...
(QB_NEW_DE)
[grammar] ~78-~78: Hier könnte ein Fehler sein.
Context: ...L = 4 bytes) - → Type mismatch error in column 8 Dokumentiert?: ❌ NEIN **Fix existiert ...
(QB_NEW_DE)
[grammar] ~80-~80: Ergänze ein Wort
Context: ... - → Type mismatch error in column 8 Dokumentiert?: ❌ NEIN Fix existiert im Git?: ❌ ...
(QB_NEW_DE_OTHER_ERROR_IDS_MISSING_NOUN)
[grammar] ~80-~80: Korrigiere das Wort
Context: ...r in column 8 Dokumentiert?: ❌ NEIN Fix existiert im Git?: ❌ NEIN - Bug ...
(QB_NEW_DE_OTHER_ERROR_IDS_REPLACEMENT_ORTHOGRAPHY_SPACE)
[grammar] ~81-~81: Ersetze das Satzzeichen
Context: ...**: ❌ NEIN Fix existiert im Git?: ❌ NEIN - Bug existiert bis HEAD Schuld: 🔴 ...
(QB_NEW_DE_OTHER_ERROR_IDS_REPLACEMENT_PUNCTUATION_DASH_–)
[grammar] ~81-~81: Hier könnte ein Fehler sein.
Context: ... Git?**: ❌ NEIN - Bug existiert bis HEAD Schuld: 🔴 ORIGINAL GIT BUG - Nie ...
(QB_NEW_DE)
[grammar] ~83-~83: Entferne ein Wort
Context: ...?**: ❌ NEIN - Bug existiert bis HEAD Schuld: 🔴 ORIGINAL GIT BUG - Nie gefixt -...
(QB_NEW_DE_OTHER_ERROR_IDS_UNNECESSARY_NOUN)
[grammar] ~83-~83: Hier könnte ein Fehler sein.
Context: ...AD Schuld: 🔴 ORIGINAL GIT BUG - Nie gefixt --- ### Issue 4: match_typ...
(QB_NEW_DE)
[grammar] ~83-~83: Hier könnte ein Fehler sein.
Context: ...**: 🔴 ORIGINAL GIT BUG - Nie gefixt --- ### Issue 4: match_type Column Status: ...
(QB_NEW_DE)
[grammar] ~87-~87: Ergänze ein Satzzeichen
Context: ...Nie gefixt --- ### Issue 4: match_type Column Status: ✅ Korrekt im Origina...
(QB_NEW_DE_OTHER_ERROR_IDS_MISSING_PUNCTUATION_MATCH_TYPEDASHCOLUMN)
[grammar] ~87-~87: Hier könnte ein Fehler sein.
Context: ...ixt --- ### Issue 4: match_type Column Status: ✅ Korrekt im Original Git ```s...
(QB_NEW_DE)
[grammar] ~89-~89: Hier könnte ein Fehler sein.
Context: ...n Status: ✅ Korrekt im Original Git sql RETURNS TABLE ( ... match_type TEXT -- ✅ Existiert ) Was passiert ist: - Mein erster Fix (A...
(QB_NEW_DE)
[grammar] ~97-~97: Entferne ein Wort
Context: ...T -- ✅ Existiert ) ``` Was passiert ist: - Mein erster Fix (ARCHON-FIX-SEARCH-FU...
(QB_NEW_DE_OTHER_ERROR_IDS_UNNECESSARY_NOUN)
[grammar] ~98-~98: Ergänze ein Satzzeichen
Context: ...UNCTIONS-COMPLETE.sql) hatte match_type ENTFERNT - Ich hatte die FULL OUTER JOIN Logik v...
(QB_NEW_DE_OTHER_ERROR_IDS_MISSING_PUNCTUATION_PERIOD)
[grammar] ~99-~99: Ergänze ein Satzzeichen
Context: ...ENTFERNT - Ich hatte die FULL OUTER JOIN Logik vereinfacht - Python Code erwartet...
(QB_NEW_DE_OTHER_ERROR_IDS_MISSING_PUNCTUATION_JOINDASHLOGIK)
[grammar] ~99-~99: Ergänze ein Satzzeichen
Context: ...T - Ich hatte die FULL OUTER JOIN Logik vereinfacht - Python Code erwartet aber `row["match...
(QB_NEW_DE_OTHER_ERROR_IDS_MISSING_PUNCTUATION_PERIOD)
[grammar] ~100-~100: Ergänze ein Satzzeichen
Context: ...LL OUTER JOIN Logik vereinfacht - Python Code erwartet aber row["match_type"] ...
(QB_NEW_DE_OTHER_ERROR_IDS_MISSING_PUNCTUATION_PYTHONDASHCODE)
[grammar] ~100-~100: Hier könnte ein Fehler sein.
Context: ...vereinfacht - Python Code erwartet aber row["match_type"] Schuld: 🔴 MEIN FEHLER - Incomplet...
(QB_NEW_DE)
[grammar] ~102-~102: Entferne ein Wort
Context: ...de erwartet aber row["match_type"] Schuld: 🔴 MEIN FEHLER - Incomplete fix --...
(QB_NEW_DE_OTHER_ERROR_IDS_UNNECESSARY_NOUN)
[grammar] ~102-~102: Hier könnte ein Fehler sein.
Context: ...type"]` Schuld: 🔴 MEIN FEHLER - Incomplete fix --- ### Issue 5: Permi...
(QB_NEW_DE)
[grammar] ~102-~102: Hier könnte ein Fehler sein.
Context: ...d**: 🔴 MEIN FEHLER - Incomplete fix --- ### Issue 5: Permission Denied (archon_page_...
(QB_NEW_DE)
[grammar] ~106-~106: Hier könnte ein Fehler sein.
Context: ...Permission Denied (archon_page_metadata) Original Migration (011_add_page_metad...
(QB_NEW_DE)
[grammar] ~108-~108: Hier könnte ein Fehler sein.
Context: ...ion** (011_add_page_metadata_table.sql): sql CREATE TABLE archon_page_metadata (...); -- ❌ KEINE GRANT statements -- ❌ KEINE RLS policies Dokumentiert?: ❌ NEIN **Fix existiert ...
(QB_NEW_DE)
[grammar] ~115-~115: Ergänze ein Wort
Context: ...atements -- ❌ KEINE RLS policies ``` Dokumentiert?: ❌ NEIN Fix existiert im Git?: ❌ ...
(QB_NEW_DE_OTHER_ERROR_IDS_MISSING_NOUN)
[grammar] ~115-~115: Korrigiere das Wort
Context: ... policies ``` Dokumentiert?: ❌ NEIN Fix existiert im Git?: ❌ NEIN - Bug ...
(QB_NEW_DE_OTHER_ERROR_IDS_REPLACEMENT_ORTHOGRAPHY_SPACE)
[grammar] ~116-~116: Ersetze das Satzzeichen
Context: ...**: ❌ NEIN Fix existiert im Git?: ❌ NEIN - Bug existiert im Original Schuld: ...
(QB_NEW_DE_OTHER_ERROR_IDS_REPLACEMENT_PUNCTUATION_DASH_–)
[grammar] ~116-~116: Hier könnte ein Fehler sein.
Context: ...t?**: ❌ NEIN - Bug existiert im Original Schuld: 🔴 ORIGINAL GIT BUG - Migr...
(QB_NEW_DE)
[grammar] ~118-~118: Entferne ein Wort
Context: ...: ❌ NEIN - Bug existiert im Original Schuld: 🔴 ORIGINAL GIT BUG - Migration inc...
(QB_NEW_DE_OTHER_ERROR_IDS_UNNECESSARY_NOUN)
[grammar] ~118-~118: Hier könnte ein Fehler sein.
Context: ...al Schuld: 🔴 ORIGINAL GIT BUG - Migration incomplete --- ## Zusammenf...
(QB_NEW_DE)
[grammar] ~118-~118: Hier könnte ein Fehler sein.
Context: ...RIGINAL GIT BUG** - Migration incomplete --- ## Zusammenfassung: Wer hat was versaut? |...
(QB_NEW_DE)
[style] ~122-~122: Das Wort ‚was‘ kommt sehr häufig in der Umgangssprache vor. Möchten Sie es durch eine Alternative ersetzen, um Ihren Text formeller zu machen?
Context: ...plete --- ## Zusammenfassung: Wer hat was versaut? | Issue | User Error | Git Bu...
(WAS_DUMMES)
[grammar] ~122-~122: Hier könnte ein Fehler sein.
Context: ...## Zusammenfassung: Wer hat was versaut? | Issue | User Error | Git Bug | Mein Fe...
(QB_NEW_DE)
[style] ~128-~128: Stilistisch kann es schöner sein, Doppelungen ganzer Phrasen in einem Satz zu vermeiden.
Context: ... Nein | | FLOAT→DOUBLE | ❌ Nein | ✅ Ja | ❌ Nein | | match_type removed | ❌ Nein | ❌ N...
(DOPPELUNGEN_PHRASEN)
[style] ~130-~130: Stilistisch kann es schöner sein, Doppelungen ganzer Phrasen in einem Satz zu vermeiden.
Context: ...in | ✅ Ja | | Permission denied | ❌ Nein | ✅ Ja | ❌ Nein | --- ## Update-Resistenz unse...
(DOPPELUNGEN_PHRASEN)
[grammar] ~130-~130: Hier könnte ein Fehler sein.
Context: ...sion denied** | ❌ Nein | ✅ Ja | ❌ Nein | --- ## Update-Resistenz unserer Fixes ### ❌ NI...
(QB_NEW_DE)
[grammar] ~134-~134: Hier könnte ein Fehler sein.
Context: ... --- ## Update-Resistenz unserer Fixes ### ❌ NICHT Update-Resistent (werden übersch...
(QB_NEW_DE)
[grammar] ~136-~136: Passe den Tippfehler an
Context: ...stenz unserer Fixes ### ❌ NICHT Update-Resistent (werden überschrieben): Alle SQL-Fixes...
(QB_NEW_DE_OTHER_ERROR_IDS_REPLACEMENT_ORTHOGRAPHY_OTHERCASE)
[grammar] ~136-~136: Hier könnte ein Fehler sein.
Context: ...Update-Resistent (werden überschrieben): Alle SQL-Fixes in `/Users/illa/Archon/mi...
(QB_NEW_DE)
[grammar] ~138-~138: Ergänze ein Satzzeichen
Context: .../illa/Archon/migration/` werden beim Git Pull überschrieben! *Betroffene Files...
(QB_NEW_DE_OTHER_ERROR_IDS_MISSING_PUNCTUATION_GITDASHPULL)
[grammar] ~138-~138: Hier könnte ein Fehler sein.
Context: ...on/werden beim Git Pull überschrieben! **Betroffene Files**: -migration/complet...
(QB_NEW_DE)
[grammar] ~140-~140: Korrigiere das Wort
Context: ...ll überschrieben! Betroffene Files: - migration/complete_setup.sql ← überschrieben - migration/0.1.0/002_add_hybrid_search_tsvector.sql ← überschrieben ### ✅ Fixes müssen ins Git Repo: **Option 1...
(QB_NEW_DE_OTHER_ERROR_IDS_REPLACEMENT_ORTHOGRAPHY_SPACE)
[grammar] ~144-~144: Ergänze ein Satzzeichen
Context: ...berschrieben ### ✅ Fixes müssen ins Git Repo: **Option 1: Pull Request ans Orig...
(QB_NEW_DE_OTHER_ERROR_IDS_MISSING_PUNCTUATION_GITDASHREPO)
[grammar] ~144-~144: Hier könnte ein Fehler sein.
Context: ...rieben ### ✅ Fixes müssen ins Git Repo: **Option 1: Pull Request ans Original Repo...
(QB_NEW_DE)
[grammar] ~146-~146: Ergänze ein Satzzeichen
Context: ...: Option 1: Pull Request ans Original Repo ``` Fix: Complete PostgreSQL sear...
(QB_NEW_DE_OTHER_ERROR_IDS_MISSING_PUNCTUATION_ORIGINALDASHREPO)
[grammar] ~146-~146: Hier könnte ein Fehler sein.
Context: ...Option 1: Pull Request ans Original Repo** Fix: Complete PostgreSQL search function bugs 1. VARCHAR → TEXT (url, source_id columns) 2. vector(1536) → VECTOR with auto-detection 3. FLOAT → DOUBLE PRECISION (similarity, rank_score) 4. Add missing GRANT statements to migration 011 Option 2: Fork & lokale Anpassungen - ...
(QB_NEW_DE)
[grammar] ~158-~158: Ergänze ein Satzzeichen
Context: ...en Fork maintainen - Nach jedem Upstream Pull: Fixes re-applyen **Option 3: Post...
(QB_NEW_DE_OTHER_ERROR_IDS_MISSING_PUNCTUATION_UPSTREAMDASHPULL)
[grammar] ~158-~158: Entferne ein Satzzeichen
Context: ...ainen - Nach jedem Upstream Pull: Fixes re-applyen Option 3: Post-Migration Script ```bas...
(QB_NEW_DE_OTHER_ERROR_IDS_UNNECESSARY_PUNCTUATION_REDASHAPPLYEN)
[grammar] ~160-~160: Entferne ein Leerzeichen
Context: ...s re-applyen Option 3: Post-Migration Script ```bash # Nach jedem Git Pull: ...
(QB_NEW_DE_OTHER_ERROR_IDS_UNNECESSARY_ORTHOGRAPHY_SPACE)
[grammar] ~160-~160: Hier könnte ein Fehler sein.
Context: ...plyen Option 3: Post-Migration Script bash # Nach jedem Git Pull: docker exec -i supabase-db psql -U postgres -d postgres < ARCHON-FIX-COMPLETE-WITH-MATCH-TYPE.sql --- ## Korrekte Update-Prozedur (für Zukunft) ...
(QB_NEW_DE)
[grammar] ~168-~168: Hier könnte ein Fehler sein.
Context: ...# Korrekte Update-Prozedur (für Zukunft) ### Schritt 1: Backup ```bash cd /Users/illa...
(QB_NEW_DE)
[grammar] ~170-~170: Hier könnte ein Fehler sein.
Context: ...dur (für Zukunft) ### Schritt 1: Backup bash cd /Users/illa/Archon/supabase docker exec supabase-db pg_dump -U postgres postgres > backup.sql ### Schritt 2: Git Pull ```bash cd /Users/il...
(QB_NEW_DE)
[grammar] ~176-~176: Hier könnte ein Fehler sein.
Context: ... backup.sql ### Schritt 2: Git Pullbash cd /Users/illa/Archon git pull ### Schritt 3: Fixes anwendenbash # 1. P...
(QB_NEW_DE)
[grammar] ~182-~182: Hier könnte ein Fehler sein.
Context: ... pull ### Schritt 3: Fixes anwendenbash # 1. Permission Fix (falls neue Tabellen) docker exec -i supabase-db psql -U postgres -d postgres < ARCHON-FIX-GRANTS-ONLY.sql # 2. Search Function Fix (IMMER!) docker exec -i supabase-db psql -U postgres -d postgres < ARCHON-FIX-COMPLETE-WITH-MATCH-TYPE.sql ### Schritt 4: Services neu startenbash ...
(QB_NEW_DE)
[grammar] ~191-~191: Hier könnte ein Fehler sein.
Context: ... ### Schritt 4: Services neu startenbash cd /Users/illa/Archon docker compose restart ### Schritt 5: Testpython import request...
(QB_NEW_DE)
[grammar] ~197-~197: Hier könnte ein Fehler sein.
Context: ...compose restart ### Schritt 5: Testpython import requests response = requests.post( 'http://localhost:8181/api/knowledge-items/search', headers={ 'Content-Type': 'application/json', 'Authorization': 'Bearer archon-claude-dev-key-2025' }, json={ 'query': 'test query', 'match_count': 5 } ) assert response.status_code == 200 assert response.json()['success'] == True print("✅ RAG search works!") ``` --- ## Empfehlung für Zukunft ### 1. Fix ins O...
(QB_NEW_DE)
[grammar] ~220-~220: Hier könnte ein Fehler sein.
Context: ...search works!") ``` --- ## Empfehlung für Zukunft ### 1. Fix ins Original Git Re...
(QB_NEW_DE)
[grammar] ~220-~220: Hier könnte ein Fehler sein.
Context: ...s!") ``` --- ## Empfehlung für Zukunft ### 1. Fix ins Original Git Repo submitten ...
(QB_NEW_DE)
[grammar] ~222-~222: Ergänze ein Satzzeichen
Context: ...ung für Zukunft ### 1. Fix ins Original Git Repo submitten PR Title: `fix: ...
(QB_NEW_DE_OTHER_ERROR_IDS_MISSING_PUNCTUATION_ORIGINALDASHGITDASHREPO)
[grammar] ~222-~222: Ergänze ein Satzzeichen
Context: ...für Zukunft ### 1. Fix ins Original Git Repo submitten PR Title: `fix: Comp...
(QB_NEW_DE_OTHER_ERROR_IDS_MISSING_PUNCTUATION_ORIGINALDASHGITDASHREPO)
[grammar] ~222-~222: Hier könnte ein Fehler sein.
Context: ...# 1. Fix ins Original Git Repo submitten PR Title: `fix: Complete PostgreSQL se...
(QB_NEW_DE)
[grammar] ~224-~224: Wähle ein passenderes Wort
Context: ...ix ins Original Git Repo submitten PR Title: `fix: Complete PostgreSQL search fun...
(QB_NEW_DE_OTHER_ERROR_IDS_REPLACEMENT_NOUN)
[grammar] ~224-~224: Hier könnte ein Fehler sein.
Context: ...ginal Git Repo submitten PR Title: fix: Complete PostgreSQL search function type mismatches and auto-detect embedding dimensions Changes: - `migration/complete_setup.s...
(QB_NEW_DE)
[grammar] ~226-~226: Hier könnte ein Fehler sein.
Context: ...tect embedding dimensions **Changes**: -migration/complete_setup.sql-migration/0.1.0/002_add_hybrid_search_tsvector.sql-migration/0.1.0/011_add_page_metadata_table.sql` ### 2. CLAUDE-ARCHON-UPDATE.md ergänzen Neu...
(QB_NEW_DE)
[grammar] ~231-~231: Hier könnte ein Fehler sein.
Context: ... ### 2. CLAUDE-ARCHON-UPDATE.md ergänzen Neue Section hinzufügen: ```markdown ###...
(QB_NEW_DE)
[grammar] ~233-~233: Hier könnte ein Fehler sein.
Context: ...TE.md ergänzen Neue Section hinzufügen: markdown ### **X. PostgreSQL Function Fixes (2025-10-14)** #### Auto-Detect Embedding Dimensions - Fixed: Hardcoded vector(1536) in wrapper functions - Now: Auto-detect using vector_dims() - supports 384/768/1024/1536/3072 #### Type Precision Fixes - Fixed: FLOAT → DOUBLE PRECISION for similarity/rank_score - Reason: ts_rank_cd() returns DOUBLE PRECISION #### Complete Fix Script Location: /Users/illa/Archon/ARCHON-FIX-COMPLETE-WITH-MATCH-TYPE.sql Apply after: Every git pull or database restore ### 3. Automated Test hinzufügen ```python ...
(QB_NEW_DE)
[grammar] ~250-~250: Hier könnte ein Fehler sein.
Context: ...re ### 3. Automated Test hinzufügen python # tests/integration/test_rag_search.py def test_rag_search_with_multi_dimensional_embeddings(): """Test RAG search works with 768-dim embeddings (Google)""" response = search("test", source="test-source") assert response.status_code == 200 assert len(response.json()['results']) > 0 ``` --- ## Fazit Was haben WIR versaut? - ❌ Us...
(QB_NEW_DE)
[grammar] ~263-~263: Hier könnte ein Fehler sein.
Context: ...son()['results']) > 0 ``` --- ## Fazit Was haben WIR versaut? - ❌ User: VARCH...
(QB_NEW_DE)
[grammar] ~265-~265: Hier könnte ein Fehler sein.
Context: ... --- ## Fazit Was haben WIR versaut? - ❌ User: VARCHAR→TEXT Fix nicht angewende...
(QB_NEW_DE)
[grammar] ~266-~266: Ergänze ein Leerzeichen
Context: ...t Was haben WIR versaut? - ❌ User: VARCHAR→TEXT Fix nicht angewendet beim Restore - ❌ I...
(QB_NEW_DE_OTHER_ERROR_IDS_MISSING_ORTHOGRAPHY_SPACE)
[grammar] ~267-~267: Entferne ein Leerzeichen
Context: ... nicht angewendet beim Restore - ❌ Ich: match_type column in erstem Fix entfernt **Was war schon...
(QB_NEW_DE_OTHER_ERROR_IDS_UNNECESSARY_ORTHOGRAPHY_SPACE)
[grammar] ~267-~267: Hier könnte ein Fehler sein.
Context: ...match_type column in erstem Fix entfernt Was war schon im Git kaputt? - ❌ VARCH...
(QB_NEW_DE)
[grammar] ~269-~269: Hier könnte ein Fehler sein.
Context: ...entfernt Was war schon im Git kaputt? - ❌ VARCHAR statt TEXT (nie ins Git gefixt...
(QB_NEW_DE)
[grammar] ~270-~270: Korrigiere die Fehler
Context: ... VARCHAR statt TEXT (nie ins Git gefixt) - ❌ Hardcoded vector(1536) dimension - ❌ F...
(QB_NEW_DE_OTHER_ERROR_IDS_REPLACEMENT_MULTITOKEN)
[grammar] ~271-~271: Korrigiere die Fehler
Context: ...s Git gefixt) - ❌ Hardcoded vector(1536) dimension - ❌ FLOAT statt DOUBLE PRECISION - ❌ Migra...
(QB_NEW_DE_OTHER_ERROR_IDS_REPLACEMENT_MULTITOKEN)
[grammar] ~272-~272: Korrigiere das Wort
Context: ...mension - ❌ FLOAT statt DOUBLE PRECISION - ❌ Migration 011 ohne GRANT statements *...
(QB_NEW_DE_OTHER_ERROR_IDS_REPLACEMENT_ORTHOGRAPHY_SPACE)
[grammar] ~273-~273: Hier könnte ein Fehler sein.
Context: ...E PRECISION - ❌ Migration 011 ohne GRANT statements Lösung für Zukunft: 1. ✅ PR ans Origin...
(QB_NEW_DE)
[grammar] ~276-~276: Ergänze ein Satzzeichen
Context: ...sung für Zukunft**: 1. ✅ PR ans Original Repo mit allen Fixes 2. ✅ Post-migration...
(QB_NEW_DE_OTHER_ERROR_IDS_MISSING_PUNCTUATION_ORIGINALDASHREPO)
[grammar] ~277-~277: Passe das Symbol an
Context: ...Original Repo mit allen Fixes 2. ✅ Post-migration script für lokale Updates 3. ✅ Integration tes...
(QB_NEW_DE_OTHER_ERROR_IDS_REPLACEMENT_OTHER)
[grammar] ~278-~278: Entferne ein Leerzeichen
Context: ...igration script für lokale Updates 3. ✅ Integration tests für RAG search Update-Resistenz: ⚠...
(QB_NEW_DE_OTHER_ERROR_IDS_UNNECESSARY_ORTHOGRAPHY_SPACE)
[grammar] ~278-~278: Hier könnte ein Fehler sein.
Context: ...e Updates 3. ✅ Integration tests für RAG search Update-Resistenz:
(QB_NEW_DE)
[grammar] ~280-~280: Ersetze das Satzzeichen
Context: ...G search Update-Resistenz:
(QB_NEW_DE_OTHER_ERROR_IDS_REPLACEMENT_PUNCTUATION_DASH_–)
[grammar] ~280-~280: Ergänze ein Satzzeichen
Context: ...
(QB_NEW_DE_OTHER_ERROR_IDS_MISSING_PUNCTUATION_GITDASHPULL)
[grammar] ~280-~280: Hier könnte ein Fehler sein.
Context: ...ach jedem Git Pull neu angewendet werden
(QB_NEW_DE)
01.Update-Fix/ARCHON-RAG-FIX-COMPLETE-SUMMARY.md
[grammar] ~5-~5: There might be a mistake here.
Context: ...ete Summary ## Problem Overview After restoring Archon database from backup, RAG search...
(QB_NEW_EN)
[grammar] ~12-~12: There might be a mistake here.
Context: ...table.sql` created the table but forgot: - RLS (Row Level Security) policies - TABL...
(QB_NEW_EN)
[grammar] ~13-~13: There might be a mistake here.
Context: ...got: - RLS (Row Level Security) policies - TABLE-level GRANT statements Fix: `...
(QB_NEW_EN)
[grammar] ~16-~16: There might be a mistake here.
Context: ... TABLE-level GRANT statements Fix: ARCHON-FIX-PAGE-METADATA-PERMISSIONS.sql - Enabled RLS - Created policies for publi...
(QB_NEW_EN)
[grammar] ~17-~17: There might be a mistake here.
Context: ...-METADATA-PERMISSIONS.sql` - Enabled RLS - Created policies for public/authenticate...
(QB_NEW_EN)
[grammar] ~18-~18: There might be a mistake here.
Context: ...es for public/authenticated/service_role - Executed GRANT statements via Supabase S...
(QB_NEW_EN)
[grammar] ~25-~25: There might be a mistake here.
Context: ... ### 2. Type Mismatch: VARCHAR vs TEXT Error: ``` structure of query does not...
(QB_NEW_EN)
[grammar] ~32-~32: There might be a mistake here.
Context: ...varying in column 2 ``` Root Cause: - Database restored WITHOUT 2025-09-30 typ...
(QB_NEW_EN)
[grammar] ~41-~41: There might be a mistake here.
Context: ...ong Embedding Dimension (Hardcoded 1536)** Error: RAG search returned 0 results d...
(QB_NEW_EN)
[grammar] ~82-~82: There might be a mistake here.
Context: ...Type Mismatch: FLOAT vs DOUBLE PRECISION** Error: ``` structure of query does not...
(QB_NEW_EN)
[grammar] ~89-~89: There might be a mistake here.
Context: ...ecision in column 8 ``` Root Cause: - Functions returned FLOAT (which is REAL ...
(QB_NEW_EN)
[grammar] ~101-~101: There might be a mistake here.
Context: ...h failed: 'match_type' **Root Cause**: - My initial SQL fixes removed thematch_...
(QB_NEW_EN)
[grammar] ~133-~133: There might be a mistake here.
Context: ...uest Field Name (User Error)** Error: Source filter not working in API reques...
(QB_NEW_EN)
[grammar] ~161-~161: There might be a mistake here.
Context: ...ngle SQL file fixes ALL database issues: 1. ✅ VARCHAR → TEXT for url and source_id 2...
(QB_NEW_EN)
[grammar] ~162-~162: There might be a mistake here.
Context: .... ✅ VARCHAR → TEXT for url and source_id 2. ✅ FLOAT → DOUBLE PRECISION for similarit...
(QB_NEW_EN)
[grammar] ~163-~163: There might be a mistake here.
Context: ... PRECISION for similarity and rank_score 3. ✅ Removed VECTOR(1536) constraint → gene...
(QB_NEW_EN)
[grammar] ~164-~164: There might be a mistake here.
Context: ...VECTOR(1536) constraint → generic VECTOR 4. ✅ Auto-detect dimension using vector_dim...
(QB_NEW_EN)
[grammar] ~165-~165: There might be a mistake here.
Context: ...uto-detect dimension using vector_dims() 5. ✅ Restored match_type column with FULL O...
(QB_NEW_EN)
[grammar] ~186-~186: There might be a mistake here.
Context: ... 4. **Restart Archon server** to clear Python cache: bash docker comp...
(QB_NEW_EN)
[grammar] ~234-~234: There might be a mistake here.
Context: ...rint(response.json()) ``` Expected: - status_code: 200 - `total_found`: 5 - `search_mode`...
(QB_NEW_EN)
[grammar] ~235-~235: There might be a mistake here.
Context: ... ``` Expected: - status_code: 200 - `total_found`: 5 - `search_mode`: "hybrid" - All resu...
(QB_NEW_EN)
[grammar] ~236-~236: There might be a mistake here.
Context: ... - status_code: 200 - total_found: 5 - search_mode: "hybrid" - All results from `source_id...
(QB_NEW_EN)
[grammar] ~237-~237: There might be a mistake here.
Context: ...otal_found: 5 - search_mode: "hybrid" - All results from source_id`: 'a0e86e00d...
(QB_NEW_EN)
[grammar] ~238-~238: There might be a mistake here.
Context: ...lts from source_id: 'a0e86e00d806739a' - Valid similarity_score values (not 0.0...
(QB_NEW_EN)
[grammar] ~239-~239: There might be a mistake here.
Context: ...alid similarity_score values (not 0.0) - Valid rerank_score values ## Final St...
(QB_NEW_EN)
[grammar] ~246-~246: There might be a mistake here.
Context: ...ll Issues Resolved** | Issue | Status | |-------|--------| | Permission denied |...
(QB_NEW_EN)
[grammar] ~247-~247: There might be a mistake here.
Context: ...* | Issue | Status | |-------|--------| | Permission denied | ✅ FIXED | | Crawl ...
(QB_NEW_EN)
[grammar] ~248-~248: There might be a mistake here.
Context: ...-------| | Permission denied | ✅ FIXED | | Crawl successful | ✅ VERIFIED | | VARC...
(QB_NEW_EN)
[grammar] ~249-~249: There might be a mistake here.
Context: ...IXED | | Crawl successful | ✅ VERIFIED | | VARCHAR/TEXT mismatch | ✅ FIXED | | Di...
(QB_NEW_EN)
[grammar] ~250-~250: There might be a mistake here.
Context: ...ED | | VARCHAR/TEXT mismatch | ✅ FIXED | | Dimension mismatch (1536 vs 768) | ✅ F...
(QB_NEW_EN)
[grammar] ~251-~251: There might be a mistake here.
Context: ...nsion mismatch (1536 vs 768) | ✅ FIXED | | FLOAT/DOUBLE PRECISION mismatch | ✅ FI...
(QB_NEW_EN)
[grammar] ~252-~252: There might be a mistake here.
Context: ...AT/DOUBLE PRECISION mismatch | ✅ FIXED | | Missing match_type column | ✅ FIXED | ...
(QB_NEW_EN)
[grammar] ~253-~253: There might be a mistake here.
Context: ... | Missing match_type column | ✅ FIXED | | Source filter working | ✅ VERIFIED | |...
(QB_NEW_EN)
[grammar] ~254-~254: There might be a mistake here.
Context: ...| | Source filter working | ✅ VERIFIED | | RAG search returns results | ✅ WORKING...
(QB_NEW_EN)
[grammar] ~259-~259: There might be a mistake here.
Context: ... Database crawled: 1 page, 5 chunks Embeddings generated: 5 × 768-dimens...
(QB_NEW_EN)
[grammar] ~260-~260: There might be a mistake here.
Context: ...onal vectors (Google text-embedding-004) Search results: 5 relevant chunks fo...
(QB_NEW_EN)
[grammar] ~261-~261: There might be a mistake here.
Context: ...earch results**: 5 relevant chunks found Similarity scores: 0.60, 0.56, 0.54,...
(QB_NEW_EN)
[grammar] ~262-~262: There might be a mistake here.
Context: ...*: 0.60, 0.56, 0.54, 0.54, 0.52 (valid!) Match types: "vector", "hybrid", "ke...
(QB_NEW_EN)
[grammar] ~271-~271: There might be a mistake here.
Context: ...vs source_id) 5. Full testing: Test at database level AND API level 6. **Cache...
(QB_NEW_EN)
01.Update-Fix/README.md
[grammar] ~5-~5: There might be a mistake here.
Context: ...unctions und Security. ## 📋 Verwendung ### Nach jedem git pull oder Update: ```b...
(QB_NEW_EN)
[grammar] ~23-~23: There might be a mistake here.
Context: ...ix/test_rag_search.py ``` ## 📁 Dateien ### Haupt-Fixes (Beide anwenden!) - **ARCHON...
(QB_NEW_EN)
[grammar] ~26-~26: There might be a mistake here.
Context: ...HON-FIX-COMPLETE-WITH-MATCH-TYPE.sql** ⭐ - Fixes für Search Functions (Type Mismatc...
(QB_NEW_EN)
[grammar] ~27-~27: Ensure spelling is correct
Context: ...PLETE-WITH-MATCH-TYPE.sql** ⭐ - Fixes für Search Functions (Type Mismatches, Dime...
(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)
[grammar] ~30-~30: There might be a mistake here.
Context: ...RCHON-FIX-SECURITY-RLS-POLICIES.sql** 🔒 - Security Fixes (RLS Policies, GRANT Stat...
(QB_NEW_EN)
[grammar] ~31-~31: There might be a mistake here.
Context: ...y Fixes (RLS Policies, GRANT Statements) - Trigger für updated_at Timestamps - Fü...
(QB_NEW_EN)
[grammar] ~32-~32: There might be a mistake here.
Context: ...s) - Trigger für updated_at Timestamps - Führe diese Datei nach jedem Update aus!...
(QB_NEW_EN)
[style] ~33-~33: Using many exclamation marks might seem excessive (in this case: 3 exclamation marks for a text that’s 1699 characters long)
Context: ... Führe diese Datei nach jedem Update aus! ### Dokumentation - **ARCHON-RAG-FIX-C...
(EN_EXCESSIVE_EXCLAMATION)
[grammar] ~33-~33: There might be a mistake here.
Context: ...Führe diese Datei nach jedem Update aus! ### Dokumentation - **ARCHON-RAG-FIX-COMPLET...
(QB_NEW_EN)
[grammar] ~35-~35: There might be a mistake here.
Context: ...ach jedem Update aus! ### Dokumentation - ARCHON-RAG-FIX-COMPLETE-SUMMARY.md -...
(QB_NEW_EN)
[grammar] ~36-~36: There might be a mistake here.
Context: ...n - ARCHON-RAG-FIX-COMPLETE-SUMMARY.md - Vollständige Zusammenfassung aller Fixes...
(QB_NEW_EN)
[grammar] ~37-~37: There might be a mistake here.
Context: ...Vollständige Zusammenfassung aller Fixes - Schritt-für-Schritt Anleitung - **ARCHO...
(QB_NEW_EN)
[grammar] ~45-~45: There might be a mistake here.
Context: ...ewertung ### Historische Fixes (Archiv) - ARCHON-FIX-GRANTS-ONLY.sql - ARCHON-FIX-...
(QB_NEW_EN)
[grammar] ~46-~46: There might be a mistake here.
Context: ...es (Archiv) - ARCHON-FIX-GRANTS-ONLY.sql - ARCHON-FIX-HYBRID-SEARCH-DOUBLE-PRECISIO...
(QB_NEW_EN)
[grammar] ~47-~47: There might be a mistake here.
Context: ...N-FIX-HYBRID-SEARCH-DOUBLE-PRECISION.sql - ARCHON-FIX-PAGE-METADATA-PERMISSIONS.sql...
(QB_NEW_EN)
[grammar] ~48-~48: There might be a mistake here.
Context: ...ARCHON-FIX-PAGE-METADATA-PERMISSIONS.sql - ARCHON-FIX-SEARCH-FUNCTIONS-COMPLETE.sql...
(QB_NEW_EN)
[grammar] ~51-~51: There might be a mistake here.
Context: ...TE.sql ## 🐛 Welche Bugs werden gefixt? ### 1. VARCHAR → TEXT Mismatch ``` ERROR: st...
(QB_NEW_EN)
[grammar] ~106-~106: There might be a mistake here.
Context: ...ss: True Results: 5 ``` ## 🔄 PR Status Branch: `fix/postgresql-search-functio...
(QB_NEW_EN)
[grammar] ~126-~126: There might be a mistake here.
Context: ...ktionen**: 8 PostgreSQL Search Functions Betroffene Dateien: 3 Migration File...
(QB_NEW_EN)
[grammar] ~127-~127: There might be a mistake here.
Context: ...Betroffene Dateien*: 3 Migration Files Update-Resistenz:
(QB_NEW_EN)
[grammar] ~147-~147: There might be a mistake here.
Context: ...st-merge` --- Erstellt: 2025-10-14 Letztes Update: 2025-10-14 **Version...
(QB_NEW_EN)
[grammar] ~148-~148: There might be a mistake here.
Context: ...025-10-14 Letztes Update: 2025-10-14 Version: 1.0
(QB_NEW_EN)
[grammar] ~149-~149: There might be a mistake here.
Context: ...es Update**: 2025-10-14 Version: 1.0
(QB_NEW_EN)
🪛 markdownlint-cli2 (0.18.1)
01.Update-Fix/ARCHON-BUG-ANALYSIS.md
5-5: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
18-18: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
146-146: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
147-147: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
156-156: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
160-160: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
01.Update-Fix/ARCHON-RAG-FIX-COMPLETE-SUMMARY.md
27-27: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
84-84: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
01.Update-Fix/README.md
54-54: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
60-60: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
65-65: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
70-70: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
100-100: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
🔇 Additional comments (9)
01.Update-Fix/ARCHON-FIX-HYBRID-SEARCH-DOUBLE-PRECISION.sql (2)
14-70: LGTM! Solid dimension-aware implementation.The multi-version function correctly uses dynamic SQL with dimension-based column selection and explicit DOUBLE PRECISION casts. The CASE statement covers all documented dimensions (384, 768, 1024, 1536, 3072), and the format() call properly escapes identifiers with %I.
78-111: LGTM! Clean auto-detection wrapper.The wrapper properly auto-detects embedding dimensions using
vector_dims()and delegates to the multi-version. This eliminates hardcoded dimension assumptions and supports multiple embedding models transparently.01.Update-Fix/APPLY-VIA-SUPABASE-SQL-EDITOR.sql (2)
14-29: LGTM! Policies and grants properly scoped.The corrected policies scope full access to
service_role(not public) and limit authenticated users to read-only (FOR SELECT). Revoking ALL from anon and granting only SELECT to authenticated follows least privilege principles.
32-44: LGTM! Standard updated_at trigger pattern.The trigger function and trigger setup follows the standard PostgreSQL pattern for auto-updating timestamps. The trigger is created without an existence check, but the comment indicates this should be run via SQL editor where DROP TRIGGER IF EXISTS was already executed.
01.Update-Fix/ARCHON-BUG-ANALYSIS.md (1)
1-280: Comprehensive bug analysis documentation.The document provides a thorough root cause analysis of the issues encountered, categorizes responsibility, and outlines corrective actions. This is valuable documentation for understanding the changes in this PR.
migration/0.1.0/011_add_page_metadata_table.sql (3)
72-96: LGTM! RLS and grants properly secured.The policies are correctly scoped: full access to
service_roleonly, read-only (FOR SELECT) for authenticated users. Grants follow least privilege with anon intentionally omitted (per line 93 comment). This addresses the security issues flagged in previous reviews.Based on past review comments, which were addressed in commit 99eeef3.
98-119: LGTM! Idempotent trigger setup.The trigger function and trigger creation follow PostgreSQL best practices. The DO block ensures idempotent execution by checking for trigger existence before creation.
122-124: LGTM! Conflict-safe migration tracking.Using
ON CONFLICT DO NOTHINGmakes the migration insertion idempotent, preventing errors on re-runs.01.Update-Fix/test_rag_search.py (1)
96-163: Source filter test is well-structured.The test properly retrieves a sample source_id, then validates filtered results originate from the same source. The graceful handling of missing results (returning True to not fail the main test) is appropriate.
| GRANT ALL ON TABLE archon_page_metadata TO postgres; | ||
| GRANT ALL ON TABLE archon_page_metadata TO anon; | ||
| GRANT ALL ON TABLE archon_page_metadata TO authenticated; | ||
| GRANT ALL ON TABLE archon_page_metadata TO service_role; |
There was a problem hiding this comment.
Grant ALL to anon violates least privilege.
Granting ALL to anon allows anonymous users full access. Even with RLS policies, this is overly permissive unless explicitly required.
The corrected implementation in migration/0.1.0/011_add_page_metadata_table.sql intentionally omits anon from grants with a comment explaining the decision (line 93: "Note: anon has no GRANT since there's no corresponding RLS policy").
🤖 Prompt for AI Agents
In 01.Update-Fix/ARCHON-FIX-GRANTS-ONLY.sql around lines 9 to 12, the GRANT ALL
ON TABLE archon_page_metadata TO anon; line violates least privilege and should
be removed; delete that anon grant, keep the grants for
postgres/authenticated/service_role as needed, and add a short comment noting
anon is intentionally omitted because there is no RLS policy for anonymous
access (matching the migration/0.1.0/011_add_page_metadata_table.sql rationale).
| CREATE POLICY "Allow service role full access to archon_page_metadata" | ||
| ON archon_page_metadata | ||
| FOR ALL | ||
| TO public | ||
| USING (true) | ||
| WITH CHECK (true); | ||
|
|
||
| CREATE POLICY "Allow authenticated users to read and update archon_page_metadata" | ||
| ON archon_page_metadata | ||
| FOR ALL | ||
| TO authenticated | ||
| USING (true) | ||
| WITH CHECK (true); |
There was a problem hiding this comment.
Critical security flaw: policies defeat RLS.
The first policy is named "Allow service role full access" but applies TO public, effectively granting all roles full access. The second policy grants authenticated users FOR ALL (read/write/delete) when read-only is typically sufficient.
This appears to be an archived version. The corrected implementation in migration/0.1.0/011_add_page_metadata_table.sql shows the proper scoping:
-- Correct: scope to service_role
CREATE POLICY "Allow service role full access to archon_page_metadata"
ON archon_page_metadata
FOR ALL
TO service_role -- not public!
USING (true)
WITH CHECK (true);
-- Correct: read-only for authenticated
CREATE POLICY "Allow authenticated users to read archon_page_metadata"
ON archon_page_metadata
FOR SELECT -- not FOR ALL
TO authenticated
USING (true);🤖 Prompt for AI Agents
In 01.Update-Fix/ARCHON-FIX-PAGE-METADATA-PERMISSIONS.sql around lines 15-27,
the policies currently grant excessive privileges (first policy uses TO public
and second uses FOR ALL). Change the first policy to scope to the service_role
(TO service_role) so only the service role has full access, and change the
second policy to be read-only by using FOR SELECT and removing the WITH CHECK
clause (or otherwise ensure no write permissions) for TO authenticated; keep
USING (true) as appropriate.
| GRANT ALL ON TABLE archon_page_metadata TO postgres; | ||
| GRANT ALL ON TABLE archon_page_metadata TO anon; | ||
| GRANT ALL ON TABLE archon_page_metadata TO authenticated; | ||
| GRANT ALL ON TABLE archon_page_metadata TO service_role; |
There was a problem hiding this comment.
Overly broad grants to anon violate least privilege.
Granting ALL to anon allows anonymous users full read/write/delete access if any permissive policy exists (which currently does via the TO public policy).
The corrected implementation in migration/0.1.0/011_add_page_metadata_table.sql intentionally omits anon from grants (see line 93 comment).
🤖 Prompt for AI Agents
In 01.Update-Fix/ARCHON-FIX-PAGE-METADATA-PERMISSIONS.sql around lines 31-34,
the script grants ALL to anon which violates least-privilege and risks anonymous
full access; remove the GRANT ALL ON TABLE archon_page_metadata TO anon; line
entirely and instead ensure only minimal, explicit privileges are granted (keep
postgres as owner/full, grant only required privileges to authenticated and
service_role such as SELECT/INSERT/UPDATE/DELETE as appropriate) matching the
intent in migration/0.1.0/011_add_page_metadata_table.sql where anon is omitted.
| id BIGINT, | ||
| url TEXT, -- FIXED: was VARCHAR | ||
| chunk_number INTEGER, | ||
| content TEXT, | ||
| metadata JSONB, | ||
| source_id TEXT, -- FIXED: was VARCHAR | ||
| similarity FLOAT | ||
| ) |
There was a problem hiding this comment.
Return types must be DOUBLE PRECISION to avoid the original mismatch
This script still declares similarity (and rank_score) as FLOAT, but the dynamic SQL returns DOUBLE PRECISION values (1 - (%I <=> $1) and ts_rank_cd). Executing the function will trigger the same “structure of query does not match function result type” error this PR is supposed to eliminate. Change every affected column to DOUBLE PRECISION so the declared signature matches the actual result set.
- similarity FLOAT
+ similarity DOUBLE PRECISION
…
- similarity FLOAT,
- rank_score FLOAT
+ similarity DOUBLE PRECISION,
+ rank_score DOUBLE PRECISIONAlso applies to: 118-126
🤖 Prompt for AI Agents
In 01.Update-Fix/ARCHON-FIX-SEARCH-FUNCTIONS-COMPLETE.sql around lines 22-29
(and also lines 118-126), the columns declared as FLOAT (similarity and
rank_score) must be changed to DOUBLE PRECISION to match the dynamic SQL returns
(1 - (%I <=> $1) and ts_rank_cd) and avoid the “structure of query does not
match function result type” error; update the column type declarations for
similarity and rank_score to DOUBLE PRECISION in both locations so the function
signature matches the actual result set.
|
This looks lie a solid contribution @IM-21-DEV thank you, could you please remove any unnecessary md files as they are in german, as well as remove the unnecessary SQL statement files, only keep the ones needed to migrate |
|
🔄 This repository is being replaced by a new version of Archon. The original Python/MCP codebase is being archived to the This PR is being closed as part of the migration. Thank you for your contribution! |
fix: PostgreSQL search function type mismatches and auto-detect embedding dimensions
Fixes multiple critical bugs in PostgreSQL search functions:
Type Mismatches:
Hardcoded Embedding Dimensions:
Missing Permissions (migration 011):
Benefits:
Affected functions:
Files modified:
🤖 Generated with [Claude Code]
Pull Request
Summary
Changes Made
Type of Change
Affected Services
Testing
Test Evidence
Checklist
Breaking Changes
Additional Notes
Summary by CodeRabbit
New Features
Refactor
Chores
Tests / Documentation