@defrex/autobuild 1.11.1 → 1.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/SPEC.md +601 -203
- package/bin/ab-build-runner.ts +8 -0
- package/docs/answering-blocked-builds.md +32 -2
- package/docs/architecture.md +188 -57
- package/docs/assets/headline-wide.png +0 -0
- package/docs/cli.md +1 -1
- package/docs/configuration.md +120 -23
- package/docs/dispatcher.md +19 -8
- package/docs/integration-overview.md +1 -1
- package/docs/integration-tree.md +33 -18
- package/docs/merge-policy.md +7 -2
- package/docs/operating.md +5 -3
- package/docs/operator-api.md +48 -25
- package/docs/operator-surfaces.md +39 -3
- package/docs/optimization-nodes.md +10 -8
- package/docs/plugin-authoring.md +46 -18
- package/docs/remote-store-protocol.md +51 -12
- package/docs/remote-ticket-protocol.md +85 -38
- package/docs/restacking.md +48 -3
- package/docs/setup.md +2 -1
- package/docs/ticket-migration.md +2 -2
- package/docs/ticket-sources.md +23 -8
- package/docs/tickets.md +4 -4
- package/docs/troubleshooting.md +17 -2
- package/docs/verification.md +3 -1
- package/package.json +3 -3
- package/packages/core/src/cli/ambient-errors.ts +17 -0
- package/packages/core/src/cli/bounded-io.ts +174 -0
- package/packages/core/src/cli/build-control.ts +72 -6
- package/packages/core/src/cli/dashboard/actions.ts +4 -0
- package/packages/core/src/cli/dashboard/integration-row.ts +43 -19
- package/packages/core/src/cli/dashboard/model.ts +93 -29
- package/packages/core/src/cli/dashboard/poll.ts +231 -34
- package/packages/core/src/cli/dashboard/queue.ts +21 -10
- package/packages/core/src/cli/dashboard/render.ts +14 -37
- package/packages/core/src/cli/dashboard/row-text.ts +26 -8
- package/packages/core/src/cli/dashboard/tone-ansi.ts +39 -0
- package/packages/core/src/cli/dashboard/vocabulary.ts +165 -20
- package/packages/core/src/cli/dispatch-frontend.ts +2 -1
- package/packages/core/src/cli/dispatch-handoff.ts +41 -10
- package/packages/core/src/cli/dispatch-launch-contract.ts +5 -0
- package/packages/core/src/cli/dispatch-launcher-cadence.ts +80 -0
- package/packages/core/src/cli/dispatch-launcher.ts +9 -10
- package/packages/core/src/cli/dispatch-preflight.ts +12 -3
- package/packages/core/src/cli/dispatch-release-observer.ts +53 -0
- package/packages/core/src/cli/dispatch-runtime-cache.ts +204 -82
- package/packages/core/src/cli/dispatch-runtime-dependencies.ts +250 -43
- package/packages/core/src/cli/dispatch-tickets.ts +33 -12
- package/packages/core/src/cli/dispatch-upgrade-install.ts +36 -16
- package/packages/core/src/cli/dispatch-upgrade-source.ts +8 -2
- package/packages/core/src/cli/dispatch-yield-observer.ts +82 -0
- package/packages/core/src/cli/dispatch.ts +595 -149
- package/packages/core/src/cli/env.ts +2 -15
- package/packages/core/src/cli/help.ts +43 -28
- package/packages/core/src/cli/main.ts +11 -7
- package/packages/core/src/cli/production-store.ts +102 -0
- package/packages/core/src/cli/publication-settlement.ts +4 -0
- package/packages/core/src/cli/remote-poll.ts +22 -5
- package/packages/core/src/cli/repo-state.ts +2 -3
- package/packages/core/src/cli/repository-status.ts +44 -28
- package/packages/core/src/cli/sessionless-store.ts +26 -0
- package/packages/core/src/cli/status.ts +188 -47
- package/packages/core/src/cli/store-opening.ts +26 -57
- package/packages/core/src/cli/store-ref.ts +6 -1
- package/packages/core/src/cli/ticket-start.ts +3 -3
- package/packages/core/src/cli/ticket.ts +12 -11
- package/packages/core/src/cli/wait.ts +8 -28
- package/packages/core/src/cli/watch.ts +113 -50
- package/packages/core/src/config/reference-metadata.ts +7 -1
- package/packages/core/src/config/reference.ts +5 -2
- package/packages/core/src/config/schema.ts +51 -16
- package/packages/core/src/distribution-packaging.ts +156 -18
- package/packages/core/src/events/catalog-identity.ts +28 -0
- package/packages/core/src/events/catalog.ts +3 -9
- package/packages/core/src/events/compatibility.ts +2 -30
- package/packages/core/src/events/payloads.ts +85 -14
- package/packages/core/src/events/policy.ts +3 -0
- package/packages/core/src/events/repository.ts +15 -4
- package/packages/core/src/events/sessions.ts +1 -1
- package/packages/core/src/events/validation-error.ts +12 -0
- package/packages/core/src/kernel/__snapshots__/reducer-accumulator-shapes.json +36 -0
- package/packages/core/src/kernel/__snapshots__/reducer-identity-records/0a10010ee5cf2e47.json +577 -0
- package/packages/core/src/kernel/__snapshots__/reducer-identity-records/227701361be6d1e0.json +490 -0
- package/packages/core/src/kernel/__snapshots__/reducer-identity-records/3064e337cc75f8d6.json +310 -0
- package/packages/core/src/kernel/__snapshots__/reducer-identity-records/76e5043bae7a80ab.json +86 -0
- package/packages/core/src/kernel/__snapshots__/reducer-identity-records/87a917802870bbed.json +87 -0
- package/packages/core/src/kernel/__snapshots__/reducer-identity-records/9d85616e5b9e24c1.json +500 -0
- package/packages/core/src/kernel/__snapshots__/reducer-identity-records/a1e90a969d32a367.json +307 -0
- package/packages/core/src/kernel/__snapshots__/reducer-identity-records/c7c94fbe7f63cf07.json +84 -0
- package/packages/core/src/kernel/__snapshots__/reducer-identity-records/da3bc91c49211eab.json +310 -0
- package/packages/core/src/kernel/auto-merge-default.ts +2 -1
- package/packages/core/src/kernel/capacity-build.ts +21 -0
- package/packages/core/src/kernel/clean-restack-policy.ts +40 -0
- package/packages/core/src/kernel/discard-in-flight.ts +13 -0
- package/packages/core/src/kernel/dispatch-capacity.ts +578 -235
- package/packages/core/src/kernel/done-escalations.ts +269 -0
- package/packages/core/src/kernel/engine.ts +30 -17
- package/packages/core/src/kernel/integration-landing.ts +24 -4
- package/packages/core/src/kernel/integration-stack.ts +39 -0
- package/packages/core/src/kernel/janitor-failure.ts +20 -1
- package/packages/core/src/kernel/log-index-value.ts +3 -0
- package/packages/core/src/kernel/log-index.ts +41 -2
- package/packages/core/src/kernel/measurement.ts +24 -0
- package/packages/core/src/kernel/open-pr-backpressure.ts +3 -3
- package/packages/core/src/kernel/read-facts.ts +8 -370
- package/packages/core/src/kernel/reducer-registry.ts +43 -125
- package/packages/core/src/kernel/reducer-revisions.ts +18 -0
- package/packages/core/src/kernel/reducer-value-entry.ts +98 -0
- package/packages/core/src/kernel/reducer-value-index.ts +75 -0
- package/packages/core/src/kernel/reducer.ts +84 -16
- package/packages/core/src/kernel/reopen-state.ts +10 -0
- package/packages/core/src/kernel/repository-attention.ts +14 -5
- package/packages/core/src/kernel/repository-read-facts.ts +375 -0
- package/packages/core/src/kernel/ticket-starts.ts +15 -4
- package/packages/core/src/kernel/verify-stage-state.ts +145 -3
- package/packages/core/src/kernel/verify-stages.ts +46 -7
- package/packages/core/src/operator/attention.ts +28 -3
- package/packages/core/src/operator/done-escalations.ts +38 -0
- package/packages/core/src/operator/presentation.ts +14 -1
- package/packages/core/src/operator/protocol.ts +8 -5
- package/packages/core/src/operator/query.ts +72 -57
- package/packages/core/src/operator/registry.ts +19 -15
- package/packages/core/src/operator/ticket-start.ts +8 -7
- package/packages/core/src/operator/tickets.ts +28 -9
- package/packages/core/src/plugin-sdk/index.ts +10 -0
- package/packages/core/src/plugins/manifest.ts +14 -1
- package/packages/core/src/ports/forge/create.ts +8 -0
- package/packages/core/src/ports/forge/github-transport.ts +5 -1
- package/packages/core/src/ports/forge/github.ts +3 -0
- package/packages/core/src/ports/tickets/contract.ts +147 -76
- package/packages/core/src/ports/tickets/create.ts +47 -7
- package/packages/core/src/ports/tickets/fake.ts +8 -4
- package/packages/core/src/ports/tickets/file-codec.ts +4 -3
- package/packages/core/src/ports/tickets/file.ts +7 -3
- package/packages/core/src/ports/tickets/github.ts +1 -0
- package/packages/core/src/ports/tickets/grants.ts +11 -3
- package/packages/core/src/ports/tickets/hosted-index.ts +5 -0
- package/packages/core/src/ports/tickets/linear.ts +28 -9
- package/packages/core/src/ports/tickets/migration.ts +4 -4
- package/packages/core/src/ports/tickets/operations.ts +4 -2
- package/packages/core/src/ports/tickets/priority-labels.ts +213 -0
- package/packages/core/src/ports/tickets/priority.ts +127 -21
- package/packages/core/src/ports/tickets/remote-protocol.ts +10 -0
- package/packages/core/src/ports/tickets/remote.ts +104 -11
- package/packages/core/src/ports/tickets/revision.ts +5 -3
- package/packages/core/src/ports/tickets/search.ts +9 -0
- package/packages/core/src/ports/tickets/tree.ts +8 -6
- package/packages/core/src/ports/types.ts +30 -15
- package/packages/core/src/ports/workspace/build-execution.ts +4 -0
- package/packages/core/src/ports/workspace/builtin-capabilities.ts +4 -0
- package/packages/core/src/ports/workspace/create.ts +16 -3
- package/packages/core/src/ports/workspace/execution-exit-marker.ts +41 -0
- package/packages/core/src/ports/workspace/fake.ts +15 -3
- package/packages/core/src/ports/workspace/recovery-step.ts +101 -0
- package/packages/core/src/ports/workspace/vercel-sandbox.ts +510 -145
- package/packages/core/src/processes/build-execution-state.ts +4 -0
- package/packages/core/src/processes/build-runner.ts +14 -1
- package/packages/core/src/processes/dispatcher.ts +777 -288
- package/packages/core/src/processes/execution-no-progress.ts +1 -0
- package/packages/core/src/processes/execution-settlement.ts +1 -0
- package/packages/core/src/processes/harvest-runner.ts +12 -7
- package/packages/core/src/processes/infrastructure-failure-budget.ts +7 -2
- package/packages/core/src/processes/invocation-budget.ts +176 -0
- package/packages/core/src/processes/publication-loss.ts +38 -3
- package/packages/core/src/processes/workspace-preservation.ts +86 -15
- package/packages/core/src/store/contract.ts +81 -3
- package/packages/core/src/store/event-reads.ts +30 -1
- package/packages/core/src/store/local/capabilities.ts +115 -0
- package/packages/core/src/store/local/store.ts +86 -56
- package/packages/core/src/store/reduced-reads.ts +32 -1
- package/packages/core/src/store/reducer-value-read.ts +235 -0
- package/packages/core/src/store/reducer-value-shapes.json +6722 -6475
- package/packages/core/src/store/reducer-value-validation.ts +181 -33
- package/packages/core/src/store/reducer-values.ts +36 -204
- package/packages/core/src/store/remote/client.ts +169 -29
- package/packages/core/src/store/remote/compatibility.ts +113 -56
- package/packages/core/src/store/remote/credentials.ts +4 -1
- package/packages/core/src/store/remote/protocol.ts +3 -0
- package/packages/core/src/store/remote/released-clients.json +22 -0
- package/packages/core/src/store/remote/released-reducer-values/1.12.0.json +35806 -0
- package/packages/core/src/store/remote/released-reducer-values/1.13.0.json +35966 -0
- package/packages/core/src/store/remote/released-reducer-values/index.ts +20 -16
- package/packages/core/src/store/remote/released-value-policy.ts +144 -0
- package/packages/core/src/store/remote/retry.ts +406 -0
- package/packages/core/src/store/rollup-lease.ts +41 -0
- package/packages/core/src/store/rollups.ts +7 -38
- package/packages/core/src/store/snapshots.ts +1 -1
- package/packages/core/src/testing/dispatch-read-budget.ts +409 -14
- package/packages/core/src/testing/import-graph.ts +78 -0
- package/packages/core/src/testing/index.ts +2 -0
- package/packages/core/src/testing/invocation-budget.ts +42 -0
- package/packages/core/src/testing/reduced-read-budget.ts +602 -40
- package/packages/core/src/testing/released-value-coverage.ts +423 -0
- package/packages/core/src/testing/slot-agreement.ts +52 -0
- package/packages/core/src/web/assets/app.js +5 -5
- package/packages/core/src/web/overview-source.ts +19 -6
- package/skills/guide/SKILL.md +245 -103
- package/skills/guide/references/integration-tree.md +33 -18
- package/skills/guide/references/merge-policy.md +7 -2
- package/skills/guide/references/operator-api.md +48 -25
- package/skills/guide/references/optimization-nodes.md +10 -8
- package/skills/guide/references/plugin-authoring.md +46 -18
- package/skills/guide/references/remote-store-protocol.md +51 -12
- package/skills/guide/references/remote-ticket-protocol.md +85 -38
- package/skills/guide/references/restacking.md +48 -3
- package/skills/guide/references/setup.md +2 -1
- package/skills/guide/references/ticket-migration.md +2 -2
- package/skills/operate/SKILL.md +114 -65
- package/skills/plan/SKILL.md +4 -3
- package/skills/spec/SKILL.md +9 -5
- package/skills/tickets/SKILL.md +25 -17
- package/templates/hosted-service/package.json +2 -2
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
/** Operator single-ticket start requests (AUT-1293): a durable, attributed
|
|
2
2
|
* request that the running dispatcher claims one named ticket through the
|
|
3
3
|
* ordinary admission gates on its next tick with a free slot in the request's
|
|
4
|
-
* tier (`manual`, `urgent` or `
|
|
4
|
+
* tier (`manual`, `urgent`, `high`, `normal` or `low`, SPEC §12), independent of intake. The
|
|
5
5
|
* request only canonicalizes the id; the dispatcher decides and settles
|
|
6
6
|
* eligibility. One invocation costs one source `get`, one reduced-value
|
|
7
7
|
* read and at most one append, whatever the number of builds. */
|
|
8
8
|
import { humanActor, type Via } from '../events/envelope'
|
|
9
|
-
import type { RepositoryEventEnvelope
|
|
9
|
+
import type { RepositoryEventEnvelope } from '../events/repository'
|
|
10
10
|
import { ticketStartKey } from '../kernel/ticket-starts'
|
|
11
11
|
import type { TicketRef } from '../ontology'
|
|
12
12
|
import { requireTicket } from '../ports/tickets/operations'
|
|
13
|
+
import { startTierFields, startTierOf, type StartTier } from '../ports/tickets/priority'
|
|
13
14
|
import type { TicketSource } from '../ports/types'
|
|
14
15
|
import { readRepositoryFacts } from '../store/reduced-reads'
|
|
15
16
|
import { OperatorControlError } from './control'
|
|
@@ -24,7 +25,7 @@ interface TicketStartOptions {
|
|
|
24
25
|
user: string
|
|
25
26
|
via?: Via
|
|
26
27
|
/** The request's admission tier; `manual` when omitted. */
|
|
27
|
-
priority?:
|
|
28
|
+
priority?: StartTier
|
|
28
29
|
}
|
|
29
30
|
|
|
30
31
|
export interface TicketStartRequested {
|
|
@@ -36,7 +37,7 @@ export interface TicketStartRequested {
|
|
|
36
37
|
updated: boolean
|
|
37
38
|
/** The pending request's first seq, unchanged by a priority update. */
|
|
38
39
|
request: number
|
|
39
|
-
priority:
|
|
40
|
+
priority: StartTier
|
|
40
41
|
requestedAt: string
|
|
41
42
|
ticket: TicketRef
|
|
42
43
|
event?: RepositoryEventEnvelope
|
|
@@ -60,7 +61,7 @@ export async function requestTicketStart(opts: TicketStartOptions): Promise<Tick
|
|
|
60
61
|
await opts.store.ensureRepo(opts.repo)
|
|
61
62
|
const facts = (await readRepositoryFacts(opts.store, opts.repo, true)).value
|
|
62
63
|
const pending = facts.ticketStarts.pending[ticketStartKey(ticket)]
|
|
63
|
-
if (pending
|
|
64
|
+
if (pending !== undefined && startTierOf(pending) === priority)
|
|
64
65
|
return {
|
|
65
66
|
status: 'pending',
|
|
66
67
|
existing: true,
|
|
@@ -73,7 +74,7 @@ export async function requestTicketStart(opts: TicketStartOptions): Promise<Tick
|
|
|
73
74
|
const event = await opts.store.appendRepo(opts.repo, {
|
|
74
75
|
actor: humanActor(opts.user, opts.via),
|
|
75
76
|
type: 'ticket.start-requested',
|
|
76
|
-
payload: { ticket: pending?.ticket ?? ticket, priority },
|
|
77
|
+
payload: { ticket: pending?.ticket ?? ticket, ...startTierFields(priority) },
|
|
77
78
|
})
|
|
78
79
|
if (pending !== undefined)
|
|
79
80
|
return {
|
|
@@ -131,7 +132,7 @@ export async function controlTicketStart(opts: {
|
|
|
131
132
|
user: string
|
|
132
133
|
via?: Via
|
|
133
134
|
cancel?: boolean
|
|
134
|
-
priority?:
|
|
135
|
+
priority?: StartTier
|
|
135
136
|
}): Promise<TicketStartRequested | TicketStartCancelled> {
|
|
136
137
|
if (opts.cancel && opts.priority !== undefined)
|
|
137
138
|
throw new OperatorControlError(
|
|
@@ -5,12 +5,16 @@ import {
|
|
|
5
5
|
} from '../kernel/ticket-migrations'
|
|
6
6
|
import { updateTicketTarget } from '../kernel/node-parent'
|
|
7
7
|
import { normalizeIssueLinks, type IssueLinkInput } from '../ports/tickets/issue-links'
|
|
8
|
-
import {
|
|
8
|
+
import { byPriority, namedPriority } from '../ports/tickets/priority'
|
|
9
9
|
import { creationAssignees } from '../ports/tickets/assignees'
|
|
10
10
|
import { creationLabels } from '../ports/tickets/labels'
|
|
11
11
|
import type { IssueLink, TicketSearchPage } from '../ports/types'
|
|
12
12
|
import { searchTickets } from '../ports/tickets/search'
|
|
13
|
-
import {
|
|
13
|
+
import {
|
|
14
|
+
projectTicketTree,
|
|
15
|
+
compatibleTicketSource,
|
|
16
|
+
type TicketTreeEntry,
|
|
17
|
+
} from '../ports/tickets/tree'
|
|
14
18
|
import { readBuildFacts } from '../store/reduced-reads'
|
|
15
19
|
import { samplePinnedAssets, preparePinnedAssets } from '../store/ticket-assets'
|
|
16
20
|
import type { TicketRef } from '../ontology'
|
|
@@ -149,13 +153,15 @@ export async function searchOperatorTickets(opts: {
|
|
|
149
153
|
cursor?: string
|
|
150
154
|
}): Promise<TicketSearchPage> {
|
|
151
155
|
const { source } = await openOperatorTickets(opts)
|
|
152
|
-
|
|
156
|
+
const page = await searchTickets(source, {
|
|
153
157
|
text: opts.query,
|
|
154
158
|
...(opts.state !== undefined ? { state: opts.state } : {}),
|
|
155
159
|
...(opts.labels !== undefined ? { labels: opts.labels } : {}),
|
|
156
160
|
...(opts.limit !== undefined ? { limit: opts.limit } : {}),
|
|
157
161
|
...(opts.cursor !== undefined ? { cursor: opts.cursor } : {}),
|
|
158
162
|
})
|
|
163
|
+
// Operator outputs name every hit's priority, `normal` included.
|
|
164
|
+
return { ...page, tickets: page.tickets.map(namedPriority) }
|
|
159
165
|
}
|
|
160
166
|
|
|
161
167
|
export async function listOperatorTickets(opts: {
|
|
@@ -181,18 +187,21 @@ export async function listOperatorTickets(opts: {
|
|
|
181
187
|
nativePage ? source.listPage!(criteria, opts.page!) : source.listReady(criteria),
|
|
182
188
|
opts.backend.statesFor(context, source),
|
|
183
189
|
])
|
|
184
|
-
// Native pages arrive ordered; the fallback
|
|
190
|
+
// Native pages arrive ordered; the fallback matches a native page's priority
|
|
185
191
|
// order. listReady is in the source's filing order, so reversing it is newest
|
|
186
192
|
// filed first.
|
|
187
193
|
const ordered = nativePage
|
|
188
194
|
? listing.tickets
|
|
189
195
|
: opts.page?.order === 'newest'
|
|
190
196
|
? [...listing.tickets].reverse()
|
|
191
|
-
:
|
|
197
|
+
: byPriority(listing.tickets)
|
|
192
198
|
const offset = opts.page?.offset ?? 0
|
|
193
199
|
return {
|
|
194
200
|
states,
|
|
195
|
-
tickets: opts.page && !nativePage
|
|
201
|
+
tickets: (opts.page && !nativePage
|
|
202
|
+
? ordered.slice(offset, offset + opts.page.limit)
|
|
203
|
+
: ordered
|
|
204
|
+
).map(namedPriority),
|
|
196
205
|
diagnostics: listing.diagnostics,
|
|
197
206
|
criteria,
|
|
198
207
|
triageState,
|
|
@@ -275,7 +284,7 @@ export async function getOperatorTicket(opts: {
|
|
|
275
284
|
const ticket = await requireTicket(source, opts.id)
|
|
276
285
|
const blockers = await source.dependencyStates(ticket.blockedBy ?? [])
|
|
277
286
|
return {
|
|
278
|
-
ticket,
|
|
287
|
+
ticket: namedPriority(ticket),
|
|
279
288
|
blockers,
|
|
280
289
|
build: await matchingBuild(
|
|
281
290
|
opts.store,
|
|
@@ -393,7 +402,7 @@ export async function mutateOperatorTicket(opts: {
|
|
|
393
402
|
)
|
|
394
403
|
const blockers = await source.dependencyStates(ticket.blockedBy ?? [])
|
|
395
404
|
return {
|
|
396
|
-
ticket,
|
|
405
|
+
ticket: namedPriority(ticket),
|
|
397
406
|
blockers,
|
|
398
407
|
build: await matchingBuild(
|
|
399
408
|
opts.store,
|
|
@@ -459,7 +468,17 @@ export async function readTicketTree(source: TicketSource, root: string) {
|
|
|
459
468
|
`${source.name} cannot enumerate all tickets; use a source with listAll support`,
|
|
460
469
|
)
|
|
461
470
|
const listing = await source.listAll()
|
|
462
|
-
|
|
471
|
+
const tree = projectTicketTree(listing.tickets, root)
|
|
472
|
+
// Tree outputs name every ticket's priority, `normal` included.
|
|
473
|
+
return { ...tree, children: namedTree(tree.children), diagnostics: listing.diagnostics }
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
function namedTree(entries: TicketTreeEntry[]): TicketTreeEntry[] {
|
|
477
|
+
return entries.map((entry) => ({
|
|
478
|
+
...entry,
|
|
479
|
+
ticket: namedPriority(entry.ticket),
|
|
480
|
+
children: namedTree(entry.children),
|
|
481
|
+
}))
|
|
463
482
|
}
|
|
464
483
|
|
|
465
484
|
export async function getOperatorTicketTree(opts: {
|
|
@@ -167,7 +167,17 @@ export {
|
|
|
167
167
|
refuseUnsupportedPriority,
|
|
168
168
|
withoutUnsupportedPriority,
|
|
169
169
|
urgentFirst,
|
|
170
|
+
byPriority,
|
|
171
|
+
dispatchPriority,
|
|
172
|
+
ticketPriority,
|
|
173
|
+
TICKET_PRIORITIES,
|
|
170
174
|
} from '../ports/tickets/priority'
|
|
175
|
+
export {
|
|
176
|
+
priorityLabelSource,
|
|
177
|
+
priorityLabel,
|
|
178
|
+
PRIORITY_LABEL_PREFIX,
|
|
179
|
+
PRIORITY_LABELS,
|
|
180
|
+
} from '../ports/tickets/priority-labels'
|
|
171
181
|
export { TicketSearchCursorInvalid, TicketSearchUnsupported } from '../ports/tickets/search'
|
|
172
182
|
export {
|
|
173
183
|
TicketAssigneesUnsupported,
|
|
@@ -15,7 +15,7 @@ import type {
|
|
|
15
15
|
} from '../ports/workspace/provider-capabilities'
|
|
16
16
|
|
|
17
17
|
/** Version of the in-process plugin contract exposed by `@defrex/autobuild/plugin-sdk`. */
|
|
18
|
-
export const PLUGIN_API_VERSION = '1.
|
|
18
|
+
export const PLUGIN_API_VERSION = '1.12.0' as const
|
|
19
19
|
|
|
20
20
|
/** Context supplied when a registered adapter or contract fixture is selected. */
|
|
21
21
|
export interface PluginFactoryContext<Config = Record<string, unknown>> {
|
|
@@ -25,6 +25,19 @@ export interface PluginFactoryContext<Config = Record<string, unknown>> {
|
|
|
25
25
|
env: Readonly<Record<string, string | undefined>>
|
|
26
26
|
/** Absolute root of the repository that enabled the plugin. */
|
|
27
27
|
repoRoot: string
|
|
28
|
+
/** Present when the host provides plugin API ≥ 1.12: the host's fetch. In
|
|
29
|
+
* a bounded dispatcher invocation every request made through it is
|
|
30
|
+
* cancelled at the current phase's deadline, together with any
|
|
31
|
+
* `init.signal` the plugin passes; otherwise it behaves exactly like global
|
|
32
|
+
* `fetch`. Use it for provider HTTP. */
|
|
33
|
+
fetch?: typeof fetch
|
|
34
|
+
/** Present when the host provides plugin API ≥ 1.12: the current phase's
|
|
35
|
+
* cancellation signal, for non-fetch work such as SQL clients,
|
|
36
|
+
* subprocesses, or SDKs with their own transport. Read it at call time,
|
|
37
|
+
* not at construction. `undefined` outside a bounded invocation. An
|
|
38
|
+
* adapter that ignores both fields still works, but its requests are
|
|
39
|
+
* abandoned rather than cancelled at the deadline. */
|
|
40
|
+
invocationSignal?: () => AbortSignal | undefined
|
|
28
41
|
}
|
|
29
42
|
|
|
30
43
|
export type PluginFactory<
|
|
@@ -44,6 +44,11 @@ export async function createForge(opts: {
|
|
|
44
44
|
/** Process label for the builtin GitHub forge: refuse requests that would
|
|
45
45
|
* go out without a credential. Plugins and `local-git` ignore it. */
|
|
46
46
|
requireCredential?: string
|
|
47
|
+
/** Host fetch for the builtin GitHub forge and the plugin factory
|
|
48
|
+
* context; absent ⇒ global `fetch`. */
|
|
49
|
+
fetchFn?: typeof fetch
|
|
50
|
+
/** Plugin factory context `invocationSignal`; absent ⇒ `() => undefined`. */
|
|
51
|
+
invocationSignal?: () => AbortSignal | undefined
|
|
47
52
|
}): Promise<Forge> {
|
|
48
53
|
const registration = resolveForgeRegistration(opts.name, opts.registry)
|
|
49
54
|
if (registration.owner.kind === 'builtin') {
|
|
@@ -56,6 +61,7 @@ export async function createForge(opts: {
|
|
|
56
61
|
...(opts.requireCredential !== undefined
|
|
57
62
|
? { requireCredential: opts.requireCredential }
|
|
58
63
|
: {}),
|
|
64
|
+
...(opts.fetchFn !== undefined ? { fetchFn: opts.fetchFn } : {}),
|
|
59
65
|
})
|
|
60
66
|
}
|
|
61
67
|
if (opts.name === 'local-git') return new LocalGitForge({ repoRoot: opts.repoRoot })
|
|
@@ -74,6 +80,8 @@ export async function createForge(opts: {
|
|
|
74
80
|
config: EMPTY_CONFIG,
|
|
75
81
|
env: opts.env,
|
|
76
82
|
repoRoot: resolve(opts.repoRoot),
|
|
83
|
+
fetch: opts.fetchFn ?? globalThis.fetch,
|
|
84
|
+
invocationSignal: opts.invocationSignal ?? (() => undefined),
|
|
77
85
|
})
|
|
78
86
|
} catch (error) {
|
|
79
87
|
throw new Error(
|
|
@@ -137,8 +137,12 @@ export function createGitHubFetchTransport(opts: {
|
|
|
137
137
|
apiBase?: string
|
|
138
138
|
now?: () => number
|
|
139
139
|
requireCredential?: string
|
|
140
|
+
/** Request seam; absent ⇒ global `fetch`. A bounded dispatcher invocation
|
|
141
|
+
* passes a fetch that cancels requests at its deadline. */
|
|
142
|
+
fetchFn?: typeof fetch
|
|
140
143
|
}): GitHubRequest {
|
|
141
144
|
const source = opts.token
|
|
145
|
+
const fetchFn = opts.fetchFn ?? fetch
|
|
142
146
|
const now = opts.now ?? Date.now
|
|
143
147
|
let resolved: Promise<GitHubCredential> | undefined
|
|
144
148
|
/** When the current answer arrived; `undefined` while one is in flight. */
|
|
@@ -211,7 +215,7 @@ export function createGitHubFetchTransport(opts: {
|
|
|
211
215
|
headers['Content-Type'] = 'application/json'
|
|
212
216
|
body = JSON.stringify(request.body)
|
|
213
217
|
}
|
|
214
|
-
const response = await
|
|
218
|
+
const response = await fetchFn(url, {
|
|
215
219
|
method,
|
|
216
220
|
headers,
|
|
217
221
|
...(body !== undefined ? { body } : {}),
|
|
@@ -1005,6 +1005,8 @@ export class GitHubForge implements Forge {
|
|
|
1005
1005
|
* without a credential. Absent, the environment's
|
|
1006
1006
|
* `AB_GITHUB_REQUIRE_CREDENTIAL` marker decides. */
|
|
1007
1007
|
requireCredential?: string
|
|
1008
|
+
/** Request seam for the default transport; absent ⇒ global `fetch`. */
|
|
1009
|
+
fetchFn?: typeof fetch
|
|
1008
1010
|
} = {},
|
|
1009
1011
|
) {
|
|
1010
1012
|
this.now = opts.now ?? Date.now
|
|
@@ -1021,6 +1023,7 @@ export class GitHubForge implements Forge {
|
|
|
1021
1023
|
createGitHubFetchTransport({
|
|
1022
1024
|
token: this.token,
|
|
1023
1025
|
...(requireCredential !== undefined ? { requireCredential } : {}),
|
|
1026
|
+
...(opts.fetchFn !== undefined ? { fetchFn: opts.fetchFn } : {}),
|
|
1024
1027
|
})
|
|
1025
1028
|
this.transport = async (...args) =>
|
|
1026
1029
|
guardedForgeRequest(async () => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createTicket, updateTicket, moveTicket, changeBlockers } from './operations'
|
|
2
2
|
import { normalizeIssueLinks, TicketIssueLinksUnsupported } from './issue-links'
|
|
3
|
-
import {
|
|
3
|
+
import { byPriority } from './priority'
|
|
4
4
|
import { TicketAssigneesUnsupported } from './assignees'
|
|
5
5
|
import { compatibleTicketSource } from './tree'
|
|
6
6
|
import { TicketRevisionConflict } from './revision'
|
|
@@ -33,7 +33,7 @@ export async function assertTicketPage(
|
|
|
33
33
|
page.order === 'newest'
|
|
34
34
|
? [...filed].reverse().map((id) => full.tickets.find((ticket) => ticket.ref.id === id)!)
|
|
35
35
|
: source.priority
|
|
36
|
-
?
|
|
36
|
+
? byPriority(full.tickets)
|
|
37
37
|
: full.tickets
|
|
38
38
|
const offset = page.offset ?? 0
|
|
39
39
|
expect(actual).toEqual({
|
|
@@ -313,32 +313,32 @@ export function describeTicketSourceContract(
|
|
|
313
313
|
})
|
|
314
314
|
})
|
|
315
315
|
|
|
316
|
-
test('native pages order
|
|
316
|
+
test('native pages order by priority level and newest filed first when declared', async () => {
|
|
317
317
|
await withTicketSource(factory, async (harness) => {
|
|
318
318
|
const source = harness.source
|
|
319
319
|
if (!source.listPage || !source.priority) return
|
|
320
|
-
const label = await freshLabel(harness, 'page-
|
|
321
|
-
//
|
|
320
|
+
const label = await freshLabel(harness, 'page-priority')
|
|
321
|
+
// Filing order: low, normal, urgent, high, normal, urgent.
|
|
322
|
+
const levels = ['low', 'normal', 'urgent', 'high', 'normal', 'urgent'] as const
|
|
322
323
|
const filed: string[] = []
|
|
323
|
-
for (
|
|
324
|
+
for (const [i, level] of levels.entries()) {
|
|
324
325
|
const interval = harness.filingIntervalMs ?? 5
|
|
325
|
-
if (i >
|
|
326
|
-
const urgent = i % 2 === 0
|
|
326
|
+
if (i > 0 && interval > 0) await Bun.sleep(interval)
|
|
327
327
|
const ticket = await createTracked(
|
|
328
328
|
harness,
|
|
329
329
|
{
|
|
330
|
-
title: contractTicketTitle('page-
|
|
330
|
+
title: contractTicketTitle('page-priority'),
|
|
331
331
|
body: CONTRACT_TICKET_BODY,
|
|
332
332
|
labels: [label],
|
|
333
|
-
...(
|
|
333
|
+
...(level !== 'normal' ? { priority: level } : {}),
|
|
334
334
|
},
|
|
335
335
|
{ state: harness.states.ready },
|
|
336
336
|
)
|
|
337
337
|
filed.push(ticket.ref.id)
|
|
338
338
|
}
|
|
339
|
-
const [
|
|
340
|
-
const dispatch = [
|
|
341
|
-
const newest = [n5,
|
|
339
|
+
const [l1, n2, u3, h4, n5, u6] = filed as [string, string, string, string, string, string]
|
|
340
|
+
const dispatch = [u3, u6, h4, n2, n5, l1]
|
|
341
|
+
const newest = [u6, n5, h4, u3, n2, l1]
|
|
342
342
|
// The fixture separates newest filed first from reversed dispatch order.
|
|
343
343
|
expect(newest).not.toEqual([...dispatch].reverse())
|
|
344
344
|
for (const criteria of [
|
|
@@ -664,97 +664,65 @@ export function describeTicketSourceContract(
|
|
|
664
664
|
})
|
|
665
665
|
})
|
|
666
666
|
|
|
667
|
-
test('
|
|
667
|
+
test('every priority level persists natively or through labels', async () => {
|
|
668
668
|
await withTicketSource(factory, async (harness) => {
|
|
669
669
|
const source = harness.source
|
|
670
670
|
const ready = harness.states.ready
|
|
671
|
+
// Both branches: an omitted priority files the ticket at normal.
|
|
672
|
+
const plain = await createTracked(
|
|
673
|
+
harness,
|
|
674
|
+
{ title: contractTicketTitle('normal'), body: CONTRACT_TICKET_BODY },
|
|
675
|
+
{ state: ready },
|
|
676
|
+
)
|
|
677
|
+
expect('priority' in plain).toBe(false)
|
|
671
678
|
if (!source.priority) {
|
|
672
|
-
|
|
673
|
-
const refusedCreate = await createTicket(source, {
|
|
674
|
-
title,
|
|
675
|
-
body: CONTRACT_TICKET_BODY,
|
|
676
|
-
state: ready,
|
|
677
|
-
priority: 'urgent',
|
|
678
|
-
}).catch((error: unknown) => error)
|
|
679
|
-
expect(refusedCreate).toBeInstanceOf(TicketPriorityUnsupported)
|
|
680
|
-
expect((refusedCreate as TicketPriorityUnsupported).source).toBe(source.name)
|
|
681
|
-
expect(
|
|
682
|
-
(await source.listReady({ state: ready })).tickets.some((t) => t.title === title),
|
|
683
|
-
).toBe(false)
|
|
684
|
-
const created = await createTracked(
|
|
685
|
-
harness,
|
|
686
|
-
{ title: contractTicketTitle('normal'), body: CONTRACT_TICKET_BODY },
|
|
687
|
-
{ state: ready },
|
|
688
|
-
)
|
|
689
|
-
const refusedUpdate = await updateTicket(source, created.ref.id, {
|
|
690
|
-
priority: 'urgent',
|
|
691
|
-
}).catch((error: unknown) => error)
|
|
692
|
-
expect(refusedUpdate).toBeInstanceOf(TicketPriorityUnsupported)
|
|
693
|
-
expect((refusedUpdate as TicketPriorityUnsupported).source).toBe(source.name)
|
|
694
|
-
if (source.mutateIfRevision) {
|
|
695
|
-
const refusedGuarded = await updateTicket(
|
|
696
|
-
source,
|
|
697
|
-
created.ref.id,
|
|
698
|
-
{ priority: 'urgent' },
|
|
699
|
-
false,
|
|
700
|
-
created.revision,
|
|
701
|
-
).catch((error: unknown) => error)
|
|
702
|
-
expect(refusedGuarded).toBeInstanceOf(TicketPriorityUnsupported)
|
|
703
|
-
}
|
|
704
|
-
const unchanged = await source.get(created.ref.id)
|
|
705
|
-
expect(unchanged?.revision).toBe(created.revision)
|
|
706
|
-
expect(unchanged?.title).toBe(created.title)
|
|
707
|
-
// Normal is the value an unsupported source already holds: a no-op.
|
|
708
|
-
await compatibleTicketSource(source).update(created.ref.id, { priority: 'normal' })
|
|
709
|
-
expect((await source.get(created.ref.id))?.revision).toBe(created.revision)
|
|
679
|
+
await assertPriorityLabels(harness)
|
|
710
680
|
return
|
|
711
681
|
}
|
|
712
682
|
const created = await createTracked(
|
|
713
683
|
harness,
|
|
714
|
-
{
|
|
715
|
-
title: contractTicketTitle('urgent'),
|
|
716
|
-
body: CONTRACT_TICKET_BODY,
|
|
717
|
-
priority: 'urgent',
|
|
718
|
-
},
|
|
684
|
+
{ title: contractTicketTitle('high'), body: CONTRACT_TICKET_BODY, priority: 'high' },
|
|
719
685
|
{ state: ready },
|
|
720
686
|
)
|
|
721
687
|
const id = created.ref.id
|
|
722
|
-
expect(created.priority).toBe('
|
|
723
|
-
expect((await source.get(id))?.priority).toBe('
|
|
688
|
+
expect(created.priority).toBe('high')
|
|
689
|
+
expect((await source.get(id))?.priority).toBe('high')
|
|
724
690
|
expect(
|
|
725
691
|
(await source.listReady({ state: ready })).tickets.find((t) => t.ref.id === id)?.priority,
|
|
726
|
-
).toBe('
|
|
692
|
+
).toBe('high')
|
|
727
693
|
if (source.listAll)
|
|
728
694
|
expect((await source.listAll()).tickets.find((t) => t.ref.id === id)?.priority).toBe(
|
|
729
|
-
'
|
|
695
|
+
'high',
|
|
730
696
|
)
|
|
731
|
-
|
|
732
|
-
await source.update(id, { priority: 'normal' })
|
|
733
|
-
const normal = await source.get(id)
|
|
734
|
-
expect(normal && 'priority' in normal).toBe(false)
|
|
735
|
-
expect(normal?.revision).not.toBe(created.revision)
|
|
736
|
-
|
|
737
|
-
await source.update(id, { priority: 'urgent' })
|
|
738
|
-
const urgent = await source.get(id)
|
|
739
|
-
expect(urgent?.priority).toBe('urgent')
|
|
740
697
|
// Revisions may be content hashes or counters: only change is required.
|
|
741
|
-
|
|
742
|
-
|
|
698
|
+
const revisions = [created.revision]
|
|
699
|
+
for (const level of ['low', 'urgent', 'normal'] as const) {
|
|
700
|
+
await source.update(id, { priority: level })
|
|
701
|
+
const read = (await source.get(id))!
|
|
702
|
+
if (level === 'normal') expect('priority' in read).toBe(false)
|
|
703
|
+
else expect(read.priority).toBe(level)
|
|
704
|
+
expect(revisions).not.toContain(read.revision)
|
|
705
|
+
revisions.push(read.revision)
|
|
706
|
+
}
|
|
707
|
+
await source.update(id, { priority: 'urgent' })
|
|
708
|
+
await source.update(id, { title: contractTicketTitle('retitled') })
|
|
709
|
+
const kept = (await source.get(id))!
|
|
710
|
+
expect(kept.priority).toBe('urgent')
|
|
743
711
|
if (source.mutateIfRevision) {
|
|
744
712
|
await expect(
|
|
745
|
-
source.mutateIfRevision(id,
|
|
713
|
+
source.mutateIfRevision(id, created.revision, {
|
|
746
714
|
kind: 'update',
|
|
747
|
-
patch: { priority: '
|
|
715
|
+
patch: { priority: 'low' },
|
|
748
716
|
}),
|
|
749
717
|
).rejects.toBeInstanceOf(TicketRevisionConflict)
|
|
750
718
|
expect((await source.get(id))?.priority).toBe('urgent')
|
|
751
|
-
await source.mutateIfRevision(id,
|
|
719
|
+
await source.mutateIfRevision(id, kept.revision, {
|
|
752
720
|
kind: 'update',
|
|
753
721
|
patch: { priority: 'normal' },
|
|
754
722
|
})
|
|
755
723
|
const cleared = await source.get(id)
|
|
756
724
|
expect(cleared && 'priority' in cleared).toBe(false)
|
|
757
|
-
expect(cleared?.revision).not.toBe(
|
|
725
|
+
expect(cleared?.revision).not.toBe(kept.revision)
|
|
758
726
|
}
|
|
759
727
|
})
|
|
760
728
|
})
|
|
@@ -1303,3 +1271,106 @@ export function describeTicketSourceContract(
|
|
|
1303
1271
|
})
|
|
1304
1272
|
})
|
|
1305
1273
|
}
|
|
1274
|
+
|
|
1275
|
+
/** The label fallback the compatibility facade gives a source without
|
|
1276
|
+
* native priority: exactly one `priority:<level>` label, the highest winning
|
|
1277
|
+
* when several are present, hidden from `labels`, untouched by a labels
|
|
1278
|
+
* replacement, and never touching another label. */
|
|
1279
|
+
async function assertPriorityLabels(harness: TicketSourceContractHarness): Promise<void> {
|
|
1280
|
+
const source = harness.source
|
|
1281
|
+
const facade = compatibleTicketSource(source)
|
|
1282
|
+
expect(facade.priority).toBe(true)
|
|
1283
|
+
const label = await freshLabel(harness, 'priority-labels')
|
|
1284
|
+
const isPriority = (name: string) => name.toLowerCase().startsWith('priority:')
|
|
1285
|
+
const rawPriority = async (id: string) =>
|
|
1286
|
+
(await source.get(id))!.labels.filter(isPriority).map((name) => name.toLowerCase())
|
|
1287
|
+
const viaFacade = { ...harness, source: facade }
|
|
1288
|
+
const created = await createTracked(
|
|
1289
|
+
viaFacade,
|
|
1290
|
+
{
|
|
1291
|
+
title: contractTicketTitle('labelled'),
|
|
1292
|
+
body: CONTRACT_TICKET_BODY,
|
|
1293
|
+
labels: [label],
|
|
1294
|
+
priority: 'high',
|
|
1295
|
+
},
|
|
1296
|
+
{ state: harness.states.ready },
|
|
1297
|
+
)
|
|
1298
|
+
const id = created.ref.id
|
|
1299
|
+
expect(created.priority).toBe('high')
|
|
1300
|
+
expect(created.labels).toEqual([label])
|
|
1301
|
+
expect(await rawPriority(id)).toEqual(['priority:high'])
|
|
1302
|
+
const seen = [(await source.get(id))!.revision]
|
|
1303
|
+
// A second priority label added by hand: the highest level wins.
|
|
1304
|
+
const raw = (await source.get(id))!
|
|
1305
|
+
await source.update(id, { labels: [...raw.labels, 'priority:low'] })
|
|
1306
|
+
expect((await facade.get(id))?.priority).toBe('high')
|
|
1307
|
+
seen.push((await source.get(id))!.revision)
|
|
1308
|
+
// The next priority write leaves exactly one and every other label intact.
|
|
1309
|
+
await facade.update(id, { priority: 'low' })
|
|
1310
|
+
expect(await rawPriority(id)).toEqual(['priority:low'])
|
|
1311
|
+
const low = (await facade.get(id))!
|
|
1312
|
+
expect(low).toMatchObject({ priority: 'low', labels: [label] })
|
|
1313
|
+
expect(seen).not.toContain(low.revision)
|
|
1314
|
+
seen.push(low.revision)
|
|
1315
|
+
// A labels replacement neither adds nor removes priority labels.
|
|
1316
|
+
const other = await freshLabel(harness, 'priority-other')
|
|
1317
|
+
await facade.update(id, { labels: [other] })
|
|
1318
|
+
expect(await rawPriority(id)).toEqual(['priority:low'])
|
|
1319
|
+
expect((await facade.get(id))?.labels).toEqual([other])
|
|
1320
|
+
expect(
|
|
1321
|
+
(await facade.listReady({ state: harness.states.ready })).tickets.find((t) => t.ref.id === id)
|
|
1322
|
+
?.priority,
|
|
1323
|
+
).toBe('low')
|
|
1324
|
+
await facade.update(id, { priority: 'normal' })
|
|
1325
|
+
expect(await rawPriority(id)).toEqual([])
|
|
1326
|
+
const normal = (await facade.get(id))!
|
|
1327
|
+
expect('priority' in normal).toBe(false)
|
|
1328
|
+
expect(normal.labels).toEqual([other])
|
|
1329
|
+
// Labels and criteria naming a priority label are refused before any write.
|
|
1330
|
+
await expect(facade.update(id, { labels: ['priority:high'] })).rejects.toThrow(
|
|
1331
|
+
'stores ticket priority',
|
|
1332
|
+
)
|
|
1333
|
+
await expect(facade.listReady({ labels: ['priority:high'] })).rejects.toThrow(
|
|
1334
|
+
'stores ticket priority',
|
|
1335
|
+
)
|
|
1336
|
+
expect((await source.get(id))?.revision).toBe(normal.revision)
|
|
1337
|
+
if (source.mutateIfRevision) {
|
|
1338
|
+
await expect(
|
|
1339
|
+
facade.mutateIfRevision!(id, low.revision, { kind: 'update', patch: { priority: 'high' } }),
|
|
1340
|
+
).rejects.toBeInstanceOf(TicketRevisionConflict)
|
|
1341
|
+
expect(await rawPriority(id)).toEqual([])
|
|
1342
|
+
await facade.mutateIfRevision!(id, normal.revision, {
|
|
1343
|
+
kind: 'update',
|
|
1344
|
+
patch: { priority: 'urgent' },
|
|
1345
|
+
})
|
|
1346
|
+
expect((await facade.get(id))?.priority).toBe('urgent')
|
|
1347
|
+
}
|
|
1348
|
+
if (source.integrationTree) {
|
|
1349
|
+
const node = await createTracked(
|
|
1350
|
+
viaFacade,
|
|
1351
|
+
{ title: contractTicketTitle('labelled node'), body: CONTRACT_TICKET_BODY, kind: 'node' },
|
|
1352
|
+
{ state: harness.states.ready },
|
|
1353
|
+
)
|
|
1354
|
+
await facade.update(node.ref.id, { priority: 'high' })
|
|
1355
|
+
expect(await facade.get(node.ref.id)).toMatchObject({ kind: 'node', priority: 'high' })
|
|
1356
|
+
// A kind change written beside a priority keeps every other label; only a
|
|
1357
|
+
// source recording kind as a label (`kindLabel`) moves that label with it.
|
|
1358
|
+
const kindLabel = source.kindLabel
|
|
1359
|
+
const work = await createTracked(
|
|
1360
|
+
viaFacade,
|
|
1361
|
+
{ title: contractTicketTitle('labelled work'), body: CONTRACT_TICKET_BODY, labels: [label] },
|
|
1362
|
+
{ state: harness.states.ready },
|
|
1363
|
+
)
|
|
1364
|
+
await facade.update(work.ref.id, { kind: 'node', priority: 'low' })
|
|
1365
|
+
const promoted = (await facade.get(work.ref.id))!
|
|
1366
|
+
expect(promoted).toMatchObject({ kind: 'node', priority: 'low' })
|
|
1367
|
+
expect([...promoted.labels].sort()).toEqual(
|
|
1368
|
+
(kindLabel === undefined ? [label] : [label, kindLabel]).sort(),
|
|
1369
|
+
)
|
|
1370
|
+
await facade.update(work.ref.id, { kind: 'work', priority: 'normal' })
|
|
1371
|
+
const demoted = (await facade.get(work.ref.id))!
|
|
1372
|
+
expect(demoted.kind).toBe('work')
|
|
1373
|
+
expect('priority' in demoted).toBe(false)
|
|
1374
|
+
expect(demoted.labels).toEqual([label])
|
|
1375
|
+
}
|
|
1376
|
+
}
|