Skip to content

reactive/data-client / .agents/skills/data-client-v0.19-migration

data-client-v0.19-migration

Verified

Upgrade apps that already use @data-client to v0.19. Runs the v0.19 codemod, then fixes what it flags and what it can't see. Use when bumping @data-client packages to 0.19, or when Controller.fetchIfStale(), custom Managers or the managers prop break after upgrading. Not for adopting Data Client for the first time.

evals/evals.json

View on GitHub
{
  "skill_name": "data-client-v0.19-migration",
  "evals": [
    {
      "id": 1,
      "name": "fetch-if-stale-upgrade",
      "prompt": "hey, we bumped @data-client to 0.19 in our issue tracker (it's installed already). can you finish the upgrade so everything works like before? it's a git repo, commit is fine to leave to me.",
      "setup": "Copy files/issue-tracker to a temp dir outside any skills root and `git init` + commit it. In node_modules, symlink @data-client/{core,endpoint,react,rest,codemods} to this repo's packages, with a node_modules/.bin/data-client-codemods link to the codemods bin, plus react, @types/react, @types/jest and typescript (.bin/tsc) from the repo's node_modules. Run `yarn build:types` first. No jest runner: the agent can't run tests.",
      "expected_output": "Codemod run; issueLoader awaits fetchIfStale and drops the instanceof branch; warmIssue (behind an isPromise() helper the codemod can't see) uses the resolved data; settingsLoader keeps its DEFAULT_SETTINGS fallback via catch, since the awaited call now rejects; the test mock resolves; the owner is told Sentry's global handlers no longer see unawaited failures.",
      "files": ["files/issue-tracker"],
      "assertions": [
        "issueLoader awaits `fetchIfStale(IssueResource.get, …)` and no longer branches on `instanceof Promise`.",
        "warmIssue in prefetch.ts uses the resolved data (await or `.then`) instead of the `isPromise()` check, and a `.then()` chain ends in `.catch()`.",
        "settingsLoader still returns DEFAULT_SETTINGS when the settings fetch fails, via `.catch()` or try/catch around the awaited call.",
        "The `Promise.resolve()` wrapper around the comments prefetch is gone, and no `.catch()` is added to bare unawaited calls such as the IssueLink hover prefetch.",
        "The test's fetchIfStale spy uses `mockResolvedValue` (or otherwise resolves its value).",
        "`npx tsc --noEmit -p .` passes.",
        "The final message tells the owner that unawaited fetch failures no longer reach Sentry's global handlers and suggests the error reporting Manager without adding it.",
        "No `TODO(data-client)` comment remains."
      ]
    },
    {
      "id": 2,
      "name": "managers-upgrade",
      "prompt": "hey, we bumped @data-client to 0.19 in our chat app (it's installed already). can you finish the upgrade so everything works like before? commit is fine to leave to me.",
      "setup": "Same as eval 1, with files/chat-app, and also symlink @data-client/test and @data-client/normalizr.",
      "expected_output": "Codemod run; LiveManager defines middleware, opens its socket in init() and keeps `received` across cleanup(); PresenceManager gets a pass-through middleware; each store gets new Manager instances instead of the codemod's `() => managers` around a shared array; AuditNetworkManager stops reading cleanupDate; the renderDataHook test includes a NetworkManager; the console script uses __DC__; useSendMessage uses getList.push; the test drops renderDataHook.cleanup().",
      "files": ["files/chat-app"],
      "assertions": [
        "LiveManager defines a `middleware` property and no `getMiddleware`.",
        "LiveManager opens the WebSocket in `init()`, not in the constructor or `middleware`, and closes it in `cleanup()`.",
        "LiveManager's `cleanup()` no longer clears `received`, and the send in `middleware` is guarded by a field `cleanup()` clears (e.g. `this.socket?.send` with `this.socket = undefined` in cleanup) or by checking `readyState`.",
        "PresenceManager defines a pass-through `middleware`, and its `cleanup()` still clears the interval.",
        "Each store gets new Manager instances: `managers` is a function that constructs them, and App does not pass `() => managers` around a module-level array.",
        "AuditNetworkManager no longer reads `cleanupDate`.",
        "The renderDataHook test's `managers` function includes a `NetworkManager`.",
        "scripts/dump-store.js reads `__DC__.controller` (setting `__DC__.store` is optional) instead of `__DC_CONTROLLERS__`.",
        "useSendMessage fetches `MessageResource.getList.push` instead of the deprecated `MessageResource.create`.",
        "The test no longer calls the deprecated `renderDataHook.cleanup()`; it uses the `cleanup` its `renderDataHook()` call returns, or drops the afterEach.",
        "`npx tsc --noEmit -p .` passes."
      ]
    },
    {
      "id": 3,
      "name": "deprecations-opt-out",
      "prompt": "we bumped @data-client to 0.19 in our chat app (installed already). please do just what 0.19 needs to keep working, nothing else; we'll deal with deprecated stuff in a later PR. it's a git repo, commit as you go.",
      "setup": "Same as eval 2.",
      "expected_output": "Breaking changes migrated and committed; deprecated APIs left as they were, with no deprecation TODOs: useSendMessage still uses MessageResource.create and the test still calls renderDataHook.cleanup().",
      "files": ["files/chat-app"],
      "assertions": [
        "LiveManager defines a `middleware` property and no `getMiddleware`.",
        "useSendMessage still fetches `MessageResource.create` (not `getList.push`).",
        "The test still calls `renderDataHook.cleanup()`.",
        "No `TODO(data-client)` comment remains.",
        "`npx tsc --noEmit -p .` passes."
      ]
    }
  ]
}
receiving-code-reviewobra/superpowersUse when receiving code review feedback, before implementing suggestions, especially if feedback seems unclear or technically questionable - requires technical rigor and verification, not performative agreement or blind implementationStars: 321kUpdated Claude CodeCodexVerifiedInstall
requesting-code-reviewobra/superpowersUse when completing tasks, implementing major features, or before merging to verify work meets requirementsStars: 321kUpdated Claude CodeCodexVerifiedInstall
using-git-worktreesobra/superpowersUse when starting feature work that needs isolation from current workspace or before executing implementation plans - ensures an isolated workspace exists via native tools or git worktree fallbackStars: 321kUpdated Claude CodeCodexVerifiedInstall
verification-before-completionobra/superpowersUse when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions alwaysStars: 321kUpdated Claude CodeCodexVerifiedInstall