chore(autonomous-session): consolidate uncommitted work from prior session

Bundles the prior autonomous-session output that was sitting unstaged:

- Em-dash sweep across src/ + tests/ (en-dash/em-dash to hyphen, ~2280 instances)
- country-flag-icons rollout (CountryFlag component, replaces emoji glyphs that
  never rendered on Windows; lazy-loads the 3x2 SVG index as a single chunk
  after the per-subpath dynamic-import approach silently failed in webpack)
- Admin IA Phase 1+2: 7-domain regroup, 41 to 38 pages, /admin/berths index,
  redirects (ocr to ai, reports to dashboard, invitations to users),
  docs/admin-ia-proposal.md
- Per-template email tester (registry + endpoint + UI on Email admin page)
- Cancel-document mode picker (delete-from-Documenso vs keep-for-audit)
- Dashboard PDF report: 25 widgets, SVG charts, date-range picker, 11 resolvers
- Customize-widgets per-region sortables at xl+ (charts/rails/feed); single
  flat sortable below xl when the layout stacks; per-viewport saved orders
- Audit doc updates capturing each shipped item
- Lint fixes: react-compiler immutability in DonutChart (reduce instead of
  let-reassign), set-state-in-effect disables in CountryFlag and
  UploadForSigning preview-bytes effect, unused 'confirm' destructures in
  interest contract + reservation tabs, unescaped apostrophe in test-template
  card copy
This commit is contained in:
2026-05-23 00:52:59 +02:00
parent 43719b49e9
commit 221ae5784e
749 changed files with 7440 additions and 3118 deletions

View File

@@ -8,7 +8,7 @@
*
* External-system cleanup (Documenso envelope void/delete, mass email
* notifications to next-in-line interests) happens AFTER the local
* commit best-effort, queued for retry, never blocks the archive.
* commit - best-effort, queued for retry, never blocks the archive.
*/
import { and, eq, isNull, sql } from 'drizzle-orm';
@@ -44,7 +44,7 @@ export type BerthDecision = {
export type YachtDecision = {
yachtId: string;
action: 'transfer' | 'mark_sold_away' | 'retain';
/** Required when action='transfer' the new owner's client/company id. */
/** Required when action='transfer' - the new owner's client/company id. */
newOwnerType?: 'client' | 'company';
newOwnerId?: string;
};
@@ -52,7 +52,7 @@ export type YachtDecision = {
export type ReservationDecision = {
reservationId: string;
action: 'cancel' | 'transfer';
/** Required when action='transfer' the new client id. */
/** Required when action='transfer' - the new client id. */
transferToClientId?: string;
};
@@ -120,7 +120,7 @@ export interface ArchiveResult {
berthId: string;
mooringNumber: string;
/** Other interests that should be notified about this berth becoming
* available drives the "next in line" notification fire. */
* available - drives the "next in line" notification fire. */
nextInLineInterestIds: string[];
}>;
}
@@ -181,7 +181,7 @@ export async function archiveClientWithDecisions(args: {
// Lock the berth row so a concurrent sale can't flip the status
// between our read of dossier.berths (outside the tx) and our
// write below. Without this lock, A archives client X while B
// sells berth A1 to client Y A's pre-tx read says
// sells berth A1 to client Y - A's pre-tx read says
// status='under_offer', B commits status='sold', A's update
// would flip it back to 'available'.
const [locked] = await tx
@@ -201,7 +201,7 @@ export async function archiveClientWithDecisions(args: {
);
// If no remaining interestBerths row marks this berth as
// is_specific_interest, set the berth status back to available.
// Sold berths are immutable from this flow also re-checked
// Sold berths are immutable from this flow - also re-checked
// against the freshly-locked row, not the pre-tx dossier read.
if (lockedStatus !== 'sold') {
const [stillUnderOffer] = await tx
@@ -319,7 +319,7 @@ export async function archiveClientWithDecisions(args: {
const doc = dossier.documents.find((x) => x.documentId === d.documentId);
if (!doc) continue;
if (d.action === 'void_documenso' && doc.documensoEnvelopeId) {
// Local marker actual API call queued post-commit.
// Local marker - actual API call queued post-commit.
await tx
.update(documents)
.set({ status: 'cancelled', updatedAt: new Date() })
@@ -348,7 +348,7 @@ export async function archiveClientWithDecisions(args: {
persistedDecisions.push({ kind: 'portal_user_revoked', refId: clientId });
}
// Auto-end company memberships (no decision needed preserves history
// Auto-end company memberships (no decision needed - preserves history
// via end_date instead of deleting the membership row).
await tx
.update(companyMemberships)