Skip to content

feat: Add job history tracking with re-download capability and full-stack local deployment#11

Closed
AWS-fpenland wants to merge 43 commits intoASUCICREPO:mainfrom
AWS-fpenland:merge-request/job-history
Closed

feat: Add job history tracking with re-download capability and full-stack local deployment#11
AWS-fpenland wants to merge 43 commits intoASUCICREPO:mainfrom
AWS-fpenland:merge-request/job-history

Conversation

@AWS-fpenland
Copy link
Copy Markdown

Overview

This merge request adds comprehensive job history tracking and introduces a full-stack local deployment workflow for faster development iteration.

Features Added

1. Job History & Re-Download Capability

  • New Job History Tab: Users can view all their past PDF processing jobs with status, timestamps, and file details
  • Re-Download Functionality: Users can re-download previously processed files without re-uploading
  • DynamoDB Integration: Job metadata stored in DynamoDB with automatic TTL (30 days)
  • API Endpoint: New /job-history endpoint with Cognito authorization
  • Lambda Function: Retrieves user-specific job history from DynamoDB
  • Page Count Display: Fixed bug where page count wasn't showing in job history

2. Full-Stack Local Deployment

  • New Script: deploy-full-stack-local.sh - Deploy both CDK backend and React frontend locally without GitHub/CodeBuild
  • S3 CORS Configuration: Added CORS rules to S3 buckets for browser-based uploads
  • Deployment Documentation:
    • docs/FULL_STACK_LOCAL_DEPLOYMENT.md - Comprehensive deployment guide
    • docs/DEPLOYMENT_COMPARISON.md - Comparison of all deployment methods
    • DEPLOYMENT_QUICK_START.md - Quick reference guide
  • Updated README: Added deployment options section with clear guidance

3. Infrastructure Improvements

  • Deterministic Cognito Domain: Fixed random domain prefix generation for consistent deployments
  • Direct Amplify Deployment: Enhanced deploy-amplify-direct.sh with job history API configuration
  • Environment Management: Added .env.production to .gitignore

Technical Details

Backend Changes:

  • cdk_backend/lib/cdk_backend-stack.ts:
    • Added DynamoDB table for job history
    • Added Lambda function for job history retrieval
    • Added API Gateway endpoint /job-history
    • Added S3 CORS configuration for browser uploads
    • Fixed Cognito domain prefix to use stack name

Frontend Changes:

  • pdf_ui/src/components/JobHistory.jsx: New component for job history display
  • pdf_ui/src/MainApp.js: Added job history tab
  • Updated API constants for job history endpoint

Deployment:

  • deploy-full-stack-local.sh: New full-stack deployment script
  • deploy-amplify-direct.sh: Enhanced with job history API support
  • docs/: Comprehensive deployment documentation

Testing

  • Job history retrieval tested with multiple users
  • Re-download functionality verified for both PDF and HTML outputs
  • Local deployment tested end-to-end
  • S3 CORS configuration validated for browser uploads

Breaking Changes

None. All changes are additive and backward compatible.

Documentation

  • Added comprehensive deployment guides
  • Updated README with deployment options
  • Added job history feature specification

Related Issues

Addresses the need for:

  • User visibility into processing history
  • Ability to retrieve previously processed files
  • Faster local development workflow
  • Consistent deployment across environments

Frank Penland and others added 30 commits March 2, 2026 14:30
Replace Math.random() with context parameter to prevent domain
recreation on every deploy. Pass COGNITO_DOMAIN_PREFIX context
for existing deployments.
- Requirements: job tracking, history retrieval, re-download, access control, UI
- Design: DynamoDB table, single Lambda with method routing, tab-based UI
- Tasks: 6 task groups covering CDK, Lambda, frontend, deploy scripts
- DynamoDB table: PDFAccessibility-JobHistory (PK=user_sub, SK=created_at)
- Lambda: single function handling POST/GET/PUT via HTTP method routing
- API Gateway: /jobs resource with Cognito authorizer on existing API
- Amplify env var: REACT_APP_JOB_HISTORY_API
- CfnOutput: JobHistoryEndpoint
- JobHistory.jsx: MUI table with status chips, format badges, download
- MainApp.js: tab navigation (New Remediation / My Documents)
- UploadSection.jsx: create job record after S3 upload
- ProcessingContainer.jsx: update job status on complete/timeout
- constants.jsx: add JobHistoryAPI constant
- Use ref instead of state for pageCount (state not flushed before
  handleUpload reads it synchronously)
- Fix falsy check: page_count of 0 was showing as dash
- Create deploy-full-stack-local.sh for end-to-end local deployment
- Deploys CDK backend and React frontend without GitHub/CodeBuild
- Ideal for local development and rapid iteration
- Add comprehensive documentation in FULL_STACK_LOCAL_DEPLOYMENT.md
- Add deployment method comparison guide in DEPLOYMENT_COMPARISON.md
- Update README with deployment options section
- Update structure.md to document new script
- Make deploy-amplify-direct.sh executable
CORS was removed from the backend stacks (commits 085349e, 5d22360)
so the UI deployment must configure it. Both deploy scripts now set
CORS on the PDF processing buckets to allow browser PutObject calls.
Support deploying UI backend (CDK) and frontend (Amplify) from
private repositories via CodeBuild with CodeConnections auth.
Includes config file support, non-interactive mode, IAM
propagation delays, cleanup, and pipeline-helpers library.
feat(deploy): Add private repo deployment script
Only admins can now create user accounts via the AWS Console
or AdminCreateUser API. Existing postConfirmation trigger and
user verification settings remain for admin-created users.
feat(auth): Disable Cognito self-service signup
Random domain prefix caused UserPoolDomain replacement on every
stack update, failing because Cognito cannot create a new domain
while the old one exists. Derive prefix from account ID instead.
fix(auth): Make Cognito domain prefix deterministic
Pass SELF_SIGNUP as CDK context through the full chain:
deploy scripts → CodeBuild env var → buildspec → CDK context.
Defaults to false (admin-only). Both deploy.sh (interactive
prompt) and deploy-private.sh (config/env var) supported.
Math.random() generated a new prefix on every synth,
causing CloudFormation to replace the CfnUserPoolDomain
on every deploy. Now uses cdk.Names.uniqueId for stability,
with optional DOMAIN_PREFIX context override.
The deploy scripts already pass -c SELF_SIGNUP=true|false
but the CDK stack was hardcoded to true. Now reads the
context variable, defaulting to false when not provided.
CodeBuild webhooks trigger on push and PR merge to the
target branch. File path filters scope backend builds to
cdk_backend/, buildspec.yml, and lambda/ changes, and
frontend builds to pdf_ui/ and buildspec-frontend.yml.
CodeCommit is skipped since it lacks webhook support.
Restructure README with Option A (public repo, simple
one-time deploy) and Option B (private repo with CI/CD
webhooks, non-interactive mode, and cleanup). Includes
manual webhook configuration instructions for the AWS
Console.
Replaces cdk.Names.uniqueId with this.account so the
Cognito domain prefix is stable per account but unique
across different AWS accounts.
Covers dependencies, build output, env files, IDE/OS
artifacts, Python cache, and temp files. Removes
previously tracked .DS_Store files.
@AWS-fpenland AWS-fpenland deleted the merge-request/job-history branch March 31, 2026 22:11
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