From e982bceff0e8f9303049bbcbde7dde5c96db4d05 Mon Sep 17 00:00:00 2001 From: Brian LeRoux Date: Mon, 5 Jan 2026 15:49:33 -0800 Subject: [PATCH 01/10] feat: adds batchsize and fixes visibilitytimeout --- src/visitors/queues/index.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/visitors/queues/index.js b/src/visitors/queues/index.js index 8a07108..fbd8b0a 100644 --- a/src/visitors/queues/index.js +++ b/src/visitors/queues/index.js @@ -10,7 +10,7 @@ module.exports = function visitQueues (inventory, template) { inv.queues.forEach(queue => { let { config } = queue - let { timeout, fifo } = config + let { timeout, fifo, batchSize } = config let name = toLogicalID(queue.name) let queueLambda = `${name}QueueLambda` @@ -36,7 +36,7 @@ module.exports = function visitQueues (inventory, template) { template.Resources[queueQueue] = { Type: 'AWS::SQS::Queue', Properties: { - VisibilityTimeout: timeout, + VisibilityTimeout: timeout * 6, }, } @@ -44,6 +44,9 @@ module.exports = function visitQueues (inventory, template) { if (fifo) { template.Resources[queueQueue].Properties.FifoQueue = fifo template.Resources[queueQueue].Properties.ContentBasedDeduplication = true + + template.Resources[queueLambda].Properties.ReservedConcurrentExecutions = batchSize || 1 + template.Resources[queueLambda].Properties.Events[queueEvent].Properties.BatchSize = 1 } template.Outputs[`${name}SqsQueue`] = { From 8742bbdf6f15fdac0c606747ec1fd35fe82664b8 Mon Sep 17 00:00:00 2001 From: Brian LeRoux Date: Mon, 5 Jan 2026 15:55:56 -0800 Subject: [PATCH 02/10] fix: ensure immediate read / no buffering --- src/visitors/queues/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/visitors/queues/index.js b/src/visitors/queues/index.js index fbd8b0a..8d32d1a 100644 --- a/src/visitors/queues/index.js +++ b/src/visitors/queues/index.js @@ -47,6 +47,7 @@ module.exports = function visitQueues (inventory, template) { template.Resources[queueLambda].Properties.ReservedConcurrentExecutions = batchSize || 1 template.Resources[queueLambda].Properties.Events[queueEvent].Properties.BatchSize = 1 + template.Resources[queueLambda].Properties.Events[queueEvent].Properties.MaximumBatchingWindowInSeconds = 0 } template.Outputs[`${name}SqsQueue`] = { From 08ad9bb7baa0a475f741cdb34ef4fa6cbe8a8111 Mon Sep 17 00:00:00 2001 From: Brian LeRoux Date: Thu, 8 Jan 2026 14:35:03 -0800 Subject: [PATCH 03/10] wip: trying out the inventory rc --- package.json | 3 +- src/visitors/queues/index.js | 2 ++ test/integration/queue-test.js | 66 ++++++++++++++++++++++++++++++++++ 3 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 test/integration/queue-test.js diff --git a/package.json b/package.json index 1c2a808..7b78327 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,7 @@ "lint": "eslint . --fix", "test": "npm run lint && npm run coverage", "test:unit": "node --test 'test/unit/**/*-test.js'", + "test:integration": "node --test 'test/integration/**/*-test.js'", "coverage": "mkdir -p coverage && node --test --experimental-test-coverage --test-reporter=lcov --test-reporter-destination=coverage/lcov.info --test-reporter=spec --test-reporter-destination=stdout 'test/unit/**/*-test.js'", "rc": "npm version prerelease --preid RC" }, @@ -20,7 +21,7 @@ "author": "Brian LeRoux ", "license": "Apache-2.0", "dependencies": { - "@architect/inventory": "~6.0.0", + "@architect/inventory": "~6.1.0-RC.0", "@architect/utils": "~6.0.0" }, "devDependencies": { diff --git a/src/visitors/queues/index.js b/src/visitors/queues/index.js index 8d32d1a..da3b763 100644 --- a/src/visitors/queues/index.js +++ b/src/visitors/queues/index.js @@ -12,6 +12,8 @@ module.exports = function visitQueues (inventory, template) { let { config } = queue let { timeout, fifo, batchSize } = config + console.dir(config, {depth:8}) + let name = toLogicalID(queue.name) let queueLambda = `${name}QueueLambda` let queueEvent = `${name}QueueEvent` diff --git a/test/integration/queue-test.js b/test/integration/queue-test.js new file mode 100644 index 0000000..d652d54 --- /dev/null +++ b/test/integration/queue-test.js @@ -0,0 +1,66 @@ +let { test } = require('node:test') +let { ok } = require('node:assert') + +let inventory = require('@architect/inventory') +let package = require('../../') + +test('Module is present', () => { + ok(package, 'Package module is present') +}) + +test('Can output plausible CloudFormation', async () => { + + let inv = await inventory({ + deployStage: 'staging', + rawArc: ` + @app + myapp + + @queues + test-q`, + }) + + let sam = package(inv) + + // Queue expected defaults + let timeout = sam.Resources.TestQQueueLambda.Properties.Timeout + ok(sam.Resources.TestQQueue.Properties.VisibilityTimeout === timeout * 6) // AWS guidance..a bit magical ? + ok(sam.Resources.TestQQueue.Properties.FifoQueue) + ok(sam.Resources.TestQQueue.Properties.ContentBasedDeduplication) + + // Queue Lambda expected defaults + ok(sam.Resources.TestQQueueLambda.Properties.ReservedConcurrentExecutions === 1) + ok(sam.Resources.TestQQueueLambda.Properties.Events.TestQQueueEvent.Properties.BatchSize === 1) + ok(sam.Resources.TestQQueueLambda.Properties.Events.TestQQueueEvent.Properties.MaximumBatchingWindowInSeconds === 0) +}) + +test('batchSize respected', async () => { + + let inv = await inventory({ + deployStage: 'staging', + rawArc: ` +@app +myapp +@queues +test-q + batchSize 5`, + }) + + let sam = package(inv) + + console.dir(sam, {depth:8}) + /* + // Queue expected defaults + let timeout = sam.Resources.TestQQueueLambda.Properties.Timeout + ok(sam.Resources.TestQQueue.Properties.VisibilityTimeout === timeout*6) // AWS guidance..a bit magical ? + ok(sam.Resources.TestQQueue.Properties.FifoQueue) + ok(sam.Resources.TestQQueue.Properties.ContentBasedDeduplication) + + // Queue Lambda expected defaults + ok(sam.Resources.TestQQueueLambda.Properties.ReservedConcurrentExecutions === 1) + ok(sam.Resources.TestQQueueLambda.Properties.Events.TestQQueueEvent.Properties.BatchSize === 1) + ok(sam.Resources.TestQQueueLambda.Properties.Events.TestQQueueEvent.Properties.MaximumBatchingWindowInSeconds === 0) + */ +}) +// test batchSize param +// test deploy From e6376035d74d01d5a3b168094e2e128c468e7324 Mon Sep 17 00:00:00 2001 From: Brian LeRoux Date: Thu, 8 Jan 2026 15:04:34 -0800 Subject: [PATCH 04/10] fix: batchSize and batchWindow props respected --- src/visitors/queues/index.js | 15 +++++++----- test/integration/queue-test.js | 44 +++++++++++++++++++++++++++------- 2 files changed, 45 insertions(+), 14 deletions(-) diff --git a/src/visitors/queues/index.js b/src/visitors/queues/index.js index da3b763..be7165f 100644 --- a/src/visitors/queues/index.js +++ b/src/visitors/queues/index.js @@ -9,10 +9,7 @@ module.exports = function visitQueues (inventory, template) { if (!inv.queues) return template inv.queues.forEach(queue => { - let { config } = queue - let { timeout, fifo, batchSize } = config - - console.dir(config, {depth:8}) + let { config, batchSize, batchWindow, fifo } = queue let name = toLogicalID(queue.name) let queueLambda = `${name}QueueLambda` @@ -38,8 +35,8 @@ module.exports = function visitQueues (inventory, template) { template.Resources[queueQueue] = { Type: 'AWS::SQS::Queue', Properties: { - VisibilityTimeout: timeout * 6, - }, + VisibilityTimeout: config.timeout + } } // Only add fifo when true; false will cause cfn to fail =/ @@ -50,6 +47,12 @@ module.exports = function visitQueues (inventory, template) { template.Resources[queueLambda].Properties.ReservedConcurrentExecutions = batchSize || 1 template.Resources[queueLambda].Properties.Events[queueEvent].Properties.BatchSize = 1 template.Resources[queueLambda].Properties.Events[queueEvent].Properties.MaximumBatchingWindowInSeconds = 0 + + if (batchWindow) { + // When batchWindow is defined we adjust all the timeouts + template.Resources[queueQueue].Properties.VisibilityTimeout = batchWindow * 6 + template.Resources[queueLambda].Properties.Timeout = batchWindow + } } template.Outputs[`${name}SqsQueue`] = { diff --git a/test/integration/queue-test.js b/test/integration/queue-test.js index d652d54..30f0f66 100644 --- a/test/integration/queue-test.js +++ b/test/integration/queue-test.js @@ -24,7 +24,7 @@ test('Can output plausible CloudFormation', async () => { // Queue expected defaults let timeout = sam.Resources.TestQQueueLambda.Properties.Timeout - ok(sam.Resources.TestQQueue.Properties.VisibilityTimeout === timeout * 6) // AWS guidance..a bit magical ? + ok(sam.Resources.TestQQueue.Properties.VisibilityTimeout === timeout) ok(sam.Resources.TestQQueue.Properties.FifoQueue) ok(sam.Resources.TestQQueue.Properties.ContentBasedDeduplication) @@ -43,24 +43,52 @@ test('batchSize respected', async () => { myapp @queues test-q - batchSize 5`, + batchSize 5` }) let sam = package(inv) - console.dir(sam, {depth:8}) - /* // Queue expected defaults let timeout = sam.Resources.TestQQueueLambda.Properties.Timeout - ok(sam.Resources.TestQQueue.Properties.VisibilityTimeout === timeout*6) // AWS guidance..a bit magical ? + ok(sam.Resources.TestQQueue.Properties.VisibilityTimeout === timeout) ok(sam.Resources.TestQQueue.Properties.FifoQueue) ok(sam.Resources.TestQQueue.Properties.ContentBasedDeduplication) // Queue Lambda expected defaults - ok(sam.Resources.TestQQueueLambda.Properties.ReservedConcurrentExecutions === 1) + ok(sam.Resources.TestQQueueLambda.Properties.ReservedConcurrentExecutions === 5) ok(sam.Resources.TestQQueueLambda.Properties.Events.TestQQueueEvent.Properties.BatchSize === 1) ok(sam.Resources.TestQQueueLambda.Properties.Events.TestQQueueEvent.Properties.MaximumBatchingWindowInSeconds === 0) - */ + }) -// test batchSize param + +test('batchWindow respected', async () => { + + let inv = await inventory({ + deployStage: 'staging', + rawArc: ` +@app +myapp +@queues +test-q + batchSize 5 + batchWindow 30` + }) + + let sam = package(inv) + + let timeout = sam.Resources.TestQQueueLambda.Properties.Timeout + ok(timeout === 30) + + // Queue expected defaults + ok(sam.Resources.TestQQueue.Properties.VisibilityTimeout === timeout * 6) + ok(sam.Resources.TestQQueue.Properties.FifoQueue) + ok(sam.Resources.TestQQueue.Properties.ContentBasedDeduplication) + + // Queue Lambda expected defaults + ok(sam.Resources.TestQQueueLambda.Properties.ReservedConcurrentExecutions === 5) + ok(sam.Resources.TestQQueueLambda.Properties.Events.TestQQueueEvent.Properties.BatchSize === 1) + ok(sam.Resources.TestQQueueLambda.Properties.Events.TestQQueueEvent.Properties.MaximumBatchingWindowInSeconds === 0) + +}) + // test deploy From 45ee13e6b92770bb5288568b556af532c24aac92 Mon Sep 17 00:00:00 2001 From: Brian LeRoux Date: Thu, 15 Jan 2026 09:57:04 -0800 Subject: [PATCH 05/10] wip: updated inventory / need to test manually to verify/ --- package.json | 6 +++--- src/visitors/queues/index.js | 4 ++-- test/integration/queue-test.js | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 7b78327..c069020 100644 --- a/package.json +++ b/package.json @@ -21,13 +21,13 @@ "author": "Brian LeRoux ", "license": "Apache-2.0", "dependencies": { - "@architect/inventory": "~6.1.0-RC.0", - "@architect/utils": "~6.0.0" + "@architect/inventory": "~6.1.0", + "@architect/utils": "~6.0.3" }, "devDependencies": { "@architect/eslint-config": "~3.0.0", "@aws-lite/client": "~0.23.2", "@aws-lite/s3": "~0.2.6", - "eslint": "~9.36.0" + "eslint": "~9.39.2" } } diff --git a/src/visitors/queues/index.js b/src/visitors/queues/index.js index be7165f..1660da1 100644 --- a/src/visitors/queues/index.js +++ b/src/visitors/queues/index.js @@ -35,8 +35,8 @@ module.exports = function visitQueues (inventory, template) { template.Resources[queueQueue] = { Type: 'AWS::SQS::Queue', Properties: { - VisibilityTimeout: config.timeout - } + VisibilityTimeout: config.timeout, + }, } // Only add fifo when true; false will cause cfn to fail =/ diff --git a/test/integration/queue-test.js b/test/integration/queue-test.js index 30f0f66..b3c7d5a 100644 --- a/test/integration/queue-test.js +++ b/test/integration/queue-test.js @@ -43,7 +43,7 @@ test('batchSize respected', async () => { myapp @queues test-q - batchSize 5` + batchSize 5`, }) let sam = package(inv) @@ -71,7 +71,7 @@ myapp @queues test-q batchSize 5 - batchWindow 30` + batchWindow 30`, }) let sam = package(inv) From 8b93ac0dcb96edc7b8bc728c68536b9ac03c1855 Mon Sep 17 00:00:00 2001 From: Brian LeRoux Date: Thu, 15 Jan 2026 11:30:46 -0800 Subject: [PATCH 06/10] 11.0.2-RC.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c069020..46032ea 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@architect/package", - "version": "11.0.1", + "version": "11.0.2-RC.0", "description": "Package .arc for deployment with CloudFormation", "main": "src/index.js", "scripts": { From 9e959b0914c47541e885b0a622f6b43722f18ec4 Mon Sep 17 00:00:00 2001 From: Brian LeRoux Date: Thu, 15 Jan 2026 12:04:53 -0800 Subject: [PATCH 07/10] fix: ensure original fifo behaviour after changes --- src/visitors/queues/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/visitors/queues/index.js b/src/visitors/queues/index.js index 1660da1..bf15d48 100644 --- a/src/visitors/queues/index.js +++ b/src/visitors/queues/index.js @@ -11,6 +11,9 @@ module.exports = function visitQueues (inventory, template) { inv.queues.forEach(queue => { let { config, batchSize, batchWindow, fifo } = queue + // for backwards compat; if fifo isn't on the queue itself it could be within the config + if (!fifo) fifo = config.fifo + let name = toLogicalID(queue.name) let queueLambda = `${name}QueueLambda` let queueEvent = `${name}QueueEvent` From 73428c5b13a3c991433c67f93cca4bdda041781f Mon Sep 17 00:00:00 2001 From: Brian LeRoux Date: Thu, 15 Jan 2026 12:05:01 -0800 Subject: [PATCH 08/10] 11.0.3-RC.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 46032ea..2309856 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@architect/package", - "version": "11.0.2-RC.0", + "version": "11.0.3-RC.0", "description": "Package .arc for deployment with CloudFormation", "main": "src/index.js", "scripts": { From 0a13787a2875e62765b842b58a2d22921bff9c8f Mon Sep 17 00:00:00 2001 From: Brian LeRoux Date: Mon, 19 Jan 2026 15:32:07 -0800 Subject: [PATCH 09/10] fix: updates changelog --- changelog.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/changelog.md b/changelog.md index ec964bd..4877cbe 100644 --- a/changelog.md +++ b/changelog.md @@ -2,6 +2,11 @@ --- +## [11.0.3] 2026-01-19 + +- Queue now accepts `batchSize` and `batchWindow` properties; only works with `fifo true` +- Queue can now directly configure `fifo true|false` explicitly (default is `true`) + ## [11.0.0 - 11.0.1] 2025-11-28 - updated to >= node22 From 5317c2a1fee6c51159e03a120451aef53e6127d4 Mon Sep 17 00:00:00 2001 From: Brian LeRoux Date: Mon, 19 Jan 2026 15:32:25 -0800 Subject: [PATCH 10/10] 11.0.3 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2309856..d6b7345 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@architect/package", - "version": "11.0.3-RC.0", + "version": "11.0.3", "description": "Package .arc for deployment with CloudFormation", "main": "src/index.js", "scripts": {