Skip to content

Commit 6a00b04

Browse files
committed
feat: implement EMBP architecture with CI, tests, and refactor
- Add EMBP-style module structure (domain.rs, lib.rs) - Add full integration tests running against real lambda runtime - Refactor filtering logic for clarity and robustness - Split CI into lint/test jobs with cargo-lambda caching and quiet mode - Cleanup README and improve changelog BREAKING CHANGE: Import paths changed to use library exports
1 parent baecd61 commit 6a00b04

File tree

12 files changed

+823
-143
lines changed

12 files changed

+823
-143
lines changed

.github/workflows/ci.yml

Lines changed: 66 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,20 @@ jobs:
1313
test:
1414
name: Test
1515
runs-on: ubuntu-latest
16+
container:
17+
image: ghcr.io/johnbasrai/cr8s/rust-dev:1.83.0-rev6
18+
credentials:
19+
username: ${{ github.actor }}
20+
password: ${{ secrets.GITHUB_TOKEN }}
1621

1722
steps:
1823
- name: Checkout code
1924
uses: actions/checkout@v4
2025

21-
- name: Install Rust
22-
uses: dtolnay/rust-toolchain@stable
23-
with:
24-
components: rustfmt
26+
- name: Show Rust version
27+
run: |
28+
rustc --version
29+
cargo --version
2530
2631
- name: Cache Cargo dependencies
2732
uses: actions/cache@v4
@@ -42,5 +47,60 @@ jobs:
4247
- name: Build release
4348
run: cargo build --release --quiet
4449

45-
- name: Run tests
46-
run: cargo test --release --quiet
50+
- name: Run unit tests only
51+
run: cargo test --release --quiet --lib --bins
52+
53+
- name: Ensure cargo-lambda 1.8.5 is installed
54+
env:
55+
CARGO_HOME: /home/runner/.cargo
56+
PATH: /home/runner/.cargo/bin:${{ env.PATH }}
57+
run: |
58+
echo "PATH=$PATH"
59+
if ! command -v cargo-lambda &> /dev/null; then
60+
cargo install cargo-lambda --version 1.8.5
61+
fi
62+
63+
- name: Start lambda runtime in background
64+
run: cargo lambda start --release &
65+
env:
66+
RUST_LOG: info
67+
68+
- name: Wait for lambda runtime to be ready
69+
run: sleep 5
70+
71+
- name: Run integration tests
72+
run: cargo test --quiet --test integration_tests --release
73+
env:
74+
RUST_LOG: info
75+
76+
lint:
77+
name: Lint
78+
runs-on: ubuntu-latest
79+
container:
80+
image: ghcr.io/johnbasrai/cr8s/rust-dev:1.83.0-rev6
81+
credentials:
82+
username: ${{ github.actor }}
83+
password: ${{ secrets.GITHUB_TOKEN }}
84+
85+
steps:
86+
- name: Checkout code
87+
uses: actions/checkout@v4
88+
89+
- name: Cache Cargo dependencies
90+
uses: actions/cache@v4
91+
with:
92+
path: |
93+
~/.cargo/bin/
94+
~/.cargo/registry/index/
95+
~/.cargo/registry/cache/
96+
~/.cargo/git/db/
97+
target/
98+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
99+
restore-keys: |
100+
${{ runner.os }}-cargo-
101+
102+
- name: Run Clippy
103+
run: cargo clippy --quiet --all-targets --all-features -- -D warnings
104+
105+
- name: Run audit & outdated
106+
run: cargo audit || cargo outdated || true

CHANGELOG.md

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,46 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and
88

99
## [Unreleased]
1010

11-
- Awaiting license and attribution confirmation from the original author
11+
---
12+
13+
## [0.2.0] – 2025-06-27
14+
15+
### Added
16+
- **EMBP Architecture**: Implemented Explicit Module Boundary Pattern for clean code organization
17+
- Created `src/domain.rs` module for core business entities (`Action`, `Priority`)
18+
- Added `src/lib.rs` as EMBP gateway with controlled public exports
19+
- Established clear module boundaries and import patterns
20+
- **Comprehensive Integration Testing**: Real end-to-end lambda testing with `cargo lambda invoke`
21+
- Added 8 integration tests covering filtering, sorting, deduplication, and error handling
22+
- Created/updated test data files: `01_sample-input.json`, `02_priority-input.json`, `03_bad-input.json`, `04_edge-cases.json`
23+
- Implemented order-agnostic testing for robust HashMap-based results
24+
- Added edge case testing for 7-day and 90-day boundary conditions
25+
- **Enhanced CI Pipeline**: Complete GitHub Actions workflow with parallel jobs
26+
- Unit tests with `--lib --bins` for proper test isolation
27+
- Integration tests with real lambda runtime execution (`cargo lambda start`)
28+
- Code quality checks with `clippy --all-targets --all-features -- -D warnings`
29+
- Code formatting validation with `rustfmt --check`
30+
- **Professional Documentation**: Comprehensive README with architecture patterns
31+
- Added EMBP pattern explanation with link to specification
32+
- Documented domain model, business rules, and processing examples
33+
- Included testing strategy, usage instructions, and CI documentation
34+
- Added development features and architecture benefits sections
35+
36+
### Changed
37+
- **Module Structure**: Refactored for EMBP pattern compliance
38+
- Moved domain types from `main.rs` to dedicated `domain.rs` module
39+
- Updated import patterns: `use domain::{Action, Priority}` in binary, `pub use domain::*` in library
40+
- Separated concerns between binary entry point and reusable library components
41+
- **Import Patterns**: Established clean module boundaries
42+
- Binary imports from local modules: `use domain::Action`
43+
- Library exports through gateway: `pub use domain::{Action, Priority}`
44+
- External code imports from library: `use aws_lambda_action_filter::{Action, Priority}`
45+
46+
### Fixed
47+
- **Test Reliability**: Resolved HashMap ordering dependencies in integration tests
48+
- Implemented order-agnostic assertions using HashSet comparisons
49+
- Eliminated brittle positional testing for same-priority results
50+
- Added proper deduplication verification with timestamp checking
1251

1352
---
1453

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "aws-lambda-action-filter"
3-
version = "0.1.1"
3+
version = "0.2.0"
44
edition = "2021"
55

66
[dependencies]
@@ -11,5 +11,4 @@ serde_json = "1.0"
1111
serde = { version = "1.0", features = ["derive"] }
1212
tokio = { version = "1", features = ["macros", "rt-multi-thread"] }
1313
tracing = "0.1"
14-
tracing-subscriber = { version = "0.3", features = ["fmt", "env-filter"] }
15-
14+
tracing-subscriber = { version = "0.3", features = ["fmt", "env-filter"] }

0 commit comments

Comments
 (0)