-
Notifications
You must be signed in to change notification settings - Fork 0
Enable Playwright by default for all scrape sources #101
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
c562f60
Enable Playwright by default for all scrape sources
mbuckingham74 129fd56
Fix use_playwright to actually default to True
mbuckingham74 88a3b4d
Add use_playwright checkbox to configure source form
mbuckingham74 7c7367c
Show Playwright status in scrape modal loading state
mbuckingham74 afffdfe
Add null check for Playwright text element in scrape modal
mbuckingham74 e8c1e47
Fix scrape success/auto-enable logic to consider jobs found
mbuckingham74 7fbcd5f
Merge origin/main into fix/playwright-default
mbuckingham74 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
backend/alembic/versions/019_enable_playwright_by_default.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| """Enable Playwright by default for all sources | ||
|
|
||
| This migration: | ||
| 1. Sets use_playwright=True for all existing sources that have it False or NULL | ||
| 2. Changes the column default to True for new sources | ||
|
|
||
| Playwright is required for most modern job sites that use JavaScript rendering. | ||
| Without it, the scraper only gets the initial HTML before JS executes, missing | ||
| dynamically loaded job listings. | ||
|
|
||
| Revision ID: 019 | ||
| Revises: 018 | ||
| Create Date: 2025-12-01 | ||
|
|
||
| """ | ||
| from alembic import op | ||
| import sqlalchemy as sa | ||
|
|
||
|
|
||
| # revision identifiers, used by Alembic. | ||
| revision = '019' | ||
| down_revision = '018' | ||
| branch_labels = None | ||
| depends_on = None | ||
|
|
||
|
|
||
| def upgrade() -> None: | ||
| # Enable Playwright for all existing sources | ||
| op.execute( | ||
| "UPDATE scrape_sources SET use_playwright = TRUE WHERE use_playwright = FALSE OR use_playwright IS NULL" | ||
| ) | ||
|
|
||
| # Change the column default to True for new sources | ||
| op.alter_column( | ||
| 'scrape_sources', | ||
| 'use_playwright', | ||
| server_default=sa.text('1'), # MySQL uses 1 for True | ||
| existing_type=sa.Boolean(), | ||
| existing_nullable=True | ||
| ) | ||
|
|
||
|
|
||
| def downgrade() -> None: | ||
| # Revert column default to False | ||
| op.alter_column( | ||
| 'scrape_sources', | ||
| 'use_playwright', | ||
| server_default=sa.text('0'), | ||
| existing_type=sa.Boolean(), | ||
| existing_nullable=True | ||
| ) | ||
| # Note: We don't revert existing data as that could break working scrapers | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
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.
The migration sets a server default of
TRUEforscrape_sources.use_playwright, but the SQLAlchemy modelScrapeSource.use_playwrightstill declaresdefault=False(backend/app/models/scrape_source.py). Because the admin create/import paths instantiateScrapeSourcewithout setting this field, SQLAlchemy will sendFalseon insert, overriding the new server default. New sources will therefore continue to have Playwright disabled despite the intent to enable it by default. Update the model (or omit the Python default) so inserts inherit the new default.Useful? React with 👍 / 👎.