From 2c1203f29e0d90bb0d3161f2b7de660953a2cc38 Mon Sep 17 00:00:00 2001 From: Kyle Mathews Date: Thu, 3 Dec 2026 11:33:31 -0700 Subject: [PATCH 1/2] docs: add initial Oracles docs and npm onboarding --- README.md | 348 ++---------------- packages/eslint-plugin-oracles/README.md | 5 +- packages/oracles/README.md | 38 +- .../docs/concepts/understanding-oracles.md | 84 +++++ packages/oracles/docs/config.json | 73 ++++ packages/oracles/docs/guides/adopt-oracles.md | 66 ++++ packages/oracles/docs/overview.md | 50 +++ packages/oracles/docs/project/contribute.md | 53 +++ packages/oracles/docs/project/roadmap.md | 66 ++++ .../docs/reference/gap-check-and-replay.md | 55 +++ .../docs/reference/writing-an-oracle.md | 51 +++ packages/oracles/docs/try-oracles.md | 54 +++ .../oracles/skills/oracles-explore/SKILL.md | 19 +- .../oracles-explore/references/problems.md | 9 - .../oracles/skills/oracles-setup/SKILL.md | 43 +-- 15 files changed, 645 insertions(+), 369 deletions(-) create mode 100644 packages/oracles/docs/concepts/understanding-oracles.md create mode 100644 packages/oracles/docs/config.json create mode 100644 packages/oracles/docs/guides/adopt-oracles.md create mode 100644 packages/oracles/docs/overview.md create mode 100644 packages/oracles/docs/project/contribute.md create mode 100644 packages/oracles/docs/project/roadmap.md create mode 100644 packages/oracles/docs/reference/gap-check-and-replay.md create mode 100644 packages/oracles/docs/reference/writing-an-oracle.md create mode 100644 packages/oracles/docs/try-oracles.md diff --git a/README.md b/README.md index 18507ac0..a621bab2 100644 --- a/README.md +++ b/README.md @@ -1,20 +1,42 @@ # TanStack Oracles -Oracle-based testing for TypeScript: state a law, generate the histories where -it matters, and check production against an independent model. +TanStack Oracles helps you define how software should behave and check real +implementations against those requirements. Use it with a coding agent to find +bugs, tackle difficult changes and build more ambitious software. -This package is under construction while it is extracted from TanStack DB's -oracle suite. CI publishes previews for passing pull-request and `main` -commits with [pkg.pr.new](https://pkg.pr.new). +It combines property-based testing, model-based testing, fuzzing and mutation +testing. You decide the rules; the agent builds checks that explore generated +inputs and sequences of operations. Independent models judge the behavior, and +deliberately introduced faults test whether the checks notice failures. The +decisions you capture become executable memory for the next agent. + +Start with one function, feature or troublesome interaction. Keep the oracle +alongside your existing tests, or ask the agent to port the tests into your +unit-test suite. + +## Try it + +Open a coding agent in a project you know well and paste this prompt: + +```text +Show me what oracle testing with @tanstack/oracles can find in this repository. + +Download https://raw.githubusercontent.com/TanStack/oracles/main/packages/oracles/skills/oracles-explore/SKILL.md + +Read it in full and follow it to explore this repository with Oracles. +``` + +The skill installs the latest npm release of `@tanstack/oracles`. JavaScript +and TypeScript have the strongest integration today. Oracles can already be +used with other languages, and porting the full toolkit to them is a top priority. + +
+Tooling and contributor reference For npm releases, see [the release instructions](RELEASING.md). ## Packages -To try it, paste the prompt in -[`packages/oracles/README.md`](packages/oracles/README.md) into your coding -agent. - - `packages/oracles` (`@tanstack/oracles`): the oracle framework, its skills and docs, and the `oracle-gaps` CLI. The CLI lists the production behavior that a project's owning oracles leave unexercised or unjudged. A project runs it as @@ -303,28 +325,6 @@ runs cold` and runs the check in its own process, which reports what the and stay no input (maintainer decision, 2026-11-13, with `watchFile` in the family of `watch`). -- `packages/eslint-plugin-oracles` (`@tanstack/eslint-plugin-oracles`): the - `oracle/*` lint rules. The rules recognize the framework by its package - specifier and by a relative module with its file name. A project names its - variable prefix and its replay-selection modules in `settings.oracles`. - -The `recommended` and `production` configs leave out tool config files: the -configs of ESLint, Vite, and Vitest (`vite.config.ts`, `vitest.unit.config.mjs`) -and any config named for oracles (`*.oracle.config.*`, such as -`eslint.oracle.config.mjs`). A config file is never an oracle file or -production source. A companion oracle module, such as `foo-oracle.ts`, keeps -the oracle rules, and so does a source module named `src/foo.config.ts`. - -A config that spreads a preset and sets its own `ignores` replaces the -preset's, so merge them: - -```js -{ - ...oracles.configs.production, - ignores: [...oracles.configs.production.ignores, 'packages/x/src/machinery/**'], -} -``` - ## Bind calibrations to histories A calibration's `history` selects an existing input directly: @@ -398,288 +398,4 @@ stay silent and do not consume that warning. Bind both probe controls together w `probeHistories`. Search will be removed after consumers migrate, before the first npm release. -## The `oracle/no-unit-test` rule - -An oracle file registers its tests only through `oracleProperty`. Its -histories hold its fixed regressions and enumerated cases, its calibrations -show that the check rejects wrong answers, and its declared states hold its -reach. The rule reports every other test registration in an oracle file as a -unit test, whatever its body calls. Move such a test to an ordinary test file. - -A registration is a call of a test function, with members such as `.each`, -`.skip`, or `.concurrent`. A call to an imported helper that registers its -caller's body is a registration too. `oracle/no-unit-test`, -`oracle/no-disabled`, and `oracle/oracle-property-only` share one account of -a test function, so they agree on every call. A callee's root is a test -function when its binding resolves to a test framework's test function or -suite, or to a fixture of one (`test.extend(fixtures)`). Where the binding -comes from decides, not its name alone: see -[Where a test function comes from](#where-a-test-function-comes-from). The -rules follow these bindings: - -- a named, default, or namespace import (`vitest.it`), a member of - `require('')`, and an unbound name that a test environment - declares as a global; -- a variable's initializer, a destructuring (`const { it: t } = vitest`), - and each plain assignment (`let t; t = it`); -- a cast (`as`, `!`, `satisfies`), and either branch of a conditional or - logical expression (`flag ? it.skip : it`), so a callee that may be a - test function is reported; -- a fixture, a tagged-template `.each`, `oracleReplayTest(it)`, and a - framework's factory call (`mergeTests(a, b)`, uvu's `suite('S')`, - `jest-each`'s `each(table)`, Lab's `script()`); -- an export of a project's test module (a relative module, a `#` import, - or a workspace package): a constant, a re-export, `export * as`, a - default export, and a relay of an imported binding, through star - exports. A cycle of modules or of variables resolves to nothing, and each - export is resolved once per lint. - -A binding that resolves to anything else is no test function, whatever its -name: a local function named `bench`, a namespace of an ordinary relative -module (`patterns.test(...)`), or Ramda's `test`. A member that is no -registration, such as Playwright's `test.step`, registers nothing, bound or -not. A `describe` or `suite` is exempt by the function that it resolves to, -not by its local name. In a cycle of modules, the answer does not depend on -which binding the lint reads first. - -The rules do not recognize these forms: - -- a test function passed as a parameter to a local helper - (`function reg(t) { t('n', fn) }`). `oracle/no-disabled` reports the - `reg(it)` call instead; -- a call through a package that the rules cannot classify that passes no - string title before its function (`fixture(fn)`, `fixture(fn, 'n')`), - because a library's `pMap(xs, fn)` and `effect(fn)` look the same (see - [Where a test function comes from](#where-a-test-function-comes-from)); -- a test function that a body receives as a parameter (`t.test(...)` in - tap, `it.layer(L)(name, (it) => ...)` in `@effect/vitest`), QUnit's - `test.if(name, condition, fn)`, Japa's chain after the call - (`test('n').skip(true)`), and an options object that disables a test - (`{ skip: true }`); -- a computed member whose name is not a string literal, and a variable that - a destructuring assignment (not a declaration) writes; -- a modifier call, such as `.skipIf(flag)`, that another module binds and - exports. A relayed `.skip` is counted at the call. - A call to an imported helper that registers a test of its own is reported - too, because that test would appear under the oracle file. An - `oracleProperty` call whose options are not an object literal with a `check` - is reported, because the rule cannot see its check. - -A test whose body is empty, such as `it('x', () => {})`, `test('x', async -() => {})`, or a skipped placeholder `it.skip('x', () => {})`, checks -nothing. The rule reports it: remove it, or use `it.todo`. - -## Where a test function comes from - -The rules cannot read a package, and they never read one under -`node_modules`. They classify a binding by its source, in this order: - -1. `settings.oracles.testPackages` maps a specifier, or a prefix that ends - in `*`, to a framework's specifier (`'@playwright/test'`) or to a table - of its exports and their roles (`{ authTest: 'test', group: 'suite' }`). - `settings.oracles.nonTestPackages` lists specifiers, or prefixes, whose - exports are no test functions. -2. The known test frameworks, with their default, named, and namespace - exports, the modifiers that an export carries (Jest's `xit` is skipped, - node:test's `only` is focused), and their factories: `vitest`, - `@vitest/runner`, `vite-plus/test`, `@fast-check/vitest`, - `@fast-check/jest`, `@fast-check/ava`, `@effect/vitest`, - `@playwright/test`, `playwright/test`, `@playwright/experimental-ct-*`, - `@jest/globals`, `jest-each`, `mocha`, `mocha-steps`, `node:test`, `test` - (node:test as an npm package), `ava`, `tap`, `tape`, `zora`, `brittle`, - `uvu`, `bun:test`, `@std/testing/bdd`, `jsr:@std/testing...`, `qunit`, - `@japa/runner`, and `@hapi/lab`. The members that keep a registration - are each framework's, such as Playwright's `.fail`, Jest's `.failing`, - node:test's `.expectFailure`, Deno's `.ignore`, and Bun's `.if` and - `.todoIf`. -3. The known packages that export other functions under these names: - Ramda, Rambda, remeda, lodash, mitata, `@thi.ng/*`, benny, tinybench, - `@tensorflow/*`, `step`, chai, `@vitest/expect`, `vitest/*`, Vitest's - browser packages, `@testing-library/*`, Storybook, Cypress's module API, - `@wdio/globals`, and iter-tools. Their exports are never reported. -4. A project's own modules: a relative module, a `#` import through the - nearest package.json's `imports`, and a workspace package, whose - `node_modules` entry resolves to a real path outside every - `node_modules` directory (a pnpm, npm, or Yarn workspace link). The rules - read its `exports` target for the `import` or `default` condition, never - its `types`, so a fixtures package that re-exports Playwright's `test`, - or exports `base.extend(...)` or `base.skip`, is followed. A published - package's `src/` is production, which no rule reads. -5. Any other source is unknown: a package that no setting or table names, - and that is not a project module. Every import from it, named, default, - or namespace, under any local name, is a source the rules cannot - classify. `settings.oracles.unknownSources` decides: - - `'report'` (the default): a title-shaped call through it, with a - string or template title first and a function after it as every - framework's registration has, gets one `unknownTestSource` report from - `oracle/no-unit-test`, at its import, and no other report. So does a - call to a relative helper that makes such a call. A call with no title - before its function, such as `pMap(xs, fn)`, `debounce(fn, 10)`, or - `effect(fn)`, gets none. The report is owed in an `oracle-` machinery - file too, where `oracle/no-disabled` alone guards the tests. - - `'test'`: an export whose name some framework uses for a test function - (`it`, `test`, `xit`, `skip`, `step`, and the rest) is read as that - framework's, as the rules read any package's `it`, `test`, `describe`, - `suite`, and `bench` before 2026-11-12. Any other export is none. - - There is no `'ignore'` mode (maintainer decision, 2026-11-12). A - configuration that still says `'ignore'` is malformed, and the rules read - it as `'report'`. To silence a package, list it in - `settings.oracles.nonTestPackages`. - - A `#` import whose `imports` target is a package (`"#vitest": -"vitest"`) is classified as that package. - -An unbound name is a test function when a test environment declares it as -a global: Vitest's `globals`, and Jest's, Mocha's, and Jasmine's (`it`, -`test`, `specify`, `xit`, `fit`, `describe`, `suite`, `context`, -`xdescribe`, `fdescribe`, and the rest), and `Deno.test` and `QUnit.test`. -`module`, `run`, `step`, and `fail` are left out, because other -environments declare them for other things. - -A registration's body follows its first argument, a title. Only a -framework whose title is optional takes a function first as the body: -node:test (and the `test` package), tap, tape, brittle, and `Deno.test` -(`test(fn)`, `test(options, fn)`). Elsewhere a function first is no body. -Playwright's `test.skip`, `test.fixme`, `test.fail`, and `test.slow` with -no arguments, a reason only, a boolean condition, or a condition callback -(`test.skip(({ browserName }) => ..., 'reason')`) are annotations, at file, -describe, or test scope: they register nothing, so `oracle/no-unit-test` -reports nothing for them, and `oracle/no-disabled` reports the `skip` and -`fixme` ones, which switch tests off. For Playwright, `test.skip('reason')` -is such an annotation; for other frameworks, `it.skip('name')` with no body -disables nothing. - -A setting that the rules cannot use is reported at line 1 as -`malformedSetting`, and it is read as unset, all of it: a -`settings.oracles` that is not an object (`null`, a string, a number, an -array), a `testPackages` that is not an object or that maps a specifier to -anything but a known framework's specifier or a table of `'test'` and -`'suite'` roles (`'constructor'` is no framework), a `nonTestPackages` that -is not an array of strings, and an `unknownSources` that is not `'report'` or -`'test'`. That includes `'ignore'`, which is no mode: its message names -`settings.oracles.nonTestPackages` as the replacement. - -```js -{ - settings: { - oracles: { - testPackages: { - 'pw-fixtures': '@playwright/test', - '@acme/legacy-fixtures': { authTest: 'test' }, - }, - nonTestPackages: ['@acme/regex'], - }, - }, -} -``` - -## Decisions - -The decisions that the rules and their oracles cite: - -- **2026-11-12, maintainer: recognize test functions precisely.** "agree - with reversed decision -- false positives are annoying and we should be - able to be precise". It reverses the coordinator decision of 2026-11-11 - that failed closed on any package's `it`, `test`, `describe`, `suite`, or - `bench`. The rules classify a binding by its source - ([Where a test function comes from](#where-a-test-function-comes-from)), - and `settings.oracles.unknownSources` defaults to `'report'`. -- **2026-11-12, coordinator, under that decision: an unknown source is - reported by the call's shape, not its name.** A title-shaped call through - any import of an unknown source gets `unknownTestSource`, whatever its - local name; a call with no title before its function stays silent. -- **2026-11-12, coordinator: where a registration's body may be is each - framework's grammar.** A function first is a body only where the - framework's title is optional (node:test, tap, tape, brittle, - `Deno.test`). Playwright's `test.skip(condition, description)` and its - other annotation forms register nothing: `oracle/no-disabled` reports the - disabling ones and `oracle/no-unit-test` reports nothing, and that is how - the rules agree on them. This replaces the same day's earlier instruction - that every rule find a body in any argument position, which made - `oracle/no-unit-test` report an annotation as a unit test. -- **Maintainer approval of the v21 cleanup plan, 2026-11-12: remove the - `unknownSources: 'ignore'` mode.** A global ignore mode would let an unknown - source pass silently. Silence for a package comes only from - `settings.oracles.nonTestPackages`, an explicit entry that a reviewer can - read. The modes are `'report'` (the default) and `'test'`. A configuration - that still says `'ignore'` gets `malformedSetting`, with a message that - names `nonTestPackages`, and the rules read the setting as unset. They never - throw. -- **Maintainer approval of the v21 cleanup plan, 2026-11-12: one id for a - malformed setting, `malformedSetting`.** `oracle/no-unit-test` and `oracle/oracle-property-only` - report every malformed `settings.oracles` entry under this id, at line 1, - and read it as unset (or as an empty list). It replaces the id - `malformedSourceSetting`, and the two rules no longer use separate ids. - -The limits that these decisions accept, which the oracles -(`lint.test-source-recognition`, `lint.test-function-agreement`) state: - -- **Maintainer approval of the v21 cleanup plan, 2026-11-12: the - identifier-title limit is accepted as a recorded limit.** An unknown source's call that passes no title before its - function is silent, whatever it does (`fixture(fn)`). So is one whose title - is a binding or a call (`it(name, fn)`, `it(String(n), fn)`, and a helper's - `t(name, fn)` with a parameter `name`), because such a call cannot be told - apart from `pMap(items, fn)`; only a string or template title makes it - title-shaped. Name the package in `settings.oracles.testPackages` to have - it judged. A known framework's registration counts whatever its title - expression is. -- An unknown source's title-shaped call is reported even when it is no - test, such as a library's `step('install', fn)`, `module('m', fn)`, or - Pinia's `defineStore('main', () => ...)`. Name the package in - `settings.oracles.nonTestPackages`. -- The rules never read a package under `node_modules`, a published - package's `src/`, a TypeScript `paths` alias, a dynamic `import()`, or a - nested `exports` condition other than `import` and `default` (such as - `{ node: { import: ... } }`). -- A test function that a body receives as a parameter, QUnit's - `test.if(name, condition, fn)`, Japa's chain after the call, and an - options object that disables a test are not recognized. -- Each lint parses the project modules that an oracle file imports. A - long-lived ESLint process reuses a parse while the module is unchanged; - a fresh process, such as an agent's post-edit hook, parses each module - again (about half a second for a 6000-line module). The lint selection - helper `resolveImportedTestModule` keeps one session for its process, so - a long-lived caller sees the paths of its first answers. - -## The `oracle/no-oracle-disable` rule - -An ESLint directive that would silence an `oracle/*` rule is reported: a -directive whose rule list names an oracle rule, a directive with no rule list -(it silences every rule), and an inline config comment that names an oracle -rule. Rule names may be quoted. The forms are the line, next-line, and block -forms, with or without a `-- description`. Oracle rules cannot be disabled -inline, so the directive is the report. - -A report sits on the directive's own line. A directive that names this rule or -has no rule list can hide its own report, and so can a directive under an -earlier block directive. Those reports sit at line 1, column 0 instead. - -Residuals the rule cannot close: - -- A directive on line 1 that names this rule or has no rule list covers the - file's start, so no report can sit there. -- In production source, a config comment that turns this rule off - (`eslint oracle/no-oracle-disable: "off"`) switches the rule off for the file. - ESLint then runs no rule, and none reports it. -- `noInlineConfig` in the `recommended` config makes ESLint ignore every - directive of every rule in an oracle file, not only the oracle rules. A - directive for another rule in an oracle file has no effect. - -## The `oracle/oracle-property-only` rule - -In an oracle file, a generated-history campaign must run through -`oracleProperty`, whose constructed histories make each declared state's reach -required. The rule reports: - -- a raw campaign: `fc.assert` or `fc.check` on a fast-check binding, from - `fast-check` or `@fast-check/vitest`, and a `.prop` registration of a test - root; -- an import of `createOracleReach` or `runOracleCampaign`, from any module. - -A framework implementation module is exempt. - -No configuration exempts any other file. - -A non-array `settings.oracles.implementationModules` or `replayWitnessModules` is -reported at line 1 as `malformedSetting`, and it is read as an empty list. +
diff --git a/packages/eslint-plugin-oracles/README.md b/packages/eslint-plugin-oracles/README.md index a406a72f..55224178 100644 --- a/packages/eslint-plugin-oracles/README.md +++ b/packages/eslint-plugin-oracles/README.md @@ -5,8 +5,9 @@ shortcuts that make an oracle pass without enforcing its law, wherever a syntactic check can see them. They need no type information, so an agent's post-edit hook can run them on one file quickly. -Install it at the same pkg.pr.new commit as `@tanstack/oracles`. The -`oracles-setup` skill in that package configures it. +Install `@tanstack/eslint-plugin-oracles@latest` alongside +`@tanstack/oracles@latest` from npm. The `oracles-setup` skill in that package +configures it. ## Configs diff --git a/packages/oracles/README.md b/packages/oracles/README.md index 6c7563bd..34240fd2 100644 --- a/packages/oracles/README.md +++ b/packages/oracles/README.md @@ -1,20 +1,38 @@ # @tanstack/oracles -Oracle testing for TypeScript: an agent states what your code promises, then -checks your real code against an independent model of those promises. +TanStack Oracles helps you define how software should behave and check real +implementations against those requirements. Use it with a coding agent to find +bugs, tackle difficult changes and build more ambitious software. + +It combines property-based testing, model-based testing, fuzzing and mutation +testing. You decide the rules; the agent builds checks that explore generated +inputs and sequences of operations. Independent models judge the behavior, and +deliberately introduced faults test whether the checks notice failures. The +decisions you capture become executable memory for the next agent. + +Start with one function, feature or troublesome interaction. Keep the oracle +alongside your existing tests, or ask the agent to port the tests into your +unit-test suite. + +## Try it + +Open a coding agent in a project you know well and paste this prompt: ```text Show me what oracle testing with @tanstack/oracles can find in this repository. -1. Find the current commit of TanStack/oracles. Run - `git ls-remote https://github.com/TanStack/oracles refs/heads/main`, and use - the first 7 characters of the hash as . -2. Install https://pkg.pr.new/TanStack/oracles/@tanstack/oracles@ as a dev - dependency, with this repository's package manager. -3. Read node_modules/@tanstack/oracles/skills/oracles-explore/SKILL.md in full, - and follow it. Use wherever a skill asks for the commit to pin. +Download https://raw.githubusercontent.com/TanStack/oracles/main/packages/oracles/skills/oracles-explore/SKILL.md + +Read it in full and follow it to explore this repository with Oracles. ``` +The skill installs the latest npm release of `@tanstack/oracles`. JavaScript +and TypeScript have the strongest integration today. Oracles can already be +used with other languages, and porting the full toolkit to them is a top priority. + +
+Tooling and contributor reference + ## Time limits A mutant copy runs under a wall-clock backstop: `--hang-limit` (60 s by default) @@ -71,3 +89,5 @@ The rest of the hooks are older, and each is inert unless its variable is set: - `ORACLE_GAPS_TEST_UNSUPERVISED` (any value): runs a check without its supervisor, the path that a run took on win32 before the supervisor covered it. - `ORACLE_GAPS_TEST_HOLD_UNTIL` (a file path): after its done line, the process keeps its exit until the file exists. The hold fails loudly after 60 s and leaves `.unreleased` behind. - `ORACLE_GAPS_TEST_WARM_PROBE` (a file path): the first config warm-up stands still on a service in the run's process group, which a stop signal ends, and holds the process 200 ms after the signal, as Vitest's handler does. The probe writes the service's pid to the path, so a test can stop the service by name (#139). + +
diff --git a/packages/oracles/docs/concepts/understanding-oracles.md b/packages/oracles/docs/concepts/understanding-oracles.md new file mode 100644 index 00000000..47bc32b8 --- /dev/null +++ b/packages/oracles/docs/concepts/understanding-oracles.md @@ -0,0 +1,84 @@ +--- +title: Understanding Oracles +description: Independent models, generated histories and executable design knowledge for coding agents. +--- + +Oracles brings powerful and sophisticated testing and specification ideas into the everyday work of developing software with coding agents. + +> [!NOTE] +> Outline draft for review. One conceptual overview will connect the ideas; deeper sources remain linked rather than becoming a prerequisite course. + +## Start with one rule + +> The header must never cover the page content. + +- Start with Headroom: change the header’s content and size, then check that its wrapper reserves enough space. +- Show the historical bug: the header grew while its wrapper kept the old height. +- Some laws need only a simple constraint. Others need a reference calculation or a small simulation. Start with the simplest model that captures the behavior you want to check. + +![Before and after a Headroom fix: the wrapper grows with the header so the header does not cover the page content.](https://raw.githubusercontent.com/KyleAMathews/tanstack-oracles-talk-assets/main/assets/02-header-height-2db4612fefea.gif) + +_A historical Headroom bug, reproduced against an earlier version._ + +## Decide what you want, then check it + +- The design loop works out what the software should do: behavior, priorities, performance budgets and tradeoffs. +- The enforcement loop checks whether the implementation does that, and whether the oracle notices when it does not. +- Agents help explore alternatives and their consequences. You make the design decisions, such as how tasks with equal priority should be ordered. + +## From examples to promises + +- An example test records an answer for one case. +- A property states a rule over a domain; generated inputs explore it. +- A test oracle supplies a judgment about correct behavior. +- Introduce the running example: maintaining the highest-priority open tasks as records change. + +## Simulate the behavior simply + +- Keep tasks in a plain collection, apply each batch of edits, then filter, sort and take the top ten. +- Production may use indexes, caches and incremental updates. The independent model can recompute the result after each batch. +- Compare exactly the promised result: an empty answer can satisfy filtering, ordering and size constraints without satisfying the query. +- Explain why an independent model can still be mistaken and needs scrutiny. + +## Observe behavior where the promise applies + +- Law, history, model, driver, observation and check, connected through one example. +- Include intermediate publications or messages when final state alone can hide a defect. +- A disagreement can reveal a bug, a model mistake or an unresolved design question. + +## Challenge the oracle too + +- Constructed histories ask whether execution reached the important situation. Deliberately create a tie at the tenth slot: add nine higher-priority tasks, then equal-priority B followed by A. Check that A takes the slot, completing A admits B and reopening A restores A. +- Calibrations ask whether the check would recognize a failure. In a separate history where both tied tasks fit, replace `[A, B]` with `[B, A]` and require the ordering check to reject it. A check that compares only length would miss the swap. +- Gap investigations change copies of production code and check whether the oracle notices. An unnoticed fault starts an investigation: improve the histories, model, observations or comparison and run again. Enforcement gaps are not waived. +- Generated exploration, shrinking and replay; what finite testing does and does not establish. + +## Make the next change easier + +- Follow an optimization that accidentally changes the order of equal-priority tasks. Show the failure and the design decision it points back to. +- Explain how a later human or agent can use that decision when it becomes relevant to their work. +- When a bug slips through, improve the part of the oracle that missed it. More random inputs will not repair a comparison that ignores the relevant result. +- Use the subscriber-message story from Kyle’s DB post: checking message semantics exposed bugs that comparing final maps had hidden. + +## Where these ideas come from + +- Property-based testing: [QuickCheck](https://www.cs.tufts.edu/~nr/cs257/archive/john-hughes/quick.pdf) and generators. +- Model-based testing: [fast-check’s conceptual overview](https://fast-check.dev/docs/advanced/model-based-testing/) and independent state/behavior judgments. +- Mutation testing: [Stryker’s introduction](https://stryker-mutator.io/docs/) and testing whether tests notice changes. +- Formal methods: [TLA+](https://lamport.azurewebsites.net/tla/tla.html) and specifying designs as models with properties to verify. +- These ideas apply across languages. The current JavaScript/TypeScript tooling is one integration of the method. + +## Connect formal verification to production code + +- Formal verification establishes properties of a model; an implementation oracle checks those same properties against production code across generated histories. +- Explain how Lean proofs and TLA+/TLC model checking can strengthen the models used to judge production behavior. +- Show the shared model connecting the two: **formal verification ↔ model ↔ production code**. + +## Why coding agents change the economics + +- Agents make demanding model, generator and investigation work more practical. +- Better checks make it practical to attempt more ambitious algorithms, richer behavior and larger changes. +- Preserve what each investigation teaches, so later work starts with better feedback and a clearer design. +- Read [Kyle’s DB/Oracles post](https://tanstack.com/blog/tanstack-db-1.0-rc1-going-all-in-on-oracles) and the existing [introduction](../intro.md). + + diff --git a/packages/oracles/docs/config.json b/packages/oracles/docs/config.json new file mode 100644 index 00000000..5eb4500f --- /dev/null +++ b/packages/oracles/docs/config.json @@ -0,0 +1,73 @@ +{ + "$schema": "https://raw.githubusercontent.com/TanStack/tanstack.com/main/tanstack-docs-config.schema.json", + "sections": [ + { + "label": "Oracles", + "tab": "home", + "children": [ + { + "label": "Overview", + "to": "overview" + } + ] + }, + { + "label": "Get Started", + "tab": "get-started", + "children": [ + { + "label": "Try Oracles", + "to": "try-oracles" + } + ] + }, + { + "label": "Guides", + "tab": "guides", + "children": [ + { + "label": "Adopt Oracles in your codebase", + "to": "guides/adopt-oracles" + } + ] + }, + { + "label": "Concepts", + "tab": "guides", + "children": [ + { + "label": "Understanding Oracles", + "to": "concepts/understanding-oracles" + } + ] + }, + { + "label": "Reference", + "tab": "api", + "children": [ + { + "label": "Writing an oracle", + "to": "reference/writing-an-oracle" + }, + { + "label": "Gap check and replay", + "to": "reference/gap-check-and-replay" + } + ] + }, + { + "label": "Project", + "tab": "home", + "children": [ + { + "label": "Roadmap", + "to": "project/roadmap" + }, + { + "label": "Contribute and participate", + "to": "project/contribute" + } + ] + } + ] +} diff --git a/packages/oracles/docs/guides/adopt-oracles.md b/packages/oracles/docs/guides/adopt-oracles.md new file mode 100644 index 00000000..ae839424 --- /dev/null +++ b/packages/oracles/docs/guides/adopt-oracles.md @@ -0,0 +1,66 @@ +--- +title: Adopt Oracles in your codebase +description: Keep what you learn from one investigation and make future changes easier to check. +--- + +Start with one important behavior and keep what you learn. An oracle can sit alongside your existing tests, help the next agent understand the design and check a refactor or optimization against the rules you agreed on. + +The decisions you capture become executable memory. When a change violates one, the oracle brings the relevant rule and a failing case back into view. + +> [!NOTE] +> Outline draft for review. The concrete package, runner and lint integration currently targets JavaScript/TypeScript; identify adaptations for other languages explicitly. + +## Choose what to keep + +- Begin with [Try Oracles](../try-oracles.md). Oracles is especially useful for thoroughly testing a specific area of your codebase. +- You can ask the agent to port the tests into your existing unit-test suite afterward. Check that each regression fails before the fix and passes afterward. +- To continue using Oracles, keep the oracle and follow the setup below. Preserve the rules it checks, its test cases and the evidence that it catches bugs. + +## Finish repository setup + +- Pin compatible toolkit packages; configure the test runner and the gap check. +- Add lint presets and agent instructions that point to the installed skills. +- Fit oracle files around the existing suite and workspace structure. +- Connect the validated workflow to CI, with replayable failures and clear ownership. + +## Expand by behavior + +- Choose another function, feature or interaction that matters to the people using your software. +- Reuse the test machinery while keeping each model independent of the production implementation. +- Track which code each oracle owns, the promises it checks and the remaining limits. + +## Make the next change easier + +- Use the oracle when asking an agent to refactor, optimize or replace the implementation. +- Keep the design decisions beside the checks, so a later agent can understand why a result matters. +- When review finds a missed bug, investigate why the oracle missed it: the generated cases, simulation, observations or comparison may need to improve. +- If the investigation exposes an undecided behavior, settle that design question before making it a new rule. + +## Evolve the design for a new feature + +- Use a request for pinned tasks as an example of a new design decision: do pinned tasks count toward the ten-task limit, and where should they appear? +- Let the agent explore the consequences of different choices. Decide which behavior you want before changing the rules. +- Update the law, model and checks together so later implementations preserve the new decision. + +## Migrate existing tests + +- Identify the obligation behind an existing example or group of tests. +- Express that obligation in an approved law with suitable histories and observations. +- Demonstrate that the oracle detects the original defect or another meaningful violation. +- Remove redundant tests only after their obligations remain covered. +- Keep a concrete before/after conversion example here. + +## Add a ratchet + +- The shipped preset enforces discipline inside oracle files, including how tests register. +- A broader policy against new ordinary unit tests is a separate repository decision and enforcement setup. +- Describe the chosen scope, treatment of existing tests and gradual conversion process. +- Add a verified configuration/CI recipe before claiming repository-wide enforcement is available. + +## Keep improving the checks + +- Diagnose disagreements before changing expected behavior. +- Keep fixes, refactors and law changes tied to the evidence appropriate to them. +- Link [Writing an oracle](../reference/writing-an-oracle.md) and [Gap check and replay](../reference/gap-check-and-replay.md). + + diff --git a/packages/oracles/docs/overview.md b/packages/oracles/docs/overview.md new file mode 100644 index 00000000..949cd212 --- /dev/null +++ b/packages/oracles/docs/overview.md @@ -0,0 +1,50 @@ +--- +title: Overview +description: Find bugs, tackle difficult changes and build more ambitious software with coding agents. +--- + +Oracles helps you and your coding agent find bugs, tackle difficult changes and build more ambitious software. Use it with applications, services, tools and libraries. + +Define how your software should behave, then check real implementations against those requirements. Your coding agent helps find violations and strengthen the checks as you learn more about the code. + +> [!NOTE] +> Outline draft for review. The sections below define the initial page’s coverage. + +## Build what you’ve been putting off + +Fix bugs you’ve learned to live with. Revisit designs you’ve been afraid to change. Try a more ambitious algorithm. Better verification gives us room to attempt more. + +- Coding agents make it cheaper to try different implementations. Oracles helps you check that they do what you intended. +- You decide how the software should behave. The agent builds an oracle to check that behavior across generated inputs and sequences of operations. +- Choose a simple independent model for the behavior: a constraint, a reference calculation or a small simulation. Test whether the oracle notices deliberately introduced faults. + +## Start with your own code + +- [Try Oracles](./try-oracles.md): paste a prompt into your coding agent. Start with one function, feature or troublesome interaction in a project you know. +- When the agent finds a problem, see the actions that produced it, what should have happened and what the code actually did. +- Optional narrated recording of the same flow; the prompt remains available as text. + +## Make the next change easier + +- Keep the rules you agreed on and the oracle that checks them, so the next agent can use what you learned. +- Refactor or optimize the implementation while checking that the behavior people rely on still holds. +- When a bug gets through, improve the oracle so later changes are checked for that kind of mistake too. + +## Start small + +- Use an oracle to thoroughly test one area of your code, then port the tests into your existing unit-test suite. +- Keep an oracle alongside the tests you already have, then [adopt the workflow](./guides/adopt-oracles.md) one behavior at a time. + +## Languages and tooling + +- The strongest current integration is JavaScript/TypeScript: framework, gap check, lint rules and agent skills. +- Oracles can already be used elsewhere; porting the full toolkit to other languages is a top priority. +- Concrete setup and reference instructions identify the language and tooling they apply to. + +## Explore the ideas and the project + +- [Understanding Oracles](./concepts/understanding-oracles.md): the testing ideas and their relevance to coding agents. +- [Roadmap](./project/roadmap.md): what better verification could let us build, and what we’re working on next. +- [Contribute and participate](./project/contribute.md): bring difficult code, build the toolkit or join an investigation. + + diff --git a/packages/oracles/docs/project/contribute.md b/packages/oracles/docs/project/contribute.md new file mode 100644 index 00000000..f551f003 --- /dev/null +++ b/packages/oracles/docs/project/contribute.md @@ -0,0 +1,53 @@ +--- +title: Contribute and participate +description: Help build Oracles or join the deeper investigation into agent-driven development. +--- + +Bring a codebase you’ve wanted to improve or a behavior you’ve struggled to test. Help us explore what becomes possible when coding agents have better ways to check their work. + +> [!NOTE] +> Outline draft for review. Joining destinations, meeting logistics and contribution commands still need concrete details. + +## Work on a difficult problem together + +- Investigate a stubborn bug, a risky refactor or an algorithm you’ve wanted to try. +- Bring applications, services, tools and libraries, along with the behavior you want to understand or improve. +- Share what the investigation taught you and improve the toolkit with what you learned. + +## Report an experience + +- Tell us what happened in a first session, what was confusing and where the workflow stalled. +- Preserve the relevant versions, commands and rerunnable evidence. +- Share a useful finding or model/design question with enough context to investigate it. + +## Build the toolkit + +- Code, docs, small examples and clearer diagnostics. +- Porting the full toolkit to other languages is a top priority. +- Build reusable pieces that make it easier for others to try a new model, driver or workflow. +- Improve a generator, model-checking technique or agent strategy and make that improvement available to existing oracles. +- Help compare approaches on real repositories: bugs found, time, computational and token cost, and how useful the checks remain after later changes. +- Add repository setup, validation commands and the contribution/review process here. + +## Join the Future of Programming effort + +Kyle plans to work with the Protocols Institute on a **Future of Programming** research effort in 2027. Follow the research email list for updates and opportunities to contribute. + +- Regular meetings for people going deeper into the ideas and experiments. +- Hackathons and meetups for trying techniques together on real codebases. +- Work together on real bugs, modeling problems and new approaches, then share the results. + +## Where to join + +- Add the author-supplied Future of Programming email signup link; it is still a placeholder in the release post. +- Add the actual discussion channel and contact route. +- Add the meeting format, time zone and event listings when known. +- Link [the roadmap](./roadmap.md) and clearly marked research questions. + +## Useful starting points + +- [Try Oracles](../try-oracles.md) and report the experience. +- [Adopt the workflow](../guides/adopt-oracles.md) and show how it fits your codebase. +- [Understand the ideas](../concepts/understanding-oracles.md) before exploring an extension. + + diff --git a/packages/oracles/docs/project/roadmap.md b/packages/oracles/docs/project/roadmap.md new file mode 100644 index 00000000..ce96cd2a --- /dev/null +++ b/packages/oracles/docs/project/roadmap.md @@ -0,0 +1,66 @@ +--- +title: Roadmap +description: Better verification, more ambitious software and an open toolkit to explore what comes next. +--- + +We can fix bugs we’ve learned to live with. We can revisit designs we’ve been afraid to change. We can build things that used to be too expensive to verify. Oracles is an early toolkit for exploring how far better verification can take software development with coding agents. + +> [!NOTE] +> Outline draft for review. Research topics below are candidates for public discussion, not dated delivery commitments. + +## What could we build with this? + +- More ambitious algorithms, richer behavior and larger changes, with clear checks for what must remain true. +- Repositories where a new human or agent can find the design decisions, run the checks and investigate a surprising result. +- Tools that turn more human judgment into feedback agents can use throughout development. +- As more behavior becomes explicit and enforceable, explore different implementations while keeping the requirements fixed. + +## What you can use today + +- Agent-led exploration and skills for design, setup, review and evaluating review findings. +- The current JavaScript/TypeScript framework, gap check and lint integration. +- Use with other languages is already possible; explain the current adaptation path and its limits. + +## A top priority: other languages + +- Port the full toolkit beyond JavaScript/TypeScript. +- Identify the work needed for language-appropriate execution, observation, gap checks, lint/tooling and agent guidance. +- Invite language-specific use cases, experiments and contributors. +- Show actual support status as ports develop. + +## An open toolkit for agent-driven development + +- Follow Kyle’s LLVM analogy: reusable pieces that other tools and workflows can combine and extend. +- Make it easier to improve a model, generator, driver or check while reusing the surrounding machinery. +- Invite experiments with richer models, new ways to observe behavior and different development workflows. + + + +## Explore agents as optimizing compilers + +- Investigate turning high-level behavioral specifications into concrete plans and implementations, then compare implementations against the same requirements. +- Explore progressively lowering specifications into code with agents choosing and checking implementation strategies. +- Trade quick, inexpensive generation against spending more computation to improve runtime speed, memory use or bundle size. +- Use representative workloads and explicit budgets to judge those improvements. +- Strengthen the models with formal techniques where useful, including Lean proofs and TLA+/TLC model checking, then connect them to checks against production code. + +## Compare approaches on real repositories + +- Kyle is building shared evaluation infrastructure for comparing models, generators and agent strategies. +- Measure which approaches find bugs fastest, with what computational and token cost. +- Investigate which models and checks remain useful as implementations change. +- Make improvements reusable: a better generator, model-checking technique or agent strategy can benefit existing oracles. + +## Active investigations to curate + +- Fault injection, recovery and guided exploration: clearly labeled design work. +- Faster feedback, clearer diagnostics and usable interfaces for new integrations. +- Select public examples from reviewed research; keep internal notes and open proposals in their proper status. + +## How priorities evolve + +- Evidence, experience with real codebases and participant feedback. +- Link current proposals and their status; avoid invented schedules. +- [Contribute or join the investigation](./contribute.md). + + diff --git a/packages/oracles/docs/reference/gap-check-and-replay.md b/packages/oracles/docs/reference/gap-check-and-replay.md new file mode 100644 index 00000000..ad3d99d7 --- /dev/null +++ b/packages/oracles/docs/reference/gap-check-and-replay.md @@ -0,0 +1,55 @@ +--- +title: Gap check and replay +description: Run the gap check, interpret its output and replay a failure. +--- + +Command and output reference for the current JavaScript/TypeScript gap-check CLI. + +> [!NOTE] +> Outline draft for review. Expand each section using the release CLI help and output captured from the complete example. + +## Run a check + +```sh +pnpm exec oracle-gaps --package --source --seed +``` + +- Source paths and `--config` are relative to the selected package. +- Include configuration discovery, environment prefix, daemon use and report location. +- Document the main flags with defaults and links to less common controls. + +## Read the baseline first + +- Each test file’s result, failing law, counterexample and replay command. +- A failing law is left out of judging; passing tests in the same file still judge mutants. A broken owner file judges nothing. +- Mutants reached only by failing laws or broken owner files are blocked, and the report is provisional. +- Distinguish setup refusal, an oracle disagreement and a production defect. + +## Interpret gaps + +- An unnoticed fault starts an investigation. Check whether the histories reach it, the driver observes its consequences and the comparison recognizes the violation; strengthen the oracle and run again. +- Enforcement gaps are not waived. If a gap exposes undecided behavior, resolve the design question; if the tooling is wrong, report the evidence and fix the tooling. +- Explain the reported classes and the observation each asks the author to investigate. +- Separate reproducible law verdicts from crashes, timeouts, ordinary-test results and unowned code. +- Link the relevant design/review instructions without copying the full workflow here. + +## Replay a failure + +- Seed, path, property and unit selection with the configured environment prefix. +- Copy the exact replay line from the report before changing expectations. +- Keep a useful counterexample as a regression history after diagnosis. + +## Reports and exit statuses + +- `summary.md`, structured results and diagnostic logs. +- **Exit 0 means the run completed; gaps may remain.** +- Refused, internal-error and stopped outcomes, with their diagnostic paths. +- The final `oracle-gaps: done` line and progress/heartbeat output. + +## Troubleshoot a run + +- Wrong package/config, incompatible environment, blocked owners and resource limits. +- Report framework problems with evidence; keep the law intact while investigating. +- Link [Writing an oracle](./writing-an-oracle.md) and [adoption](../guides/adopt-oracles.md). + + diff --git a/packages/oracles/docs/reference/writing-an-oracle.md b/packages/oracles/docs/reference/writing-an-oracle.md new file mode 100644 index 00000000..6aa42f5b --- /dev/null +++ b/packages/oracles/docs/reference/writing-an-oracle.md @@ -0,0 +1,51 @@ +--- +title: Writing an oracle +description: A complete example and reference for the JavaScript/TypeScript oracle framework. +--- + +Reference for the current JavaScript/TypeScript integration. Start with one small, complete oracle and the production module it checks. + +> [!NOTE] +> Outline draft for review. The complete example and option descriptions must match the selected release; [PR #250](https://github.com/TanStack/oracles/pull/250) supplies candidate material to verify. + +## One complete oracle + +- A tiny production module with a precise observable promise. +- The law and authority, owned source, histories, independent model, driver, check and calibration in one file. +- Show installation and the command that runs this exact example through the gap check. +- Keep displayed code synchronized with its executable source. + +## Register a law + +- `oracleProperty`: property identity, law statement, authority and limits. +- `owns`: the production source or functions the oracle judges. +- Explicit configuration through `configureOracles` when defaults need changing. + +## Describe histories + +- Generated histories, fixed seeds and random campaigns. +- Constructed histories, fixed regressions, declared states and measured states. +- Enumerated histories and their limits. + +## Compute, drive and compare + +- Model and optional plan resolution. +- Choose the simplest model that captures the law: a constraint, a reference calculation or a small simulation. +- Driver observations and checkpoints. +- Check verdicts, `differs`, `pass` and `violation`. +- Independence, synchronous expected answers and production errors as observations. + +## Demonstrate sensitivity + +- Reach: show that execution actually enters the important situation. Use a constructed history that creates a tie at the tenth-task boundary. +- Calibration: show that the check rejects a known wrong result. Use a separate history where both tied tasks fit, then swap `[A, B]` into `[B, A]` and require the ordering law to reject it. +- Corrupt-trace and mutant-driver calibrations. +- Reach and probe-related options where applicable. +- Work bounds, timeouts, failure fidelity and replay helpers. + +## Explore other model styles + +- Link the existing [model styles](../model-styles.md), [techniques](../guide.md), [glossary](../glossary.md) and [checklist](../oracle-checklist.md). +- Distinguish exact interface facts here from design guidance in those sources. + + diff --git a/packages/oracles/docs/try-oracles.md b/packages/oracles/docs/try-oracles.md new file mode 100644 index 00000000..ced84701 --- /dev/null +++ b/packages/oracles/docs/try-oracles.md @@ -0,0 +1,54 @@ +--- +title: Try Oracles +description: Try Oracles with your coding agent on a function, feature or interaction in your own codebase. +--- + +Pick a project you know well and let your coding agent investigate one function, feature or troublesome interaction. Paste the prompt below to start. + +> [!NOTE] +> Outline draft for review. The prompt downloads the explore skill from GitHub’s `main` branch; the skill installs the latest npm release. + +## What to expect + +Start with a codebase you can run and change locally. Pick a part to investigate, or ask the agent to suggest one. + +1. The agent reads your code, runs small experiments and shows you what it finds. +2. You decide what the code should do. The agent writes an oracle to check those rules across many inputs and sequences of operations. +3. When you confirm a bug, the agent makes the oracle catch it, fixes the code and reruns the checks. +4. The agent tests the oracle by changing a copy of your code and checking whether the oracle notices. You can ask it to explain how the oracle caught a bug using the actual code and failing case. + +When a problem turns up, you get something concrete to inspect: the actions that produced it, what should have happened and what your code actually did. + +The agent installs the test packages it needs and adds an oracle file, with test configuration if needed. You can stop at any time and decide later whether to set up Oracles more broadly. + +## Paste this prompt + +```text +Show me what oracle testing with @tanstack/oracles can find in this repository. + +Download https://raw.githubusercontent.com/TanStack/oracles/main/packages/oracles/skills/oracles-explore/SKILL.md + +Read it in full and follow it to explore this repository with Oracles. +``` + +## A few words you’ll encounter + +- **Probe:** a focused experiment to learn how the code behaves. +- **Law:** one promise about how the code should behave across a set of inputs or situations. +- **Model:** a simplified simulation of how the code should behave, written independently of the production implementation. +- **History:** one test case: an input or sequence of operations, usually generated randomly through property-based testing. +- Link unfamiliar terms to the [glossary](./glossary.md) as they become relevant. + +## Watch a session + +- Recording to add: a short narrated investigation on a real codebase. +- Show the evidence, a human decision, a counterexample and the resulting change. +- Reuse the recording for social media; keep the written prompt usable without it. + +## After your first session + +- Use the oracle to test the area more thoroughly, then ask the agent to port the tests into your existing unit-test suite. Keep regression cases that fail before the fix and pass afterward. +- [Keep the oracle](./guides/adopt-oracles.md) alongside your current tests. The next agent can check changes against the behavior you agreed on here. +- For other languages: describe the currently available adaptation path before adding runnable instructions; do not imply identical tooling support. + + diff --git a/packages/oracles/skills/oracles-explore/SKILL.md b/packages/oracles/skills/oracles-explore/SKILL.md index d7d008bc..21faf5f0 100644 --- a/packages/oracles/skills/oracles-explore/SKILL.md +++ b/packages/oracles/skills/oracles-explore/SKILL.md @@ -1,10 +1,23 @@ --- name: oracles-explore -description: Explore an area of a codebase with @tanstack/oracles, or the whole repository. Probe the real API to prove each finding, propose a potential oracle and its potential laws, build it, fix confirmed bugs oracle first, and close gaps until bugs or design questions turn up. The first time in a repository, it also onboards the developer: what the session will do, new words explained as they come up, a walk-through, and the choice to finish setting up. Use when someone is trying @tanstack/oracles, asks where an oracle would help, or asks to explore an area ("explore the clearQueue API"). +description: 'Explore an area of a codebase with @tanstack/oracles, or the whole repository. Probe the real API to prove each finding, propose a potential oracle and its potential laws, build it, fix confirmed bugs oracle first, and close gaps until bugs or design questions turn up. The first time in a repository, it also onboards the developer: what the session will do, new words explained as they come up, a walk-through, and the choice to finish setting up. Use when someone is trying @tanstack/oracles, asks where an oracle would help, or asks to explore an area ("explore the clearQueue API").' --- # Explore with oracles +## Install the latest release + +Before exploring, install `@tanstack/oracles@latest` from npm as a dev +dependency, using the repository’s package manager. For example, with pnpm: + +```sh +pnpm add -D @tanstack/oracles@latest +``` + +Use the installed package’s `skills/oracles-explore/` directory as the base +for relative links in this file, even if you downloaded this skill elsewhere. +The linked skills and docs then match the installed release. Continue below. + ## First session, or a later one The developer may name an area: in their message, or as this skill's @@ -181,8 +194,8 @@ is for later, not a reason to stop. (first session) Send your first message as soon as you have read this skill and glanced at the repository's README and `package.json`, before any other tool call: before reading the code, the tests, or the other -skills, and before any probe. Installing this package, when the prompt -that brought you here asked for it, does not count: it comes first. The developer should see what is about to +skills, and before any probe. Installing the latest release as described +above comes first. The developer should see what is about to happen right away. Write it for this repository, in plain words, in your own sentences, in a short paragraph and a short list: diff --git a/packages/oracles/skills/oracles-explore/references/problems.md b/packages/oracles/skills/oracles-explore/references/problems.md index 090a259d..e6b58726 100644 --- a/packages/oracles/skills/oracles-explore/references/problems.md +++ b/packages/oracles/skills/oracles-explore/references/problems.md @@ -25,15 +25,6 @@ Vitest 5 needs Node 22.12 or later. Which Node versions CI runs is a question for when the repository's setup is finished: do not raise it now. -**`pkg.pr.new` returns HTTP 404 for the tip of `main`.** `Publish preview` -runs only after the jobs in its `needs` list pass, so a red blocking job on -the tip (for example, the random-seed gap job on `7b6bae16`) leaves no -preview. Check recent -commits on `main` in `TanStack/oracles` for the latest one whose `Publish -preview` check succeeded (or whose `pkg.pr.new` URL returns HTTP 200 with -`curl -sI`), pin both packages to that commit, and tell the developer which -commit you pinned. - **An install fails.** Show the error in a line or two, say what you think caused it, and ask before you try anything that changes more than the packages the oracle needs. Once the install works, go on from where you diff --git a/packages/oracles/skills/oracles-setup/SKILL.md b/packages/oracles/skills/oracles-setup/SKILL.md index 89e0aa2d..9b296ce2 100644 --- a/packages/oracles/skills/oracles-setup/SKILL.md +++ b/packages/oracles/skills/oracles-setup/SKILL.md @@ -1,6 +1,6 @@ --- name: oracles-setup -description: Finish setting up a repository for oracles with @tanstack/oracles. Pin the packages, add the lint preset and the Vitest config, write the agent instructions, make the oracle skills findable by coding agents, and run the oracle through the gap check. Use when the developer wants to keep the work of a first session (a commit, or a pull request), when a repository adopts @tanstack/oracles, or when it upgrades its pinned commit. Its install and file-placement sections also cover the minimal setup that a first session needs. +description: Finish setting up a repository for oracles with @tanstack/oracles. Install the latest releases, add the lint preset and the Vitest config, write the agent instructions, make the oracle skills findable by coding agents, and run the oracle through the gap check. Use when the developer wants to keep the work of a first session (a commit, or a pull request), when a repository adopts @tanstack/oracles, or when it upgrades the installed release. Its install and file-placement sections also cover the minimal setup that a first session needs. --- # Finish setting up a repository for oracles @@ -46,19 +46,15 @@ Find out, and tell the developer: - Which coding agents the developer works with. Look for `.claude/`, `.agents/`, `.codex/`, `AGENTS.md`, and `CLAUDE.md`, and ask. -## 2. Install two pinned packages +## 2. Install the latest releases -The packages are not on npm yet. Install both from pkg.pr.new, pinned to the -same commit of TanStack/oracles. If you were not given one, use the current -commit on main (if its preview is missing, use the fallback below): the first -7 characters of the hash that -`git ls-remote https://github.com/TanStack/oracles refs/heads/main` prints. -Tell the developer which commit you pinned. +Install the latest npm releases of both packages. Tell the developer the +exact versions installed. ```sh pnpm add -D \ - https://pkg.pr.new/TanStack/oracles/@tanstack/oracles@ \ - https://pkg.pr.new/TanStack/oracles/@tanstack/eslint-plugin-oracles@ \ + @tanstack/oracles@latest \ + @tanstack/eslint-plugin-oracles@latest \ fast-check@^4 vitest@^4.1 ``` @@ -73,19 +69,8 @@ included), install every package here with `--legacy-peer-deps` (npm), and see the fallback in step 3. With that flag, npm skips peers, so check that Vitest's own peer `vite` is installed, and add it if it is not. -If `pkg.pr.new` returns HTTP 404 for the tip of `main`, its preview has not -published. `Publish preview` runs only after the jobs in its `needs` list pass -(`.github/workflows/pr.yml`), so one red blocking job on the tip leaves no -preview. For example, on `7b6bae16` the blocking `Gap report end-to-end -oracle (random seed)` job failed, and the preview was skipped. Check recent -commits on `main` for the latest one whose `Publish preview` check succeeded -(or whose `https://pkg.pr.new/TanStack/oracles/@tanstack/oracles@` -returns HTTP 200 with `curl -sI`), pin both packages to that commit, and tell -the developer which commit you pinned. - Never add, upgrade, or downgrade the repository's `typescript` for oracles. -The gap check uses its own TypeScript and never reads the project's, from -commit `d8adfee` on. Pin a commit at or after `d8adfee`. Oracle files need +The gap check uses its own TypeScript and never reads the project's. Oracle files need TypeScript 5 or newer. If the repository's `tsc` is older, keep the oracle files and the Vitest config out of its run (its `include` or `exclude`). Report any typecheck errors that existed before setup as pre-existing. @@ -105,11 +90,11 @@ pnpm 12.18 or later, installing `@tanstack/oracles` prints `Agent skills awaitin and does not block installs; the developer can run `pnpm approve` if they use pnpm's built-in skill approval, or leave it and use step 5's pointer files. -A run that installs from a local tarball has no commit to pin or check. Say -which tarball you installed, and note that `package.json` now points at a -local path that must be replaced before anything is committed. +For a development install from a local tarball, say which tarball you +installed, and note that `package.json` now points at a local path that must +be replaced before anything is committed. -To upgrade, change both URLs to the new commit at once. Then do step 4 and +To upgrade, install both packages with `@latest` again. Then do step 4 and step 5 again (copy each pointer's `name` and `description` again, since they can change), and rerun the gap check (step 7). @@ -240,9 +225,7 @@ export default [ `settings.oracles.testPackages` to the framework it wraps (`{ '@acme/test-utils': 'vitest' }`) or to a table of its exports and their roles (`{ authTest: 'test', group: 'suite' }`). List a library that - only looks like one in `settings.oracles.nonTestPackages`. The root - README of TanStack/oracles, "Where a test function comes from", has the - details. + only looks like one in `settings.oracles.nonTestPackages`. - Do not add an exemption. There is none. **An older ESLint (7 or 8, `.eslintrc`).** Do not upgrade the repository's @@ -597,7 +580,7 @@ glob and the gap check command you ran. Tell the developer: -- what was installed (both pinned URLs) and where configuration changed +- what was installed (both package versions) and where configuration changed - which pointers were written, and where - the first oracle's law and its result - the gap check's totals, and every gap left, grouped as: From 5e174462dc7ebf6ca65b609878b1d9826cee512c Mon Sep 17 00:00:00 2001 From: Kyle Mathews Date: Thu, 3 Dec 2026 11:33:40 -0700 Subject: [PATCH 2/2] docs: add release documentation changeset --- .changeset/oracles-release-docs.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/oracles-release-docs.md diff --git a/.changeset/oracles-release-docs.md b/.changeset/oracles-release-docs.md new file mode 100644 index 00000000..8d14a04a --- /dev/null +++ b/.changeset/oracles-release-docs.md @@ -0,0 +1,5 @@ +--- +'@tanstack/oracles': patch +--- + +Add initial documentation outlines and agent-first onboarding with npm releases. Update the READMEs with a shared exploration prompt.