From 7d4df0cdcdf3ac75d9ad0ef6043d53e21d4bce72 Mon Sep 17 00:00:00 2001 From: Quinten Steenhuis Date: Thu, 23 Jul 2026 12:08:05 -0400 Subject: [PATCH] Fix #126 - update app name consistently to litefile, not forms-mvp --- .dockerignore | 1 + .github/workflows/ci.yml | 4 +- README.md | 4 +- compose.yml | 6 +- efile_app/.env.example | 2 +- efile_app/efile/api/s3_upload.py | 4 +- efile_app/efile/authentication.py | 5 +- efile_app/efile/settings_prod.py | 4 +- efile_app/efile/settings_staging.py | 4 +- efile_app/efile/tests/test_efsp_payload.py | 4 +- .../tests/test_stand_in_document_guards.py | 2 +- efile_app/efile/utils/proxy_connection.py | 9 +- efile_app/pyproject.toml | 2 +- efile_app/uv.lock | 138 +++++++++--------- fly.toml | 4 +- testing/README.md | 2 +- .../ready.d/01-create-s3-bucket.sh | 2 +- 17 files changed, 101 insertions(+), 96 deletions(-) diff --git a/.dockerignore b/.dockerignore index 7e169ca..ef141a5 100644 --- a/.dockerignore +++ b/.dockerignore @@ -12,6 +12,7 @@ __pycache__/ # Virtual environments .venv/ +**/.venv/ .env .env.* diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 620b828..cecf323 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,8 +27,8 @@ jobs: # GH actions workflow in the future. The direct method is supposed to be faster so we'll leave it for # now. When we start to have more complex dependencies within the dockerfile we can swap over. # Sample run commands: - # docker build -t form-submission-mvp:ci . - # docker run --rm form-submission-mvp:ci uv run pytest -q + # docker build -t litefile:ci . + # docker run --rm litefile:ci uv run pytest -q - name: Install uv run: curl -LsSf https://astral.sh/uv/install.sh | sh diff --git a/README.md b/README.md index ca7ca45..57ce6da 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Form Submission MVP +# LITEFile A minimal Django app for form submission and review. The Django project lives under `efile_app/` with settings in `efile_app/efile/`. @@ -80,7 +80,7 @@ The application uses AWS S3 for document storage and file uploads. Follow these ### 1. Create an S3 Bucket - Log into the AWS Console and navigate to S3 -- Create a new bucket (e.g., `forms-mvp-your-suffix`) +- Create a new bucket (e.g., `litefile-your-suffix`) - Choose your preferred region (default: `us-east-1`) - Initially, turn off "Block all public access" in the S3 bucket settings. We will need this off initially so that the bucket policy can be applied. After we have created the bucket policy, we will block all public access by toggling back on "Block all public access". - Tags can be created to help track ownership of resources and is useful for cost tracking, environment tracking, etc. diff --git a/compose.yml b/compose.yml index f1cd635..96d3359 100644 --- a/compose.yml +++ b/compose.yml @@ -10,7 +10,7 @@ services: DEBUG: "${DEBUG:-0}" SERVICES: s3 AWS_DEFAULT_REGION: us-east-1 - AWS_S3_BUCKET_NAME: forms-mvp-xf6361 + AWS_S3_BUCKET_NAME: litefile-staging volumes: - localstack:/var/lib/localstack - /var/run/docker.sock:/var/run/docker.sock @@ -25,7 +25,7 @@ services: build: context: . dockerfile: Dockerfile - image: form-submission-mvp:web + image: litefile:web command: >- sh -c "uv run python manage.py migrate --noinput --fake-initial && uv run python manage.py runserver 0.0.0.0:8000" @@ -39,7 +39,7 @@ services: PYTHONUNBUFFERED: "1" AWS_ACCESS_KEY_ID: test AWS_SECRET_ACCESS_KEY: test - AWS_S3_BUCKET_NAME: forms-mvp-xf6361 + AWS_S3_BUCKET_NAME: litefile-staging AWS_S3_REGION_NAME: us-east-1 AWS_S3_ENDPOINT_URL: http://localstack:4566 # botocore >= 1.35 routes S3 through account-ID-specific endpoints, which diff --git a/efile_app/.env.example b/efile_app/.env.example index 244ea35..67eb4a4 100644 --- a/efile_app/.env.example +++ b/efile_app/.env.example @@ -24,7 +24,7 @@ EFSP_TEST_DOCUMENT_URL = "https://raw.githubusercontent.com/SuffolkLITLab/LITEFi AWS_S3_ENDPOINT_URL = "http://localstack:4566" # if mocking S3 locally, see [testing README](../testing/README.md). AWS_ACCESS_KEY_ID = "your-aws-access-key-id-here" AWS_SECRET_ACCESS_KEY = r"your-aws-secret-access-key-here" # Raw string to handle special chars -AWS_S3_BUCKET_NAME = "forms-mvp-xf6361" +AWS_S3_BUCKET_NAME = "litefile-staging" AWS_S3_REGION_NAME = "us-east-1" # Tyler test-EFM login, shared by the Python suite (efile/tests/) and the diff --git a/efile_app/efile/api/s3_upload.py b/efile_app/efile/api/s3_upload.py index 4da5336..9465444 100644 --- a/efile_app/efile/api/s3_upload.py +++ b/efile_app/efile/api/s3_upload.py @@ -164,8 +164,8 @@ def mock_s3_upload(request): mock_upload_results.append( { "original_name": uploaded_file.name, - "url": f"https://forms-mvp-xf6361.s3.amazonaws.com/efile-documents/{file_type}/{file_id}.pdf", - "public_url": f"https://forms-mvp-xf6361.s3.amazonaws.com/efile-documents/{file_type}/{file_id}.pdf", + "url": f"https://litefile-staging.s3.amazonaws.com/efile-documents/{file_type}/{file_id}.pdf", + "public_url": f"https://litefile-staging.s3.amazonaws.com/efile-documents/{file_type}/{file_id}.pdf", "key": f"efile-documents/{file_type}/{file_id}.pdf", "size": uploaded_file.size, "type": file_type, diff --git a/efile_app/efile/authentication.py b/efile_app/efile/authentication.py index 43e42d7..dc679c5 100644 --- a/efile_app/efile/authentication.py +++ b/efile_app/efile/authentication.py @@ -20,11 +20,12 @@ def authenticate(self, request, username=None, password=None, **kwargs): try: auth_data = auth_with_tyler_api(username, password, jurisdiction) - request.session["auth_tokens"] = auth_data["tokens"] - if not auth_data: + if not auth_data or "tokens" not in auth_data: logger.info("Tyler auth failed for user %s", username) return None + request.session["auth_tokens"] = auth_data["tokens"] + logger.info("Auth data: %s", auth_data) user = self._get_or_create_user(username, auth_data, jurisdiction) diff --git a/efile_app/efile/settings_prod.py b/efile_app/efile/settings_prod.py index 19f83fc..664ff77 100644 --- a/efile_app/efile/settings_prod.py +++ b/efile_app/efile/settings_prod.py @@ -13,8 +13,8 @@ DATABASES = BASE_DATABASES DEBUG = False -ALLOWED_HOSTS = ["forms-mvp-prod.fly.dev"] -CSRF_TRUSTED_ORIGINS = ["https://forms-mvp-prod.fly.dev"] +ALLOWED_HOSTS = ["litefile-prod.fly.dev"] +CSRF_TRUSTED_ORIGINS = ["https://litefile-prod.fly.dev"] # Static files (WhiteNoise), mirroring settings_staging. # diff --git a/efile_app/efile/settings_staging.py b/efile_app/efile/settings_staging.py index 3480c08..62379d2 100644 --- a/efile_app/efile/settings_staging.py +++ b/efile_app/efile/settings_staging.py @@ -13,8 +13,8 @@ DATABASES = BASE_DATABASES DEBUG = False -ALLOWED_HOSTS = ["forms-mvp-staging.fly.dev"] -CSRF_TRUSTED_ORIGINS = ["https://forms-mvp-staging.fly.dev"] +ALLOWED_HOSTS = ["litefile-staging.fly.dev"] +CSRF_TRUSTED_ORIGINS = ["https://litefile-staging.fly.dev"] # Security hardening suitable for staging SECRET_KEY = os.environ.get("DJANGO_SECRET_KEY") diff --git a/efile_app/efile/tests/test_efsp_payload.py b/efile_app/efile/tests/test_efsp_payload.py index b614090..be7d301 100644 --- a/efile_app/efile/tests/test_efsp_payload.py +++ b/efile_app/efile/tests/test_efsp_payload.py @@ -20,7 +20,7 @@ validate_required_party_types, ) -REAL_S3_URL = "https://forms-mvp-xf6361.s3.us-east-1.amazonaws.com/efile-documents/lead/abc.pdf?X-Amz-Signature=x" +REAL_S3_URL = "https://litefile-staging.s3.us-east-1.amazonaws.com/efile-documents/lead/abc.pdf?X-Amz-Signature=x" STAND_IN_URL = "https://example.org/fixtures/blank.pdf" @@ -117,7 +117,7 @@ def test_stand_in_url_replaces_every_document_url(): efile_data = { "al_court_bundle": [ {"data_url": REAL_S3_URL}, - {"data_url": "https://forms-mvp-xf6361.s3.us-east-1.amazonaws.com/efile-documents/supporting/d.pdf"}, + {"data_url": "https://litefile-staging.s3.us-east-1.amazonaws.com/efile-documents/supporting/d.pdf"}, ] } diff --git a/efile_app/efile/tests/test_stand_in_document_guards.py b/efile_app/efile/tests/test_stand_in_document_guards.py index a312095..f2bc337 100644 --- a/efile_app/efile/tests/test_stand_in_document_guards.py +++ b/efile_app/efile/tests/test_stand_in_document_guards.py @@ -29,7 +29,7 @@ def test_dev_settings_refuse_to_load_on_a_deployed_host(monkeypatch): A deploy that loses DJANGO_SETTINGS_MODULE would otherwise come up with DEBUG=True, where every DEBUG-keyed guard below is inert. """ - monkeypatch.setenv("FLY_APP_NAME", "forms-mvp-staging") + monkeypatch.setenv("FLY_APP_NAME", "litefile-staging") import efile.settings_dev diff --git a/efile_app/efile/utils/proxy_connection.py b/efile_app/efile/utils/proxy_connection.py index 44cee08..4b17cde 100644 --- a/efile_app/efile/utils/proxy_connection.py +++ b/efile_app/efile/utils/proxy_connection.py @@ -11,14 +11,17 @@ def auth_with_tyler_api(username, password, jurisdiction): try: api_key = getattr(settings, "SUFFOLK_EFILE_API_KEY", None) payload = {"api_key": api_key, f"tyler-{jurisdiction}": {"username": username, "password": password}} - headers = {"Content-Type": "application/json", "User-Agent": f"{jurisdiction.title()}-eFile-Client/1.0"} + headers = get_headers() + headers["User-Agent"] = f"{jurisdiction.title()}-eFile-Client/1.0" response = requests.post(url, json=payload, headers=headers, timeout=10) - logger.debug("Auth API response: status=%s url=%s", response.status_code, url) + logger.info("Auth API response: status=%s url=%s", response.status_code, url) if response.status_code == 200: return response.json() + else: + logger.warning("Auth endpoint returned status %s for user %s", response.status_code, username) except Exception as e: - logger.debug("Auth endpoint failed: %s - %s", url, str(e)) + logger.error("Auth endpoint failed: %s - %s", url, str(e)) return None diff --git a/efile_app/pyproject.toml b/efile_app/pyproject.toml index d9c696d..027edf5 100644 --- a/efile_app/pyproject.toml +++ b/efile_app/pyproject.toml @@ -1,5 +1,5 @@ [project] -name = "form-submission-mvp" +name = "litefile" version = "0.1.0" description = "Minimal Django app for form submission and review" requires-python = ">=3.12" diff --git a/efile_app/uv.lock b/efile_app/uv.lock index 620505d..fad1c37 100644 --- a/efile_app/uv.lock +++ b/efile_app/uv.lock @@ -425,75 +425,6 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/e8/2d/d2a548598be01649e2d46231d151a6c56d10b964d94043a335ae56ea2d92/flatbuffers-25.12.19-py2.py3-none-any.whl", hash = "sha256:7634f50c427838bb021c2d66a3d1168e9d199b0607e6329399f04846d42e20b4", size = 26661, upload-time = "2025-12-19T23:16:13.622Z" }, ] -[[package]] -name = "form-submission-mvp" -version = "0.1.0" -source = { editable = "." } -dependencies = [ - { name = "boto3" }, - { name = "dj-database-url" }, - { name = "django" }, - { name = "djlint" }, - { name = "gunicorn" }, - { name = "markdown" }, - { name = "markdownify" }, - { name = "markitdown" }, - { name = "openai" }, - { name = "psycopg", extra = ["binary"] }, - { name = "python-dotenv" }, - { name = "requests" }, - { name = "tiktoken" }, - { name = "uvicorn" }, - { name = "whitenoise" }, -] - -[package.dev-dependencies] -dev = [ - { name = "boto3-stubs" }, - { name = "django-stubs", extra = ["compatible-mypy"] }, - { name = "pre-commit" }, - { name = "pytest" }, - { name = "pytest-cov" }, - { name = "pytest-django" }, - { name = "pytest-xdist" }, - { name = "ruff" }, - { name = "ty" }, - { name = "types-requests" }, -] - -[package.metadata] -requires-dist = [ - { name = "boto3", specifier = ">=1.40.12" }, - { name = "dj-database-url", specifier = ">=2.2" }, - { name = "django", specifier = "==5.2.5" }, - { name = "djlint", specifier = ">=1.36.4" }, - { name = "gunicorn", specifier = ">=22.0" }, - { name = "markdown", specifier = ">=3.10.2" }, - { name = "markdownify", specifier = ">=1.2.2" }, - { name = "markitdown", specifier = ">=0.1.4" }, - { name = "openai", specifier = ">=2.14.0" }, - { name = "psycopg", extras = ["binary"], specifier = ">=3.1" }, - { name = "python-dotenv", specifier = ">=1.0" }, - { name = "requests", specifier = ">=2.31,<3" }, - { name = "tiktoken", specifier = ">=0.12.0" }, - { name = "uvicorn", specifier = ">=0.30" }, - { name = "whitenoise", specifier = ">=6.7" }, -] - -[package.metadata.requires-dev] -dev = [ - { name = "boto3-stubs", specifier = ">=1.40.12" }, - { name = "django-stubs", extras = ["compatible-mypy"] }, - { name = "pre-commit", specifier = ">=3.7" }, - { name = "pytest", specifier = ">=8.0" }, - { name = "pytest-cov", specifier = ">=5.0" }, - { name = "pytest-django", specifier = ">=4.8" }, - { name = "pytest-xdist", specifier = ">=3.6" }, - { name = "ruff", specifier = ">=0.5.0,<1" }, - { name = "ty" }, - { name = "types-requests" }, -] - [[package]] name = "gunicorn" version = "23.0.0" @@ -733,6 +664,75 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/fc/85/69f92b2a7b3c0f88ffe107c86b952b397004b5b8ea5a81da3d9c04c04422/librt-0.7.8-cp314-cp314t-win_arm64.whl", hash = "sha256:8766ece9de08527deabcd7cb1b4f1a967a385d26e33e536d6d8913db6ef74f06", size = 40550, upload-time = "2026-01-14T12:56:01.542Z" }, ] +[[package]] +name = "litefile" +version = "0.1.0" +source = { editable = "." } +dependencies = [ + { name = "boto3" }, + { name = "dj-database-url" }, + { name = "django" }, + { name = "djlint" }, + { name = "gunicorn" }, + { name = "markdown" }, + { name = "markdownify" }, + { name = "markitdown" }, + { name = "openai" }, + { name = "psycopg", extra = ["binary"] }, + { name = "python-dotenv" }, + { name = "requests" }, + { name = "tiktoken" }, + { name = "uvicorn" }, + { name = "whitenoise" }, +] + +[package.dev-dependencies] +dev = [ + { name = "boto3-stubs" }, + { name = "django-stubs", extra = ["compatible-mypy"] }, + { name = "pre-commit" }, + { name = "pytest" }, + { name = "pytest-cov" }, + { name = "pytest-django" }, + { name = "pytest-xdist" }, + { name = "ruff" }, + { name = "ty" }, + { name = "types-requests" }, +] + +[package.metadata] +requires-dist = [ + { name = "boto3", specifier = ">=1.40.12" }, + { name = "dj-database-url", specifier = ">=2.2" }, + { name = "django", specifier = "==5.2.5" }, + { name = "djlint", specifier = ">=1.36.4" }, + { name = "gunicorn", specifier = ">=22.0" }, + { name = "markdown", specifier = ">=3.10.2" }, + { name = "markdownify", specifier = ">=1.2.2" }, + { name = "markitdown", specifier = ">=0.1.4" }, + { name = "openai", specifier = ">=2.14.0" }, + { name = "psycopg", extras = ["binary"], specifier = ">=3.1" }, + { name = "python-dotenv", specifier = ">=1.0" }, + { name = "requests", specifier = ">=2.31,<3" }, + { name = "tiktoken", specifier = ">=0.12.0" }, + { name = "uvicorn", specifier = ">=0.30" }, + { name = "whitenoise", specifier = ">=6.7" }, +] + +[package.metadata.requires-dev] +dev = [ + { name = "boto3-stubs", specifier = ">=1.40.12" }, + { name = "django-stubs", extras = ["compatible-mypy"] }, + { name = "pre-commit", specifier = ">=3.7" }, + { name = "pytest", specifier = ">=8.0" }, + { name = "pytest-cov", specifier = ">=5.0" }, + { name = "pytest-django", specifier = ">=4.8" }, + { name = "pytest-xdist", specifier = ">=3.6" }, + { name = "ruff", specifier = ">=0.5.0,<1" }, + { name = "ty" }, + { name = "types-requests" }, +] + [[package]] name = "magika" version = "0.6.3" diff --git a/fly.toml b/fly.toml index b81c826..9f30289 100644 --- a/fly.toml +++ b/fly.toml @@ -1,9 +1,9 @@ -# fly.toml app configuration file generated for forms-mvp-staging on 2025-08-20T14:42:16-07:00 +# fly.toml app configuration file generated for litefile-staging on 2025-08-20T14:42:16-07:00 # # See https://fly.io/docs/reference/configuration/ for information about how to use this file. # -app = 'forms-mvp-staging' +app = 'litefile-staging' primary_region = 'lax' [build] diff --git a/testing/README.md b/testing/README.md index e9197fb..6532fae 100644 --- a/testing/README.md +++ b/testing/README.md @@ -15,7 +15,7 @@ To poke at the bucket by hand, install ```bash pip install 'awscli-local[ver1]' -awslocal s3 ls s3://forms-mvp-xf6361/efile-documents/ --recursive +awslocal s3 ls s3://litefile-staging/efile-documents/ --recursive ``` Also make sure that `AWS_S3_ENDPOINT_URL = "http://host.docker.internal:4566"` and `AWS_ACCOUNT_ID_ENDPOINT_MODE = "disabled"` in your env. diff --git a/testing/localstack-init/ready.d/01-create-s3-bucket.sh b/testing/localstack-init/ready.d/01-create-s3-bucket.sh index d632fb1..f097430 100755 --- a/testing/localstack-init/ready.d/01-create-s3-bucket.sh +++ b/testing/localstack-init/ready.d/01-create-s3-bucket.sh @@ -3,6 +3,6 @@ set -e awslocal s3api create-bucket \ - --bucket "${AWS_S3_BUCKET_NAME:-forms-mvp-xf6361}" \ + --bucket "${AWS_S3_BUCKET_NAME:-litefile-staging}" \ --region "${AWS_DEFAULT_REGION:-us-east-1}" \ 2>/dev/null || true