Skip to content

feat(tracker): trackerManifestContract, trackerManifestFake and trackerManifestFixture test a source from a manifest - #3120

Merged
leemour merged 4 commits into
mainfrom
feat/tracker-manifest-fake
Nov 18, 2026
Merged

leemour merged 4 commits into
mainfrom
feat/tracker-manifest-fake

Conversation

@leemour

@leemour leemour commented Nov 18, 2026

Copy link
Copy Markdown
Member

Task

A tracker CLI made from wirecat.config.ts (linear-cli, the Linear pilot of the connector factory) could not run trackerSourceContract over its source: there was no fake of the tracker built from the manifest, only fakeTrackerSource in memory. cli-dev ready (cli-base #651) asks a tracker for that contract.

Why

The tracker counterpart of #3088 (crmManifestFake/crmManifestContract/crmManifestFixture), so the contract proves the manifest against a stateful fake of the service, not schema samples.

What

  • trackerManifestFake(manifest, { api, definitions }) over cli-base's graphqlFake: three rows per kind written where the map reads them, Relay pages, includeArchived, the {since} filter, touch/archive/remove.
  • It refuses what it cannot apply: a {since} that is not at <updatedAt path>.gte|gt, a filter on a list or id read, any change filter beyond the since. Refusals fail the case with their own message.
  • trackerManifestFixture (held rows, dead cursor, faults) and trackerManifestContract; docs/dev/TRACKER.md "The contract kit"; the Linear-shaped test schema moved to src/testing/tracker-graphql.ts.

Testing

  • vitest run src/tracker: 64 passed; typecheck and docs:check clean.
  • Over linear-cli's real generated schema and its SOURCE: 10 of 10 contract cases (one-off check, not committed).
  • Reviewed by a fresh agent; its two high findings (filters on the wrong field or operator, a filter that drops rows from the id pass, both passing the contract) are fixed and pinned by tests.

Not covered

  • The dead-cursor case is answered by the source itself (Date.parse), so a tracker's own refusal of an old page token is not tested.
  • A small sampling helper copies cli-base's unexported sampleWithin.

🤖 Generated with Claude Code

leemour and others added 4 commits November 18, 2026 21:05
…erManifestFixture test a source from a manifest

A tracker CLI made from wirecat.config.ts (linear-cli first) could not run
trackerSourceContract: fakeTrackerSource is a TrackerSource, not a fake of
the service, and the generated test synced over graphqlFake, which answers
schema samples with no state. This is the tracker counterpart of #3088.

- trackerManifestFake(manifest, { api, definitions, baseUrl? }) is cli-base's
  strict graphqlFake with three rows of each kind behind it. Each row is
  sampled within every selection its kind's calls send, with the values the
  map reads written where it reads them, and links to the first row of the
  kind a field points at (state.id, assignee.id, labels.nodes with each).
  Calls are answered within their selection, two rows a Relay page; a change
  read keeps rows at or after its since, oldest first; an operation taking
  includeArchived hides archived rows unless the call sets it. A call whose
  fixed variables match no manifest call, a cursor the fake never gave, an
  unreadable since and an answer of its own that breaks the schema are
  recorded in refusals. touch, archive and remove change a row.
- trackerManifestFixture adds the source, held ids, a dead cursor and the
  faults skewed, change, archive and remove.
- trackerManifestContract runs trackerSourceContract over it and fails a case
  whose calls the fake refused.
- The Linear-shaped schema of source.test.ts moves to src/testing/
  tracker-graphql.ts so both tests use it; its change call now sends
  orderBy, and issue labels use { each, id } as linear-cli does.
- rowSelection is exported from the tracker manifest module.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…t is, and an enum field is pinned by a test

The generated wirecat-config.ts types SOURCE as a plain record, so the three
helpers take the manifest as unknown and parse it, as
trackerSourceFromManifest does; linear-cli's test needs no cast. The
Linear-shaped schema gains an enum project status, and a test checks the
fake writes one of its values, the one defect linear-cli's real schema
showed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… apply, and names the refusal in the failed case

A review found manifests the contract passed although real Linear would
answer them differently:

- {since} was found by position and always read as updatedAt >= since, so
  filter.createdAt.gte and filter.updatedAt.lt passed. A change call is now
  refused unless {since} sits at <map updatedAt path>.gte or .gt; gt keeps
  only rows strictly after it.
- Fixed variables only picked a route, so an ids call filtering out
  canceled issues passed, though sync would mark them deleted. A list or id
  call with a filter, and a change call whose filter holds anything beside
  the since, are refused. Other variables are trusted, and TRACKER.md says so.
- trackerManifestContract now fails with the fake's refusals as the message
  even when the source threw first, so a test can match why.
- TRACKER.md says the dead-cursor case is answered by the source itself and
  never reaches the fake.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ission-key check does not read them as keys

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@leemour
leemour merged commit 61e6db0 into main Nov 18, 2026
43 checks passed
@leemour
leemour deleted the feat/tracker-manifest-fake branch November 18, 2026 20:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant