From c77963afccdd1a4fcbc0babfb3887f1c69d81404 Mon Sep 17 00:00:00 2001 From: PIERLUIGI VITI Date: Thu, 15 Oct 2026 17:31:32 +0200 Subject: [PATCH 1/2] ci(publish): slack says who triggered the release, as before Co-Authored-By: Claude Opus 5.5 --- .github/workflows/publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 5b45465d..390d186a 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -204,7 +204,7 @@ jobs: }, { "type": "mrkdwn", - "text": "*${{ github.event.sender.login }}* has merged this release." + "text": "*${{ github.event.sender.login }}* has triggered this release." } ] } From c47ae738012d5cfae10ac6734b3518b14aa601e3 Mon Sep 17 00:00:00 2001 From: PIERLUIGI VITI Date: Tue, 20 Oct 2026 10:54:47 +0200 Subject: [PATCH 2/2] test(tags): wait for the api to list a renamed or deleted tag The nightly integration run of 2026-10-20 failed on "renames the tag": the tag was renamed (the next test deleted it by its new name), but the lookup right after the command still listed the previous state. The live suites get liveEventually, which repeats a lookup until it gives the expected value (20 seconds at most); the tags suite uses it after create, rename and delete. Co-Authored-By: Claude Opus 5.5 --- packages/test-utils/src/index.ts | 1 + packages/test-utils/src/live.ts | 16 ++++++++++++++++ plugins/tags/test/integration/tags-write.it.ts | 13 ++++++++----- 3 files changed, 25 insertions(+), 5 deletions(-) diff --git a/packages/test-utils/src/index.ts b/packages/test-utils/src/index.ts index 0ac44f46..0def1ec0 100644 --- a/packages/test-utils/src/index.ts +++ b/packages/test-utils/src/index.ts @@ -92,6 +92,7 @@ export { liveAuth, liveCreate, liveDelete, + liveEventually, liveFirst, liveName, liveRequest, diff --git a/packages/test-utils/src/live.ts b/packages/test-utils/src/live.ts index a41b6408..bddd8ebd 100644 --- a/packages/test-utils/src/live.ts +++ b/packages/test-utils/src/live.ts @@ -56,6 +56,22 @@ export const liveFirst = async (type: string, query: Record = {} return body.data?.[0]?.id } +/** + * The value of a lookup once it satisfies a condition: the API lists a change + * (a renamed or deleted resource) a moment after the write that made it, so a + * lookup right after a command may still see the previous state. Returns the + * last value when the time is up, for the test's own assertion to report. + */ +export const liveEventually = async (lookup: () => Promise, done: (value: T) => boolean, timeout = 20_000, interval = 1000): Promise => { + const until = Date.now() + timeout + let value = await lookup() + while (!done(value) && Date.now() < until) { + await new Promise((resolve) => setTimeout(resolve, interval)) + value = await lookup() + } + return value +} + /** * A describe block that runs only with the test organization's credentials, * with a timeout fit for real API calls. diff --git a/plugins/tags/test/integration/tags-write.it.ts b/plugins/tags/test/integration/tags-write.it.ts index 9ed936fb..59cd5456 100644 --- a/plugins/tags/test/integration/tags-write.it.ts +++ b/plugins/tags/test/integration/tags-write.it.ts @@ -1,4 +1,4 @@ -import { describeLive, LIVE_RUN, liveAuth, liveCreate, liveDelete, liveFirst, liveName } from '@commercelayer/cli-test-utils' +import { describeLive, LIVE_RUN, liveAuth, liveCreate, liveDelete, liveEventually, liveFirst, liveName } from '@commercelayer/cli-test-utils' import { runCommand } from '@oclif/test' import { expect } from 'chai' @@ -9,6 +9,9 @@ const run = async (args: string[]): Promise => { } const tagId = (name: string) => liveFirst('tags', { 'filter[q][name_eq]': name }) +// The API lists a created, renamed or deleted tag a moment after the command +const tagListed = (name: string) => liveEventually(() => tagId(name), (id) => id !== undefined) +const tagGone = (name: string) => liveEventually(() => tagId(name), (id) => id === undefined) // A tag of this run on a customer of this run describeLive('tags: create, add, remove, update and delete', () => { @@ -26,7 +29,7 @@ describeLive('tags: create, add, remove, update and delete', () => { it('creates a tag', async () => { await run(['tags:create', '-n', name]) - expect(await tagId(name)).to.be.a('string') + expect(await tagListed(name)).to.be.a('string') }) it('tags a resource and finds it', async () => { @@ -41,12 +44,12 @@ describeLive('tags: create, add, remove, update and delete', () => { it('renames the tag', async () => { await run(['tags:update', name, '-n', renamed]) - expect(await tagId(renamed)).to.be.a('string') - expect(await tagId(name)).to.equal(undefined) + expect(await tagListed(renamed)).to.be.a('string') + expect(await tagGone(name)).to.equal(undefined) }) it('deletes the tag', async () => { await run(['tags:delete', '-n', renamed]) - expect(await tagId(renamed)).to.equal(undefined) + expect(await tagGone(renamed)).to.equal(undefined) }) })