Skip to content

Recipe conformance check for SSE event-contract drift (3 recipes currently broken; follows up #86) #243

Open

Description

@Hotragn

Problem

Recipes in this cookbook silently break in a specific, repeating way: the SSE event contract drifts between the TinyFish agent stream, the recipe's own /api route, and the client hook that renders progress. Nothing in CI catches it, so it is only found when a human opens the app and notices the live browser preview never appears.

@zk1tty called this out in #86 (March, still open):

I only tried this folder, but I assume same issues can happen at other folders too. Highly recommended to review and adjust to new event types on /run-sse endpoints.

That review never happened repo-wide. I did it, and the prediction was correct — three recipes are currently shipping dead code paths, including one Featured recipe with a live demo:

Recipe Defect User-visible effect
tinyskills use-generation.ts:202 handles source_streaming; api/scrape-sources/route.ts never emits it (emits source_start, source_step, source_error, source_complete, scrape_complete, error, scrape_start) Live browser preview never renders
stay-scout-hub lib/api/area-search.ts:84 handles event.type === 'STATUS'; api/research-area/route.ts emits only CONNECTED, SCREENSHOT, COMPLETE, ERROR Progress text never updates during research
competitor-analysis api/scrape-pricing/route.ts:369 reads event.streamingUrl off the raw SDK event; the SDK emits streaming_url Guard never fires → competitor_streaming never sent → preview dead end-to-end

All three are the same shape as #86: a consumer waiting on an event type or field name that no producer ever emits. tinyskills and stay-scout-hub are provable statically — the consumed event-type set is not a subset of the emitted set. competitor-analysis is a snake_case/camelCase slip at the SDK boundary, where every other recipe correctly reads event.streaming_url.

This is not a one-off. Each recipe hand-rolls the same three-hop relay (SDK event → internal SSE → client state) and picks its own key convention along the way — streamingUrl, streaming_url, and data.streamingUrl are all in use today. There is no shared contract and no check, so every new recipe is a fresh chance to get it wrong.

Why a checker rather than another round of fixes

The fixes themselves are small. The reason this recurs is that the cookbook has no conformance check at all — CI today is TruffleHog + osv-scan, both security-only. CONTRIBUTING.md specifies seven required README.md sections for every project, and nothing verifies them either.

That gap also shows up in review throughput: 43 PRs are currently open, the oldest from January, and most are large recipe submissions where correctness has to be established by hand. A mechanical pre-check moves the cheap, objective part of that review off the maintainers.

Proposed approach

A single .github/scripts/check_recipes.py, run from a pull_request workflow and a make check-recipes target, that validates only the recipes touched by the PR.

Directly modelled on openai/openai-cookbook's .github/scripts/check_notebooks.py + .github/workflows/validate-notebooks.yaml — git diff --name-only against the base ref, per-file validation, error count, sys.exit(1), SHA-pinned actions. Same shape, same footprint. Credit to that repo in the PR description; I'm borrowing their structure rather than inventing one.

Checks, ordered by confidence:

  1. SSE event-type reachability (hard error) — within a recipe, every event type string a client compares against must be emitted somewhere in that recipe. This is the set-difference check that catches tinyskills and stay-scout-hub.
  2. SDK boundary field names (hard error) — on a value derived from client.agent.stream(), flag camelCase reads of documented snake_case fields (streamingUrl → streaming_url, resultJson → result). Catches competitor-analysis.
  3. README structure (hard error) — the seven sections CONTRIBUTING.md already requires.
  4. .env.example coverage (warning only) — env vars referenced in code but undocumented.

Deliberately kept to stdlib + regex/AST heuristics scoped to the TinyFish boundary. I'd rather ship four checks with near-zero false positives than a broad linter people learn to ignore — a noisy gate is worse than no gate.

What I'd like a maintainer's read on

  1. Should the workflow gate merges, or start advisory (continue-on-error) until the backlog is clean? My instinct is advisory for one or two releases, because turning it on as a hard gate today would fail some of the 43 open PRs and that isn't a fair thing to spring on contributors. Happy to go straight to blocking if you'd prefer.
  2. Scope of check 3 — enforce README sections on new recipes only, or all touched recipes? Existing recipes predate the current template and some would fail.
  3. Placement — .github/scripts/ (matching openai-cookbook) or scripts/? scripts/ currently holds user-facing Raycast content, so I've assumed .github/scripts/.

Note: Makefile, .semgrepignore, and golden-images.yaml are Terraform-managed from github-control, so I'd add the make target only if you confirm that file is locally editable — otherwise the workflow alone is fine.

Offer

I have the checker working locally against all 40+ recipes and the three defects above reproduced. Happy to send it as one reviewable PR (script + workflow + a short CONTRIBUTING.md note), with the three recipe fixes as separate small PRs so each can be reviewed and reverted independently.

If you'd rather not take on new CI, say so and I'll just send the three bug fixes — those stand on their own and close out #86.

Activity

  1. Hotragn commented on Aug 4, 2026

    @Hotragn
    Author

    @simantak-dabhade — @zk1tty pointed me your way. Consolidating everything here so it's one triage pass rather than five tabs.

    Root cause — #86, open since March

    The three recipes it flags — one PR each, so each is independently reviewable and revertible

    Separate problem found on the way

    Two things worth knowing before you look

    1. The security workflows on all five PRs are sitting at action_required — standard first-time-contributor gating. TruffleHog and OSV-Scanner can't report until someone with write access approves the runs, so the absence of green checks isn't a failure signal, just no signal.
    2. Add recipe conformance check for SSE event-contract drift #244's workflow is continue-on-error: true on purpose. Making it a hard gate today would fail some of the currently open PRs, which didn't seem a fair thing to spring on people mid-flight. Deleting that one line makes it blocking whenever you want.

    One correction to my own framing above: this isn't a new ask. @JiwaniZakir already called for exactly this audit on #86 back in March, naming the same three renames (streamingUrl → streaming_url, STATUS → PROGRESS, resultJson → result) and noting other samples likely shared the stale handler. #243 is the second request for it, not the first.

    If any of this isn't the direction you want — particularly adding a new CI workflow — say so and I'll close it rather than leave it sitting. I'd genuinely rather have a no than a stale PR.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions