Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Refs/heads/main #4771
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Uh oh!
There was an error while loading. Please reload this page.
Refs/heads/main #4771
Changes from all commits
5f32b013619b1bcca9dd496fa5c0File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
load_configuses a relative path — will break if run from another directory.open("config.yaml")resolves against the current working directory, not the script location. Runningpython shorts_pipeline/main.pyfrom the repo root will fail withFileNotFoundError.db.pyalready usesPath(__file__).resolve().parents[1]for absolute paths —load_configshould follow the same pattern.🛠️ Proposed fix
📝 Committable suggestion
🤖 Prompt for AI Agents
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🩺 Stability & Availability | 🟠 Major | 🏗️ Heavy lift
Shared SQLAlchemy session across concurrent async coroutines risks silent data loss.
The session from
session_scopeis passed toVoiceSynthesizer.synthesize_pending, which dispatches multiple_process_scriptcoroutines viaasyncio.gather(..., return_exceptions=True). Each coroutine callssession.query(Video)...andsession.add(video). SQLAlchemy's auto-flush can flush one coroutine's pending changes during another's query; if that flush fails, the session enters aPendingRollbackErrorstate and all subsequent coroutines fail silently (swallowed byreturn_exceptions=True).Consider passing the session factory instead and giving each coroutine its own session, or processing scripts sequentially within the single session.
🔧 Suggested approach: per-coroutine sessions
In
main.py, pass the factory instead of the session to the voice step:Then in
voice_synthesizer.py, each_process_scriptcreates and commits its own session:🤖 Prompt for AI Agents
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
IndexErrorwhen YouTube Analytics API returns empty rowsresp.get("rows", [[0, 0.0, 0.0]])[0]only defaults when therowskey is absent. If the API returns{"rows": []}(common for videos with no analytics data yet),getreturns[]and[][0]raisesIndexError. The exception is caught on Line 33, but the video stays in"uploaded"status and will be retried on every subsequent run, producing repeated log errors.🐛 Proposed fix: safe row extraction
📝 Committable suggestion
🤖 Prompt for AI Agents
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win
Missing parent directory creation before writing report files
Unlike
thumbnail_generator.py(Line 14),_write_reportdoes not create parent directories before opening files for writing. If the output directory doesn't exist,open()will raiseFileNotFoundError.🛡️ Proposed fix
📝 Committable suggestion
🧰 Tools
🪛 ast-grep (0.44.1)
[warning] 38-38: File path is request-/variable-derived; validate and normalize to prevent path traversal.
Context: open(self.cfg["analytics"]["report_output_json"], "w", encoding="utf-8")
Note: [CWE-22] Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').
(open-filename-from-request)
[warning] 40-40: File path is request-/variable-derived; validate and normalize to prevent path traversal.
Context: open(self.cfg["analytics"]["report_output_txt"], "w", encoding="utf-8")
Note: [CWE-22] Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').
(open-filename-from-request)
🤖 Prompt for AI Agents
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win
Handle malformed LLM rows per niche
row["idea"]/row["hook"]are outside thetry, so one bad object stops the rest ofgenerate_and_store()and skips later niches in that run. Validate each row or keep the per-row add inside the niche-level error handling.🤖 Prompt for AI Agents
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.