Working through the audit-v2 deferred backlog. Each round was tested
(typecheck + 1168/1168 vitest) before moving on.
Round 1 — DB performance + AI cost visibility:
- Add missing FK indexes Postgres doesn't auto-create on
berth_reservations.{interest_id, contract_file_id},
documents.{file_id, signed_file_id}, document_events.signer_id,
document_templates.source_file_id, form_submissions.{form_template_id,
client_id}, document_sends.{brochure_id, brochure_version_id,
sent_by_user_id}. Without these, RESTRICT-checks on parent delete +
reverse-lookups walk the child tables fully. Migration 0037.
- AI worker now writes one ai_usage_ledger row per OpenAI call so admins
can audit spend per port/user/feature and future per-port budgets have
history to read from. Failure to write is logged-not-thrown so the
user-facing email draft is unaffected.
Round 2 — Boot-time + transport hardening:
- S3 backend verifies the bucket exists at startup (or auto-creates
when MINIO_AUTO_CREATE_BUCKET=true). A typo'd bucket name now
surfaces with a clear boot error instead of a vague Minio error
inside the first user-facing request.
- Documenso v1 placeFields: 3-attempt exponential-backoff retry on 5xx
+ network errors, fail-fast on 4xx. Stops one transient flake from
leaving a document with a partial field set.
- FilesystemBackend logs a structured warn-once at boot when the dev
HMAC fallback is in effect, so two processes started with different
BETTER_AUTH_SECRET values are observable (random 401s on file
downloads otherwise).
- Logger redact paths extended to cover *.headers.{authorization,
cookie}, *.config.headers.authorization, encrypted-credential blobs
(secretKeyEncrypted, smtpPassEncrypted, etc.), the Documenso
X-Documenso-Secret header, and 2-level nested forms.
Round 3 — UI feedback + permission gates:
- Storage admin migrate dialog: success toast with row count + error
toast on both dryRun and migrate mutations.
- Invoice detail Send + Record-payment buttons wrapped in
PermissionGate (invoices.send / invoices.record_payment); both
mutations now toast on success/error.
- Admin user list Edit button wrapped in PermissionGate(admin.manage_users).
- Scan-receipt page surfaces an amber warning when OCR fails so reps
know they can fill the form manually instead of staring at a stalled
spinner; the editable form now also opens on scanMutation.isError
/ uploadedFile, not only on success.
- Email threads list now renders skeleton rows during load + shared
EmptyState for the empty case (was a single "Loading…" line).
Round 4 — Service / route correctness:
- documentSends.sent_by_user_id was a free-text NOT NULL column with no
FK. Now nullable + FK to user(id) ON DELETE SET NULL so the audit row
survives a user being hard-deleted. Migration 0038 with a defensive
null-out for any orphan ids before attaching the constraint.
- Saved-views route: documented why withAuth alone is correct (the
service strictly filters by (portId, userId) — owner-only by design).
- Public-interests audit log: replaced "userId: null as unknown as
string" cast with userId: null; AuditLogParams already accepts null
for system-generated events.
- EOI in-app PDF fill: extracted setBerthRange() that, when the
AcroForm field is missing AND the context has a non-empty range
string, logs a structured warn so the deployment gap (live Documenso
template needs the field) is observable instead of silently dropping
the multi-berth range.
Test status: 1168/1168 vitest. tsc clean. Two new migrations
(0037/0038) need pnpm db:push (or migration apply) on the dev DB.
Deferred-doc updated with the remaining open items (bigger refactors).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
280 lines
5.8 KiB
JSON
280 lines
5.8 KiB
JSON
{
|
|
"version": "7",
|
|
"dialect": "postgresql",
|
|
"entries": [
|
|
{
|
|
"idx": 0,
|
|
"version": "7",
|
|
"when": 1776185027494,
|
|
"tag": "0000_narrow_longshot",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 1,
|
|
"version": "7",
|
|
"when": 1776185487775,
|
|
"tag": "0001_soft_ender_wiggin",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 2,
|
|
"version": "7",
|
|
"when": 1776958500747,
|
|
"tag": "0002_groovy_excalibur",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 3,
|
|
"version": "7",
|
|
"when": 1776959610819,
|
|
"tag": "0003_opposite_lucky_pierre",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 4,
|
|
"version": "7",
|
|
"when": 1776959707066,
|
|
"tag": "0004_nasty_warstar",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 5,
|
|
"version": "7",
|
|
"when": 1776959832091,
|
|
"tag": "0005_stale_kronos",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 6,
|
|
"version": "7",
|
|
"when": 1776959911400,
|
|
"tag": "0006_great_pixie",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 7,
|
|
"version": "7",
|
|
"when": 1776959993173,
|
|
"tag": "0007_brainy_felicia_hardy",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 8,
|
|
"version": "7",
|
|
"when": 1777204563579,
|
|
"tag": "0008_loud_ikaris",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 9,
|
|
"version": "7",
|
|
"when": 1777210206070,
|
|
"tag": "0009_outgoing_rumiko_fujikawa",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 10,
|
|
"version": "7",
|
|
"when": 1777303428222,
|
|
"tag": "0010_brave_joshua_kane",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 11,
|
|
"version": "7",
|
|
"when": 1777307410311,
|
|
"tag": "0011_red_cargill",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 12,
|
|
"version": "7",
|
|
"when": 1777308900666,
|
|
"tag": "0012_large_zarda",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 13,
|
|
"version": "7",
|
|
"when": 1777334766194,
|
|
"tag": "0013_abnormal_thundra",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 14,
|
|
"version": "7",
|
|
"when": 1777379952283,
|
|
"tag": "0014_black_banshee",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 15,
|
|
"version": "7",
|
|
"when": 1777391373291,
|
|
"tag": "0015_i18n_columns",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 16,
|
|
"version": "7",
|
|
"when": 1777395538988,
|
|
"tag": "0016_magical_spyke",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 17,
|
|
"version": "7",
|
|
"when": 1777398450555,
|
|
"tag": "0017_tiny_mercury",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 18,
|
|
"version": "7",
|
|
"when": 1777399135032,
|
|
"tag": "0018_stormy_spencer_smythe",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 19,
|
|
"version": "7",
|
|
"when": 1777671562738,
|
|
"tag": "0019_lazy_vampiro",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 20,
|
|
"version": "7",
|
|
"when": 1777811835982,
|
|
"tag": "0020_unusual_azazel",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 21,
|
|
"version": "7",
|
|
"when": 1777812671833,
|
|
"tag": "0021_magenta_madame_hydra",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 22,
|
|
"version": "7",
|
|
"when": 1777814682110,
|
|
"tag": "0022_medical_betty_brant",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 23,
|
|
"version": "7",
|
|
"when": 1777927586934,
|
|
"tag": "0023_omniscient_reaper",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 24,
|
|
"version": "7",
|
|
"when": 1777938954111,
|
|
"tag": "0024_normalize_mooring_numbers",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 25,
|
|
"version": "7",
|
|
"when": 1777939212954,
|
|
"tag": "0025_berth_pricing_columns",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 26,
|
|
"version": "7",
|
|
"when": 1777939906731,
|
|
"tag": "0026_client_contacts_one_primary_per_channel",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 27,
|
|
"version": "7",
|
|
"when": 1777939914252,
|
|
"tag": "0027_backfill_nationality_iso_from_phone",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 28,
|
|
"version": "7",
|
|
"when": 1777940421236,
|
|
"tag": "0028_interest_berths_junction",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 29,
|
|
"version": "7",
|
|
"when": 1777941465866,
|
|
"tag": "0029_puzzling_romulus",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 30,
|
|
"version": "7",
|
|
"when": 1777944021221,
|
|
"tag": "0030_berth_pdf_versions",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 31,
|
|
"version": "7",
|
|
"when": 1777944191753,
|
|
"tag": "0031_brochures_and_document_sends",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 32,
|
|
"version": "7",
|
|
"when": 1777946048910,
|
|
"tag": "0032_brochures_one_default_per_port_and_storage_fixes",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 33,
|
|
"version": "7",
|
|
"when": 1777948521076,
|
|
"tag": "0033_expense_no_receipt_acknowledged",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 34,
|
|
"version": "7",
|
|
"when": 1778000000000,
|
|
"tag": "0034_normalize_mooring_numbers_broaden",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 35,
|
|
"version": "7",
|
|
"when": 1778050000000,
|
|
"tag": "0035_document_sends_preserve_audit_on_parent_delete",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 36,
|
|
"version": "7",
|
|
"when": 1778100000000,
|
|
"tag": "0036_polymorphic_check_constraints",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 37,
|
|
"version": "7",
|
|
"when": 1778150000000,
|
|
"tag": "0037_missing_fk_indexes",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 38,
|
|
"version": "7",
|
|
"when": 1778200000000,
|
|
"tag": "0038_document_sends_sent_by_user_fk",
|
|
"breakpoints": true
|
|
}
|
|
]
|
|
}
|