Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
61 changes: 61 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,67 @@
releases, other ways of signing in. So a hook that prompts a person
should still check that the session is gone before it prompts.

- **`client.lists` rows are translated like any other row.** The
endpoint sends every value as a string, and alpha.12 passed that on:
a status's `Order` was `"115"` from `client.lists` and `115` from
`client.query`. Now a number is a number, a Boolean a Boolean and a
relation a Ref or `null`, by the list type's schema (spec 000 §2: one
shape for a row on every read). A multi-value relation can no longer
be selected (it never arrived in a readable form); a date is still
refused. Migration: drop a `Number(row.Order)` or a comparison with
`"True"`; a sort on `Order` now sorts numbers.
- **`/wire`'s `validValues` takes `sort` as one attribute name**, not a
list: the endpoint sorts by one attribute, ascending, and ignores
without an error a name the list type does not have. Migration:
`sort: "Order"` in place of `sort: ["Order"]`.

### Fixed

- **What `client.lists` documents was wrong in three places**, now
corrected in the README, the doc comments and the module headers, and
each proved against an instance:
- A team's own values replace the scheme's for **any** list the team
owns values of, not for Status only. alpha.12 said "for Status
only", which was true of the fixture and not of the rule.
- "The project's scheme decides" holds for work items, issues,
requests, goals, strategic themes, retrospectives, environments,
regression tests and regression plans. For members, budgets,
projects, iterations, change sets, attachments and build runs every
active value is valid, with no scheme involved.
- The team step exists only on an instance with team workspaces
enabled.
- What a write enforces is narrower than alpha.12 implied, and is now
stated and tested: only the Status of a story or defect, and only
against its team. Any other list value, an inactive status and a
status outside the scheme are accepted. Moving a story or defect to
another project or team clears a status that is not valid there,
without a failure, unless the same write sets one. A team's
workflow rules can still refuse a status the list offers. This is
what one release does, not a contract: the product has added
enforcement over time, so follow the list and do not rely on a
value outside it being accepted.
- **An empty answer could be the server giving up.** When the server
cannot work out its rule for lack of context it answers no values and
no error. `client.lists` always sends the project; for a new
regression suite, whose rule goes through its regression plan, it now
refuses the call without `context: { RegressionPlan }` instead of
answering `[]`.
- **A list type is told from its own definition.** alpha.12 walked up
the type's ancestors (`StoryStatus`, then `Status`) to reach `List`,
which cost a type load and made a test serving captured meta.v1 types
serve `Status` too. Each inherited attribute already names the
ancestor that defines it, so the list type's own definition is
enough; nothing above it is loaded. (alpha.12's notes also named
`List` among the types loaded; it never was.)

### Added

- `client.lists`: `context` on the type-and-scope form (any attribute
of the asset to be), and `team: null` on the asset form (as if the
asset were on no team).
- The requests for several attributes, and the type loads before them,
go out together instead of one after another, as on every other read.

### Changed

- **A write the member has no right to make is said so, to a person, on
Expand Down
13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,16 @@ const done = await client.lists.value({ asset: "Story:1077", attribute: "Status"
await client.send([{ from: "Story:1077", update: { Status: done._oid } }]);
```

- **What decides.** The project's scheme: only the values selected in it. A team that has its own process (it owns statuses; `Team.HasProcess`) replaces the scheme's statuses with its own, and `{ asset }` alone applies that, so there is nothing to switch on. A team without a process changes nothing. An inactive value is left out, and "no value" is never an entry. The order is the values' `Order`.
- **Resolve before you write.** A team's process IS enforced on a write: a status outside it is refused, as a command failure `Violation'PrimaryWorkitemCannotHaveInvalidStatus`. A scheme's selection is NOT: a status the project's scheme does not select is accepted, with no violation at all. Nothing but this lookup stops a write from setting a value the project does not use.
- **What decides: the team's own values first, then the asset type's rule.** If the asset is on a team (or you name one) and that team owns values of the list, those are the answer, for any list: a team that owns statuses is offered its statuses, one that owned priorities its priorities. `{ asset }` alone applies that, so there is nothing to switch on; `team: null` asks as if the asset were on no team. This first step exists only on an instance with team workspaces enabled. Otherwise the asset type's own rule applies: for work items, issues, requests, goals, strategic themes, retrospectives, environments, regression tests and regression plans, the active values selected in the project's scheme; for members, budgets, projects, iterations, change sets, attachments and build runs, every active value, with no scheme involved.
- **An inactive value is left out**, "no value" is never an entry, and the order is the values' `Order`.
- **Resolve before you write: the server checks very little.** On a write, one thing is enforced: the Status of a story or defect against its team. A status owned by a team is refused on a work item that is not on that team, and a status owned by no team is refused on a work item whose team has statuses of its own (`Violation'PrimaryWorkitemCannotHaveInvalidStatus`). Nothing else was checked on the release this was proved against: a status the project's scheme does not select, an inactive status, and any Priority, Source, Category or other list value from anywhere were all accepted. Do not build on that leniency. The product has added enforcement release by release and may refuse tomorrow what it accepts today; the list is the rule to follow, and this lookup is how to follow it.
- **A move can clear a status.** When a story or defect changes project or team and the same write does not set a Status, a status that is not valid in the new place (not among the new team's own, or else not selected in the new project's scheme) is set to empty, with no failure reported. Read the Status back after a move if you show it.
- **Valid is not the same as allowed.** A team can restrict which status may follow which, and which roles may make the change; a value `client.lists` offers can still be refused by such a workflow rule when written.
- **`lists.value` matches the whole name**, ignoring case and surrounding space. `match: "prefix"` also accepts the start of the name or of a word in it ("prog" finds "In Progress") when no name matches whole. It never picks among several: no match is an `ApiError` coded `NO_SUCH_VALUE`, more than one is `AMBIGUOUS_VALUE`, and both carry the candidates as rows in `error.details.values` (every valid value, or the ones that matched), ready to offer.
- **Only lists.** The server's endpoint takes no page and no filter and would answer every member, team or iteration in the project, so for `Owners`, `Team`, `Timebox` and any relation that is not to a list type, `client.lists` throws a `UsageError` before sending anything. There is no "valid values" call for those: read them with `client.query({ from: "Member", filter, page })`, bounded like every other read.
- **Costs and limits.** One request per attribute, sent one after another, and on a cold schema cache the type loads that tell a list from another relation (for Status: `StoryStatus`, `Status`, `List`; a test that serves captured meta.v1 types must serve that whole chain, and the error names the type it could not load when one is missing); nothing is cached, because an administrator can change a scheme at any time. `select` takes attributes of the value itself (`Order`, `RollupState`), not paths and not dates, and every value arrives as a string. On an instance without the endpoint the call fails as the server's 404; it does not fall back to every value of the list type, which would be a different answer.
- **Only lists.** The server's endpoint takes no page and would answer every member, team or iteration it considers valid, so for `Owners`, `Team`, `Timebox` and any relation that is not to a list type, `client.lists` throws a `UsageError` before sending anything. Read those with `client.query({ from: "Member", filter, page })`, bounded like every other read.
- **Values are rows like any other.** `select` takes attributes of the value itself (`Order`, `RollupState`, `Team`): a number is a number, a Boolean a Boolean, a relation a Ref or `null`. Not a path, not a multi-value relation, and not a date, which the endpoint writes in the server's culture format.
- **An empty list means no value is valid, and the SDK keeps it meaning that.** The server answers "no values" also when it cannot work the rule out for lack of context, so the SDK always sends the project, and for a type whose rule needs more it asks you for it: `context: { RegressionPlan: "RegressionPlan:7" }` for a new regression suite. `context` takes any attribute of the asset to be.
- **Costs.** One request per attribute, sent together. Nothing is cached, because an administrator can change a scheme or a team's values at any time; the schema is cached as for every read, and telling a list from another relation needs the list type's own definition and nothing above it.
- `client.fields.describe(type, scope).lists` says which of a form's attributes are list-typed and to which list type each points.

### Reference
Expand Down
Loading