Add Team Alerts module #46
Conversation
…; add tests for project filtering
…amsAlertClient integration
… with mock configurations
…ion for Lambda variables and testing
…e dependency installation
TotalDwarf03
left a comment
There was a problem hiding this comment.
Couple of minor nits and a few questions.
I appreciate that this repo is being replaced soon so I'll approve anyway.
The only point I have is that the try-catch sections cover a lot of code. I think in the future, more targeted try-catches should be used. Again, since this is being replaced, that's fine though.
| } | ||
|
|
||
| # Special case filters | ||
| def filter_developed(project): |
There was a problem hiding this comment.
Should these functions remain nested in another or be put somewhere else?
Also, they need docstrings
| standard_filters_pass = all( | ||
| matches_filter( | ||
| get_nested_values(project, paths[key]), filter_params[key] | ||
| def filter_source_control(project): |
|
|
||
|
|
||
|
|
||
| def get_teams_alert_client() -> Any: |
There was a problem hiding this comment.
Docstring
The return type doesn't seem right. I think it should be TeamsAlertClient | None
There was a problem hiding this comment.
Pull request overview
This PR introduces Microsoft Teams alerting support for the Tech Audit Tool API, including Terraform wiring and CI/CD updates, while also tightening auth error handling so expected auth failures remain 401s without triggering alert noise.
Changes:
- Add Teams alert client initialization + alert sending hooks, and preserve
HTTPExceptionduring auth/token verification. - Update Terraform to pass new env vars (Azure secret name, branch gating, environment label) and expand Secrets Manager IAM permissions.
- Update tests and documentation to reflect new auth behavior, endpoint responses, and required secret/variable shapes; adjust CI/CD build/install flow for the git-based dependency.
Reviewed changes
Copilot reviewed 24 out of 25 changed files in this pull request and generated 12 comments.
Show a summary per file
| File | Description |
|---|---|
| testing/test_api.py | Updates mocks/patch paths and adds regression tests ensuring auth failures stay 401 and don’t emit Teams alerts. |
| testing/conftest.py | Mocks AWS Secrets Manager/S3 at import time so pytest runs locally without real cloud credentials. |
| terraform/lambda/variables.tf | Adds new Terraform inputs for Teams alert secret + branch/env labeling. |
| terraform/lambda/main.tf | Expands Secrets Manager permissions and injects new env vars into the Lambda. |
| terraform/lambda/env/prod/example_tfvars.txt | Documents azure_secret_name in example tfvars. |
| terraform/lambda/env/dev/example_tfvars.txt | Documents azure_secret_name in example tfvars. |
| terraform/README.md | Documents new Lambda tfvars and expected Azure secret JSON shape. |
| pyproject.toml | Adds keh-teams-alert git dependency for Poetry-managed installs. |
| poetry.lock | Updates lockfile for new dependency set / Poetry version. |
| docs/infrastructure.md | Mirrors Terraform README updates for Teams alert variables/secret shape. |
| docs/endpoints/user.md | Updates /user docs to include groups in response. |
| docs/endpoints/refresh.md | Updates refresh endpoint docs to POST + body shape and response codes. |
| docs/endpoints/projects.md | Updates projects docs and schema fields (supporting tools keys, status codes). |
| docs/endpoints/project.md | Updates project detail docs (behavior + schema + status codes). |
| docs/endpoints/filter.md | Updates filter parameter types/wording and response codes. |
| docs/endpoints/auth.md | Clarifies auth-code exchange endpoint doesn’t require Authorization header. |
| concourse/scripts/terraform_infra.sh | Passes new Terraform vars for Azure secret + branch/env labeling. |
| concourse/scripts/build_image.sh | Passes a GitHub token as a build secret for installing git dependencies during image build. |
| concourse/ci.yml | Adds a failure notification task using Azure credentials and refactors release deploy flow. |
| aws_lambda_script/requirements.txt | Updates pinned runtime deps and adds keh-teams-alert for container builds. |
| aws_lambda_script/app/utils.py | Adds Teams alert client wiring, improved S3 error logging, and env-driven alert gating. |
| aws_lambda_script/app/resources.py | Preserves HTTPException for auth flows and adds alerting on unexpected endpoint failures. |
| aws_lambda_script/Dockerfile | Implements multi-stage build with git-based dependency install using a mounted secret token. |
| README.md | Updates local testing guidance (no real token/AWS creds needed for pytest) and aligns endpoint descriptions. |
| .github/workflows/ci.yml | Updates Poetry version and alters dependency installation behavior for CI. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| IMAGE_TAG = var.container_ver | ||
| AZURE_SECRET_NAME = var.azure_secret_name | ||
| BRANCH_NAME = var.branch_name | ||
| AWS_ACCOUNT_NAME = var.domain |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…pendency installation for alerts
What type of PR is this? (check all applicable)
What
This PR includes the following changes:
Testing
Have any new tests been added as part of this issue? If not, try to explain why test coverage is not needed here.
Please write a brief description of why test coverage is not necessary here.
Documentation
Has any new documentation been written as part of this issue? We should try to keep documentation up to date
as new code is added, rather than leaving it for the future.
Please write a brief description of why documentation is not necessary here.
Related issues
Provide links to any related issues.
How to review
Describe the steps required to test the changes.