Skip to content

Lambda Deployment, Security Hardening & Test Infrastructure - #4

Merged
hal-bot merged 10 commits into
mainfrom
feat/module5_lambda-deployment
Mar 27, 2026
Merged

Lambda Deployment, Security Hardening & Test Infrastructure#4
hal-bot merged 10 commits into
mainfrom
feat/module5_lambda-deployment

Conversation

@hal-bot

@hal-bot hal-bot commented Mar 27, 2026

Copy link
Copy Markdown
Owner

Summary

Adds Lambda deployment infrastructure, hardens authentication with BCrypt password hashing, fixes swap and image display bugs, and builds comprehensive test infrastructure with a unified dashboard.

Changes

Infrastructure & Deployment

  • Fix Lambda create/update logic in deploy script
  • Create Lambda execution role with correct trust policy (instead of using LabRole)
  • Remove reserved AWS_REGION from Lambda environment variables
  • Make verify script executable, ignore Python cache files
  • Consolidate CI — remove legacy backend-ci.yml and frontend-ci.yml superseded by ci-cd.yml

Security

  • Hash passwords with BCrypt (spring-security-crypto) before persisting
  • Login now uses findByUsername + BCryptPasswordEncoder.matches() instead of plaintext comparison

Bug Fixes

  • Swap ownership: Items now stay active after a swap (removed setActive(false)), so swapped items correctly appear in each user's list under the new owner
  • Image URL: ItemCard now uses the item's imageUrl when provided, falling back to Unsplash only when absent

Test Infrastructure

  • Add generate-dashboard.sh producing a single HTML test dashboard with:
    • Backend unit tests, integration tests, frontend unit tests, E2E tests
    • JaCoCo backend coverage + Vitest V8 frontend coverage
    • PIT mutation testing with per-class scores and surviving mutation details
  • Dashboard separates integration tests into their own section

Tests Added

  • Integration: SwapLifecycleIntegrationTest — BCrypt round-trip, duplicate user 409, create+fetch by owner, filter by type, full swap lifecycle
  • E2E: Logout redirect, no-items swap error, swap-then-verify-home-page
  • Updated: SwapControllerTest, frontend mock handlers, and existing E2E assertions to match new swap behavior (items stay active)

Test Results

Layer Count Status
Backend Unit 66 ✅ All passing
Integration 5 ✅ All passing
Frontend Unit 45 ✅ All passing
E2E (Playwright) 14 ✅ All passing
Total 130

Mutation score: 83.8% · Backend line coverage: 87.6% · Frontend line coverage: 89.2%

hal-bot added 10 commits March 23, 2026 23:12
backend-ci.yml and frontend-ci.yml were the original single-job CI files
created before the consolidated multi-job ci-cd.yml pipeline was built.
Keeping them caused duplicate runs on every push/PR.
- Add JaCoCo plugin to backend pom.xml for Java code coverage
- Add @vitest/coverage-v8 and coverage config to frontend vite.config.ts
- Update generate-dashboard.sh with coverage parsers and HTML sections
- Add backend/frontend coverage summary cards and detail breakdowns
- Add frontend/coverage/ to .gitignore
- Add spring-security-crypto dependency for BCryptPasswordEncoder
- Register BCryptPasswordEncoder bean in ToyswapApplication
- Hash password on registration (createSwapper) and update (updateSwapper)
- Replace findByUsernameAndPassword with findByUsername + BCrypt matches
- Remove TODO comment from Swapper model
- Update controller and repository tests for BCrypt flow
- All 66 backend tests passing
- Add SwapLifecycleIntegrationTest (6 tests): BCrypt login round-trip,
  duplicate userId 409, create+fetch items by owner, filter by type,
  full swap lifecycle with ownership transfer, swap inactive item 409
- Add E2E: logout redirects to /login
- Add E2E: swap button shows error when user has no items
- Backend: 72 tests passing, E2E: 13 tests passing
- SwapController: remove setActive(false) so items stay active with swapped owners
- ItemCard: use item.imageUrl with Unsplash fallback instead of always using Unsplash
- Update SwapControllerTest to assert active:true after swap
- Update SwapLifecycleIntegrationTest: verify swapped items stay active under new owners, remove broken swapWithInactiveItem test
- Update frontend mock handlers to return active:true from swap endpoint
- Add E2E test: received toy appears on home page after swap, given toy does not
- Parse Surefire XML to separate unit vs integration tests (by package/class name)
- Add Integration summary card and detail section to dashboard
- Remove unused instruction files (initial-instructions.md, test-instructions.md)
@hal-bot
hal-bot merged commit 0f08df9 into main Mar 27, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant