Skip to content

Commit 491fc2d

Browse files
authored
Merge pull request #90 from superluminar-io/feat/chatbot-integration
Feat/chatbot integration
2 parents 07eb512 + 61b6853 commit 491fc2d

37 files changed

+11009
-333
lines changed

β€Ž.github/dependabot.ymlβ€Ž

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,19 @@
55

66
version: 2
77
updates:
8-
- package-ecosystem: "npm" # See documentation for possible values
9-
directory: "/" # Location of package manifests
8+
- package-ecosystem: 'npm' # See documentation for possible values
9+
directory: '/' # Location of package manifests
1010
schedule:
11-
interval: "weekly"
11+
interval: 'weekly'
1212
groups:
1313
all-npm-dependencies:
1414
patterns:
15-
- "*"
16-
- package-ecosystem: "github-actions"
17-
directory: "/"
15+
- '*'
16+
- package-ecosystem: 'github-actions'
17+
directory: '/'
1818
schedule:
19-
interval: "weekly"
19+
interval: 'weekly'
2020
groups:
2121
all-actions:
2222
patterns:
23-
- "*"
23+
- '*'

β€Ž.github/workflows/lint-and-test.ymlβ€Ž

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,3 @@ jobs:
4949
🚦 **Test run complete**
5050
- Status: ${{ job.status }}
5151
- Commit: `${{ github.sha }}`
52-

β€Ž.github/workflows/publish-on-tag.ymlβ€Ž

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,23 @@ jobs:
1616
publish:
1717
runs-on: ubuntu-latest
1818
permissions:
19-
contents: write # create GitHub Release
20-
id-token: write # npm provenance (optional but recommended)
21-
actions: write # softprops/action-gh-release
19+
contents: write # create GitHub Release
20+
id-token: write # npm provenance (optional but recommended)
21+
actions: write # softprops/action-gh-release
2222
steps:
2323
- name: Checkout tag
2424
uses: actions/checkout@v6
2525
with:
2626
fetch-depth: 0
27-
ref: "refs/tags/${{ github.event.inputs.version }}"
27+
ref: 'refs/tags/${{ github.event.inputs.version }}'
2828

2929
- name: Setup Node
3030
uses: actions/setup-node@v6
3131
with:
32-
node-version: "24"
33-
registry-url: "https://registry.npmjs.org"
32+
node-version: '24'
33+
registry-url: 'https://registry.npmjs.org'
3434
cache: npm
35-
35+
3636
- name: Update npm
3737
run: npm install -g npm@latest
3838

@@ -45,7 +45,7 @@ jobs:
4545
- name: Test
4646
run: npm test
4747

48-
- name: "Sanity check: tag matches package.json version"
48+
- name: 'Sanity check: tag matches package.json version'
4949
run: |
5050
set -euo pipefail
5151
VERSION="$(node -p "require('./package.json').version")"
@@ -69,6 +69,5 @@ jobs:
6969
- name: Create GitHub Release
7070
uses: softprops/action-gh-release@v2
7171
with:
72-
tag_name: "v${{ github.event.inputs.version }}"
72+
tag_name: 'v${{ github.event.inputs.version }}'
7373
generate_release_notes: true
74-

β€Ž.github/workflows/release-pr.ymlβ€Ž

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
workflow_dispatch:
55
inputs:
66
bump:
7-
description: "Version bump type"
7+
description: 'Version bump type'
88
type: choice
99
required: true
1010
options: [patch, minor, major]
@@ -28,7 +28,7 @@ jobs:
2828

2929
- uses: actions/setup-node@v6
3030
with:
31-
node-version: "24"
31+
node-version: '24'
3232
cache: npm
3333

3434
- name: Configure git
@@ -50,12 +50,11 @@ jobs:
5050
token: ${{ secrets.GITHUB_TOKEN }}
5151
branch: release/v${{ steps.bump.outputs.version }}
5252
base: main
53-
title: "chore(release): v${{ steps.bump.outputs.version }}"
53+
title: 'chore(release): v${{ steps.bump.outputs.version }}'
5454
body: |
5555
Automated release PR.
5656
5757
- Bump: `${{ inputs.bump }}`
5858
- Version: `v${{ steps.bump.outputs.version }}`
5959
labels: release
6060
draft: always-true
61-

β€Ž.github/workflows/tag-on-main.ymlβ€Ž

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ jobs:
5252
git push origin "$TAG"
5353
echo "created=true" >> "$GITHUB_OUTPUT"
5454
55-
5655
- name: Invoke workflow without inputs
5756
uses: benc-uk/workflow-dispatch@v1
5857
if: steps.tag.outputs.created == 'true'

β€ŽAGENTS.mdβ€Ž

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# AGENTS.md - Updates and Operations Log
2+
3+
## Updates Performed:
4+
5+
- **Inspection:** Reviewed CDK stack code for SNS->SQS subscriptions and analyzed policies for PendingConfirmation cases.
6+
- **Search Operations:** Verified for misconfigured protocols or cross-account settings involving wrong Source/Principals.
7+
- **Condition & Mismatch Evaluations:** Examined TopicPolicy and SQS-queue properties for elements like SourceArn, AWS regions.
8+
- Implemented fixes to support these operational misconfigs in ./Budget-Stack modules.
9+
- **Custom resource fixes (SNS↔SQS subscription):** Updated the `subscribe-sqs` provider Lambda to unsubscribe on CloudFormation `Delete` using `event.Data.SubscriptionArn`, and adjusted Jest tests to avoid brittle `SNSClient.mock.instances` usage by injecting a shared `sendMock`.
10+
- **SQS queue policy fix:** Updated the aggregation queue resource policy `aws:SourceArn` construction to match real SNS topic ARNs (avoids `ArnFormat.NO_RESOURCE_NAME` generating `arn:...:sns:region:*:budget-alerts`, which can leave subscriptions in PendingConfirmation).
11+
- **Tests:** Ran `npm test --silent` successfully (10/10 suites, 68/68 tests, 4/4 snapshots).
12+
- **Lint:** `npm run lint` currently times out in this environment (needs follow-up).

β€ŽCONTRIBUTING.mdβ€Ž

Lines changed: 61 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -34,25 +34,25 @@ test/
3434

3535
**🚫 DO NOT violate these rules. This project depends heavily on predictability.**
3636

37-
### 1. The *planner* is pure and deterministic
37+
### 1. The _planner_ is pure and deterministic
3838

3939
All modules in `lib/planner/` MUST:
4040

41-
* contain **no AWS SDK calls**
42-
* avoid reading the filesystem
43-
* avoid environment access
44-
* avoid time-based behavior
45-
* avoid randomization
41+
- contain **no AWS SDK calls**
42+
- avoid reading the filesystem
43+
- avoid environment access
44+
- avoid time-based behavior
45+
- avoid randomization
4646

4747
They must take **inputs β†’ outputs** and be fully testable.
4848

4949
### 2. No business logic in CDK constructs
5050

5151
`budget-alerts-stack.ts` must only:
5252

53-
* evaluate planner results
54-
* wire CDK constructs and StackSets
55-
* pass validated data to resources
53+
- evaluate planner results
54+
- wire CDK constructs and StackSets
55+
- pass validated data to resources
5656

5757
### 3. Validation is performed **before** CDK synthesis
5858

@@ -62,8 +62,8 @@ They must take **inputs β†’ outputs** and be fully testable.
6262

6363
In particular:
6464

65-
* TypeScript sources must compile cleanly via `npm run build`
66-
* No hard-coded organization ID
65+
- TypeScript sources must compile cleanly via `npm run build`
66+
- No hard-coded organization ID
6767
(this is resolved dynamically via the custom resource)
6868

6969
### 5. No test-breaking rewrites
@@ -117,10 +117,10 @@ npm test
117117

118118
Tests focus on:
119119

120-
* Organizational Unit tree building
121-
* Effective budget calculation
122-
* Homogeneous subtree detection
123-
* Stack attachment selection
120+
- Organizational Unit tree building
121+
- Effective budget calculation
122+
- Homogeneous subtree detection
123+
- Stack attachment selection
124124

125125
The entire planner layer is fully unit-testable.
126126

@@ -155,58 +155,58 @@ npx budget-alerts-init-config
155155

156156
# 🧬 Making Changes
157157

158-
## 1. Planner logic (lib/planner/*)
158+
## 1. Planner logic (lib/planner/\*)
159159

160160
Changes must:
161161

162-
* be **pure functions**
163-
* include **unit tests** for new behaviors
164-
* avoid dependencies outside the planner folder
165-
* receive architectural approval if changing core algorithm flow
162+
- be **pure functions**
163+
- include **unit tests** for new behaviors
164+
- avoid dependencies outside the planner folder
165+
- receive architectural approval if changing core algorithm flow
166166

167167
## 2. Organization loader (org-loader.ts)
168168

169169
Allowed:
170170

171-
* Using AWS SDK v3
172-
* Querying Organizations API
173-
* Returning normalized OU nodes
171+
- Using AWS SDK v3
172+
- Querying Organizations API
173+
- Returning normalized OU nodes
174174

175175
Not allowed:
176176

177-
* Writing planner logic here
178-
* Modifying planner output logic in this layer
177+
- Writing planner logic here
178+
- Modifying planner output logic in this layer
179179

180180
## 3. Budget config loader (budget-config-loader.ts)
181181

182182
Allowed:
183183

184-
* YAML parsing
185-
* YAML comment round-tripping
186-
* Validation
187-
* Synchronization logic
184+
- YAML parsing
185+
- YAML comment round-tripping
186+
- Validation
187+
- Synchronization logic
188188

189189
Not allowed:
190190

191-
* Introducing side effects that would break determinism
192-
* Moving org-structure-dependent logic into the config loader
191+
- Introducing side effects that would break determinism
192+
- Moving org-structure-dependent logic into the config loader
193193

194194
## 4. CDK stack (budget-alerts-stack.ts)
195195

196196
Allowed:
197197

198-
* Mapping planner outputs to StackSets
199-
* Adding CloudFormation resources
200-
* Creating custom resources
201-
* Wiring permissions
202-
* Adding future IAM boundaries or service integrations
198+
- Mapping planner outputs to StackSets
199+
- Adding CloudFormation resources
200+
- Creating custom resources
201+
- Wiring permissions
202+
- Adding future IAM boundaries or service integrations
203203

204204
Not allowed:
205205

206-
* Planner logic
207-
* Config merging logic
208-
* Introducing account-specific assumptions
209-
* Hard-coding organization IDs
206+
- Planner logic
207+
- Config merging logic
208+
- Introducing account-specific assumptions
209+
- Hard-coding organization IDs
210210

211211
---
212212

@@ -244,41 +244,41 @@ npm publish --access public
244244

245245
# πŸ—‚ Branching Strategy
246246

247-
* `main` β†’ always stable, publishable
248-
* `dev` or feature branches β†’ active development
249-
* PRs must include tests when affecting planner or validation logic
247+
- `main` β†’ always stable, publishable
248+
- `dev` or feature branches β†’ active development
249+
- PRs must include tests when affecting planner or validation logic
250250

251251
---
252252

253253
# 🧾 Pull Request Requirements
254254

255255
Every PR must include:
256256

257-
* [ ] Clear description of the change
258-
* [ ] Unit tests for new or changed planner behavior
259-
* [ ] No breaking changes unless discussed
260-
* [ ] No architectural violations
261-
* [ ] Maintains npm package status
262-
* [ ] Does not remove or bypass existing validation
257+
- [ ] Clear description of the change
258+
- [ ] Unit tests for new or changed planner behavior
259+
- [ ] No breaking changes unless discussed
260+
- [ ] No architectural violations
261+
- [ ] Maintains npm package status
262+
- [ ] Does not remove or bypass existing validation
263263

264264
---
265265

266266
# πŸ›‘ Anti-Patterns (Do Not Do This)
267267

268-
* ❌ Adding AWS calls into planner logic
269-
* ❌ Running unmocked AWS calls in unit tests
270-
* ❌ Stubbing away planner logic to make tests pass
271-
* ❌ Hard-coding Organization IDs or account numbers
272-
* ❌ Adding features without documentation
273-
* ❌ Rewriting module architecture without explicit approval
268+
- ❌ Adding AWS calls into planner logic
269+
- ❌ Running unmocked AWS calls in unit tests
270+
- ❌ Stubbing away planner logic to make tests pass
271+
- ❌ Hard-coding Organization IDs or account numbers
272+
- ❌ Adding features without documentation
273+
- ❌ Rewriting module architecture without explicit approval
274274

275275
---
276276

277277
# 🧠 Design Principles Summary
278278

279-
* **Strong separation** of planner, config I/O, org discovery, and CDK stack
280-
* **Predictability** and **determinism** in every planner function
281-
* **Minimal customer boilerplate**
282-
* **Pure functional planning logic**
283-
* **Safe deployment via service-managed StackSets**
284-
* **Config as the single source of truth**
279+
- **Strong separation** of planner, config I/O, org discovery, and CDK stack
280+
- **Predictability** and **determinism** in every planner function
281+
- **Minimal customer boilerplate**
282+
- **Pure functional planning logic**
283+
- **Safe deployment via service-managed StackSets**
284+
- **Config as the single source of truth**

0 commit comments

Comments
Β (0)