Add Mozilla Foundation Greenhouse instance - #17366
Conversation
971e8b0 to
02c845c
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #17366 +/- ##
=======================================
Coverage 83.17% 83.18%
=======================================
Files 180 180
Lines 9402 9407 +5
=======================================
+ Hits 7820 7825 +5
Misses 1582 1582 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
🟡 Changes recommended
The Ashby command is currently unusable and can delete Greenhouse data, while nullable grouping IDs can merge unrelated jobs.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds Mozilla Foundation Greenhouse jobs to the careers listings, but also introduces an unrelated Ashby integration with blocking defects.
Changes:
- Fetches jobs from both Greenhouse boards.
- Expands job IDs and permits nullable internal IDs.
- Adds an Ashby synchronization command.
Assessment: Not safe to merge until grouping, Ashby API, and cross-source deletion issues are fixed. Reviewed using the repository custom instructions.
File summaries
| File | Description |
|---|---|
bedrock/settings/base.py |
Configures the Foundation board. |
bedrock/careers/models.py |
Expands and relaxes job identifier fields. |
bedrock/careers/migrations/0004_alter_position_internal_job_id_alter_position_job_id.py |
Applies schema changes. |
bedrock/careers/management/commands/sync_greenhouse.py |
Aggregates both Greenhouse boards. |
bedrock/careers/management/commands/sync_ashby.py |
Adds Ashby job synchronization. |
Review details
- Files reviewed: 5/5 changed files
- Comments generated: 6
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| """Sanitize Ashby job description HTML.""" | ||
| # Convert h1/h2/h3 to h4 for consistent heading levels | ||
| content = _HEADER_RE.sub(r"<\1h4\3", content) | ||
| return JustHTML(content, safe=True, policy=_SANITIZE_POLICY, fragment=True).to_html(pretty=False) |
| for source in sources: | ||
| response = requests.get(source) | ||
| response.raise_for_status() | ||
| data = response.json() | ||
| jobs_list.extend(data["jobs"]) |
| response = requests.get("https://api.ashbyhq.com/location.list") | ||
| response.raise_for_status() | ||
| data = response.json() | ||
| locations = data["results"] |
| jobs_updated += 1 | ||
| position.save() | ||
|
|
||
| positions_to_be_removed = Position.objects.exclude(job_id__in=job_ids, source="ashby") |
| # Store the Greenhouse internal ID for grouping the same jobs with multiple | ||
| # listings per location. | ||
| internal_job_id = models.PositiveIntegerField() | ||
| internal_job_id = models.PositiveIntegerField(null=True) |
| jobs_updated = 0 | ||
| jobs_removed = 0 | ||
| job_ids = [] | ||
| sources = [GREENHOUSE_URL.format(settings.GREENHOUSE_BOARD), GREENHOUSE_URL.format(settings.FOUNDATION_GREENHOUSE_BOARD)] |
stevejalim
left a comment
There was a problem hiding this comment.
Looking very promising - thanks! Have added some human commetns, and also unleashed the robot.
This will need tests before we can merge it, though - feel free to call on a robot for that, if you want
| } | ||
|
|
||
| GREENHOUSE_BOARD = config("GREENHOUSE_BOARD", default="mozilla") | ||
| FOUNDATION_GREENHOUSE_BOARD = config("FOUNDATION_GREENHOUSE_BOARD", default="mozillafoundation") |
There was a problem hiding this comment.
nit, totally optional, nonblocking: this is fine, but each time we need to add a new Greenhouse option, we'll need a new const. What do you think of
GREENHOUSE_BOARDS = [
config("GREENHOUSE_BOARD", default="mozilla"),
config("FOUNDATION_GREENHOUSE_BOARD", default="mozillafoundation"),
]
...and loop through those for sources in sync_greenhouse?
There was a problem hiding this comment.
Is this one meant to be in here yet? The PR only mentions Greenhouse.
If we're going to also sync Ashby, we'll need to add a line to ./bin/run-db-update.sh like the Greenhouse one in there
There was a problem hiding this comment.
No, rebase went wild. I had filtered it out and it got filtered back in after and I didn't notice.
One-line summary
Adds additional Mozilla Foundation Greenhouse URL
Issue / Bugzilla link
https://mozilla-hub.atlassian.net/jira/for-you?tab=assigned&selectedIssue=WT-1617
Testing
python manage.py sync_greenhouseThat test job comes from https://boards-api.greenhouse.io/v1/boards/mozillafoundation/jobs?content=true. The other jobs come from https://boards-api.greenhouse.io/v1/boards/mozilla/jobs?content=true