Skip to content

Comments

feat: pass updated seasons to catalog refresh endpoint#388

Open
reybahl wants to merge 1 commit intomasterfrom
update-refresh-endpoint-params
Open

feat: pass updated seasons to catalog refresh endpoint#388
reybahl wants to merge 1 commit intomasterfrom
update-refresh-endpoint-params

Conversation

@reybahl
Copy link
Member

@reybahl reybahl commented Feb 15, 2026

Summary by CodeRabbit

  • Chores
    • Enhanced catalog refresh workflows to conditionally apply seasonal data parameters when available.
    • Improved tracking of updated seasons across refresh cycles in production and staging environments.

@coderabbitai
Copy link

coderabbitai bot commented Feb 15, 2026

📝 Walkthrough

Walkthrough

The changes implement season-specific catalog refresh functionality. main.py writes updated seasons to a file after crawls. ferry.yml conditionally reads this file and passes seasons to refresh endpoints. evals.yml now accepts a seasons input parameter for direct refresh requests.

Changes

Cohort / File(s) Summary
Workflow Season Parameter Updates
.github/workflows/evals.yml
Modified production and staging catalog refresh curl calls to include ?seasons=${{ inputs.season }} query parameter based on workflow input.
Conditional Catalog Refresh
.github/workflows/ferry.yml
Added file-existence check for data/ferry_updated_seasons.txt. If present, reads content into SEASONS variable and passes ?seasons=${SEASONS} to both refresh endpoints; otherwise, executes original parameterless refresh requests.
Season Persistence
main.py
Added logic to write joined list of updated seasons to data/ferry_updated_seasons.txt when either crawl_classes or crawl_evals flags are enabled.

Sequence Diagram

sequenceDiagram
    actor User
    participant MainScript as main.py
    participant FileSystem as Data Directory
    participant FerryWorkflow as ferry.yml
    participant EvalWorkflow as evals.yml
    participant CatalogAPI as Catalog Endpoints

    User->>MainScript: Trigger crawl (crawl_classes/evals enabled)
    MainScript->>MainScript: Process crawl data
    MainScript->>FileSystem: Write seasons to ferry_updated_seasons.txt
    
    User->>FerryWorkflow: Trigger ferry workflow
    FerryWorkflow->>FileSystem: Check if ferry_updated_seasons.txt exists
    alt File exists
        FerryWorkflow->>FileSystem: Read SEASONS variable
        FerryWorkflow->>CatalogAPI: POST /catalog/refresh?seasons=${SEASONS}
    else File missing
        FerryWorkflow->>CatalogAPI: POST /catalog/refresh (no seasons)
    end
    
    User->>EvalWorkflow: Trigger evals workflow with season input
    EvalWorkflow->>CatalogAPI: POST /catalog/refresh?seasons=${{ inputs.season }}
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A season-aware refresh takes flight,
Files pass the word left and right,
From crawl to catalog, the seasons align,
Selective refreshes, oh how they shine! ✨

🚥 Pre-merge checks | ✅ 3 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately captures the main objective of the changeset: passing updated seasons as a query parameter to the catalog refresh endpoint across multiple workflow files and supporting logic.
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into master

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch update-refresh-endpoint-params

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (4)
.github/workflows/evals.yml (1)

88-89: Consider adding --fail flag to detect HTTP errors.

The curl commands will silently succeed even if the server returns a 4xx/5xx error. Adding --fail (or -f) ensures the workflow step fails if the refresh endpoint returns an error status.

-          curl --silent --show-error -H "X-FERRY-SECRET: ${{secrets.FERRY_SECRET}}" "https://api.coursetable.com/api/catalog/refresh?seasons=${{ inputs.season }}"
-          curl --silent --show-error -H "X-FERRY-SECRET: ${{secrets.FERRY_SECRET}}" "https://api-staging.coursetable.com/api/catalog/refresh?seasons=${{ inputs.season }}"
+          curl --silent --show-error --fail -H "X-FERRY-SECRET: ${{secrets.FERRY_SECRET}}" "https://api.coursetable.com/api/catalog/refresh?seasons=${{ inputs.season }}"
+          curl --silent --show-error --fail -H "X-FERRY-SECRET: ${{secrets.FERRY_SECRET}}" "https://api-staging.coursetable.com/api/catalog/refresh?seasons=${{ inputs.season }}"
main.py (1)

86-89: Potential for stale data if file persists from a previous run.

The file ferry_updated_seasons.txt is only written when crawl_classes or crawl_evals is enabled. If a subsequent workflow run (e.g., transform-only) doesn't delete this file, ferry.yml would still read and use the stale seasons from a previous run.

Consider either:

  1. Cleaning up the file after it's consumed in the workflow, or
  2. Writing an empty/sentinel file when crawl flags are not set to ensure the fallback path is taken.

This may be intentional if non-crawl runs don't trigger the "Regenerate static catalog" step, but worth confirming the workflow doesn't hit that step unexpectedly.

.github/workflows/ferry.yml (2)

123-126: Strip trailing newline from file content to avoid malformed URL.

cat may include a trailing newline if the file was written with one (Python's write_text doesn't add one, but defensive coding is warranted). A trailing newline in SEASONS would result in a malformed URL or unexpected behavior.

           if [ -f data/ferry_updated_seasons.txt ]; then
-            SEASONS=$(cat data/ferry_updated_seasons.txt)
+            SEASONS=$(tr -d '\n' < data/ferry_updated_seasons.txt)
             curl --silent --show-error -H "X-FERRY-SECRET: ${{secrets.FERRY_SECRET}}" "https://api.coursetable.com/api/catalog/refresh?seasons=${SEASONS}"

125-129: Consider adding --fail flag to detect HTTP errors.

Same as in evals.yml, the curl commands will silently succeed even if the server returns an error. Adding --fail ensures the workflow fails visibly if the catalog refresh endpoint has issues.

-            curl --silent --show-error -H "X-FERRY-SECRET: ${{secrets.FERRY_SECRET}}" "https://api.coursetable.com/api/catalog/refresh?seasons=${SEASONS}"
-            curl --silent --show-error -H "X-FERRY-SECRET: ${{secrets.FERRY_SECRET}}" "https://api-staging.coursetable.com/api/catalog/refresh?seasons=${SEASONS}"
+            curl --silent --show-error --fail -H "X-FERRY-SECRET: ${{secrets.FERRY_SECRET}}" "https://api.coursetable.com/api/catalog/refresh?seasons=${SEASONS}"
+            curl --silent --show-error --fail -H "X-FERRY-SECRET: ${{secrets.FERRY_SECRET}}" "https://api-staging.coursetable.com/api/catalog/refresh?seasons=${SEASONS}"
           else
-            curl --silent --show-error -H "X-FERRY-SECRET: ${{secrets.FERRY_SECRET}}" https://api.coursetable.com/api/catalog/refresh
-            curl --silent --show-error -H "X-FERRY-SECRET: ${{secrets.FERRY_SECRET}}" https://api-staging.coursetable.com/api/catalog/refresh
+            curl --silent --show-error --fail -H "X-FERRY-SECRET: ${{secrets.FERRY_SECRET}}" https://api.coursetable.com/api/catalog/refresh
+            curl --silent --show-error --fail -H "X-FERRY-SECRET: ${{secrets.FERRY_SECRET}}" https://api-staging.coursetable.com/api/catalog/refresh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant