fix: harden crawl filename handling and stale recovery#6
Conversation
Prevent worker crashes from oversized generated asset filenames and shorten post-crash crawl recovery with safer BullMQ defaults plus a lock-renewal escape hatch.
|
🚅 Deployed to the dxd-webflow-scraper-pr-6 environment in WebFlow Archive
|
📝 WalkthroughWalkthroughCentralizes worker runtime configuration into a new typed module, updates the worker processor to consume config-driven values (including orphan reconciliation and lock-renewal flags), bounds generated asset filenames to 200 chars with a new helper and tests, adds worker tests to the root test script, and documents new worker env vars in Changes
Sequence Diagram(s)mermaid Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.env.example:
- Around line 7-14: Add documentation for the ORPHAN_CRAWL_RECONCILE_INTERVAL_MS
environment variable in the "Worker recovery" section: describe that it controls
the reconcile interval for orphaned active crawls (milliseconds), note the
default value, show an example like
ORPHAN_CRAWL_RECONCILE_INTERVAL_MS=<default-ms>, and mention its relation to
ORPHAN_CRAWL_GRACE_MS and WORKER_LOCK_DURATION_MS so operators understand how
the timing knobs interact.
🪄 Autofix (Beta)
✅ Autofix completed
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 8a7ac387-2826-4036-aed8-779ce1d67923
📒 Files selected for processing (7)
.env.examplepackage.jsonpackages/scraper/src/asset-downloader.test.tspackages/scraper/src/asset-downloader.tsservices/worker/src/processor.tsservices/worker/src/worker-config.test.tsservices/worker/src/worker-config.ts
|
Note Autofix is a beta feature. Expect some limitations and changes as we gather feedback and continue to improve it. Fixes Applied SuccessfullyFixed 1 file(s) based on 1 unresolved review comment. Files modified:
Commit: The changes have been pushed to the Time taken: |
Fixed 1 file(s) based on 1 unresolved review comment. Co-authored-by: CodeRabbit <noreply@coderabbit.ai>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.env.example:
- Line 46: Add a trailing newline to the end of the .env.example file so the
file ends with a blank line (after the VITE_API_URL entry) to satisfy
dotenv-linter and standard POSIX conventions; simply ensure the last line
"VITE_API_URL=http://localhost:3001" is followed by a newline character.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
|
|
||
| # Web | ||
| VITE_API_URL=http://localhost:3001 | ||
| VITE_API_URL=http://localhost:3001 No newline at end of file |
There was a problem hiding this comment.
Add blank line at end of file.
The dotenv-linter tool flags the missing trailing newline. Adding a blank line at the end follows standard convention and prevents potential issues with certain tools.
📝 Proposed fix
VITE_API_URL=http://localhost:3001
+📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| VITE_API_URL=http://localhost:3001 | |
| VITE_API_URL=http://localhost:3001 | |
🧰 Tools
🪛 dotenv-linter (4.0.0)
[warning] 46-46: [EndingBlankLine] No blank line at the end of the file
(EndingBlankLine)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In @.env.example at line 46, Add a trailing newline to the end of the
.env.example file so the file ends with a blank line (after the VITE_API_URL
entry) to satisfy dotenv-linter and standard POSIX conventions; simply ensure
the last line "VITE_API_URL=http://localhost:3001" is followed by a newline
character.
Summary
ENAMETOOLONGcrashes, with regressions for long basenames, long extensions, and exact chunk-name preservationWORKER_SKIP_LOCK_RENEWALas an operator escape hatchservices/worker/srcin the root test run and documented the worker recovery env vars in.env.exampleTest plan
bun test packages/scraper/src/asset-downloader.test.ts services/worker/src/worker-config.test.tsbun run verifySummary by CodeRabbit
New Features
Documentation
Tests
Chores