Compare commits

..
Author SHA1 Message Date
ishan-karmakar 2700e62935 Remove unnecessary landing page port expose
CI / Test Suite (push) Has been cancelled
CI / Lint & Type Check (push) Has been cancelled
Docker Build and Publish / prepare (push) Has been cancelled
Docker Build and Publish / build (linux/amd64, ubuntu-latest) (push) Has been cancelled
Docker Build and Publish / build (linux/arm64, ubuntu-24.04-arm) (push) Has been cancelled
Docker Build and Publish / merge (push) Has been cancelled
Release Please / release-please (push) Has been cancelled
2026-06-06 10:51:50 -05:00
ishan-karmakar 517b93cc95 Update docker-compose for our purposes
CI / Test Suite (push) Waiting to run
CI / Lint & Type Check (push) Waiting to run
Docker Build and Publish / prepare (push) Waiting to run
Docker Build and Publish / build (linux/amd64, ubuntu-latest) (push) Blocked by required conditions
Docker Build and Publish / build (linux/arm64, ubuntu-24.04-arm) (push) Blocked by required conditions
Docker Build and Publish / merge (push) Blocked by required conditions
Release Please / release-please (push) Waiting to run
2026-06-06 10:25:13 -05:00
Dries Augustyns 8e3fb9595d tests: prevent race condition by inserting RUNNING execution directly 2026-05-27 18:14:29 +02:00
Dries Augustyns 58be4abc31 tests: prevent race condition by inserting RUNNING execution directly 2026-05-27 18:08:13 +02:00
Dries Augustyns 480f0c1034 tests: refactor request logger tests to use helper functions for async logging verification 2026-05-27 18:01:56 +02:00
6 changed files with 69 additions and 163 deletions
+1 -1
View File
@@ -1,3 +1,3 @@
{ {
".": "0.12.0" ".": "0.11.0"
} }
-42
View File
@@ -1,47 +1,5 @@
# Changelog # Changelog
## [0.12.0](https://github.com/useplunk/plunk/compare/v0.11.0...v0.12.0) (2026-05-27)
### Features
* add disabledReason field to projects for better tracking of disable reasons ([94ceadb](https://github.com/useplunk/plunk/commit/94ceadbbe417f0cb3ab72c66bfad9428bdce2d11))
* **api:** allow API key authentication for domain endpoints ([d2496bc](https://github.com/useplunk/plunk/commit/d2496bc51d17657380160dbfc20e099d3f4eadba))
* **contacts:** make email cell a link to the contact detail page ([6759bff](https://github.com/useplunk/plunk/commit/6759bffd2a1f0bfb09b754bb0efdfe5c347ea2b3))
* **contacts:** make email cell a link to the contact detail page ([6d98d51](https://github.com/useplunk/plunk/commit/6d98d512222ffb422bc2a4bef4284a644558b39d))
* **EmailService:** add worker concurrency settings and improve email queue prioritization ([80beb2b](https://github.com/useplunk/plunk/commit/80beb2bb9937101d1723f2d54648060fdcbe6cef))
* make detectCustomHtmlPatterns aware of TipTap's actual capabilities ([9797aed](https://github.com/useplunk/plunk/commit/9797aed47f520aba51bec4e09c9bc4b7762e02f8))
* make detectCustomHtmlPatterns aware of TipTap's actual capabilities ([ba3813e](https://github.com/useplunk/plunk/commit/ba3813e2422d9fe4e252a90242393cada65644dc))
* render template variables in WEBHOOK step url, headers and body ([bfecf04](https://github.com/useplunk/plunk/commit/bfecf04fa38309804ee19e99b9908caf51c5e039))
* render template variables in WEBHOOK step url, headers and body ([c484da8](https://github.com/useplunk/plunk/commit/c484da88ab7b4635987868e2e3c6fdded68ade8c))
* **SecurityService:** enhance phishing detection by verifying sender domains and institutional TLDs ([6ab4d77](https://github.com/useplunk/plunk/commit/6ab4d77ca9bebd01f75d8799dad23fdec7768b52))
* **SecurityService:** enhance phishing detection by verifying sender domains and institutional TLDs ([edfc399](https://github.com/useplunk/plunk/commit/edfc399061cb7fd079b7f11167a2796df766d8ac))
* **tests:** enhance test database setup and cleanup for improved isolation and performance ([32dd7bb](https://github.com/useplunk/plunk/commit/32dd7bba462a6f4a13d59b8fb03708f971d1eff0))
### Bug Fixes
* coerce boolean and numeric values in custom CSV columns ([4a145f3](https://github.com/useplunk/plunk/commit/4a145f3488bee63c2d82a4a477f6dfaaaaede64b))
* **filters:** land templates/workflows/campaigns search inputs at 32px to match filter buttons ([283f402](https://github.com/useplunk/plunk/commit/283f40239dcc81e78d35b39cb9b31f97b435b8d7))
* make email templates, campaigns and workflow search inputs same height as the rest of the app ([8b3657d](https://github.com/useplunk/plunk/commit/8b3657d056938b17f0634c0fe8d664ae1e07cd73))
### Code Refactoring
* **database:** increase Prisma connection pool limits for improved test performance ([71e2277](https://github.com/useplunk/plunk/commit/71e227764319e6fc732aefdebd11f3e844257ef6))
* **SecurityService:** update absolute count ceilings for new projects to improve spam detection ([4de40f4](https://github.com/useplunk/plunk/commit/4de40f40fa300c9e9ed2ed35f367ca4cd601f309))
### Documentation
* add env-var sync rule to CLAUDE.md ([a348d37](https://github.com/useplunk/plunk/commit/a348d37c21ecf1d57845f31210f66a8113fadb8d))
* add new recipe pages for waitlist and sync unsubscribes ([01ec34a](https://github.com/useplunk/plunk/commit/01ec34a8cbbe0f4a158398c0eb8300d847bc29ab))
* correct PHISHING_CONFIDENCE_THRESHOLD default in CLAUDE.md ([5c16679](https://github.com/useplunk/plunk/commit/5c166797b57f2e7b714957824ee1acdcb22c05f2))
* **env:** add wiki-documented vars to apps/api/.env.example ([81315ea](https://github.com/useplunk/plunk/commit/81315eac8eb32a7d2e61617c6a84f349afaf7860))
* **env:** sync .env.self-host.example with missing variables ([1c1c95d](https://github.com/useplunk/plunk/commit/1c1c95d332fb9ab6c2f926f6d51071cfb245ed86))
* **env:** sync env example files, fix CLAUDE.md drift, add process rule ([6ebbb50](https://github.com/useplunk/plunk/commit/6ebbb50f6817f1354f26cc7734631d3b6ded32ed))
* **wiki:** document MAIL_FROM_SUBDOMAIN and NGINX_PORT env vars ([971b98a](https://github.com/useplunk/plunk/commit/971b98a4cc6145571204f5a4ad794aa3d09ea71c))
## [0.11.0](https://github.com/useplunk/plunk/compare/v0.10.0...v0.11.0) (2026-05-13) ## [0.11.0](https://github.com/useplunk/plunk/compare/v0.10.0...v0.11.0) (2026-05-13)
@@ -3,6 +3,20 @@ import type {NextFunction, Request, Response} from 'express';
import {databaseRequestLogger} from '../requestLogger.js'; import {databaseRequestLogger} from '../requestLogger.js';
import {factories, getPrismaClient} from '../../../../../test/helpers'; import {factories, getPrismaClient} from '../../../../../test/helpers';
async function waitForLog(prisma: ReturnType<typeof getPrismaClient>, id: string, timeoutMs = 2000) {
const deadline = Date.now() + timeoutMs;
while (Date.now() < deadline) {
const record = await prisma.apiRequest.findUnique({where: {id}});
if (record) return record;
await new Promise(resolve => setTimeout(resolve, 20));
}
return prisma.apiRequest.findUnique({where: {id}});
}
async function waitForNoLog(ms = 200) {
await new Promise(resolve => setTimeout(resolve, ms));
}
describe('Request Logger Middleware', () => { describe('Request Logger Middleware', () => {
const prisma = getPrismaClient(); const prisma = getPrismaClient();
let req: Partial<Request>; let req: Partial<Request>;
@@ -77,13 +91,7 @@ describe('Request Logger Middleware', () => {
const responseBody = {success: true, data: {id: '123'}}; const responseBody = {success: true, data: {id: '123'}};
await res.json!(responseBody); await res.json!(responseBody);
// Wait for async logging to complete const loggedRequest = await waitForLog(prisma, 'test-request-id-123');
await new Promise(resolve => setTimeout(resolve, 100));
// Verify database record was created
const loggedRequest = await prisma.apiRequest.findUnique({
where: {id: 'test-request-id-123'},
});
expect(loggedRequest).toBeDefined(); expect(loggedRequest).toBeDefined();
expect(loggedRequest?.method).toBe('POST'); expect(loggedRequest?.method).toBe('POST');
@@ -109,11 +117,7 @@ describe('Request Logger Middleware', () => {
const responseBody = {success: true}; const responseBody = {success: true};
await res.json!(responseBody); await res.json!(responseBody);
await new Promise(resolve => setTimeout(resolve, 100)); const loggedRequest = await waitForLog(prisma, 'public-request-id');
const loggedRequest = await prisma.apiRequest.findUnique({
where: {id: 'public-request-id'},
});
expect(loggedRequest).toBeDefined(); expect(loggedRequest).toBeDefined();
expect(loggedRequest?.projectId).toBeNull(); expect(loggedRequest?.projectId).toBeNull();
@@ -131,11 +135,7 @@ describe('Request Logger Middleware', () => {
await res.json!({success: true}); await res.json!({success: true});
await new Promise(resolve => setTimeout(resolve, 100)); const loggedRequest = await waitForLog(prisma, 'test-request-id-123');
const loggedRequest = await prisma.apiRequest.findUnique({
where: {id: 'test-request-id-123'},
});
// Allow for timer imprecision (especially in CI environments) // Allow for timer imprecision (especially in CI environments)
expect(loggedRequest?.duration).toBeGreaterThanOrEqual(45); expect(loggedRequest?.duration).toBeGreaterThanOrEqual(45);
@@ -162,11 +162,7 @@ describe('Request Logger Middleware', () => {
await res.json!(errorResponse); await res.json!(errorResponse);
await new Promise(resolve => setTimeout(resolve, 100)); const loggedRequest = await waitForLog(prisma, 'test-request-id-123');
const loggedRequest = await prisma.apiRequest.findUnique({
where: {id: 'test-request-id-123'},
});
expect(loggedRequest).toBeDefined(); expect(loggedRequest).toBeDefined();
expect(loggedRequest?.statusCode).toBe(400); expect(loggedRequest?.statusCode).toBe(400);
@@ -189,11 +185,7 @@ describe('Request Logger Middleware', () => {
await res.json!(errorResponse); await res.json!(errorResponse);
await new Promise(resolve => setTimeout(resolve, 100)); const loggedRequest = await waitForLog(prisma, 'test-request-id-123');
const loggedRequest = await prisma.apiRequest.findUnique({
where: {id: 'test-request-id-123'},
});
expect(loggedRequest?.statusCode).toBe(500); expect(loggedRequest?.statusCode).toBe(500);
expect(loggedRequest?.errorCode).toBe('INTERNAL_SERVER_ERROR'); expect(loggedRequest?.errorCode).toBe('INTERNAL_SERVER_ERROR');
@@ -209,11 +201,7 @@ describe('Request Logger Middleware', () => {
error: {code: 'RESOURCE_NOT_FOUND', message: 'Template not found'}, error: {code: 'RESOURCE_NOT_FOUND', message: 'Template not found'},
}); });
await new Promise(resolve => setTimeout(resolve, 100)); const loggedRequest = await waitForLog(prisma, 'test-request-id-123');
const loggedRequest = await prisma.apiRequest.findUnique({
where: {id: 'test-request-id-123'},
});
expect(loggedRequest?.statusCode).toBe(404); expect(loggedRequest?.statusCode).toBe(404);
expect(loggedRequest?.errorCode).toBe('RESOURCE_NOT_FOUND'); expect(loggedRequest?.errorCode).toBe('RESOURCE_NOT_FOUND');
@@ -306,11 +294,8 @@ describe('Request Logger Middleware', () => {
databaseRequestLogger(req as Request, res as Response, next); databaseRequestLogger(req as Request, res as Response, next);
await res.json!({success: true}); await res.json!({success: true});
await new Promise(resolve => setTimeout(resolve, 100));
const loggedRequest = await prisma.apiRequest.findUnique({ const loggedRequest = await waitForLog(prisma, `log-${path.replace(/\//g, '-')}`);
where: {id: `log-${path.replace(/\//g, '-')}`},
});
expect(loggedRequest).toBeDefined(); expect(loggedRequest).toBeDefined();
expect(loggedRequest?.path).toBe(path); expect(loggedRequest?.path).toBe(path);
@@ -352,17 +337,18 @@ describe('Request Logger Middleware', () => {
await res.json!({success: true}); await res.json!({success: true});
await new Promise(resolve => setTimeout(resolve, 100)); // Should create a record with generated UUID — poll for it
const deadline = Date.now() + 2000;
// Should create a record with generated UUID let allRequests: Awaited<ReturnType<typeof prisma.apiRequest.findMany>> = [];
const allRequests = await prisma.apiRequest.findMany({ while (Date.now() < deadline) {
where: { allRequests = await prisma.apiRequest.findMany({
path: '/v1/send', where: {path: '/v1/send', method: 'POST'},
method: 'POST',
},
orderBy: {createdAt: 'desc'}, orderBy: {createdAt: 'desc'},
take: 1, take: 1,
}); });
if (allRequests.length > 0) break;
await new Promise(resolve => setTimeout(resolve, 20));
}
expect(allRequests.length).toBeGreaterThan(0); expect(allRequests.length).toBeGreaterThan(0);
expect(allRequests[0].id).toBeDefined(); expect(allRequests[0].id).toBeDefined();
@@ -418,11 +404,8 @@ describe('Request Logger Middleware', () => {
databaseRequestLogger(reqWithSize as Request, resWithId as Response, next); databaseRequestLogger(reqWithSize as Request, resWithId as Response, next);
await resWithId.json!({success: true}); await resWithId.json!({success: true});
await new Promise(resolve => setTimeout(resolve, 100));
const loggedRequest = await prisma.apiRequest.findUnique({ const loggedRequest = await waitForLog(prisma, 'test-size-5000');
where: {id: 'test-size-5000'},
});
expect(loggedRequest?.requestSize).toBe(5000); expect(loggedRequest?.requestSize).toBe(5000);
}); });
@@ -445,11 +428,8 @@ describe('Request Logger Middleware', () => {
databaseRequestLogger(reqNoSize as Request, resWithId as Response, next); databaseRequestLogger(reqNoSize as Request, resWithId as Response, next);
await resWithId.json!({success: true}); await resWithId.json!({success: true});
await new Promise(resolve => setTimeout(resolve, 100));
const loggedRequest = await prisma.apiRequest.findUnique({ const loggedRequest = await waitForLog(prisma, 'test-no-size');
where: {id: 'test-no-size'},
});
expect(loggedRequest?.requestSize).toBeNull(); expect(loggedRequest?.requestSize).toBeNull();
}); });
@@ -474,11 +454,8 @@ describe('Request Logger Middleware', () => {
}; };
await resLarge.json!(largeResponse); await resLarge.json!(largeResponse);
await new Promise(resolve => setTimeout(resolve, 100));
const loggedRequest = await prisma.apiRequest.findUnique({ const loggedRequest = await waitForLog(prisma, 'test-large-response');
where: {id: 'test-large-response'},
});
const expectedSize = JSON.stringify(largeResponse).length; const expectedSize = JSON.stringify(largeResponse).length;
expect(loggedRequest?.responseSize).toBe(expectedSize); expect(loggedRequest?.responseSize).toBe(expectedSize);
@@ -758,8 +758,20 @@ describe('WorkflowService', () => {
}); });
const contact = await factories.createContact({projectId}); const contact = await factories.createContact({projectId});
// Start first execution (still running) // Insert a RUNNING execution directly to avoid racing with the background
await WorkflowService.startExecution(projectId, workflow.id, contact.id); // step processor that startExecution kicks off (a trigger-only workflow can
// transition to COMPLETED before the second call observes it as RUNNING).
const triggerStep = await prisma.workflowStep.findFirst({
where: {workflowId: workflow.id, type: WorkflowStepType.TRIGGER},
});
await prisma.workflowExecution.create({
data: {
workflowId: workflow.id,
contactId: contact.id,
status: WorkflowExecutionStatus.RUNNING,
currentStepId: triggerStep?.id,
},
});
// Second execution should fail (first still running) // Second execution should fail (first still running)
await expect(WorkflowService.startExecution(projectId, workflow.id, contact.id)).rejects.toThrow( await expect(WorkflowService.startExecution(projectId, workflow.id, contact.id)).rejects.toThrow(
+17 -58
View File
@@ -27,39 +27,6 @@ services:
# Infrastructure Services # Infrastructure Services
# ============================================ # ============================================
postgres:
image: postgres:16-alpine
container_name: plunk-postgres
restart: unless-stopped
environment:
POSTGRES_DB: plunk
POSTGRES_USER: plunk
POSTGRES_PASSWORD: ${DB_PASSWORD:-changeme123}
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U plunk" ]
interval: 10s
timeout: 5s
retries: 5
networks:
- plunk
redis:
image: redis:7-alpine
container_name: plunk-redis
restart: unless-stopped
command: redis-server --appendonly yes
volumes:
- redis_data:/data
healthcheck:
test: [ "CMD", "redis-cli", "ping" ]
interval: 10s
timeout: 5s
retries: 5
networks:
- plunk
minio: minio:
image: minio/minio:latest image: minio/minio:latest
container_name: plunk-minio container_name: plunk-minio
@@ -70,10 +37,10 @@ services:
MINIO_ROOT_PASSWORD: ${MINIO_ROOT_PASSWORD:-plunkminiopass} MINIO_ROOT_PASSWORD: ${MINIO_ROOT_PASSWORD:-plunkminiopass}
volumes: volumes:
- minio_data:/data - minio_data:/data
ports: # ports:
# Expose Minio API (for S3 operations) and Console (for web UI) # # Expose Minio API (for S3 operations) and Console (for web UI)
- "${MINIO_API_PORT:-9000}:9000" # - "${MINIO_API_PORT:-9000}:9000"
- "${MINIO_CONSOLE_PORT:-9001}:9001" # - "${MINIO_CONSOLE_PORT:-9001}:9001"
healthcheck: healthcheck:
test: [ "CMD", "curl", "-f", "http://localhost:9000/minio/health/live" ] test: [ "CMD", "curl", "-f", "http://localhost:9000/minio/health/live" ]
interval: 30s interval: 30s
@@ -88,13 +55,13 @@ services:
restart: unless-stopped restart: unless-stopped
command: serve command: serve
environment: environment:
- TZ=UTC - TZ=CST
volumes: volumes:
- ntfy_cache:/var/cache/ntfy - ntfy_cache:/var/cache/ntfy
- ntfy_etc:/etc/ntfy - ntfy_etc:/etc/ntfy
ports: # ports:
# Expose ntfy web UI and API # # Expose ntfy web UI and API
- "${NTFY_PORT:-8080}:80" # - "${NTFY_PORT:-8080}:80"
healthcheck: healthcheck:
test: [ "CMD-SHELL", "wget -q --tries=1 http://localhost:80/v1/health -O - | grep -Eo '\"healthy\"\\s*:\\s*true' || exit 1" ] test: [ "CMD-SHELL", "wget -q --tries=1 http://localhost:80/v1/health -O - | grep -Eo '\"healthy\"\\s*:\\s*true' || exit 1" ]
interval: 30s interval: 30s
@@ -118,11 +85,11 @@ services:
NODE_ENV: production NODE_ENV: production
# Database # Database
DATABASE_URL: postgresql://plunk:${DB_PASSWORD:-changeme123}@postgres:5432/plunk DATABASE_URL: ${DATABASE_URL}
DIRECT_DATABASE_URL: postgresql://plunk:${DB_PASSWORD:-changeme123}@postgres:5432/plunk DIRECT_DATABASE_URL: ${DIRECT_DATABASE_URL}
# Redis # Redis
REDIS_URL: redis://redis:6379 REDIS_URL: ${REDIS_URL}
# Security # Security
JWT_SECRET: ${JWT_SECRET} JWT_SECRET: ${JWT_SECRET}
@@ -214,19 +181,15 @@ services:
ports: ports:
# SMTP ports (for email relay) # SMTP ports (for email relay)
- "${PORT_SECURE:-465}:465" # SMTPS (implicit TLS) # - "${PORT_SECURE:-465}:465" # SMTPS (implicit TLS)
- "${PORT_SUBMISSION:-587}:587" # SMTP Submission (STARTTLS) # - "${PORT_SUBMISSION:-587}:587" # SMTP Submission (STARTTLS)
# Optional: Expose individual service ports for debugging # Optional: Expose individual service ports for debugging
# - "8080:8080" # API - "6000:8080" # API
# - "3000:3000" # Web - "6001:3000" # Web
# - "4000:4000" # Landing # - "6002:4000" # Landing
# - "1000:1000" # Wiki # - "6003:1000" # Wiki
depends_on: depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
minio: minio:
condition: service_healthy condition: service_healthy
ntfy: ntfy:
@@ -244,10 +207,6 @@ services:
- plunk - plunk
volumes: volumes:
postgres_data:
driver: local
redis_data:
driver: local
minio_data: minio_data:
driver: local driver: local
plunk_data: plunk_data:
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "plunk", "name": "plunk",
"version": "0.12.0", "version": "0.11.0",
"private": true, "private": true,
"scripts": { "scripts": {
"build": "turbo build", "build": "turbo build",