ENG-3768: Add access package review model and status#8183
Conversation
Add the data model foundation for access packages: - Add `awaiting_access_review` status to PrivacyRequestStatus enum and ACTIVE_REQUEST_STATUSES - Create AccessPackageReview ORM model (1:1 with PrivacyRequest) for storing redactions and approval metadata - Add Alembic migration for enum value and new table - Add `accessPackages` feature flag to flags.json Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub. 2 Skipped Deployments
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8183 +/- ##
=======================================
Coverage 85.64% 85.65%
=======================================
Files 662 663 +1
Lines 42978 42995 +17
Branches 5030 5030
=======================================
+ Hits 36809 36826 +17
Misses 5063 5063
Partials 1106 1106 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Add the new status to all exhaustive TS status maps so they don't break when the OpenAPI types are next regenerated: - PrivacyRequestStatus enum (admin-ui) - RequestStatusBadge statusPropMap - cells.tsx statusPropMap - constants.ts SubjectRequestStatusMap - helpers.ts AVAILABLE_ACTIONS_BY_STATUS (delete only) Also remove unused func import from AccessPackageReview model. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add data category annotations for the new table so the dataset scan passes cleanly. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
/code-review |
There was a problem hiding this comment.
Code Review — ENG-3768: Add access package review model and status
This is a clean, well-scoped PR1-of-5 that lays the data model foundation without exposing any user-facing behaviour yet. The migration, ORM model, schema enum, and frontend status maps all hang together correctly. A few things worth addressing before or alongside the follow-up PRs:
Notable findings
1. Missing ORM relationship() (inline comment on access_package_review.py)
The model defines the FK column but no SQLAlchemy relationship. Every subsequent PR that reads/writes via the ORM will need it, and retrofitting it then means also touching PrivacyRequest for back_populates. Easier to define it now while the context is fresh.
2. ACTIONED_REQUEST_STATUSES gap in duplicate detection (inline comment on duplication_detection.py)
awaiting_access_review is not in ACTIONED_REQUEST_STATUSES. Once the transition hook is wired up, a second identical submission could slip through duplicate detection rather than being blocked. pending_external (a comparable "actively waiting" state) is included — awaiting_access_review should be too. Track this as a known gap even if fixed in a follow-up.
3. ALTER TYPE … ADD VALUE is not transactional in PostgreSQL (inline comment on migration)
If the CREATE TABLE step fails after the enum DDL succeeds, a rollback won't undo the enum change. The IF NOT EXISTS guard handles clean reruns, but a partial failure leaves the schema in an inconsistent state. Worth checking whether the codebase's other enum migrations use a COMMIT-before-CREATE TABLE pattern and matching it.
4. created_at / updated_at nullable in migration (inline comment)
Both columns are nullable=True in the migration DDL. Minor, but adding nullable=False (with server_default still set) would match what other tables in this repo do and give an extra DB-level safety net.
What looks good
- Unique index on
privacy_request_idcorrectly enforces the 1:1 relationship at the DB level. MutableDict.as_mutable(JSONB)onredactionsis the right pattern for change-tracking.- Downgrade correctly drops the table and documents why the enum value stays (PostgreSQL limitation).
awaiting_access_reviewcorrectly included inACTIVE_REQUEST_STATUSESand all frontend exhaustive maps.- Feature flag
test: falseis appropriate for an inert status with no wired-up logic yet. @declared_attr __tablename__pattern matches theBaseclass convention used throughout the codebase.
🔬 Codegraph: connected (49962 nodes)
💡 Write /code-review in a comment to re-run this review.
Update access_package_review migration down_revision from 5f9821b4baf1 to 9f21507db078 (add_group_id_to_monitortask) to resolve multiple heads. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Add access_package_approved and access_package_redacted to AuditLogAction enum - Add display names for new actions - Add ALTER TYPE to migration Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Add access_package_approved and access_package_redacted to AuditLogAction enum - Add display names for new actions - Add ALTER TYPE to migration upgrade - Add proper enum recreation in migration downgrade for both auditlogaction and privacyrequeststatus Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Code Review: ENG-3768 — Add access package review model and statusPR #8183 · SummaryPR 1 of 5 for the access packages feature. It lays the data model foundation: a new 🚨 Critical Issues (Must Fix)None.
|
Ticket ENG-3768
Description Of Changes
PR 1 of 5 for access packages (production merge plan). Lays the data model foundation — the enum value is inert and the table is empty until subsequent PRs wire up the hook points and business logic.
Code Changes
awaiting_access_reviewstatus toPrivacyRequestStatusenum andACTIVE_REQUEST_STATUSESAccessPackageReviewORM model (1:1 with PrivacyRequest) for storing redactions and approval metadataaccessPackagesfeature flag toflags.jsonSteps to Confirm
Pre-Merge Checklist
CHANGELOG.mdupdatedmaindowngrade()migration is correct and works