Skip to content

fix: handle None from supabase maybe_single() in dedup lookups#100

Open
krapfj23 wants to merge 11 commits intomainfrom
fix-maybe-single-none
Open

fix: handle None from supabase maybe_single() in dedup lookups#100
krapfj23 wants to merge 11 commits intomainfrom
fix-maybe-single-none

Conversation

@krapfj23
Copy link
Copy Markdown
Collaborator

Summary

  • find_document_by_hash() and get_document() use .maybe_single().execute() on the async supabase-py client, which returns None (not a result wrapper) when zero rows match.
  • The old result.data access raised AttributeError: 'NoneType' object has no attribute 'data' on every upload of a brand-new file.
  • Check result is None before touching .data.

Test plan

  • cd backend && pytest — 61 tests pass.
  • ruff check clean.
  • Upload a never-before-seen PDF → no 500, pipeline proceeds.
  • Upload the same file twice → second upload short-circuits with duplicate: true.

🤖 Generated with Claude Code

krapfj23 and others added 11 commits April 15, 2026 20:22
Formatting, async Supabase migration, improved error handling,
and logging across routes and services.
Add frontend Dockerfiles, ESLint, Prettier, Vercel config, and nginx.
Update docker-compose, env example, and lint workflow.
Remove broken route-level tests from test_ingest (referenced removed
functions). Update test_storage and test_dataset_name_validation for
current service signatures.
23 tests exercising full HTTP request → route → service → response
chain. Covers upload, search, graph, document CRUD, file-url, and
health check endpoints. External services mocked at SDK boundary.
Replace standalone script with pytest-discoverable e2e test. Creates
temp fixture data (no external mock_data needed), uses Cognee embedded
defaults (LanceDB/KuzuDB), auto-skips when LLM_API_KEY is missing.
Run pytest on every PR touching backend/. Excludes broken test_storage
and e2e test_cognee. Adds pip caching, pytest-asyncio dependency, and
registers the e2e marker in pyproject.toml.
Architecture overview, key files, environment variables, run/test
commands, branch naming conventions, and code review checklist.
…, and cross-page navigation

Fixes the graph flipping/bouncing bug by stabilizing the force simulation
(cooldownTicks, d3AlphaDecay, d3VelocityDecay, warmupTicks) and memoizing
graph data to prevent unnecessary re-renders. Adds:

- Click-to-inspect node detail panel with connected entities, related
  content (Cognee CHUNKS search), and source documents
- Connected node highlighting: selected node glows, neighbors stay
  visible, unrelated nodes dim to 20% opacity
- Graph node search (client-side filter with dropdown, zoom-to-node)
- Search-to-graph bridge: "View in Graph" button on search result
  source cards navigates to /graph?dataset=X
- URL param support: ?dataset= auto-selects filter, ?node= auto-selects
  and zooms to a node
- Improved UI: overlaid controls, polished hover tooltip, degree-based
  node sizing, UUID label filtering

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Compute a SHA-256 hash of file contents at upload time and check for an
existing completed document with the same hash before running the pipeline.
Duplicates return the existing document immediately, skipping R2 upload,
LLM classification, and Cognee ingestion. Frontend shows a distinct amber
"Duplicate" card with a link to the existing document.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace outdated ETL-era README with practical setup instructions covering
Docker and manual workflows, project structure, API endpoints, testing,
linting, CI/CD, and branch/PR conventions.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
find_document_by_hash() and get_document() use .maybe_single().execute(),
which returns None (not a result wrapper) when zero rows match in the
async supabase-py client. The old result.data access raised
AttributeError on every upload of a new (non-duplicate) file.

Check for None before accessing .data.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
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.

1 participant