@defrex/autobuild 1.12.0 → 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 +435 -160
- package/bin/ab-build-runner.ts +8 -0
- package/docs/answering-blocked-builds.md +25 -3
- package/docs/architecture.md +124 -53
- package/docs/cli.md +1 -1
- package/docs/configuration.md +110 -15
- package/docs/dispatcher.md +19 -8
- package/docs/integration-overview.md +1 -1
- package/docs/integration-tree.md +12 -9
- package/docs/merge-policy.md +7 -2
- package/docs/operating.md +5 -3
- package/docs/operator-api.md +46 -23
- package/docs/operator-surfaces.md +7 -6
- package/docs/optimization-nodes.md +7 -6
- 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/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 +14 -8
- package/packages/core/src/cli/dashboard/poll.ts +218 -10
- package/packages/core/src/cli/dashboard/queue.ts +21 -10
- package/packages/core/src/cli/dashboard/row-text.ts +2 -1
- package/packages/core/src/cli/dashboard/vocabulary.ts +5 -1
- package/packages/core/src/cli/dispatch-frontend.ts +2 -1
- package/packages/core/src/cli/dispatch-tickets.ts +33 -12
- package/packages/core/src/cli/dispatch.ts +527 -144
- package/packages/core/src/cli/help.ts +38 -24
- package/packages/core/src/cli/main.ts +7 -5
- 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/repository-status.ts +19 -9
- package/packages/core/src/cli/status.ts +23 -11
- package/packages/core/src/cli/store-opening.ts +12 -0
- 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/events/payloads.ts +74 -14
- package/packages/core/src/events/repository.ts +14 -3
- package/packages/core/src/kernel/__snapshots__/reducer-accumulator-shapes.json +27 -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/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/c7c94fbe7f63cf07.json +84 -0
- package/packages/core/src/kernel/clean-restack-policy.ts +40 -0
- package/packages/core/src/kernel/dispatch-capacity.ts +243 -107
- package/packages/core/src/kernel/done-escalations.ts +269 -0
- package/packages/core/src/kernel/engine.ts +28 -9
- 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/open-pr-backpressure.ts +3 -3
- package/packages/core/src/kernel/reducer-registry.ts +3 -0
- package/packages/core/src/kernel/reducer-revisions.ts +15 -0
- package/packages/core/src/kernel/reducer.ts +27 -7
- package/packages/core/src/kernel/repository-attention.ts +14 -5
- package/packages/core/src/kernel/ticket-starts.ts +15 -4
- 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 +1 -1
- package/packages/core/src/operator/protocol.ts +8 -5
- package/packages/core/src/operator/query.ts +33 -19
- package/packages/core/src/operator/registry.ts +17 -13
- 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/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 +544 -212
- 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/reduced-reads.ts +23 -0
- package/packages/core/src/store/reducer-value-shapes.json +6628 -6469
- package/packages/core/src/store/reducer-value-validation.ts +181 -33
- 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 +11 -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 +18 -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/testing/dispatch-read-budget.ts +144 -10
- 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 +381 -18
- package/packages/core/src/testing/released-value-coverage.ts +423 -0
- package/packages/core/src/web/overview-source.ts +19 -6
- package/skills/guide/SKILL.md +138 -67
- package/skills/guide/references/integration-tree.md +12 -9
- package/skills/guide/references/merge-policy.md +7 -2
- package/skills/guide/references/operator-api.md +46 -23
- package/skills/guide/references/optimization-nodes.md +7 -6
- 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 +82 -51
- 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
|
@@ -11,6 +11,8 @@ import { DISPATCHER, humanActor, KERNEL } from '../events/envelope'
|
|
|
11
11
|
import { WebModelHub } from '../web/hub'
|
|
12
12
|
import { readOnlyStore } from '../web/read-only'
|
|
13
13
|
import { OverviewFrameSource } from '../web/overview-source'
|
|
14
|
+
import { DashboardBuildPollCache, type DashboardPollSnapshot } from '../cli/dashboard/poll'
|
|
15
|
+
import { configSchema } from '../config/schema'
|
|
14
16
|
import { projectRepositoryFrame } from '../web/repository-source'
|
|
15
17
|
import { finishedOutcomeText } from '../cli/dashboard/vocabulary'
|
|
16
18
|
import { measureStoreReads } from './reduced-read-budget'
|
|
@@ -967,12 +969,16 @@ const OVERVIEW_BUDGET_CONFIG = {
|
|
|
967
969
|
|
|
968
970
|
/**
|
|
969
971
|
* `ab web`'s overview costs the same at 100 and 100,000 builds (5 live, the
|
|
970
|
-
* rest finished
|
|
971
|
-
*
|
|
972
|
-
*
|
|
973
|
-
*
|
|
974
|
-
*
|
|
975
|
-
*
|
|
972
|
+
* rest finished, one finished long ago with an open escalation): a fresh
|
|
973
|
+
* process reads the `buildRoster` and `doneEscalations` rollups and only the
|
|
974
|
+
* live and escalated builds; an idle poll reads the change position; a change
|
|
975
|
+
* to one build reads that build only, plus one roster read when the build
|
|
976
|
+
* starts or finishes, including one created and finished between two polls,
|
|
977
|
+
* or is acknowledged; and no read scans history. The terminal dashboard's
|
|
978
|
+
* poll cache then measures the same repositories: cold start, idle refresh,
|
|
979
|
+
* one live change and an acknowledgement each cost the same at both sizes and
|
|
980
|
+
* never list builds or read events (#1372). Row metrics need a memory
|
|
981
|
+
* backing, so other backings skip it.
|
|
976
982
|
*/
|
|
977
983
|
async function webOverviewReadBudget(store: BuildStore, backing: BuildStore): Promise<void> {
|
|
978
984
|
const { MemoryBuildStore } = await import('../store/memory')
|
|
@@ -1009,6 +1015,27 @@ async function webOverviewReadBudget(store: BuildStore, backing: BuildStore): Pr
|
|
|
1009
1015
|
} else await complete(slug)
|
|
1010
1016
|
}
|
|
1011
1017
|
for (let i = 0; i < 5; i++) await create(live(i))
|
|
1018
|
+
// A post-completion escalation on a build far older than the roster's
|
|
1019
|
+
// newest finished entries.
|
|
1020
|
+
const escalated = `${prefix}done-000000`
|
|
1021
|
+
const raise = (slug: string) =>
|
|
1022
|
+
backing.append(slug, {
|
|
1023
|
+
actor: KERNEL,
|
|
1024
|
+
type: 'escalation.raised',
|
|
1025
|
+
payload: {
|
|
1026
|
+
id: 'integration-audit-op',
|
|
1027
|
+
phase: 'verify:integration',
|
|
1028
|
+
source: 'agent',
|
|
1029
|
+
question: 'Integration result requires attention',
|
|
1030
|
+
},
|
|
1031
|
+
})
|
|
1032
|
+
const acknowledge = (slug: string) =>
|
|
1033
|
+
backing.append(slug, {
|
|
1034
|
+
actor: humanActor('op'),
|
|
1035
|
+
type: 'escalation.answered',
|
|
1036
|
+
payload: { id: 'integration-audit-op', answer: 'ack', resolution: 'retry' },
|
|
1037
|
+
})
|
|
1038
|
+
await raise(escalated)
|
|
1012
1039
|
const config = await backing.putRepoArtifact(repo, {
|
|
1013
1040
|
kind: 'config',
|
|
1014
1041
|
content: JSON.stringify(OVERVIEW_BUDGET_CONFIG),
|
|
@@ -1026,7 +1053,9 @@ async function webOverviewReadBudget(store: BuildStore, backing: BuildStore): Pr
|
|
|
1026
1053
|
// The canonical materializations happen once, before any measured read.
|
|
1027
1054
|
await readRepositoryFacts(store, repo)
|
|
1028
1055
|
await store.getReducerValue({ kind: 'rollup', repo }, { reducer: 'buildRoster' })
|
|
1056
|
+
await store.getReducerValue({ kind: 'rollup', repo }, { reducer: 'doneEscalations' })
|
|
1029
1057
|
for (let i = 0; i < 5; i++) await readBuildFacts(store, live(i))
|
|
1058
|
+
await readBuildFacts(store, escalated)
|
|
1030
1059
|
|
|
1031
1060
|
const counter = countingStore(store, { slugs: true })
|
|
1032
1061
|
// A fresh process: no state but the saved values.
|
|
@@ -1068,13 +1097,18 @@ async function webOverviewReadBudget(store: BuildStore, backing: BuildStore): Pr
|
|
|
1068
1097
|
const named = (calls: Record<string, number>, slug: string) =>
|
|
1069
1098
|
Object.keys(buildScope(calls)).every((name) => name.endsWith(`:${slug.replace(prefix, '')}`))
|
|
1070
1099
|
|
|
1071
|
-
// (a) The first read:
|
|
1100
|
+
// (a) The first read: both rollups, the five live builds and the
|
|
1101
|
+
// escalated done build.
|
|
1072
1102
|
const first = await measure('first')
|
|
1073
|
-
expect(first.calls['getReducerValue:rollup']).toBe(
|
|
1074
|
-
expect(buildScope(first.calls)).toEqual(reads(...[0, 1, 2, 3, 4].map(live)))
|
|
1103
|
+
expect(first.calls['getReducerValue:rollup']).toBe(2)
|
|
1104
|
+
expect(buildScope(first.calls)).toEqual(reads(...[0, 1, 2, 3, 4].map(live), escalated))
|
|
1075
1105
|
expect(first.rows).toBe(0)
|
|
1076
1106
|
expect(first.repoRows).toBe(0)
|
|
1077
|
-
expect(frame.overview!.active.length + frame.overview!.queued.length).toBe(
|
|
1107
|
+
expect(frame.overview!.active.length + frame.overview!.queued.length).toBe(6)
|
|
1108
|
+
expect(frame.overview!.active.find((row) => row.slug === escalated)?.status).toMatchObject({
|
|
1109
|
+
word: 'BLOCKED',
|
|
1110
|
+
note: 'done',
|
|
1111
|
+
})
|
|
1078
1112
|
expect(frame.overview!.finished).toHaveLength(10)
|
|
1079
1113
|
|
|
1080
1114
|
// (b) Idle: the change position only.
|
|
@@ -1131,11 +1165,58 @@ async function webOverviewReadBudget(store: BuildStore, backing: BuildStore): Pr
|
|
|
1131
1165
|
word: finishedOutcomeText('merged').word,
|
|
1132
1166
|
})
|
|
1133
1167
|
expect(shown()).not.toContain(blinked)
|
|
1168
|
+
|
|
1169
|
+
// (g) Acknowledging the escalation: that build's reads, and it leaves.
|
|
1170
|
+
await acknowledge(escalated)
|
|
1171
|
+
const acknowledged = await measure('acknowledged')
|
|
1172
|
+
expect(named(acknowledged.calls, escalated)).toBe(true)
|
|
1173
|
+
expect(shown()).not.toContain(escalated)
|
|
1134
1174
|
expect(await measure('after')).toEqual({
|
|
1135
1175
|
calls: { getRepoChangePosition: 1 },
|
|
1136
1176
|
rows: 0,
|
|
1137
1177
|
repoRows: 0,
|
|
1138
1178
|
})
|
|
1179
|
+
|
|
1180
|
+
// The terminal dashboard over the same repository, as a fresh process.
|
|
1181
|
+
const terminalEscalated = `${prefix}done-000004`
|
|
1182
|
+
await raise(terminalEscalated)
|
|
1183
|
+
const terminalConfig = configSchema.parse(OVERVIEW_BUDGET_CONFIG)
|
|
1184
|
+
// Warm-up: an earlier process saved every value the cold start reads.
|
|
1185
|
+
await new DashboardBuildPollCache(store, repo, terminalConfig).refresh()
|
|
1186
|
+
const terminalCounter = countingStore(store, { slugs: true })
|
|
1187
|
+
const cache = new DashboardBuildPollCache(terminalCounter.proxy, repo, terminalConfig)
|
|
1188
|
+
let snapshot!: DashboardPollSnapshot
|
|
1189
|
+
const refresh = async (phase: string) => {
|
|
1190
|
+
terminalCounter.calls.length = 0
|
|
1191
|
+
const metrics = await measureStoreReads(backing, async () => {
|
|
1192
|
+
snapshot = await cache.refresh()
|
|
1193
|
+
})
|
|
1194
|
+
for (const name of terminalCounter.calls) expect(HISTORY_READS.has(name)).toBe(false)
|
|
1195
|
+
const calls = Object.fromEntries(
|
|
1196
|
+
Object.entries(terminalCounter.histogram()).map(([name, count]) => [
|
|
1197
|
+
name.replaceAll(prefix, ''),
|
|
1198
|
+
count,
|
|
1199
|
+
]),
|
|
1200
|
+
)
|
|
1201
|
+
phases[`terminal-${phase}`] = { calls, rows: metrics.rows, repoRows: metrics.repoRows }
|
|
1202
|
+
return phases[`terminal-${phase}`]!
|
|
1203
|
+
}
|
|
1204
|
+
const visible = () => snapshot.builds.map((build) => build.slug)
|
|
1205
|
+
const holding = () => (snapshot.capacityBuilds ?? []).map((build) => build.record.slug)
|
|
1206
|
+
const cold = await refresh('cold')
|
|
1207
|
+
expect(cold.rows).toBe(0)
|
|
1208
|
+
expect(visible()).toContain(terminalEscalated)
|
|
1209
|
+
expect(holding()).not.toContain(terminalEscalated)
|
|
1210
|
+
expect(await refresh('idle')).toEqual({
|
|
1211
|
+
calls: { listBuildsChangedSince: 1 },
|
|
1212
|
+
rows: 0,
|
|
1213
|
+
repoRows: 0,
|
|
1214
|
+
})
|
|
1215
|
+
await backing.append(live(2), { actor: KERNEL, type: 'plan.started', payload: { round: 1 } })
|
|
1216
|
+
expect(named((await refresh('change')).calls, live(2))).toBe(true)
|
|
1217
|
+
await acknowledge(terminalEscalated)
|
|
1218
|
+
expect(named((await refresh('acknowledged')).calls, terminalEscalated)).toBe(true)
|
|
1219
|
+
expect(visible()).not.toContain(terminalEscalated)
|
|
1139
1220
|
results[n] = phases
|
|
1140
1221
|
}
|
|
1141
1222
|
expect(results[100_000]).toEqual(results[100]!)
|
|
@@ -2410,6 +2491,59 @@ export async function githubTicketSearchRequestBudget(
|
|
|
2410
2491
|
expect(sequences[1]).toEqual(sequences[0]!)
|
|
2411
2492
|
}
|
|
2412
2493
|
|
|
2494
|
+
export interface TicketPriorityLabelFixture {
|
|
2495
|
+
/** A raw source without native priority. */
|
|
2496
|
+
source: TicketSource
|
|
2497
|
+
/** The ready criteria dispatch lists with. */
|
|
2498
|
+
criteria: import('../ports/types').TicketCriteria
|
|
2499
|
+
/** A seeded ready ticket carrying the `priority:high` label. */
|
|
2500
|
+
highId: string
|
|
2501
|
+
reset(): void
|
|
2502
|
+
/** Provider requests since the last reset, in order. */
|
|
2503
|
+
requests(): string[]
|
|
2504
|
+
}
|
|
2505
|
+
|
|
2506
|
+
/** The label fallback reads priority from data a read already returned: for
|
|
2507
|
+
* every recurring read the raw source offers, at 1 and 100 tickets, the
|
|
2508
|
+
* facade issues exactly the raw source's request sequence (none when the raw
|
|
2509
|
+
* read issues none), so it adds zero requests whatever the raw read costs. A
|
|
2510
|
+
* seeded `priority:high` label reads as `high` and never appears among
|
|
2511
|
+
* `labels`. */
|
|
2512
|
+
export async function ticketPriorityLabelReadBudget(
|
|
2513
|
+
fixture: (population: number) => Promise<TicketPriorityLabelFixture>,
|
|
2514
|
+
): Promise<void> {
|
|
2515
|
+
const { compatibleTicketSource } = await import('../ports/tickets/tree')
|
|
2516
|
+
for (const population of [1, 100]) {
|
|
2517
|
+
const { source, criteria, highId, reset, requests } = await fixture(population)
|
|
2518
|
+
expect(source.priority).toBeFalsy()
|
|
2519
|
+
const facade = compatibleTicketSource(source)
|
|
2520
|
+
expect(facade.priority).toBe(true)
|
|
2521
|
+
const reads: Array<[string, (from: TicketSource) => Promise<unknown>]> = [
|
|
2522
|
+
['listReady', (from) => from.listReady(criteria)],
|
|
2523
|
+
['get', (from) => from.get(highId)],
|
|
2524
|
+
['dependencyStates', (from) => from.dependencyStates([highId])],
|
|
2525
|
+
]
|
|
2526
|
+
if (source.listAll) reads.push(['listAll', (from) => from.listAll!()])
|
|
2527
|
+
if (source.listPage) reads.push(['listPage', (from) => from.listPage!(criteria, { limit: 10 })])
|
|
2528
|
+
for (const [name, read] of reads) {
|
|
2529
|
+
await read(source)
|
|
2530
|
+
reset()
|
|
2531
|
+
await read(source)
|
|
2532
|
+
const raw = requests()
|
|
2533
|
+
reset()
|
|
2534
|
+
await read(facade)
|
|
2535
|
+
expect({ name, requests: requests() }).toEqual({ name, requests: raw })
|
|
2536
|
+
}
|
|
2537
|
+
const high = await facade.get(highId)
|
|
2538
|
+
expect(high?.priority).toBe('high')
|
|
2539
|
+
expect(high?.labels.some((label) => label.toLowerCase().startsWith('priority:'))).toBe(false)
|
|
2540
|
+
const ready = (await facade.listReady(criteria)).tickets.find(
|
|
2541
|
+
(ticket) => ticket.ref.id === highId,
|
|
2542
|
+
)
|
|
2543
|
+
expect(ready?.priority).toBe('high')
|
|
2544
|
+
}
|
|
2545
|
+
}
|
|
2546
|
+
|
|
2413
2547
|
/** Builds one dispatcher pass's observation inputs for a node build over a
|
|
2414
2548
|
* fresh memory store, reporting which listing path the source decided on
|
|
2415
2549
|
* before the pass; `observe` then observes the node with those inputs. */
|
|
@@ -74,11 +74,13 @@ export {
|
|
|
74
74
|
targetedCompletenessParity,
|
|
75
75
|
ticketListReadBudget,
|
|
76
76
|
ticketPageReadBudget,
|
|
77
|
+
ticketPriorityLabelReadBudget,
|
|
77
78
|
ticketSearchReadBudget,
|
|
78
79
|
ticketSearchRequestBudget,
|
|
79
80
|
ticketSearchRows,
|
|
80
81
|
ticketTargetingReadBudget,
|
|
81
82
|
type TicketPageFixture,
|
|
83
|
+
type TicketPriorityLabelFixture,
|
|
82
84
|
type TicketSearchFixture,
|
|
83
85
|
type TicketSearchRequestFixture,
|
|
84
86
|
type TicketSearchRow,
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { PluginFactoryContext } from '../plugins/manifest'
|
|
2
|
+
import { InvocationDeadlineError, withInvocationSignal } from '../processes/invocation-budget'
|
|
3
|
+
|
|
4
|
+
/** A base fetch whose every request stalls until its signal aborts, recording
|
|
5
|
+
* the signal each request carried. No network, no timers. */
|
|
6
|
+
export function stallingFetch(): { base: typeof fetch; signals: (AbortSignal | undefined)[] } {
|
|
7
|
+
const signals: (AbortSignal | undefined)[] = []
|
|
8
|
+
const base = ((_input: unknown, init?: RequestInit) => {
|
|
9
|
+
const signal = init?.signal ?? undefined
|
|
10
|
+
signals.push(signal)
|
|
11
|
+
return new Promise<Response>((_, reject) =>
|
|
12
|
+
signal?.addEventListener('abort', () => reject(signal.reason), { once: true }),
|
|
13
|
+
)
|
|
14
|
+
}) as unknown as typeof fetch
|
|
15
|
+
return { base, signals }
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/** Drive a cooperative plugin through the plugin API 1.12 factory context:
|
|
19
|
+
* inside a work phase it reads `invocationSignal()` and fetches through the
|
|
20
|
+
* host `fetch`; the phase then hits its deadline. Returns what the plugin
|
|
21
|
+
* observed so each port's test can assert the contract. */
|
|
22
|
+
export async function cancelCooperativePluginCall(
|
|
23
|
+
context: PluginFactoryContext,
|
|
24
|
+
signals: (AbortSignal | undefined)[],
|
|
25
|
+
): Promise<{
|
|
26
|
+
seen: AbortSignal | undefined
|
|
27
|
+
requestSignal: AbortSignal | undefined
|
|
28
|
+
error: unknown
|
|
29
|
+
}> {
|
|
30
|
+
const work = new AbortController()
|
|
31
|
+
let seen: AbortSignal | undefined
|
|
32
|
+
const call = withInvocationSignal(work.signal, async () => {
|
|
33
|
+
seen = context.invocationSignal?.()
|
|
34
|
+
return context.fetch!('https://provider.plugin.test/call')
|
|
35
|
+
})
|
|
36
|
+
work.abort(new InvocationDeadlineError('work'))
|
|
37
|
+
const error = await call.then(
|
|
38
|
+
() => undefined,
|
|
39
|
+
(rejection: unknown) => rejection,
|
|
40
|
+
)
|
|
41
|
+
return { seen, requestSignal: signals.at(-1), error }
|
|
42
|
+
}
|