Skip to content

Release 1.0.0-alpha.9: client.search across asset types, client.deleted - #63

Merged
jallers merged 12 commits into
masterfrom
claude/search-with-find
Nov 26, 2026
Merged

jallers merged 12 commits into
masterfrom
claude/search-with-find

Conversation

@jallers

@jallers jallers commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Head 5cab0b9, with master merged in.

Breaking

  • client.data.list is removed, and client.data with it. Its uses have named calls:
    • a text search across asset types → client.search (below);
    • a search within one type or family, or any other list → client.query / client.queryPage (with find and findin for a search);
    • deleted assets → client.deleted(type, params);
    • rest-1's list itself stays at @versionone/agility-sdk/wire: rest1.list(client.transport, type, params).
  • A Ref is { _oid } on every read. rest-1 sends display columns beside a selected relation unasked (Owners.Name, Owners.Nickname), and the SDK used to put them on the Ref, so the same select gave { _oid, Name } through rest-1 and { _oid } through the query endpoints. They are now dropped; a path the caller selected is at row[path]. Affects client.history, client.template, client.deleted, client.search and the rest-1 reads at /wire. Migration: select the path you read ("Owners.Name") and read row["Owners.Name"]. Nothing errors if you do not; ref.Name is simply undefined. A read with no select at all (a template) keeps every column the server sent, each under its own key.
  • A date has one spelling on every read: "2026-09-06T13:52:51.903", three decimals, Z on a UTC attribute. That is the standard's date-time format, so new Date(value) reads it in any engine. The three endpoints write a date three ways, and rows carried whichever the endpoint behind the call used: query and get answered seven decimals, queryPage dropped trailing zeros, history / template and the rest-1 reads answered three and a midnight as the date alone. This changes the default read path too (seven decimals → three). The SDK cuts to the millisecond, by design: the server's stored resolution is about three milliseconds (in a live sample of 400 timestamps every digit past the third was zero, and the third was only ever 0, 3 or 7), so nothing observed is lost; if an instance ever carries finer digits, they are dropped. The schema says which attribute is a date, so text that looks like one is untouched. A consumer that normalises fractions itself can stop.
  • A read with an empty find throws a UsageError. It answered no rows, which is what the server answers to a search for nothing.

Changed

  • client.explain: a rule the instance has no sentence for is for a developer, not a user. Its explanation is the rule's name spelled out ("Refused (asset cannot inactivate closed)."), which is a name, not a sentence written for a person, and can read as the opposite of what happened: "Refused (message must not be sent)." is what it says of a message that was sent. audience is now "developer" for these; the sentence, rule and echoed: false are unchanged. A consumer that shows only audience: "user" sentences gives such a failure its own wording, and needs no change.

Added

client.search(text, { types, select?, findin?, filter?, where?, with?, sort?, page }) → { rows, total, more }

Text search across asset types: one page of mixed rows, one server-side order, the total.

const { rows, total, more } = await client.search("warehouse ship*", {
  types: ["Workitem", "Request", "Issue", "Goal"],
  select: ["Name", "Number", "AssetState", "Scope.Name", "Owners", "Owner"],
  filter: ["AssetState!='Closed'"],
  sort: ["-ChangeDateUTC"],
  page: { size: 25, start: 0 }
});
  • types is required and has no default: a default of "work items" silently drops requests, issues, goals and topics (two consumers measured about a fifth of the hits lost that way). It takes concrete types, or a family by its abstract type ("Workitem"), expanded from a small generated table with no extra request.
  • select and findin take plain attribute names. Each row has every selected key under that name: its value if the row's type defines the attribute, null if not, and null on every row when none of the searched types has it, so one list of columns serves any choice of types. Only a name that is no attribute of any asset type is refused. Spec 000 §2 states this as the one place a row carries a key its type lacks.
  • Selects are plain; filters are sent as written and may be type-qualified. A select names a value and the SDK can ask each type for it. A filter is an expression, and a condition across types has no plain spelling. Tested live.
  • Refused before any request, as a UsageError: empty text, no types, an unknown type, a misspelt attribute, a findin with nothing the searched types have.

client.deleted(type, params): deleted assets of a type, as { rows, total, more }.

FakeAgilityClient.onSearch(rows) and fake.searched. It answers at the fake's transport, so a client the code under test builds on fake.transport searches the same way. The fake also resolves a number of any scripted type now (a Request's number used to need every other number type scripted).

typesVersions for /wire, /services and /testing: their types now resolve under TypeScript's moduleResolution: "node" (node10), which ignores exports.

Things a reviewer should know

  • Which endpoint answers a search is not part of the contract. Today it is one GET to rest-1, because rest-1 alone takes a subtype's attribute from a base type on instances before the release that lets api/asset do it. The service's doc comment and spec 000 say so. Nothing rest-1-shaped reaches the caller.
  • An earlier commit of this PR spelled dates with seven decimals and added a toDate helper for engines that do not parse seven. With three decimals new Date is the helper, so toDate was removed before it shipped.
  • The generator now writes two small runtime values beside the types (src/types/assets/subtypes.ts, about 8 KB): each abstract type's concrete subtypes, and the set of the product's attribute names, which is what tells "this type has no such attribute" from a misspelling.
  • The Ref rule has one stated exception: a read with no select keeps the columns the server chose, as keys of the row.
  • Why client.query with find is not enough across types. It works within one type or family, and the README's "Searching" section says so. On BaseAsset the query endpoints refuse Story.Number and every other subtype attribute with HTTP 400 (live test).
  • The text index trails a write by a few seconds (live test; not found at 1 s, found at 4 s). Documented.
  • The first search loads the schema of each type searched (cached; none with a seeded TypeCache). The README says what a short-lived process should do.
  • A search filter on an attribute only some types have should be type-qualified whatever types is: unqualified, it is accepted for one type and refused for several. Documented rather than changed.
  • client.deleted adds IsDeleted='true' so it answers deleted assets only (live test).
  • The explain change follows a second rule with no sentence on the instance being seen live. audience's doc comment now says exactly when it is "user".

Verification

  • npm run verify on 5cab0b9: 249 unit tests in 32 files, all passing. Among them: a packaging test that installs the built package in a temp directory and compiles a consumer of all four import paths under node10, node16 and bundler resolution (it fails under node10 without typesVersions).
  • The full integration tier against the API-testing instance on c7c619d (the commit before the explain change): 79 passed, 3 skipped by design; every suite's fixtures deleted (the cleanup fails a suite otherwise). On 5cab0b9 the client suite, which exercises explain on real failures, ran again: 12 passed. Pinned live, among the rest: one asset read through query.v1, api/asset and rest-1 with one select gives equal rows, dates included, each date in the three-decimal spelling and round-tripping through new Date; the mixed search page (sixteen types, one request, plain keys, an Issue's Number, the total, one order); a column none of the searched types has is null and the search is made; types: ["Workitem"] and the subtype table checked against the server; the matching rules; the index lag; the refusals with nothing sent; client.deleted.
  • Consumers, on an earlier commit of this PR (before the change from seven decimals to three and the explain change): two migrated their find to client.search on trial branches. A chat-bot consumer's suite passed (220 tests) with the fake answering its own client; it reads no dates from these calls. A CLI consumer's suite passed and ten live runs of its find and asset commands were byte-identical to the same commands on the released alpha.8; it normalises dates to three decimals itself, which is now what the SDK answers, so that step can go. A browser-app consumer confirmed the Ref rule costs it nothing and takes the day from a template's date by slicing, which holds for either spelling. Both consumers that render explain's sentences have been told of that change.

After merge

Tag v1.0.0-alpha.9 to stage the publish.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Rgicmffzzwb2CzyeDSEhBm

…ty find is a usage error

The README sent text search to rest-1's list; query.v1 honours find and
findin across types. A Searching section states the server's matching
rules, each with a live test and a control. An empty find answered no
rows (the server's answer to a search for nothing); it now throws a
UsageError before any request.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Rgicmffzzwb2CzyeDSEhBm
…0.0-alpha.9

One page of mixed rows in one server-side order with the total. types is
required; select and findin take plain attribute names and each row has
every selected key under that name, null where its type has no such
attribute, so nothing type-qualified is written or read. rest-1 answers
it today (it alone takes a subtype's attribute from a base type on
instances before the release that lets api/asset); the route is not part
of the contract. client.deleted reads deleted assets. The fake has
onSearch. Spec 000 states the one place a row carries a key its type
lacks.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Rgicmffzzwb2CzyeDSEhBm
Kept as its own commit so that removing it (now or at 1.0) is one change.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Rgicmffzzwb2CzyeDSEhBm
client.data goes with it. rest-1's list stays at /wire (rest1.list). The
changelog lists it under Breaking with a migration line per use, and the
README says why a search's selects are plain while its filters are sent
as written.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Rgicmffzzwb2CzyeDSEhBm
A Ref is { _oid } on rest-1-backed reads too: the display columns rest-1
sends beside a relation unasked are dropped instead of put on the Ref,
and a path the caller selected is at row[path]. The same select now gives
the same row whichever endpoint answers (a live test compares all three).

client.search accepts a family by its abstract type (types: ["Workitem"])
from a generated table of each abstract type's concrete subtypes; a live
test checks the table against the instance.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Rgicmffzzwb2CzyeDSEhBm
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Rgicmffzzwb2CzyeDSEhBm
… fake answers at its transport

A select name none of the searched types defines is left out of the
request and null on every row, so one list of columns serves any choice
of types; only a name that is no attribute of any asset type is refused
(from a generated set of the product's attribute names). A findin name
none has is dropped; none left is refused.

A date is spelled one way on every read (seven decimals, Z on a UTC
attribute): query.v1, api/asset and rest-1 each wrote it differently.
The schema says what is a date, so text that looks like one is untouched.

onSearch answers at the fake's transport, so a client built on
fake.transport searches the same way; the fake's instance has any type a
scripted search names.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Rgicmffzzwb2CzyeDSEhBm
TypeScript's node10 resolution ignores exports, so /wire, /services and
/testing had runtime entries and no types there. Checked by compiling a
consumer file against the packed package under node10, bundler and
node16. Also a doc line on what fake.searched records.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Rgicmffzzwb2CzyeDSEhBm
The packaging test installs the built package in a temp directory and
compiles a consumer of all four import paths under each resolution (it
fails under node10 without typesVersions). toDate reads a DateString
without relying on a parser's tolerance for seven decimals, which the
standard does not promise; the README no longer says new Date does.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Rgicmffzzwb2CzyeDSEhBm
…filters and the fake's metamodel

A number lookup on the fake went to real per-root queries as soon as one
number root (a Request) had scripted rows, and threw on the first root
without a script. It now answers from the scripted rows whichever types
have them.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Rgicmffzzwb2CzyeDSEhBm
@jallers
jallers marked this pull request as ready for review November 26, 2026 15:06
The standard's date-time format, which any engine's Date parses, where
the model spelled seven decimals. This changes the default read path too
(client.query and get answered seven). The SDK cuts to the millisecond by
design: the server stores about three milliseconds, and in a live sample
of 400 timestamps every digit past the third was zero. toDate goes: with
three decimals it is new Date.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Rgicmffzzwb2CzyeDSEhBm
A rule the instance has no sentence for is answered as its name in words.
That is a name, not a sentence written for a person, and it can read as
the opposite of what happened ("message must not be sent", of one that
was). audience is "developer" for these; the doc comment says exactly
when it is "user".

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Rgicmffzzwb2CzyeDSEhBm
@jallers
jallers merged commit 0c8ea96 into master Nov 26, 2026
4 checks passed
@jallers
jallers deleted the claude/search-with-find branch November 26, 2026 15:31
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.

2 participants