Compare commits

..

1 Commits

Author SHA1 Message Date
Mason Daugherty
0081deae96 feat(infra): schedule daily model profile refresh with job summary (#35354)
- Schedules the `refresh_model_profiles` workflow to run daily at 08:00
UTC (manual trigger available).
- Adds a job summary step that reports whether a PR was created/updated
or skipped because profiles were already up to date.
- Each run supersedes any stale PR from a previous run since the action
force-pushes to a fixed branch (`bot/refresh-model-profiles`).
2026-02-20 00:43:09 -05:00
2 changed files with 24 additions and 25 deletions

View File

@@ -1,11 +1,15 @@
# Refreshes model profile data for all in-monorepo partner integrations by
# pulling the latest metadata from models.dev via the `langchain-profiles` CLI.
#
# Creates a pull request with any changes. Triggered manually from the Actions UI.
# Creates a pull request with any changes. Runs daily and can be triggered
# manually from the Actions UI. Uses a fixed branch so each run supersedes
# any stale PR from a previous run.
name: "🔄 Refresh Model Profiles"
on:
schedule:
- cron: "0 8 * * *" # daily at 08:00 UTC
workflow_dispatch:
permissions:
@@ -63,7 +67,8 @@ jobs:
private-key: ${{ secrets.MODEL_PROFILE_BOT_PRIVATE_KEY }}
- name: "🔀 Create pull request"
uses: peter-evans/create-pull-request@v7
id: create-pr
uses: peter-evans/create-pull-request@v8
with:
token: ${{ steps.app-token.outputs.token }}
branch: bot/refresh-model-profiles
@@ -74,4 +79,15 @@ jobs:
integrations via `langchain-profiles refresh`.
🤖 Generated by the `refresh_model_profiles` workflow.
labels: bot
add-paths: libs/partners/**/data/_profiles.py
- name: "📝 Summary"
run: |
op="${{ steps.create-pr.outputs.pull-request-operation }}"
url="${{ steps.create-pr.outputs.pull-request-url }}"
if [ "$op" = "created" ] || [ "$op" = "updated" ]; then
echo "### ✅ PR ${op}: ${url}" >> "$GITHUB_STEP_SUMMARY"
else
echo "### ⏭️ Skipped: profiles already up to date" >> "$GITHUB_STEP_SUMMARY"
fi

View File

@@ -26,29 +26,12 @@ def test_uuid7() -> None:
assert out1_ms == ms
def _uuid_v7_sortable_prefix(uuid_obj: UUID) -> int:
"""Extract the timestamp + counter bits (top 96 bits minus version/variant)."""
val = uuid_obj.int
timestamp_ms = (val >> 80) & 0xFFFFFFFFFFFF
counter_hi = (val >> 64) & 0x0FFF
counter_lo = (val >> 32) & 0x3FFFFFFF
return (timestamp_ms << 42) | (counter_hi << 30) | counter_lo
def test_monotonicity() -> None:
"""Test that UUIDs are monotonically increasing.
UUIDv7 guarantees monotonicity of the timestamp+counter portion,
but the trailing 32-bit random field can cause raw string or int
comparisons to appear non-monotonic. Compare only the sortable prefix.
"""
last_prefix = -1
last_uuid = None
"""Test that UUIDs are monotonically increasing."""
last = ""
for n in range(100_000):
u = uuid7()
prefix = _uuid_v7_sortable_prefix(u)
if n > 0 and prefix < last_prefix:
msg = f"UUIDs are not monotonic: {last_uuid} versus {u}"
i = str(uuid7())
if n > 0 and i <= last:
msg = f"UUIDs are not monotonic: {last} versus {i}"
raise RuntimeError(msg)
last_prefix = prefix
last_uuid = u
last = i