remove old tables we moved to clickhouse#5094
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
2 Skipped Deployments
|
|
Claude finished @chitalian's task —— View job PR Review CompleteScore: 2/10 - Critical blocking issues that will cause immediate production failures Critical Issues Found🚨 BLOCKING: Database Query Failures1. experimentStore.ts - Multiple queries reference dropped tables:
2. DatasetManager.ts:209: left join request on request.id = prompt_input_record.source_requestThese queries will throw "relation does not exist" errors immediately when:
🚨 BLOCKING: Deprecated Table ReferencesThe migration drops
Code Quality Issues📝 Missing Implementation in Modified FilesScoreStore.ts: The old VersionedRequestStore.ts: New methods added but the Suggestions SummaryCritical Fixes Needed:
Recommended Approach:// Example fix for experimentStore.ts
const responseObjectString = (filter: string) => {
return `(
SELECT jsonb_build_object(
'createdAt', rr.response_created_at,
'completionTokens', rr.completion_tokens,
'promptTokens', rr.prompt_tokens,
'delayMs', rr.latency,
'model', rr.model
)
FROM request_response_rmt rr
WHERE ${filter}
)`;
};Testing Required:
Migration Safety ConcernsThe migration comments acknowledge these issues but the code wasn't updated. This creates a dangerous situation where the migration will succeed but the application will immediately start failing with database errors. Recommendation: Do not merge until all database query references are updated to use ClickHouse tables. |
There was a problem hiding this comment.
Greptile Overview
Summary
This PR drops legacy Postgres tables (request, response, asset, cache_hits, feedback, prompt_input_record) that were migrated to ClickHouse. Code changes deprecate methods that previously updated these tables.
Major changes:
- Migration drops 6 legacy tables and their foreign key constraints
- Updated 4 files to handle deprecated Postgres table operations
ScoreStore.bumpRequestVersion()andVersionedRequestStore.putPropertyAndBumpVersion()now return errorsInputsManagerqueries updated to useprompts_versionsfor org filteringRequestManager.waitForRequestAndResponse()now uses ClickHouse
Critical issues found:
experimentStore.tscontains multiple queries using droppedrequest/responsetables (lines 149-157, 160-170, 206-210, 307-310, 1063-1096, 1450-1453)DatasetManager.tsjoins droppedrequesttable (line 209)- These files are listed in migration warnings but not updated in this PR
- Will cause runtime failures when experiment features are used
Confidence Score: 0/5
- This PR will cause immediate production failures when experiment/dataset features are accessed
- Multiple critical files (
experimentStore.ts,DatasetManager.ts) still query therequestandresponsetables being dropped. The migration itself acknowledges these files "may still reference these tables" but they were not updated. This will cause database errors immediately upon deployment when users access experiment or dataset functionality. valhalla/jawn/src/lib/stores/experimentStore.tsandvalhalla/jawn/src/managers/dataset/DatasetManager.tsmust be updated to use ClickHouse before this migration can be safely deployed
Important Files Changed
File Analysis
| Filename | Score | Overview |
|---|---|---|
| supabase/migrations/20251021000000_drop_legacy_request_response_tables.sql | 3/5 | Migration drops legacy request, response, and other tables that were migrated to ClickHouse; includes foreign key cleanup |
| valhalla/jawn/src/lib/stores/experimentStore.ts | 0/5 | Multiple queries still reference dropped request/response tables - will fail at runtime |
| valhalla/jawn/src/managers/dataset/DatasetManager.ts | 1/5 | Query joins dropped request table - will cause database errors |
Sequence Diagram
sequenceDiagram
participant Client
participant API
participant Jawn
participant Postgres
participant ClickHouse
Note over Postgres: Legacy tables:<br/>request, response, asset, etc.
Client->>API: Request experiment data
API->>Jawn: experimentStore.getExperiments()
Jawn->>Postgres: SELECT with JOIN request/response
Postgres--xJawn: ERROR: relation does not exist
Jawn--xAPI: Query failure
API--xClient: 500 Error
Note over Jawn,ClickHouse: Fixed files use ClickHouse
Client->>API: Request score update
API->>Jawn: ScoreStore.bumpRequestVersion()
Jawn-->>API: Returns error (deprecated)
Client->>API: Request data (via fixed code)
API->>Jawn: RequestManager.waitForRequestAndResponse()
Jawn->>ClickHouse: Query request_response_rmt
ClickHouse-->>Jawn: Data returned
Jawn-->>API: Success
API-->>Client: Data
Additional Comments (7)
-
valhalla/jawn/src/lib/stores/experimentStore.ts, line 149-157 (link)logic: queries
responseandrequesttables that are being dropped in this PR -
valhalla/jawn/src/lib/stores/experimentStore.ts, line 160-170 (link)logic: queries
requesttable being dropped -
valhalla/jawn/src/lib/stores/experimentStore.ts, line 206-210 (link)logic: joins
requesttable being dropped - should use ClickHouse or alternative approach -
valhalla/jawn/src/lib/stores/experimentStore.ts, line 307-310 (link)logic: joins
requesttable being dropped -
valhalla/jawn/src/lib/stores/experimentStore.ts, line 1063-1096 (link)logic: joins both
requestandresponsetables being dropped -
valhalla/jawn/src/lib/stores/experimentStore.ts, line 1450-1453 (link)logic: joins
requestandresponsetables being dropped -
valhalla/jawn/src/managers/dataset/DatasetManager.ts, line 209-210 (link)logic: joins
requesttable being dropped
6 files reviewed, 8 comments
.claude/settings.local.json
Outdated
| "Bash(psql:*)", | ||
| "Bash(for table in asset cache_hits experiment_output experiment_v2_hypothesis_run feedback finetune_dataset_data job_node_request prompt_input_record properties request_job_task score_value)", | ||
| "Bash(do echo -n \"$table: \")", | ||
| "Bash(done)" |
There was a problem hiding this comment.
style: malformed bash commands - remove debugging artifacts
| "Bash(psql:*)", | |
| "Bash(for table in asset cache_hits experiment_output experiment_v2_hypothesis_run feedback finetune_dataset_data job_node_request prompt_input_record properties request_job_task score_value)", | |
| "Bash(do echo -n \"$table: \")", | |
| "Bash(done)" | |
| "Bash(psql:*)" |
Prompt To Fix With AI
This is a comment left during a code review.
Path: .claude/settings.local.json
Line: 61:64
Comment:
**style:** malformed bash commands - remove debugging artifacts
```suggestion
"Bash(psql:*)"
```
How can I resolve this? If you propose a fix, please make it concise.
No description provided.