Repository navigation
Release 1.0.0-alpha.8: the last breaking batch before 1.0 - #61
Merged
Merged
Conversation
…e deprecated aliases gone The removals, moves and renames of the last breaking batch; no behaviour of the server is assumed that was not already tested. - client.assets.send / preview / sendGuarded become client.send / preview / sendGuarded; client.assets is gone. - The root no longer exports the wire modules or the endpoints' envelope types; they are at @versionone/agility-sdk/wire. What a caller writes and reads moves into the model first (src/types/command.ts: QueryBody, Query, Command, Outcome, CommandFailureDetail, Violation), so nobody needs /wire to type a query. The layers test now matches envelope field names as whole words (Outcome.queryResults is not queryResult). - Removed, deprecated since alpha.3: client.queryV1, client.assets.query and queries, attachments.url, embeddedImages.url, rest-1 sel / where, and the bare Transport as the constructor's second argument. - A read takes a Query: a QueryBody whose page is required by the type. The run-time check stays for callers the types do not reach and now runs before the schema load, so a usage error really is "nothing was sent". needTotal leaves QueryBody; queryPage sets it. - ClientOptions keeps `types` (a TypeCache) and loses metamodel and schema. FakeAgilityClient therefore runs on the 404 it answers for every type, and leaves those loads out of `requests`. - code "CommandFailure" becomes "COMMAND_FAILURE", like every other code. - The Ref type's doc no longer claims a dotted path lands on the Ref. Version 1.0.0-alpha.8; the changelog has a migration line per change. The guard's move to Moment and the remaining approved items follow. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Rgicmffzzwb2CzyeDSEhBm
# Conflicts: # test/unit/testing.test.ts
…out loud
sendGuarded and batch.run guard each asset with
where { ID, Moment } + filter RetireDateUTC=''
instead of a ChangeDate literal. A Moment alone selects the asset as it
was and guards nothing; with the filter it matches only while that
version is current. Proved live (test/integration/guard.test.ts, issue
#51): current applies, stale matches nothing for a query, a preview and a
send, a resend applies nothing, operations and closed assets guard the
same way, a deleted asset matches nothing, and Moment travels as a `with`
variable, so the one value spliced into filter text is gone.
- A command that matched lists its asset even when it changed no value,
so "in neither modified nor operated, and no failure for it" is a
conflict, and a no-op is a success. `skipped` becomes `conflicts` and
no longer includes failed commands; with throwOnFailure a conflict
throws ConflictError (kind "conflict").
- sendGuarded's result is the Outcome plus touched, conflicts and details
(projected, sent, stamps): one shape to read after any send.
- sendGuarded takes `moments`: guard on the version a caller read earlier.
- Both terms always travel together and the moment is checked to be
digits: RetireDateUTC='' without a Moment, and a non-numeric Moment,
are server errors.
- batch.run takes guard: true | false with no default. Receipts are
`receipt: 2` with stamps, changedAt (readable) and stopped; a stored
`receipt: 1` is refused by batch.reversible with ReceiptVersionError
(code RECEIPT_VERSION) unless forced, which checks nothing. isReceipt
tells them apart.
- Each unguardable reason has a code; batch.run finds the fatal one by
code, not by its wording.
- The blind spot is documented and tested live: a child added to an
asset makes no new version of it.
Spec 000 section 6 describes the guard as it now is.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Rgicmffzzwb2CzyeDSEhBm
…rimmed to what a client user imports - Rows: a relation you select is a Ref, a path you select by name is at row[path], nothing arrives that you did not select, on every read path. rest-1's uninvited display columns are on the Refs only now; a dotted key stays when the path was selected, or when it has no Ref to fold onto. A live test reads one asset through query.v1, api/asset and rest-1 and compares the keys. Spec 000 section 2 and the README state the rule. - client.data.history / template / operate become client.history / template / operate; data.get goes; data.list stays public. rest-1 reads answer `more`, and a refused one is a QUERY_REJECTED with the server's sentences, as for query.v1 (fixture copied from a live refusal). - @versionone/agility-sdk/services holds the services as free functions, one namespace per module; the root keeps the client, the model, every error class and the pure helpers (unguardable, isReceipt, isAssetNumber, TypeCache, toBase64, fromBase64). Four entries, one flat dist/. - Row types: a sub-select is rows of the related type with what it selected (a Ref now carries its target type, at the type level only); a single relation is always nullable on a row; an explicit row type needs only `_oid`, so a consumer's own interface works. - An inline attachment read also answers `base64`. - README: a "which call for what" table. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Rgicmffzzwb2CzyeDSEhBm
…setStateKind, fetch looked up per request
- resolve.numbers / ref answer rows ({ _oid, AssetType, Number, Name,
AssetState }); they were the last camelCase vocabulary in the SDK.
- resolve.refs reads numbers and OID tokens mixed, in two requests at
most, asking each OID's type only for the attributes it has.
- Outcome.unmatched: updates and operations addressed to one asset by OID
that did nothing and reported nothing. Live: an update of a deleted
asset, and an operation on an asset that went with its parent, answer
success with empty lists; an applied command, a no-op and a refused
operation (which is a failure) are not flagged.
- assetStateKind: a state's name or code as open / closed / template /
deleted / other.
- The fetch transport reads globalThis.fetch at each request, so a stub
installed after the transport was made is the one called.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Rgicmffzzwb2CzyeDSEhBm
…when it is missing
A caller that picked { reverse, after } by hand (type-correct before)
had every receipt refused as "format undefined". The version is now
required by the type, and a missing one is named for what it is.
client.data's doc says why it has one member.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Rgicmffzzwb2CzyeDSEhBm
One Explanation per failed command (from a CommandFailureError, an
Outcome or its failures), or one for any other error: a short sentence
("Project is required.") with the instance's own labels for the
attribute and the asset type, the parts it was made from, and the
server's own sentence for the whole token where loc-2 has one.
Resolution failures are read as well as Violations. One loc-2 request
at most, none for an error that is not about commands, and a label that
cannot be fetched is replaced by the attribute's name, never an error.
Built from what the instance answers (loc-2 localizes a Required
violation usefully and an Invalid one emptily, so the sentence is made
here and loc-2's is offered beside it). Two consumers each wrote this
by hand.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Rgicmffzzwb2CzyeDSEhBm
transportConformance(make) answers the SDK's expectations of a Transport as named checks any test runner can run: a path stays inside the base URL, bodies are sent in the shape given, responses are read as asked, onResponse runs before the body with case-insensitive headers, a 304 with acceptNotModified resolves undefined, a refused response is worded as apiErrorFromResponse words it, an abort is ABORTED and a failed connection NETWORK_ERROR, and responseType json insists. The SDK's fetch transport runs the suite, and a test shows it catching three broken transports. From a browser app consumer's nine hand-written rules. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Rgicmffzzwb2CzyeDSEhBm
… document form under /wire
- new FakeAgilityClient({ metamodel }) takes a meta.v1 document and
serves meta.v1/<Type> from it, so the fake's instance has those types:
a response captured from a server and scripted with onRequest reads
translated, for the fake and for a client built on fake.transport.
Rows scripted in the model's shape still read as scripted, and the
type loads stay out of `requests`.
- onList(type, rows) scripts client.data.list in the model's shape; the
fake answers rest-1's document so the client's own translation reads
it back, paging and total included.
- /wire meta: readMetamodelDocument and readAssetTypeDocument, the
document form with the conditional read, for a caller whose code
parses meta.v1's own spelling.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Rgicmffzzwb2CzyeDSEhBm
FakeAgilityClient keeps a moment per asset, so sendGuarded and batch.run work on it for assets addressed by OID that a row was scripted for: a guarded command applies only at the asset's moment, a batch's snapshot, stamps and read-backs are answered from the scripted rows, and a preview projects OID-addressed writes per asset. fake.touch(oid) is someone else changing the asset (a conflict for a write stamped earlier, drift for a receipt's reverse); fake.remove(oid) is it being deleted. A write scoped by a query cannot be previewed by a fake that evaluates no filter, and the fake says so. onSend still replaces the simulation with its own answer. Also: the alpha.4 notes now list urls.asset's UsageError as the breaking change it was. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Rgicmffzzwb2CzyeDSEhBm
jallers
marked this pull request as ready for review
November 26, 2026 13:39
jallers
marked this pull request as draft
November 26, 2026 13:40
- A receipt's assets are rows: `created` and `touched` carry _oid, AssetType, Number and Name (created also its alias), and `names[oid]` Number and Name. The receipt format is new in this release, so it ships with the one convention the release is about. - Outcome.unmatched is filled on the receipt of an unguarded batch.run, where it matters most, and for an aliased command addressed by OID. Live-tested for both. - resolve.refs finds an asset once when its number and its OID both name it. - assetStateKind claims only what a server confirms: Active is open, Closed is closed, code 200 is a template, Deleted is deleted (a live test walks a story through three of them); Future, Dead and a split story are "other". It had called Dead deleted, which the server contradicts. - A selected key is typed as its value or null, not undefined: a row has the keys that were selected, on all three read paths. - ReceiptVersionError describes the receipt (its format and what that format recorded), not a version of this package. - The fake treats a removed asset as gone for a plain write too. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Rgicmffzzwb2CzyeDSEhBm
…; reauthorize: false - An idempotent request (a GET, a query.v1 read, a guarded batch with no creates) is sent once more after a transient failure whichever Transport the client has: the built-in one does it itself, and the client does it around a custom one (core/retry). `retries: 0` turns it off per client. A plain write, a 401, a 403, any other 4xx and an aborted request are never resent. A behaviour change for a consumer with its own transport; the changelog says what to do when that transport reports errors to a user before throwing, or resends on its own. - ClientConfig.onError(error, request) is told about each request that finally failed, after any resend, with any transport; it observes. - RequestOptions.reauthorize: false skips the unauthorized hook for that request, so a hook's own "is the session alive" request cannot wait on itself. - withSignal does not stack a second resend; the fake resends nothing unless asked. Merged master (alpha.7 is released from there). Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Rgicmffzzwb2CzyeDSEhBm
…ther they are fit for a user - described.updates / executes and reversible's drifted entries name their asset as _oid, like every other object that carries an asset's identity. No exceptions left to remember. - Explanation.explained: true when the sentence was made for a person (from a rule and the instance's labels, the server's localized sentence, or the kind of error), false when it is only the message as it came: a token the instance has no words for (seen live: closing a closed story), raw server text, or a developer's message such as a usage error. A consumer can explain any error and show only what is explained. - assetStateKind gains "future" for the Future state, which the server names and Timeboxes carry (checked live); "open" is Active alone. - The fake's metamodel option takes any subset of meta.v1 type documents, Version optional: only the types the code under test touches. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Rgicmffzzwb2CzyeDSEhBm
…ho they are for, and the fake matching the server
- onUnauthorized may answer "retry-write": after re-authenticating, the
refused request is sent once more even when it is a plain write. The
default is unchanged (a write is never resent; "retry" resends
idempotent requests only). The hook asserts that on its server such a
refusal means nothing was executed; the SDK cannot verify that, since
its tests run where every request is authenticated, and says so in the
type's doc, the spec and the changelog. Tested: resent once on
retry-write, not on retry, not for a status outside
unauthorizedStatuses, never twice, and never with reauthorize: false.
- Explanation: `audience` ("user" or "developer") and `echoed` replace
the flag added in the previous commit; a rule the instance has no words
for gets a sentence, never its bare token; a Resolution failure's
related type is answered with its label.
- described.updates / executes and drifted entries keep `oid`, as
before the previous commit: they mention an asset and are not rows.
Spec 000 and the README say why rows carry `_oid` (the server's key,
underscored so it cannot collide with an attribute) and where plain
`oid` appears.
- The fake: what a scripted Ref carries stays on it in a rest-1 list, as
rest-1's display columns do live; a preview projects a scalar update
and an operation in the server's form.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Rgicmffzzwb2CzyeDSEhBm
jallers
marked this pull request as ready for review
November 26, 2026 13:57
@versionone/agility-sdk/package.json resolves by require and by import; a tool reading a dependency's version that way was refused. The CommonJS consumer test checks both. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Rgicmffzzwb2CzyeDSEhBm
The sentence for a rule the instance has no words for carried its own
framing ("Agility did not accept this change (…)") while the others gave
the reason only, so a consumer that frames the reply said it twice. It
is now "Refused (asset cannot inactivate closed).", and the field's doc
says the sentence is the reason and the framing is the caller's.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Rgicmffzzwb2CzyeDSEhBm
CreateDate and "CreatedBy.Name" were always null on what add answers, which in a closed row reads as "this attachment has none". The answer is now AddedAttachment (AttachmentInfo without those two), and so is AttachmentUploadError.attachment. Reported by a browser app consumer. 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
alpha.7 (#59) has merged; this PR is against
master. Three consumers migrated against this branch twice and what they found is fixed here.Head
4df2410. Three small changes sinceb1942bf(the commit two consumers last ran and reported good):@versionone/agility-sdk/package.jsonresolves, byrequireand byimport, with a test for both.client.explain: for a rule the instance has no words for it now states the reason alone ("Refused (asset cannot inactivate closed).") like every other explanation, where it carried its own framing.client.attachments.addno longer answersCreateDateand"CreatedBy.Name". They were always null there, because the server's stamps are not read back after a create, and in a row a null reads as "this attachment has none". The answer's type isAddedAttachment(the two keys are absent from the object as well), and so isAttachmentUploadError.attachment. Found by a browser-app consumer compiling against the published alpha.7.CHANGELOG.mdhas a migration line for every change below.Breaking
The guard compares Moments, and a conflict is said out loud (closes #51)
sendGuardedandbatch.runguard each asset withwhere { ID, Moment }plusfilter RetireDateUTC='', an exact compare-and-set, where they compared aChangeDateliteral. The evidence is on guard: research an exact stamp for the compare-and-set (Moment, ChangeDateUTC, or a moment-qualified OID) #51 and intest/integration/guard.test.ts.conflicts, or aConflictErrorwiththrowOnFailure,kind: "conflict"). A command that matched and changed no value is a success. A failed command is infailuresand no longer also listed as skipped.sendGuarded's result is theOutcomeplustouched,conflictsanddetails.batch.runtakesguard: true | falseand has no default.receipt: 2: Moments; newstamps,changedAt,stopped; and the assets a receipt names (created,touched,names) are rows (_oid,AssetType,Number,Name). A storedreceipt: 1cannot be checked for drift:batch.reversiblerefuses it with aReceiptVersionError(codeRECEIPT_VERSION) unlessforce, which checks nothing.batch.reversiblerequires the receipt's format in what it is given.code.Resends (a behaviour change for a consumer with its own
Transport)retries: 0turns it off per client. A plain write, a 401, a 403, any other 4xx and an aborted request are never resent. The changelog says what a consumer does whose transport reports errors to a user before throwing, or resends on its own.Surface
client.send,client.preview,client.sendGuarded.client.assetsis gone./wireonly, and the services as free functions at a new/services. The root keeps the client, the model, every error class and a few pure helpers. What a caller writes and reads (QueryBody,Command,Outcome, …) moved into the model first.Transportconstructor argument.pageis required by the type (Query);needTotalleavesQueryBody.ClientOptionskeepstypesonly.client.data.history/template/operate→client.history/template/operate;data.getis gone;data.liststays.row[path], nothing else arrives. rest-1's uninvited display columns are on the Refs only.QUERY_REJECTEDlike a refused query.v1 read._oid,AssetType,Number,Name,AssetState).client.attachments.addanswersAddedAttachment: the attachment as written, withoutCreateDateand"CreatedBy.Name"; read those withattachments.info(id)or from alist.null, neverundefined; a single relation is always nullable on a row."CommandFailure"→"COMMAND_FAILURE"(the kind,commandFailure, is unchanged).Added
sendGuarded(commands, { moments }): guard on the version a caller read earlier.client.explain(error): an error said to a person ("Project is required."), with the instance's own labels, from one loc-2 request; each explanation says who its sentence is for (audience) and whether it only echoes the server (echoed).onUnauthorizedmay answer"retry-write": an opt-in resend of a refused write after re-authentication (see below).ClientConfig.onError(error, request): told about each request that finally failed, with any transport; it observes.RequestOptions.reauthorize: false: that request's refusal skips the re-authentication hook, so a hook's own session check cannot wait on itself.client.resolve.refs(specs): numbers and OID tokens mixed.Outcome.unmatched: commands addressed by OID to an asset that was gone, which the server answers with success./testing:transportConformance(make), the SDK's expectations of aTransportas named checks any test runner can run; and the fake at the transport's level: ametamodeloption (captured responses read translated),onListfor rest-1 list reads, guarded sends andbatch.runwithtouch/remove./wiremeta: the document form with a conditional read.Receipt.stopped,isReceipt,ReadResult.more,assetStateKind,withRetry,toBase64/fromBase64on the root,base64on an inline attachment read, an explicit row type of the caller's own,fetchlooked up at each request,./package.jsonin the exports map._oid.Things a reviewer should know
"retry-write"rests on a premise this repository cannot test. A hook that answers it asserts that on its server a refusal for an expired session means nothing in the request was executed. The integration tier runs where every request is authenticated, so no 401 or 403 can be produced there. The default is unchanged (a write is never resent), the decision's doc comment, the spec and the changelog all say whose assertion it is, and the unit tests cover the mechanics only: resent once on"retry-write", not on"retry", not for a status outsideunauthorizedStatuses, never twice, never withreauthorize: false.receipt: 1is a deliberate decision; the error message and the changelog say what a holder can do (reverse withforce, accepting no drift check, or run the batch again).RetireDateUTC=''without aMoment, and a non-numericMoment, are HTTP 500s. Both terms always travel together and the moment is checked to be digits.Refgained a type-only marker of its target type (aunique symbolkey that exists in no object), which is what lets sub-selects be typed.client.explain's sentences are English and state the reason alone, built here with the instance's labels, because the server's own sentence for an invalid value is empty ("…has encountered an invalid ."). The server's sentence is offered beside it aslocalized. A rule the instance has no words for is answered as "Refused (…)" with the rule's name in words; the framing around a sentence is the caller's.assetStateKindnames five states only (Active, Future, Closed, code 200, Deleted), each checked against a server; everything else is"other".oidand_oid. Rows, and what stands for a row, carry_oid(the server's key, underscored so it cannot collide with an attribute). Records that only mention an asset (describedentries,driftedentries) sayoid. Spec 000 states it.attachments.adddoes not read back. Leaving the two stamps out of its answer was chosen over a second request to fetch them; a caller that wants them callsinfo.client.search(the first addition after this release;client.data.liststays public until it exists).AGENTS.mdarrives with AGENTS.md, and the integration tier on a schedule #60 and describesmasterbefore this release. Whichever of AGENTS.md, and the integration tier on a schedule #60 and this PR merges second gets a short follow-up commit for the four import paths andclient.send; the merge order does not matter.Verification
npm run verifyon4df2410: 234 unit tests in 30 files, all passing.b1942bf, 50 passed, 3 skipped by design; the attachment tests again on4df2410(the only live-exercised code changed since), 3 passed, 1 skipped by design. Live tests new in this PR: the Moment guard (current applies; stale is a conflict for a query, a preview and a send; resend applies nothing; a no-op is a success; caller-supplied moments; operations; a closed asset; a deleted asset; the blind spot), receipts with Moment stamps and row-shaped assets, one asset read through query.v1, api/asset and rest-1 with identical keys, a refused rest-1 read,unmatched(bare, aliased, and on an unguarded batch's receipt),resolve.refs,explainon real failures,assetStateKindon a story walked through open, closed and deleted and on a Future timebox, andattachments.addanswering no stamps whileinfoa moment later has both.b1942bf: a CLI consumer ran its suite, type-check and a live smoke and reported it good, with its batch flow run end to end on the fake; a chat-bot consumer's suite and live smoke passed. A browser-app consumer type-checked its queries against the source of an earlier commit.After merge
Tag
v1.0.0-alpha.8to stage the publish.🤖 Generated with Claude Code
https://claude.ai/code/session_01Rgicmffzzwb2CzyeDSEhBm