Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 43 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,9 @@ Four paths, and `package.json`'s `exports` lists no others (spec 000 §5a):

A new export goes on the lowest of these that serves it; the root grows
only for something a client user writes or reads. On the client, reads are
`client.query` / `queryPage` / `get`, `client.search` across asset types
and `client.deleted`, and writes are `client.send`,
`client.query` / `queryPage` / `get`, `client.search` across asset types,
`client.deleted` and `client.lists` (the values a list-typed attribute may
take), and writes are `client.send`,
`client.preview` and `client.sendGuarded` (a guarded write compares each
asset's `Moment`; what matched nothing is a conflict, never a success:
spec 000 §6).
Expand Down Expand Up @@ -112,6 +113,46 @@ change, by design: `layers.test.ts` (imports point down the layer table),
line.** Until 1.0.0, breaking changes are allowed between alphas and are
listed under "Breaking".

## Reference data on the testing instance

The API-testing instance holds nine assets that are there to stay, so
that a consumer can prove valid values (`client.lists`, api/ValidValues)
and status-by-name against real values.

A team with its own process and the three statuses it owns, in this
Order:

| OID | Name | |
|---|---|---|
| `Team:152495` | sdk-reference team | `HasProcess` is true |
| `StoryStatus:152496` | sdk-reference Ready | RollupState Future |
| `StoryStatus:152497` | sdk-reference In Progress | RollupState Active |
| `StoryStatus:152498` | sdk-reference Done | RollupState Closed |

Five global story statuses with the product's own names, on no team,
selected in the Default Scheme (`Scheme:1000`, which nearly every project
on the instance uses), in this Order:

| OID | Name | |
|---|---|---|
| `StoryStatus:152567` | Future | RollupState Active |
| `StoryStatus:152568` | In Progress | RollupState Active |
| `StoryStatus:152569` | QA / Test | RollupState Active |
| `StoryStatus:152570` | Done | RollupState Closed |
| `StoryStatus:152571` | Accepted | RollupState Closed |

A Story created as a fixture in the system project (`Scope:0`) on no team
is offered exactly those five; one with `Team: "Team:152495"` exactly the
three `sdk-reference` ones.

**Nothing creates, edits, closes, reorders or deletes any of the nine, or
anything named `sdk-reference`, and nothing changes what `Scheme:1000`
selects.** `sdk-reference` marks permanent data; `sdk-integration` marks
what a test creates and deletes in its own run. `deleteFixtures` refuses a
list that contains any of the nine OIDs or any asset whose name starts
with `sdk-reference` (test/integration/referenceData.ts), and no test may
assume the instance has no status, team or other asset of a kind.

## Pull requests and releases

- Branch from `master`, open the pull request against `master`, and say
Expand Down
123 changes: 123 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,128 @@
# Changelog

## 1.0.0-alpha.12

### Breaking

- **A config object with a key its factory does not know is refused.**
`new AgilityApiClient(config, options)`, `createFetchTransport(config)`
and `new FakeAgilityClient(config)` (the fake this package exports
from `/testing`, not a test double of your own that happens to share
the name) each throw a `UsageError` at
construction when the object has a key that is not one of theirs. The
message names the key or keys, suggests the nearest known key when one
looks like a typo (`"retrys" (did you mean "retries"?)`), lists the
keys the factory takes, and never repeats a value. Until now such a
key was ignored without a word, which a TypeScript caller is told at
compile time and a JavaScript or JSDoc-checked caller never was: a
consumer's `fetchImpl` on the client's config did nothing for several
releases. A key is refused whatever its value, `undefined` included
(the name is the mistake); a known key may still be `undefined`.
Migration: read each `new AgilityApiClient(…)`,
`createFetchTransport(…)` and `new FakeAgilityClient(…)` in your code
and remove or correct any key the README does not list for it. The two
most likely: an option in the wrong object (`transport` and `types` go
in the client's second argument; `onError` is the client's, not the
transport's), and a config object shared between the client and
something else that added its own keys to it (pass the client its own
object).

### Fixed

- **A built-in transport handed to a client was wrapped in the resend
and timeout rules a second time**, so a read that failed with a 5xx,
a 429 or a lost connection was sent four times instead of two
(`new AgilityApiClient(config, { transport: createFetchTransport(…)
})`, the way to give the client a `fetch` of your own until now; a
CLI consumer finding, present since alpha.5). The transport
`createFetchTransport` returns now says that it applies both rules
itself, and the client adds neither. Its own `retries` and `timeoutMs`
are then the ones that count: set them on `createFetchTransport`, not
on the client. Migration: nothing, unless you counted on four sends.
A wrapper of your own around the built-in transport is a custom
transport and gets the client's rules around it; make the inner one
with `retries: 0, timeoutMs: 0` to have each rule once.

### Changed

- **More is known about `"retry-write"`** (no behaviour change). A
browser-app consumer checked the case that matters most to a browser:
a credential that had been valid and expired. On one product release
an api/asset batch of creates and a rest-1 attribute write were each
answered 401 and not applied, and a query.v1 read got the same 401;
no 403 and no redirect was seen. The doc comment, spec 000 and example
09 now say so. Still not checked: a 403, other releases, other ways of
signing in. The same check showed that a 401 can carry a body
(`{"error":"Unauthorized"}`, or rest-1's `{"_type":"Error", …}`) or
none; all three are `kind: "auth"`, and `transportConformance` now has
each as a case.

### Added

- `fetchImpl` in the client's config: the `fetch` the built-in transport
calls (a proxy-aware one, a recording one in a test), so a caller no
longer has to build the transport to supply it. It was accepted and
silently ignored by a JavaScript caller before.

- **`client.lists`: the values a list-typed attribute may take, and the
one a name means.** For Status, Priority, Source, Category and any
other relation to a list type, over the server's api/ValidValues, as
the product's own pickers ask it.
- `client.lists.values({ asset, attributes, select? })` for an existing
asset, or `{ type, scope, team?, attributes }` for one not created
yet: a map from attribute to rows `{ _oid, Name, …selected }` in the
list's own order. One request per attribute, one after another;
nothing is cached.
- `client.lists.value({ asset | type+scope, attribute, name, match? })`:
the one value a name means there, matched whole, ignoring case and
surrounding space; `name` may be an OID, which is checked to be among
the valid values; `match: "prefix"` also accepts the start of the
name or of a word in it when no name matches whole. No match is an
`ApiError` coded `NO_SUCH_VALUE`, several is `AMBIGUOUS_VALUE` (both
`kind: "invalid"`), each with the candidates as rows in
`details.values`.
- What decides, proved live on fixtures: the scope's scheme (only the
values selected in it); a team that owns statuses replaces the
scheme's statuses with its own, and `{ asset }` alone applies that;
a team that owns none changes nothing; an inactive value is left
out; there is no "none" entry; a base type (`PrimaryWorkitem`) is
accepted.
- The server enforces less on a write than this list says: it refuses
a status outside a team's process, and accepts one the scope's
scheme does not select. Resolve a name with `lists.value` before
writing it.
- Only relations to a list type. The endpoint takes no page and no
filter and answers any attribute whole, so `Owners`, `Team`,
`Timebox` and the like are a `UsageError` before anything is sent,
naming the bounded read to use (`client.query` on the related type
with a filter and a page). An attribute the type does not have, a
date in `select` (the endpoint writes dates in the server's culture
format) and a path in `select` are refused the same way.
- Telling a list from another relation walks the related type's
ancestors to `List` (for Status: `StoryStatus`, `Status`, `List`), so
a cold schema cache pays up to two more type loads. A type in that
chain that cannot be loaded is an `ApiError` coded `NOT_FOUND` naming
it, never "not a list type" (a test that serves captured meta.v1
types needs those two as well).
- No fallback: on an instance without the endpoint the call fails as
the server's 404, never as an empty list. From which product release
the endpoint exists is not established here.
- `client.fields.describe(type, scope)` answers `lists` as well: which
of the required, visible and important attributes are list-typed, and
the list type of each (`{ Status: "StoryStatus" }`). A consumer that
compares the whole answer with `toEqual` adds the key.
- `/wire`: `validValues.forAsset` and `validValues.forNew`, the endpoint
as it is, unbounded; its header says what care that needs. `/services`:
`lists`.
- `/testing`: `fake.onValues({ Status: rows })` scripts the valid values
by attribute (rows, a function of what was asked, or an Error), and
`fake.valuesAsked` records each request. Name matching and the two
errors are the client's own on the fake. Without a `metamodel` the
fake does not know what an attribute nobody scripted is and says so
in its own words; to test what the client refuses (`Owners`), give
the fake a metamodel.
- `examples/12-list-values.ts`.

## 1.0.0-alpha.11

### Breaking
Expand Down
Loading