Repository navigation
Fix knowledge compiler Go port regressions (MySQL 1101 + Start deadlock) - #17599
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe change separates worker-pool startup synchronization from overall ingestor startup, adds a full-path lifecycle regression test, exposes message-queue engine setup, and removes MySQL-incompatible defaults from two JSON ChangesIngestion startup and document persistence
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
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 |
Drop the literal DEFAULT '[]' on the TEXT columns backlog_doc_ids / inflight_doc_ids. MySQL 8.0.13+ rejects a literal default on TEXT/BLOB columns, so GORM's AutoMigrate failed with Error 1101 and the API server could not start. The scheduler already writes '[]' explicitly on insert (FirstOrCreate) and on release, so the DDL default was redundant.
Start() wraps start() in e.startOnce.Do, but start() called startWorkerPool() which nested the same startOnce. sync.Once.Do blocks forever when re-entered from inside its own callback, so Start() hung after InitConsumer succeeded: no worker pool, no consumeLoop, and ingestion tasks were never consumed (stuck in CREATED). Give startWorkerPool its own workerOnce. Add TestStart_FullPathReturnsAndStartsWorkers which drives the real Start() path against an embedded NATS server and asserts Start() returns within a deadline with workers up; it fails (10s timeout) without the fix.
c66aad3 to
bee7423
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@internal/ingestion/service/ingestor_lifecycle_test.go`:
- Around line 236-238: Update the activeWorkers assertion in the Start()
lifecycle test to poll until at least one worker is active or a deadline
expires, matching the established approach in
TestStartWorkerPool_StartOnceIdempotent. Keep the existing failure message and
assert only after the wait completes.
- Around line 216-220: Update the test setup around SetMessageQueueEngine to
capture the existing message-queue engine before calling SetupNatsEngine(t),
then register cleanup immediately afterward to restore that saved engine. Keep
the existing ing.Stop cleanup and ensure restoration occurs after the injected
test engine is no longer needed.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 901a5419-b4da-4074-93ea-d3f05bf15d15
📒 Files selected for processing (4)
internal/engine/global.gointernal/entity/knowledge_compile_doc.gointernal/ingestion/service/ingestion_service.gointernal/ingestion/service/ingestor_lifecycle_test.go
🚧 Files skipped from review as they are similar to previous changes (1)
- internal/entity/knowledge_compile_doc.go
- Save and restore the previous message-queue engine around the new Start() full-path test so later tests don't inherit a closed embedded NATS server (SetMessageQueueEngine is process-global). - Poll briefly for activeWorkers instead of asserting immediately, since Start() launches workers asynchronously (avoids a flaky assertion).
Two regressions from #17536: (1) MySQL 8.0 AutoMigrate crash on knowledge_compile_docs (Error 1101) from a TEXT default; (2) ingestor Start() sync.Once re-entrant deadlock. Both fixed with regression tests.