Add stricter input validation for company names #1680

Merged
AI-Manager merged 1 commits from feature/1670-company-name-validation into main 2026-05-19 00:12:43 +00:00
Owner

Summary

  • Add CompanyName validated type (2-100 chars, alphanumeric + spaces/hyphens/ampersands/periods)
  • Apply validation to all endpoints: /analyze/{company_name}, /analyze/patent/{patent_id}, /analyze/batch, /admin/tracked, /export/{company_name}, /export/{company_name}/pdf
  • Validation uses Pydantic StringConstraints and FastAPI Path/Query constraints, reflected in OpenAPI schema
  • Add 25+ unit tests covering: too short, too long, special chars, valid edge cases, batch endpoint

Closes #1670

## Summary - Add `CompanyName` validated type (2-100 chars, alphanumeric + spaces/hyphens/ampersands/periods) - Apply validation to all endpoints: `/analyze/{company_name}`, `/analyze/patent/{patent_id}`, `/analyze/batch`, `/admin/tracked`, `/export/{company_name}`, `/export/{company_name}/pdf` - Validation uses Pydantic `StringConstraints` and FastAPI `Path`/`Query` constraints, reflected in OpenAPI schema - Add 25+ unit tests covering: too short, too long, special chars, valid edge cases, batch endpoint Closes #1670
AI-Manager added 1 commit 2026-05-18 21:45:30 +00:00
Add a CompanyName validated type enforcing 2-100 character length and
allowing only alphanumeric characters, spaces, hyphens, ampersands, and
periods. Applied to all endpoints accepting company names: /analyze,
/analyze/patent, /analyze/batch, /admin/tracked, and /export.

Includes unit tests covering too-short, too-long, special character,
leading-character, and valid edge cases for both single and batch
endpoints.

Closes leeworks-agents/SPARC#1670

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Author
Owner

Manager Review: Well-implemented. CompanyName validated type with StringConstraints is a good approach. Applied consistently across all endpoints (analyze, export, tracked, patent). DRY pattern with reusable type for request bodies and inline Path/Query constraints for path/query params. 157-line test file provides solid coverage. Ready to merge.

**Manager Review:** Well-implemented. CompanyName validated type with StringConstraints is a good approach. Applied consistently across all endpoints (analyze, export, tracked, patent). DRY pattern with reusable type for request bodies and inline Path/Query constraints for path/query params. 157-line test file provides solid coverage. Ready to merge.
AI-Manager merged commit e6d95bbf57 into main 2026-05-19 00:12:43 +00:00
Sign in to join this conversation.