agentleFS
arturogarridoarturogarrido/claudinho/.cursor/rules/bundle-bracket-pr.mdc

claudinho / rules

Cursor rule30 starsChanged 56 days agoMITView on GitHub

Bundle, bracket, and live-data invariants before opening a PR

The file

We split this bundle-bracket-pr.mdc into the rules it gives an agent

6 rules. About 0 are common, 0 are distinctive, and 6 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 6

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Before marking a data-heavy feature merge-ready, run pnpm -r build && pnpm -r typecheck && pnpm -r test && pnpm lint (mirror CI — build …

    line 9
  2. Very specific:

    Test degraded getBracket() on the bundle: seed/winner slots stay tbd, never confirmed.

    line 20
  3. Very specific:

    Always test FT draw + winnerCode — routine in knockouts.

    line 25
  4. Very specific:

    Keep the disagreeing-feeder P1 GUARD in packages/core/test/bracket-resolve.test.ts green, and cover the feeder fallback when the target …

    line 35
  5. Very specific:

    When knockout fetch fails but standings succeed: set source from standings provider.

    line 40
  6. Very specific:

    After pnpm -r build, run pnpm release:qa (scripts/release-qa.sh).

    line 47

≈ “Common” is an estimate: at least 1 in 5 of the 3,030 Cursor rule files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
bundle-bracket-pr.mdc
---
description: Bundle, bracket, and live-data invariants before opening a PR
globs: packages/core/**/*
alwaysApply: false
---

# Bundle & bracket PR readiness

Before marking a data-heavy feature merge-ready, run **`pnpm -r build && pnpm -r typecheck && pnpm -r test && pnpm lint`** (mirror CI — build first because cli/mcp import `@claudinho/core` from dist; `build` alone does not typecheck).

## Bundled schedule invariant

`schedule.*.json` is a **resultless skeleton**: no scores/status, no confirmed nations in knockout slots.

- `sanitizeBundledFixture` must restore topology placeholders for KO home/away.
- `gen:schedule` must **fail** if any knockout fixture carries a real nation flag, and at once,
  writing nothing, on a window that failed, carried no account, was not whole, or stated another
  season (or none), and on a fixture served by two windows; its expected counts are named facts (`GROUPS`, `TEAMS_PER_GROUP`) and core's
  `EXPECTED_KNOCKOUT_COUNTS`, never literals or this run's own topology.
- Test degraded `getBracket()` on the bundle: seed/winner slots stay `tbd`, never `confirmed`.

## Knockout resolution

- Advance winners from **score OR `winnerCode`** (ESPN `competitor.winner` for penalties).
- Always test FT draw + `winnerCode` — routine in knockouts.
- Group slots project from live standings once **≥1 match played** (`hasGroupStarted`); **`confirmed`** when every team has played a full round-robin (`played >= n - 1` for `n` teams); **`(proj.)`** only mid-group. TBD at 0 games or when standings are degraded.

## Topology indexing

- Assign each bundled match's 1-based index within its stage by ascending numeric ESPN event id
  (`orderByBracketIndex` in `packages/core/src/bracket/build.ts`), never by kickoff sort order.
- **The live fixture's pairing wins.** ESPN's bundled placeholder winner/loser refs do not
  reliably describe its actual feeder assignment. Use the participant served for that fixture;
  project from a bundled feeder ref only when the target fixture is absent from the merged set.
- Keep the disagreeing-feeder `P1 GUARD` in `packages/core/test/bracket-resolve.test.ts` green,
  and cover the feeder fallback when the target fixture is absent. See `AGENTS.md` → Conventions.

## Live hybrid paths

- When knockout fetch fails but standings succeed: set `source` from standings provider.
- Share/MCP: inner `formatBracketList({ footer: false })`, outer layer adds attribution/notices **once**.
- CLI/MCP wrappers: option types must match the formatter (`ShareBracketOptions`, not `ShareSnippetOptions`).
- **Surface parity:** see `.cursor/rules/surface-parity.mdc` — every bracket formatter path passes `tz` + `locale`; statusline knockouts indirect-resolve via cached `getKnockoutFixtures` (hot path fail-closed).

## Pre-merge QA

After `pnpm -r build`, run **`pnpm release:qa`** (`scripts/release-qa.sh`). Eyeball every section; tripwires at the end encode the 0.8.x bracket regressions (calendar month, tz threading, share disclaimer).

## Adversarial tests (add when touching bracket/schedule)

| Scenario | Assert |
|----------|--------|
| FT level + `winnerCode` | Winner advances |
| `fetchWindow` throws, standings OK | Projected groups + `source` set |
| Bundle-only bracket | No real flags in R32+ slots |
| Group at 0 games played | Slots stay `tbd`, no `(proj.)` |
| Group at 2/3 played, standings live | Leaders show flags + `(proj.)` |
| Group fully played (round-robin complete) | Winner + runner-up `confirmed`, no `(proj.)` |
| `toolGetBracket` `tz: UTC` vs `America/Mexico_City` | Calendar date/time differs on cross-midnight kickoff |
| Knockout kickoffs span >1 week | Output includes month + day (not weekday-only) |
| `formatShareBracket` social + compact | Same date format as CLI list |
| `formatShareBracket` / `toolGetBracket` | Each disclaimer line once |
| Statusline knockout countdown (cached fixtures) | Real nations or `⚽ —`; never `🏳️` |
| Statusline stale cache during live KO | `live · syncing…` without `🏳️`; resolved pairing when cache has it |
| Empty fixtures cache at phase boundary | Re-polls after short TTL (~60s), not 15min |

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.