feat(form-builder): admin UI completion — server filters, KPIs, resource expansion (WS-6 sessie 3c)
Closes the four production gaps that emerged from sessie 3b's admin UI.
What we ship here is final: no further rework planned before production.
Backend
- IndexFailuresRequest validates state/search/failed_at_from/failed_at_to/
listener_class. orgIndex + platformIndex apply them via a single
applyIndexFilters() helper. Search runs case-insensitive `LIKE` on
exception_message; SQL wildcards in user input are escaped.
- New /kpis aggregate endpoint per scope (orgKpis, platformKpis) returns
open / resolved_30d / dismissed_30d / total_submissions in O(1) COUNTs.
Replaces sessie 3b's client-side bucketing of an oversized list.
- Resource expansion: organisation_name, form_schema_label,
resolved_by_user_name, dismissed_by_user_name, exception_trace,
retry_history[]. Eager-loading via indexEagerLoads()/detailEagerLoads()
prevents N+1 (verified by query-count assertion in test).
- New 2026_04_28_181000 migration adds exception_trace (longtext nullable)
to form_submission_action_failures. ApplyBindingsOnFormSubmit listener
now captures $e->getTraceAsString() at failure time.
- New FormSubmissionActionFailureRetryAttemptResource exposes per-attempt
data (timestamp, actor name, outcome, exception details) inside
retry_history[]. Index payloads omit the field via whenLoaded() to keep
list responses lean.
Frontend (apps/app)
- Types updated to mirror the expanded resource shape and the new KPI
endpoint contract. FormFailuresKpis is now { open, resolved_30d,
dismissed_30d, total_submissions } (server-aggregate).
- useFormFailures composable forwards all 5 server filters via
buildIndexParams() (strips empty/whitespace). useFormFailuresKpis hits
the dedicated /kpis endpoint per scope.
- FormFailuresTable replaces client-side bucketing with server-side
filtering, adds listener_class + date-range filter inputs, and renames
the 4th KPI tile to "Submissions" (was "Totaal").
- FormFailureDetail renders organisation_name + form_schema_label in the
header, surfaces an expandable stack-trace card, names the resolved/
dismissed actor in the timeline, and replaces the "v1 placeholder"
retry-history card with a full per-attempt timeline.
ESLint config gap (apps/app)
- New .eslintrc.cjs adapted from the Vuexy reference, minus Vuexy-internal
rules. `pnpm lint` now runs successfully (was previously broken — the
package.json script referenced a missing config). The 80 baseline
violations across the codebase are pre-existing and out of scope for
this session.
Tests + gates
- 24 new backend tests across filter, kpis, and resource-shape suites.
Backend: 1462 → 1486 passing, 0 → 0 failing. Larastan clean. Rector
dry-run unchanged at 354 (pre-Task-1 baseline from f18b55b).
- 3 new vitest tests in apps/app (filter wiring, KPI endpoint, KPI tile
values from /kpis). Vitest: 38 → 41 passing. tsc clean. Portal
unchanged (113 vitest, tsc clean).
- 5 backfill rollback tests bumped --step counts +1 for the new migration.
- Ws6FoundationMigrationTest down/up chain now includes exception_trace
before the parent table is restored.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -9,11 +9,13 @@ use App\Exceptions\FormBuilder\FailureNotRetriableException;
|
||||
use App\Exceptions\FormBuilder\ParentSubmissionGoneException;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\FormBuilder\DismissFailureRequest;
|
||||
use App\Http\Requests\FormBuilder\IndexFailuresRequest;
|
||||
use App\Http\Requests\FormBuilder\ResolveFailureRequest;
|
||||
use App\Http\Resources\FormBuilder\FormSubmissionActionFailureResource;
|
||||
use App\Models\FormBuilder\FormSubmissionActionFailure;
|
||||
use App\Models\Organisation;
|
||||
use App\Services\FormBuilder\FormFailureRetryService;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
@@ -28,7 +30,7 @@ use Illuminate\Support\Facades\Gate;
|
||||
*/
|
||||
final class FormSubmissionActionFailureController extends Controller
|
||||
{
|
||||
public function orgIndex(Organisation $organisation): AnonymousResourceCollection
|
||||
public function orgIndex(Organisation $organisation, IndexFailuresRequest $request): AnonymousResourceCollection
|
||||
{
|
||||
// RFC V3 IDOR-class — the user must be super_admin OR an
|
||||
// org_admin on THIS specific organisation. Viewing any org's
|
||||
@@ -38,28 +40,64 @@ final class FormSubmissionActionFailureController extends Controller
|
||||
// resolve/dismiss.
|
||||
$this->authorizeViewAnyInOrgOrNotFound($organisation);
|
||||
|
||||
$failures = FormSubmissionActionFailure::query()
|
||||
$query = FormSubmissionActionFailure::query()
|
||||
->with($this->indexEagerLoads())
|
||||
->whereHas('submission', function ($q) use ($organisation): void {
|
||||
/** @var \Illuminate\Database\Eloquent\Builder<\App\Models\FormBuilder\FormSubmission> $q */
|
||||
$q->where('organisation_id', $organisation->id);
|
||||
})
|
||||
->latest('failed_at')
|
||||
->paginate(50);
|
||||
});
|
||||
|
||||
$this->applyIndexFilters($query, $request);
|
||||
|
||||
$failures = $query->latest('failed_at')->paginate(50)->withQueryString();
|
||||
|
||||
return FormSubmissionActionFailureResource::collection($failures);
|
||||
}
|
||||
|
||||
public function platformIndex(): AnonymousResourceCollection
|
||||
public function platformIndex(IndexFailuresRequest $request): AnonymousResourceCollection
|
||||
{
|
||||
Gate::authorize('viewAny', FormSubmissionActionFailure::class);
|
||||
|
||||
$failures = FormSubmissionActionFailure::query()
|
||||
->latest('failed_at')
|
||||
->paginate(50);
|
||||
$query = FormSubmissionActionFailure::query()->with($this->indexEagerLoads());
|
||||
$this->applyIndexFilters($query, $request);
|
||||
|
||||
$failures = $query->latest('failed_at')->paginate(50)->withQueryString();
|
||||
|
||||
return FormSubmissionActionFailureResource::collection($failures);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sessie 3c — admin-UI dashboard counters (org-scoped). Same
|
||||
* tenant gate as orgIndex (RFC V3): denied → 404.
|
||||
*/
|
||||
public function orgKpis(Organisation $organisation): JsonResponse
|
||||
{
|
||||
$this->authorizeViewAnyInOrgOrNotFound($organisation);
|
||||
|
||||
return response()->json([
|
||||
'data' => $this->buildKpis(
|
||||
FormSubmissionActionFailure::query()
|
||||
->whereHas('submission', function ($q) use ($organisation): void {
|
||||
/** @var \Illuminate\Database\Eloquent\Builder<\App\Models\FormBuilder\FormSubmission> $q */
|
||||
$q->where('organisation_id', $organisation->id);
|
||||
}),
|
||||
$organisation,
|
||||
),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sessie 3c — platform-wide dashboard counters (super_admin only).
|
||||
*/
|
||||
public function platformKpis(): JsonResponse
|
||||
{
|
||||
Gate::authorize('viewAny', FormSubmissionActionFailure::class);
|
||||
|
||||
return response()->json([
|
||||
'data' => $this->buildKpis(FormSubmissionActionFailure::query(), null),
|
||||
]);
|
||||
}
|
||||
|
||||
public function show(?Organisation $organisation, FormSubmissionActionFailure $formSubmissionActionFailure): FormSubmissionActionFailureResource
|
||||
{
|
||||
// $organisation is bound only on the org-scoped route; null on the
|
||||
@@ -70,6 +108,8 @@ final class FormSubmissionActionFailureController extends Controller
|
||||
unset($organisation);
|
||||
$this->authorizeOrNotFound('view', $formSubmissionActionFailure);
|
||||
|
||||
$formSubmissionActionFailure->load($this->detailEagerLoads());
|
||||
|
||||
return new FormSubmissionActionFailureResource($formSubmissionActionFailure);
|
||||
}
|
||||
|
||||
@@ -97,7 +137,7 @@ final class FormSubmissionActionFailureController extends Controller
|
||||
], 410);
|
||||
}
|
||||
|
||||
return new FormSubmissionActionFailureResource($failure->refresh());
|
||||
return new FormSubmissionActionFailureResource($failure->refresh()->load($this->detailEagerLoads()));
|
||||
}
|
||||
|
||||
public function resolve(
|
||||
@@ -126,7 +166,7 @@ final class FormSubmissionActionFailureController extends Controller
|
||||
$failure->resolved_by_user_id = $request->user()?->id;
|
||||
$failure->save();
|
||||
|
||||
return new FormSubmissionActionFailureResource($failure->refresh());
|
||||
return new FormSubmissionActionFailureResource($failure->refresh()->load($this->detailEagerLoads()));
|
||||
}
|
||||
|
||||
public function dismiss(
|
||||
@@ -156,7 +196,118 @@ final class FormSubmissionActionFailureController extends Controller
|
||||
$failure->dismissed_by_user_id = $request->user()?->id;
|
||||
$failure->save();
|
||||
|
||||
return new FormSubmissionActionFailureResource($failure->refresh());
|
||||
return new FormSubmissionActionFailureResource($failure->refresh()->load($this->detailEagerLoads()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Sessie 3c — relations needed by the index Resource.
|
||||
* Tight set: org+schema labels and the two action-actor user names.
|
||||
* Skip retryAttempts on the index for payload size; show endpoint
|
||||
* lazy-loads it via {@see detailEagerLoads()}.
|
||||
*
|
||||
* @return array<int, string>
|
||||
*/
|
||||
private function indexEagerLoads(): array
|
||||
{
|
||||
return [
|
||||
'submission:id,form_schema_id,organisation_id',
|
||||
'submission.organisation:id,name',
|
||||
'submission.schema:id,name',
|
||||
'resolvedBy:id,first_name,last_name',
|
||||
'dismissedBy:id,first_name,last_name',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sessie 3c — relations for the detail Resource. Adds retryAttempts
|
||||
* with attempted-by user for the timeline.
|
||||
*
|
||||
* @return array<int, string>
|
||||
*/
|
||||
private function detailEagerLoads(): array
|
||||
{
|
||||
return [
|
||||
'submission:id,form_schema_id,organisation_id',
|
||||
'submission.organisation:id,name',
|
||||
'submission.schema:id,name',
|
||||
'resolvedBy:id,first_name,last_name',
|
||||
'dismissedBy:id,first_name,last_name',
|
||||
'retryAttempts',
|
||||
'retryAttempts.attemptedBy:id,first_name,last_name',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sessie 3c — KPI aggregate (open / resolved 30d / dismissed 30d /
|
||||
* total submissions). The 30d windows are computed via aggregate
|
||||
* SQL (single COUNT per metric) so the cost stays O(1) on indexed
|
||||
* columns regardless of org volume.
|
||||
*
|
||||
* `total_submissions` is org-scoped when an organisation is given;
|
||||
* platform-wide otherwise. We re-query FormSubmission rather than
|
||||
* derive it from the failures query because total submissions is
|
||||
* unrelated to the failure rowset.
|
||||
*
|
||||
* @param Builder<FormSubmissionActionFailure> $query
|
||||
* @return array{open:int, resolved_30d:int, dismissed_30d:int, total_submissions:int}
|
||||
*/
|
||||
private function buildKpis(Builder $query, ?Organisation $organisation): array
|
||||
{
|
||||
$thirtyDaysAgo = now()->subDays(30);
|
||||
|
||||
$open = (clone $query)->whereNull('resolved_at')->whereNull('dismissed_at')->count();
|
||||
$resolved30d = (clone $query)->where('resolved_at', '>=', $thirtyDaysAgo)->count();
|
||||
$dismissed30d = (clone $query)->where('dismissed_at', '>=', $thirtyDaysAgo)->count();
|
||||
|
||||
$submissionsQuery = \App\Models\FormBuilder\FormSubmission::query();
|
||||
if ($organisation instanceof Organisation) {
|
||||
$submissionsQuery->where('organisation_id', $organisation->id);
|
||||
}
|
||||
|
||||
return [
|
||||
'open' => $open,
|
||||
'resolved_30d' => $resolved30d,
|
||||
'dismissed_30d' => $dismissed30d,
|
||||
'total_submissions' => $submissionsQuery->count(),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sessie 3c — apply admin-UI filters to the failure query.
|
||||
*
|
||||
* Default state = `open`. Search runs case-insensitive substring
|
||||
* match on `exception_message`. Date range is half-open by default
|
||||
* (Laravel `whereBetween` is inclusive on both ends — sufficient
|
||||
* for ISO date inputs from the date-picker UI).
|
||||
*
|
||||
* @param Builder<FormSubmissionActionFailure> $query
|
||||
*/
|
||||
private function applyIndexFilters(Builder $query, IndexFailuresRequest $request): void
|
||||
{
|
||||
$state = (string) ($request->validated('state') ?? 'open');
|
||||
match ($state) {
|
||||
'open' => $query->whereNull('resolved_at')->whereNull('dismissed_at'),
|
||||
'resolved' => $query->whereNotNull('resolved_at'),
|
||||
'dismissed' => $query->whereNotNull('dismissed_at'),
|
||||
'all' => null,
|
||||
default => null,
|
||||
};
|
||||
|
||||
if (($search = $request->validated('search')) !== null && $search !== '') {
|
||||
$like = '%'.str_replace(['%', '_'], ['\\%', '\\_'], (string) $search).'%';
|
||||
$query->where('exception_message', 'like', $like);
|
||||
}
|
||||
|
||||
if (($from = $request->validated('failed_at_from')) !== null) {
|
||||
$query->where('failed_at', '>=', $from);
|
||||
}
|
||||
if (($to = $request->validated('failed_at_to')) !== null) {
|
||||
$query->where('failed_at', '<=', $to);
|
||||
}
|
||||
|
||||
if (($listener = $request->validated('listener_class')) !== null && $listener !== '') {
|
||||
$query->where('listener_class', $listener);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
34
api/app/Http/Requests/FormBuilder/IndexFailuresRequest.php
Normal file
34
api/app/Http/Requests/FormBuilder/IndexFailuresRequest.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Http\Requests\FormBuilder;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
/**
|
||||
* Sessie 3c (WS-6) — query-param validation for the failure index
|
||||
* endpoints (orgIndex + platformIndex). All params are optional;
|
||||
* `state` defaults to `open` at the controller layer.
|
||||
*/
|
||||
final class IndexFailuresRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'state' => ['nullable', 'string', 'in:open,resolved,dismissed,all'],
|
||||
'search' => ['nullable', 'string', 'max:255'],
|
||||
'failed_at_from' => ['nullable', 'date'],
|
||||
'failed_at_to' => ['nullable', 'date', 'after_or_equal:failed_at_from'],
|
||||
'listener_class' => ['nullable', 'string', 'max:255'],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -4,11 +4,19 @@ declare(strict_types=1);
|
||||
|
||||
namespace App\Http\Resources\FormBuilder;
|
||||
|
||||
use App\Models\FormBuilder\FormSchema;
|
||||
use App\Models\FormBuilder\FormSubmission;
|
||||
use App\Models\FormBuilder\FormSubmissionActionFailure;
|
||||
use App\Models\Organisation;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
/**
|
||||
* Sessie 3c (WS-6) — admin UI consumes denormalized labels
|
||||
* (`organisation_name`, `form_schema_label`, user names) plus a full
|
||||
* stack trace and per-attempt retry history. The relations are
|
||||
* eager-loaded by the controller via {@see FormSubmissionActionFailure::loadAdminListContext()}.
|
||||
*
|
||||
* @mixin FormSubmissionActionFailure
|
||||
*/
|
||||
final class FormSubmissionActionFailureResource extends JsonResource
|
||||
@@ -18,6 +26,13 @@ final class FormSubmissionActionFailureResource extends JsonResource
|
||||
*/
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
/** @var FormSubmission|null $submission */
|
||||
$submission = $this->submission;
|
||||
/** @var Organisation|null $organisation */
|
||||
$organisation = $submission?->organisation;
|
||||
/** @var FormSchema|null $schema */
|
||||
$schema = $submission?->schema;
|
||||
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'form_submission_id' => $this->form_submission_id,
|
||||
@@ -26,11 +41,16 @@ final class FormSubmissionActionFailureResource extends JsonResource
|
||||
'failed_at' => $this->failed_at->toIso8601String(),
|
||||
'exception_class' => $this->exception_class,
|
||||
'exception_message' => $this->exception_message,
|
||||
'exception_trace' => $this->exception_trace,
|
||||
'context' => $this->context,
|
||||
'retry_count' => $this->retry_count,
|
||||
'resolved_at' => $this->resolved_at?->toIso8601String(),
|
||||
'resolved_by_user_id' => $this->resolved_by_user_id,
|
||||
'resolved_by_user_name' => $this->resolvedBy?->name,
|
||||
'resolved_note' => $this->resolved_note,
|
||||
'dismissed_at' => $this->dismissed_at?->toIso8601String(),
|
||||
'dismissed_by_user_id' => $this->dismissed_by_user_id,
|
||||
'dismissed_by_user_name' => $this->dismissedBy?->name,
|
||||
'dismissed_reason_type' => $this->dismissed_reason_type?->value,
|
||||
'dismissed_reason_note' => $this->dismissed_reason_note,
|
||||
'state' => match (true) {
|
||||
@@ -38,6 +58,13 @@ final class FormSubmissionActionFailureResource extends JsonResource
|
||||
$this->dismissed_at !== null => 'dismissed',
|
||||
default => 'open',
|
||||
},
|
||||
'organisation_id' => $organisation?->id,
|
||||
'organisation_name' => $organisation?->name,
|
||||
'form_schema_id' => $schema?->id,
|
||||
'form_schema_label' => $schema?->name,
|
||||
'retry_history' => FormSubmissionActionFailureRetryAttemptResource::collection(
|
||||
$this->whenLoaded('retryAttempts'),
|
||||
),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Http\Resources\FormBuilder;
|
||||
|
||||
use App\Models\FormBuilder\FormSubmissionActionFailureRetryAttempt;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
/**
|
||||
* @mixin FormSubmissionActionFailureRetryAttempt
|
||||
*/
|
||||
final class FormSubmissionActionFailureRetryAttemptResource extends JsonResource
|
||||
{
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'attempted_at' => $this->attempted_at->toIso8601String(),
|
||||
'attempted_by_user_id' => $this->attempted_by_user_id,
|
||||
'attempted_by_user_name' => $this->attemptedBy?->name,
|
||||
'outcome' => $this->outcome,
|
||||
'exception_class' => $this->exception_class,
|
||||
'exception_message' => $this->exception_message,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -71,6 +71,7 @@ final readonly class ApplyBindingsOnFormSubmit
|
||||
'failed_at' => now(),
|
||||
'exception_class' => $e::class,
|
||||
'exception_message' => $e->getMessage(),
|
||||
'exception_trace' => $e->getTraceAsString(),
|
||||
'context' => [
|
||||
'purpose' => $purposeValue,
|
||||
],
|
||||
|
||||
@@ -42,6 +42,7 @@ final class FormSubmissionActionFailure extends Model
|
||||
'failed_at',
|
||||
'exception_class',
|
||||
'exception_message',
|
||||
'exception_trace',
|
||||
'context',
|
||||
'retry_count',
|
||||
'resolved_at',
|
||||
|
||||
@@ -23,6 +23,7 @@ final class FormSubmissionActionFailureFactory extends Factory
|
||||
'failed_at' => now(),
|
||||
'exception_class' => \RuntimeException::class,
|
||||
'exception_message' => 'Simulated apply failure',
|
||||
'exception_trace' => "#0 /app/Listeners/FormBuilder/ApplyBindingsOnFormSubmit.php(63): SimulatedException::throw()\n#1 [internal function]: Listener->handle()",
|
||||
'context' => [
|
||||
'target_entity' => 'person',
|
||||
'target_attribute' => 'email',
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
/**
|
||||
* Sessie 3c (WS-6) — admin UI surfaces a stack trace for triage.
|
||||
* `longText` because PHP traces can be 10-50 KB and `text` (64 KB)
|
||||
* is enough headroom; `longtext` allows future-proofing without
|
||||
* truncation. Nullable: not all listener paths capture a trace and
|
||||
* we don't want to retroactively backfill historical rows.
|
||||
*/
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('form_submission_action_failures', function (Blueprint $table): void {
|
||||
$table->longText('exception_trace')->nullable()->after('exception_message');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('form_submission_action_failures', function (Blueprint $table): void {
|
||||
$table->dropColumn('exception_trace');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -628,13 +628,13 @@ DROP TABLE IF EXISTS `form_submission_action_failure_retry_attempts`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!50503 SET character_set_client = utf8mb4 */;
|
||||
CREATE TABLE `form_submission_action_failure_retry_attempts` (
|
||||
`id` char(26) COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||
`form_submission_action_failure_id` char(26) COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||
`id` char(26) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||
`form_submission_action_failure_id` char(26) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||
`attempted_at` timestamp NOT NULL,
|
||||
`attempted_by_user_id` char(26) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
|
||||
`outcome` enum('succeeded','failed') COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||
`exception_class` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
|
||||
`exception_message` text COLLATE utf8mb4_unicode_ci,
|
||||
`attempted_by_user_id` char(26) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
|
||||
`outcome` enum('succeeded','failed') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||
`exception_class` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
|
||||
`exception_message` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
|
||||
`created_at` timestamp NULL DEFAULT NULL,
|
||||
`updated_at` timestamp NULL DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
@@ -655,6 +655,7 @@ CREATE TABLE `form_submission_action_failures` (
|
||||
`failed_at` timestamp NOT NULL,
|
||||
`exception_class` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||
`exception_message` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||
`exception_trace` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
|
||||
`context` json NOT NULL,
|
||||
`retry_count` tinyint unsigned NOT NULL DEFAULT '0',
|
||||
`resolved_at` timestamp NULL DEFAULT NULL,
|
||||
@@ -1753,21 +1754,22 @@ INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (104,'2026_04_24_20
|
||||
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (105,'2026_04_25_015838_create_telescope_entries_table',1);
|
||||
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (106,'2026_04_25_100000_create_form_field_bindings_table',1);
|
||||
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (107,'2026_04_25_100001_drop_binding_json_columns',1);
|
||||
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (140,'2026_04_25_110000_create_form_field_validation_rules_table',2);
|
||||
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (141,'2026_04_25_110001_backfill_form_field_validation_rules',2);
|
||||
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (142,'2026_04_25_120000_create_form_field_configs_table',2);
|
||||
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (143,'2026_04_25_120001_backfill_form_field_configs',2);
|
||||
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (144,'2026_04_25_120002_drop_validation_rules_json_columns',2);
|
||||
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (145,'2026_04_25_140000_extend_form_submissions_with_apply_status',2);
|
||||
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (146,'2026_04_25_140100_create_form_submission_action_failures',2);
|
||||
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (147,'2026_04_26_100000_create_form_field_conditional_logic_groups_table',2);
|
||||
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (148,'2026_04_26_100001_create_form_field_conditional_logic_conditions_table',2);
|
||||
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (149,'2026_04_26_100002_backfill_form_field_conditional_logic',2);
|
||||
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (150,'2026_04_26_100003_drop_conditional_logic_json_column',2);
|
||||
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (151,'2026_04_26_120000_add_default_crowd_type_id_to_form_schemas',2);
|
||||
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (152,'2026_04_27_100000_create_form_field_options_table',2);
|
||||
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (153,'2026_04_27_100001_backfill_form_field_options',2);
|
||||
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (154,'2026_04_27_100002_drop_form_field_options_json_columns',2);
|
||||
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (155,'2026_04_28_100000_restore_default_crowd_type_id_foreign_key',2);
|
||||
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (156,'2026_04_28_140000_add_kvk_number_to_companies_table',3);
|
||||
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (157,'2026_04_28_180000_create_form_submission_action_failure_retry_attempts_table',4);
|
||||
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (108,'2026_04_25_110000_create_form_field_validation_rules_table',1);
|
||||
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (109,'2026_04_25_110001_backfill_form_field_validation_rules',1);
|
||||
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (110,'2026_04_25_120000_create_form_field_configs_table',1);
|
||||
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (111,'2026_04_25_120001_backfill_form_field_configs',1);
|
||||
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (112,'2026_04_25_120002_drop_validation_rules_json_columns',1);
|
||||
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (113,'2026_04_25_140000_extend_form_submissions_with_apply_status',1);
|
||||
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (114,'2026_04_25_140100_create_form_submission_action_failures',1);
|
||||
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (115,'2026_04_26_100000_create_form_field_conditional_logic_groups_table',1);
|
||||
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (116,'2026_04_26_100001_create_form_field_conditional_logic_conditions_table',1);
|
||||
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (117,'2026_04_26_100002_backfill_form_field_conditional_logic',1);
|
||||
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (118,'2026_04_26_100003_drop_conditional_logic_json_column',1);
|
||||
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (119,'2026_04_26_120000_add_default_crowd_type_id_to_form_schemas',1);
|
||||
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (120,'2026_04_27_100000_create_form_field_options_table',1);
|
||||
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (121,'2026_04_27_100001_backfill_form_field_options',1);
|
||||
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (122,'2026_04_27_100002_drop_form_field_options_json_columns',1);
|
||||
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (123,'2026_04_28_100000_restore_default_crowd_type_id_foreign_key',1);
|
||||
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (124,'2026_04_28_140000_add_kvk_number_to_companies_table',2);
|
||||
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (125,'2026_04_28_180000_create_form_submission_action_failure_retry_attempts_table',2);
|
||||
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (126,'2026_04_28_181000_add_exception_trace_to_form_submission_action_failures',2);
|
||||
|
||||
@@ -147,6 +147,7 @@ Route::prefix('admin')
|
||||
|
||||
// RFC-WS-6 §3 (Q5) — platform-wide form-failure admin endpoints.
|
||||
Route::get('form-failures', [\App\Http\Controllers\Api\V1\FormBuilder\FormSubmissionActionFailureController::class, 'platformIndex']);
|
||||
Route::get('form-failures/kpis', [\App\Http\Controllers\Api\V1\FormBuilder\FormSubmissionActionFailureController::class, 'platformKpis']);
|
||||
Route::get('form-failures/{formSubmissionActionFailure}', [\App\Http\Controllers\Api\V1\FormBuilder\FormSubmissionActionFailureController::class, 'show']);
|
||||
Route::post('form-failures/{formSubmissionActionFailure}/retry', [\App\Http\Controllers\Api\V1\FormBuilder\FormSubmissionActionFailureController::class, 'retry']);
|
||||
Route::post('form-failures/{formSubmissionActionFailure}/resolve', [\App\Http\Controllers\Api\V1\FormBuilder\FormSubmissionActionFailureController::class, 'resolve']);
|
||||
@@ -248,6 +249,7 @@ Route::middleware(['auth:sanctum', 'impersonation'])->group(function () {
|
||||
// Organisation has no formSubmissionActionFailures() relation;
|
||||
// the policy's FK-chain check is the tenant gate.
|
||||
Route::get('form-failures', [\App\Http\Controllers\Api\V1\FormBuilder\FormSubmissionActionFailureController::class, 'orgIndex']);
|
||||
Route::get('form-failures/kpis', [\App\Http\Controllers\Api\V1\FormBuilder\FormSubmissionActionFailureController::class, 'orgKpis']);
|
||||
Route::get('form-failures/{formSubmissionActionFailure}', [\App\Http\Controllers\Api\V1\FormBuilder\FormSubmissionActionFailureController::class, 'show'])->withoutScopedBindings();
|
||||
Route::post('form-failures/{formSubmissionActionFailure}/retry', [\App\Http\Controllers\Api\V1\FormBuilder\FormSubmissionActionFailureController::class, 'retry'])->withoutScopedBindings();
|
||||
Route::post('form-failures/{formSubmissionActionFailure}/resolve', [\App\Http\Controllers\Api\V1\FormBuilder\FormSubmissionActionFailureController::class, 'resolve'])->withoutScopedBindings();
|
||||
|
||||
@@ -0,0 +1,247 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Feature\FormBuilder\Api;
|
||||
|
||||
use App\Listeners\FormBuilder\ApplyBindingsOnFormSubmit;
|
||||
use App\Models\FormBuilder\FormSchema;
|
||||
use App\Models\FormBuilder\FormSubmission;
|
||||
use App\Models\FormBuilder\FormSubmissionActionFailure;
|
||||
use App\Models\Organisation;
|
||||
use App\Models\User;
|
||||
use Database\Seeders\RoleSeeder;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Laravel\Sanctum\Sanctum;
|
||||
use Tests\TestCase;
|
||||
|
||||
/**
|
||||
* Sessie 3c — covers the IndexFailuresRequest filter wiring on
|
||||
* orgIndex + platformIndex (state, search, failed_at_from/to,
|
||||
* listener_class). Cross-tenant filtering still scopes to the
|
||||
* org via FK chain (RFC V3) — verified implicitly because every
|
||||
* row in this suite belongs to orgA.
|
||||
*/
|
||||
final class FormSubmissionActionFailureFilterTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
private Organisation $orgA;
|
||||
|
||||
private User $orgAdminA;
|
||||
|
||||
private User $superAdmin;
|
||||
|
||||
private FormSubmission $submission;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
$this->seed(RoleSeeder::class);
|
||||
|
||||
$this->orgA = Organisation::factory()->create();
|
||||
$schema = FormSchema::factory()->create(['organisation_id' => $this->orgA->id]);
|
||||
$this->submission = FormSubmission::factory()->create([
|
||||
'form_schema_id' => $schema->id,
|
||||
'organisation_id' => $this->orgA->id,
|
||||
]);
|
||||
|
||||
$this->orgAdminA = User::factory()->create();
|
||||
$this->orgA->users()->attach($this->orgAdminA, ['role' => 'org_admin']);
|
||||
|
||||
$this->superAdmin = User::factory()->create();
|
||||
$this->superAdmin->assignRole('super_admin');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, mixed> $attrs
|
||||
*/
|
||||
private function makeFailure(array $attrs = []): FormSubmissionActionFailure
|
||||
{
|
||||
return FormSubmissionActionFailure::factory()
|
||||
->for($this->submission, 'submission')
|
||||
->create($attrs);
|
||||
}
|
||||
|
||||
private function orgUrl(string $query = ''): string
|
||||
{
|
||||
return "/api/v1/organisations/{$this->orgA->id}/form-failures".($query !== '' ? "?{$query}" : '');
|
||||
}
|
||||
|
||||
public function test_default_state_filter_returns_only_open(): void
|
||||
{
|
||||
$open = $this->makeFailure();
|
||||
$this->makeFailure(['resolved_at' => now()]);
|
||||
$this->makeFailure(['dismissed_at' => now(), 'dismissed_reason_type' => 'schema_deleted']);
|
||||
|
||||
Sanctum::actingAs($this->orgAdminA);
|
||||
$response = $this->getJson($this->orgUrl())->assertOk();
|
||||
|
||||
$ids = array_column((array) $response->json('data'), 'id');
|
||||
$this->assertSame([(string) $open->id], $ids);
|
||||
}
|
||||
|
||||
public function test_state_resolved_filter(): void
|
||||
{
|
||||
$this->makeFailure();
|
||||
$resolved = $this->makeFailure(['resolved_at' => now()]);
|
||||
$this->makeFailure(['dismissed_at' => now(), 'dismissed_reason_type' => 'schema_deleted']);
|
||||
|
||||
Sanctum::actingAs($this->orgAdminA);
|
||||
$response = $this->getJson($this->orgUrl('state=resolved'))->assertOk();
|
||||
|
||||
$ids = array_column((array) $response->json('data'), 'id');
|
||||
$this->assertSame([(string) $resolved->id], $ids);
|
||||
}
|
||||
|
||||
public function test_state_dismissed_filter(): void
|
||||
{
|
||||
$this->makeFailure();
|
||||
$this->makeFailure(['resolved_at' => now()]);
|
||||
$dismissed = $this->makeFailure(['dismissed_at' => now(), 'dismissed_reason_type' => 'schema_deleted']);
|
||||
|
||||
Sanctum::actingAs($this->orgAdminA);
|
||||
$response = $this->getJson($this->orgUrl('state=dismissed'))->assertOk();
|
||||
|
||||
$ids = array_column((array) $response->json('data'), 'id');
|
||||
$this->assertSame([(string) $dismissed->id], $ids);
|
||||
}
|
||||
|
||||
public function test_state_all_returns_every_row(): void
|
||||
{
|
||||
$this->makeFailure();
|
||||
$this->makeFailure(['resolved_at' => now()]);
|
||||
$this->makeFailure(['dismissed_at' => now(), 'dismissed_reason_type' => 'schema_deleted']);
|
||||
|
||||
Sanctum::actingAs($this->orgAdminA);
|
||||
$response = $this->getJson($this->orgUrl('state=all'))->assertOk();
|
||||
|
||||
$this->assertCount(3, $response->json('data'));
|
||||
}
|
||||
|
||||
public function test_search_matches_exception_message_substring_case_insensitive(): void
|
||||
{
|
||||
$hit = $this->makeFailure(['exception_message' => 'Person provisioning failed: NO_DEFAULT_CROWD_TYPE']);
|
||||
$this->makeFailure(['exception_message' => 'Some other unrelated error']);
|
||||
|
||||
Sanctum::actingAs($this->orgAdminA);
|
||||
$response = $this->getJson($this->orgUrl('search=crowd_type'))->assertOk();
|
||||
|
||||
$ids = array_column((array) $response->json('data'), 'id');
|
||||
$this->assertSame([(string) $hit->id], $ids);
|
||||
}
|
||||
|
||||
public function test_search_with_sql_wildcards_is_escaped(): void
|
||||
{
|
||||
$this->makeFailure(['exception_message' => 'literal % percent in message']);
|
||||
$this->makeFailure(['exception_message' => 'no wildcard here']);
|
||||
|
||||
Sanctum::actingAs($this->orgAdminA);
|
||||
$response = $this->getJson($this->orgUrl('search=%25'))->assertOk();
|
||||
|
||||
$messages = array_column((array) $response->json('data'), 'exception_message');
|
||||
$this->assertCount(1, $messages);
|
||||
$this->assertStringContainsString('%', (string) $messages[0]);
|
||||
}
|
||||
|
||||
public function test_failed_at_from_and_to_inclusive(): void
|
||||
{
|
||||
$old = $this->makeFailure(['failed_at' => '2026-01-01 12:00:00']);
|
||||
$mid = $this->makeFailure(['failed_at' => '2026-02-15 12:00:00']);
|
||||
$new = $this->makeFailure(['failed_at' => '2026-03-30 12:00:00']);
|
||||
|
||||
Sanctum::actingAs($this->orgAdminA);
|
||||
$response = $this
|
||||
->getJson($this->orgUrl('failed_at_from=2026-02-01&failed_at_to=2026-03-01'))
|
||||
->assertOk();
|
||||
|
||||
$ids = array_column((array) $response->json('data'), 'id');
|
||||
$this->assertSame([(string) $mid->id], $ids);
|
||||
$this->assertNotContains((string) $old->id, $ids);
|
||||
$this->assertNotContains((string) $new->id, $ids);
|
||||
}
|
||||
|
||||
public function test_listener_class_exact_match(): void
|
||||
{
|
||||
$hit = $this->makeFailure(['listener_class' => ApplyBindingsOnFormSubmit::class]);
|
||||
$this->makeFailure(['listener_class' => 'App\\Listeners\\Other\\Listener']);
|
||||
|
||||
Sanctum::actingAs($this->orgAdminA);
|
||||
$response = $this
|
||||
->getJson($this->orgUrl('listener_class='.urlencode(ApplyBindingsOnFormSubmit::class)))
|
||||
->assertOk();
|
||||
|
||||
$ids = array_column((array) $response->json('data'), 'id');
|
||||
$this->assertSame([(string) $hit->id], $ids);
|
||||
}
|
||||
|
||||
public function test_filters_combine_with_and_semantics(): void
|
||||
{
|
||||
$match = $this->makeFailure([
|
||||
'exception_message' => 'crowd_type missing',
|
||||
'failed_at' => '2026-02-15 12:00:00',
|
||||
'listener_class' => ApplyBindingsOnFormSubmit::class,
|
||||
]);
|
||||
$this->makeFailure([
|
||||
'exception_message' => 'crowd_type missing',
|
||||
'failed_at' => '2025-01-01 12:00:00',
|
||||
'listener_class' => ApplyBindingsOnFormSubmit::class,
|
||||
]);
|
||||
$this->makeFailure([
|
||||
'exception_message' => 'unrelated',
|
||||
'failed_at' => '2026-02-15 12:00:00',
|
||||
'listener_class' => ApplyBindingsOnFormSubmit::class,
|
||||
]);
|
||||
|
||||
Sanctum::actingAs($this->orgAdminA);
|
||||
$response = $this
|
||||
->getJson($this->orgUrl('search=crowd_type&failed_at_from=2026-01-01&failed_at_to=2026-12-31&listener_class='.urlencode(ApplyBindingsOnFormSubmit::class)))
|
||||
->assertOk();
|
||||
|
||||
$ids = array_column((array) $response->json('data'), 'id');
|
||||
$this->assertSame([(string) $match->id], $ids);
|
||||
}
|
||||
|
||||
public function test_invalid_state_returns_422(): void
|
||||
{
|
||||
Sanctum::actingAs($this->orgAdminA);
|
||||
$this->getJson($this->orgUrl('state=bogus'))
|
||||
->assertStatus(422)
|
||||
->assertJsonValidationErrors(['state']);
|
||||
}
|
||||
|
||||
public function test_invalid_date_range_returns_422(): void
|
||||
{
|
||||
Sanctum::actingAs($this->orgAdminA);
|
||||
$this
|
||||
->getJson($this->orgUrl('failed_at_from=2026-03-01&failed_at_to=2026-01-01'))
|
||||
->assertStatus(422)
|
||||
->assertJsonValidationErrors(['failed_at_to']);
|
||||
}
|
||||
|
||||
public function test_platform_index_applies_same_filters(): void
|
||||
{
|
||||
$open = $this->makeFailure();
|
||||
$this->makeFailure(['resolved_at' => now()]);
|
||||
|
||||
Sanctum::actingAs($this->superAdmin);
|
||||
$response = $this->getJson('/api/v1/admin/form-failures?state=open')->assertOk();
|
||||
|
||||
$ids = array_column((array) $response->json('data'), 'id');
|
||||
$this->assertSame([(string) $open->id], $ids);
|
||||
}
|
||||
|
||||
public function test_pagination_preserves_query_string(): void
|
||||
{
|
||||
for ($i = 0; $i < 3; $i++) {
|
||||
$this->makeFailure(['resolved_at' => now()]);
|
||||
}
|
||||
|
||||
Sanctum::actingAs($this->orgAdminA);
|
||||
$response = $this->getJson($this->orgUrl('state=resolved&search=Simulated'))->assertOk();
|
||||
|
||||
$firstPageUrl = (string) $response->json('links.first');
|
||||
$this->assertStringContainsString('state=resolved', $firstPageUrl);
|
||||
$this->assertStringContainsString('search=Simulated', $firstPageUrl);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,148 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Feature\FormBuilder\Api;
|
||||
|
||||
use App\Models\FormBuilder\FormSchema;
|
||||
use App\Models\FormBuilder\FormSubmission;
|
||||
use App\Models\FormBuilder\FormSubmissionActionFailure;
|
||||
use App\Models\Organisation;
|
||||
use App\Models\User;
|
||||
use Database\Seeders\RoleSeeder;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Laravel\Sanctum\Sanctum;
|
||||
use Tests\TestCase;
|
||||
|
||||
/**
|
||||
* Sessie 3c — admin-UI dashboard KPI counters. Both org-scoped and
|
||||
* platform-wide endpoints; tenant gate via FK chain (RFC V3).
|
||||
*/
|
||||
final class FormSubmissionActionFailureKpisTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
private Organisation $orgA;
|
||||
|
||||
private Organisation $orgB;
|
||||
|
||||
private User $orgAdminA;
|
||||
|
||||
private User $orgAdminB;
|
||||
|
||||
private User $superAdmin;
|
||||
|
||||
private FormSubmission $submissionA;
|
||||
|
||||
private FormSubmission $submissionB;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
$this->seed(RoleSeeder::class);
|
||||
|
||||
$this->orgA = Organisation::factory()->create();
|
||||
$this->orgB = Organisation::factory()->create();
|
||||
|
||||
$schemaA = FormSchema::factory()->create(['organisation_id' => $this->orgA->id]);
|
||||
$schemaB = FormSchema::factory()->create(['organisation_id' => $this->orgB->id]);
|
||||
$this->submissionA = FormSubmission::factory()->create([
|
||||
'form_schema_id' => $schemaA->id,
|
||||
'organisation_id' => $this->orgA->id,
|
||||
]);
|
||||
$this->submissionB = FormSubmission::factory()->create([
|
||||
'form_schema_id' => $schemaB->id,
|
||||
'organisation_id' => $this->orgB->id,
|
||||
]);
|
||||
|
||||
$this->orgAdminA = User::factory()->create();
|
||||
$this->orgA->users()->attach($this->orgAdminA, ['role' => 'org_admin']);
|
||||
$this->orgAdminB = User::factory()->create();
|
||||
$this->orgB->users()->attach($this->orgAdminB, ['role' => 'org_admin']);
|
||||
$this->superAdmin = User::factory()->create();
|
||||
$this->superAdmin->assignRole('super_admin');
|
||||
}
|
||||
|
||||
public function test_org_kpis_counts_open_resolved_dismissed_and_total_submissions(): void
|
||||
{
|
||||
FormSubmissionActionFailure::factory()->for($this->submissionA, 'submission')->create();
|
||||
FormSubmissionActionFailure::factory()->for($this->submissionA, 'submission')->create();
|
||||
FormSubmissionActionFailure::factory()->for($this->submissionA, 'submission')
|
||||
->create(['resolved_at' => now()->subDays(5)]);
|
||||
FormSubmissionActionFailure::factory()->for($this->submissionA, 'submission')
|
||||
->create(['dismissed_at' => now()->subDays(10), 'dismissed_reason_type' => 'schema_deleted']);
|
||||
|
||||
// Outside-30d window — must NOT count.
|
||||
FormSubmissionActionFailure::factory()->for($this->submissionA, 'submission')
|
||||
->create(['resolved_at' => now()->subDays(45)]);
|
||||
|
||||
// Other tenant — must NOT count.
|
||||
FormSubmissionActionFailure::factory()->for($this->submissionB, 'submission')->create();
|
||||
|
||||
Sanctum::actingAs($this->orgAdminA);
|
||||
$response = $this->getJson("/api/v1/organisations/{$this->orgA->id}/form-failures/kpis")->assertOk();
|
||||
|
||||
$response->assertJsonPath('data.open', 2);
|
||||
$response->assertJsonPath('data.resolved_30d', 1);
|
||||
$response->assertJsonPath('data.dismissed_30d', 1);
|
||||
$response->assertJsonPath('data.total_submissions', 1);
|
||||
}
|
||||
|
||||
public function test_org_kpis_cross_tenant_returns_404(): void
|
||||
{
|
||||
FormSubmissionActionFailure::factory()->for($this->submissionA, 'submission')->create();
|
||||
|
||||
Sanctum::actingAs($this->orgAdminB);
|
||||
$this->getJson("/api/v1/organisations/{$this->orgA->id}/form-failures/kpis")
|
||||
->assertStatus(404);
|
||||
}
|
||||
|
||||
public function test_org_kpis_unauthenticated_returns_401(): void
|
||||
{
|
||||
$this->getJson("/api/v1/organisations/{$this->orgA->id}/form-failures/kpis")
|
||||
->assertStatus(401);
|
||||
}
|
||||
|
||||
public function test_platform_kpis_aggregates_across_all_orgs(): void
|
||||
{
|
||||
FormSubmissionActionFailure::factory()->for($this->submissionA, 'submission')->create();
|
||||
FormSubmissionActionFailure::factory()->for($this->submissionB, 'submission')->create();
|
||||
FormSubmissionActionFailure::factory()->for($this->submissionA, 'submission')
|
||||
->create(['resolved_at' => now()->subDays(2)]);
|
||||
|
||||
Sanctum::actingAs($this->superAdmin);
|
||||
$response = $this->getJson('/api/v1/admin/form-failures/kpis')->assertOk();
|
||||
|
||||
$response->assertJsonPath('data.open', 2);
|
||||
$response->assertJsonPath('data.resolved_30d', 1);
|
||||
$response->assertJsonPath('data.dismissed_30d', 0);
|
||||
$response->assertJsonPath('data.total_submissions', 2);
|
||||
}
|
||||
|
||||
public function test_platform_kpis_org_admin_returns_403(): void
|
||||
{
|
||||
Sanctum::actingAs($this->orgAdminA);
|
||||
$this->getJson('/api/v1/admin/form-failures/kpis')
|
||||
->assertStatus(403);
|
||||
}
|
||||
|
||||
public function test_platform_kpis_unauthenticated_returns_401(): void
|
||||
{
|
||||
$this->getJson('/api/v1/admin/form-failures/kpis')->assertStatus(401);
|
||||
}
|
||||
|
||||
public function test_kpis_with_no_data_returns_zeros(): void
|
||||
{
|
||||
$orgC = Organisation::factory()->create();
|
||||
$orgAdminC = User::factory()->create();
|
||||
$orgC->users()->attach($orgAdminC, ['role' => 'org_admin']);
|
||||
|
||||
Sanctum::actingAs($orgAdminC);
|
||||
$response = $this->getJson("/api/v1/organisations/{$orgC->id}/form-failures/kpis")->assertOk();
|
||||
|
||||
$response->assertJsonPath('data.open', 0);
|
||||
$response->assertJsonPath('data.resolved_30d', 0);
|
||||
$response->assertJsonPath('data.dismissed_30d', 0);
|
||||
$response->assertJsonPath('data.total_submissions', 0);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,160 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Feature\FormBuilder\Api;
|
||||
|
||||
use App\Models\FormBuilder\FormSchema;
|
||||
use App\Models\FormBuilder\FormSubmission;
|
||||
use App\Models\FormBuilder\FormSubmissionActionFailure;
|
||||
use App\Models\FormBuilder\FormSubmissionActionFailureRetryAttempt;
|
||||
use App\Models\Organisation;
|
||||
use App\Models\User;
|
||||
use Database\Seeders\RoleSeeder;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Laravel\Sanctum\Sanctum;
|
||||
use Tests\TestCase;
|
||||
|
||||
/**
|
||||
* Sessie 3c — verifies the expanded admin-UI resource payload
|
||||
* (denormalized labels, exception_trace, retry_history[]) and the
|
||||
* eager-loading guarantees that prevent N+1 on index/show.
|
||||
*/
|
||||
final class FormSubmissionActionFailureResourceShapeTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
private Organisation $orgA;
|
||||
|
||||
private User $superAdmin;
|
||||
|
||||
private FormSchema $schemaA;
|
||||
|
||||
private FormSubmission $submissionA;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
$this->seed(RoleSeeder::class);
|
||||
|
||||
$this->orgA = Organisation::factory()->create(['name' => 'Festival X']);
|
||||
$this->schemaA = FormSchema::factory()->create([
|
||||
'organisation_id' => $this->orgA->id,
|
||||
'name' => 'Vrijwilligers aanmelding',
|
||||
]);
|
||||
$this->submissionA = FormSubmission::factory()->create([
|
||||
'form_schema_id' => $this->schemaA->id,
|
||||
'organisation_id' => $this->orgA->id,
|
||||
]);
|
||||
|
||||
$this->superAdmin = User::factory()->create();
|
||||
$this->superAdmin->assignRole('super_admin');
|
||||
}
|
||||
|
||||
public function test_show_payload_includes_denormalized_labels_and_trace(): void
|
||||
{
|
||||
$resolver = User::factory()->create(['first_name' => 'Maud', 'last_name' => 'Admin']);
|
||||
$failure = FormSubmissionActionFailure::factory()
|
||||
->for($this->submissionA, 'submission')
|
||||
->create([
|
||||
'exception_trace' => "#0 stack frame\n#1 next frame",
|
||||
'resolved_at' => now(),
|
||||
'resolved_by_user_id' => $resolver->id,
|
||||
'resolved_note' => 'fixed manually',
|
||||
]);
|
||||
|
||||
Sanctum::actingAs($this->superAdmin);
|
||||
$response = $this->getJson("/api/v1/admin/form-failures/{$failure->id}")->assertOk();
|
||||
|
||||
$response
|
||||
->assertJsonPath('data.id', (string) $failure->id)
|
||||
->assertJsonPath('data.organisation_id', (string) $this->orgA->id)
|
||||
->assertJsonPath('data.organisation_name', 'Festival X')
|
||||
->assertJsonPath('data.form_schema_id', (string) $this->schemaA->id)
|
||||
->assertJsonPath('data.form_schema_label', 'Vrijwilligers aanmelding')
|
||||
->assertJsonPath('data.exception_trace', "#0 stack frame\n#1 next frame")
|
||||
->assertJsonPath('data.resolved_by_user_name', 'Maud Admin')
|
||||
->assertJsonPath('data.dismissed_by_user_name', null);
|
||||
}
|
||||
|
||||
public function test_show_payload_includes_retry_history_in_chronological_order(): void
|
||||
{
|
||||
$failure = FormSubmissionActionFailure::factory()
|
||||
->for($this->submissionA, 'submission')
|
||||
->create();
|
||||
|
||||
$actor = User::factory()->create(['first_name' => 'Alex', 'last_name' => 'Operator']);
|
||||
|
||||
FormSubmissionActionFailureRetryAttempt::factory()->create([
|
||||
'form_submission_action_failure_id' => $failure->id,
|
||||
'attempted_at' => now()->subMinutes(10),
|
||||
'attempted_by_user_id' => $actor->id,
|
||||
'outcome' => 'failed',
|
||||
'exception_class' => \RuntimeException::class,
|
||||
'exception_message' => 'first retry failed',
|
||||
]);
|
||||
FormSubmissionActionFailureRetryAttempt::factory()->succeeded()->create([
|
||||
'form_submission_action_failure_id' => $failure->id,
|
||||
'attempted_at' => now(),
|
||||
'attempted_by_user_id' => $actor->id,
|
||||
]);
|
||||
|
||||
Sanctum::actingAs($this->superAdmin);
|
||||
$response = $this->getJson("/api/v1/admin/form-failures/{$failure->id}")->assertOk();
|
||||
|
||||
$history = $response->json('data.retry_history');
|
||||
$this->assertIsArray($history);
|
||||
$this->assertCount(2, $history);
|
||||
// latest('attempted_at') in the relation puts the newest first.
|
||||
$this->assertSame('succeeded', $history[0]['outcome']);
|
||||
$this->assertSame('failed', $history[1]['outcome']);
|
||||
$this->assertSame('Alex Operator', $history[0]['attempted_by_user_name']);
|
||||
$this->assertSame('first retry failed', $history[1]['exception_message']);
|
||||
}
|
||||
|
||||
public function test_index_payload_omits_retry_history_to_keep_payload_small(): void
|
||||
{
|
||||
$failure = FormSubmissionActionFailure::factory()
|
||||
->for($this->submissionA, 'submission')
|
||||
->create();
|
||||
FormSubmissionActionFailureRetryAttempt::factory()->create([
|
||||
'form_submission_action_failure_id' => $failure->id,
|
||||
]);
|
||||
|
||||
Sanctum::actingAs($this->superAdmin);
|
||||
$response = $this->getJson('/api/v1/admin/form-failures')->assertOk();
|
||||
|
||||
// whenLoaded() => the key resolves to MissingValue and is omitted.
|
||||
$first = $response->json('data.0');
|
||||
$this->assertArrayNotHasKey('retry_history', $first);
|
||||
$this->assertSame('Festival X', $first['organisation_name']);
|
||||
$this->assertSame('Vrijwilligers aanmelding', $first['form_schema_label']);
|
||||
}
|
||||
|
||||
public function test_index_does_not_n_plus_one_on_relations(): void
|
||||
{
|
||||
for ($i = 0; $i < 5; $i++) {
|
||||
$sub = FormSubmission::factory()->create([
|
||||
'form_schema_id' => $this->schemaA->id,
|
||||
'organisation_id' => $this->orgA->id,
|
||||
]);
|
||||
FormSubmissionActionFailure::factory()->for($sub, 'submission')->create();
|
||||
}
|
||||
|
||||
Sanctum::actingAs($this->superAdmin);
|
||||
DB::enableQueryLog();
|
||||
$this->getJson('/api/v1/admin/form-failures')->assertOk();
|
||||
$queries = DB::getQueryLog();
|
||||
DB::disableQueryLog();
|
||||
|
||||
// Eager-loading bound: failures + submissions + organisations + schemas
|
||||
// + resolvedBy + dismissedBy + count = 7 baseline; allow modest headroom
|
||||
// for auth/sanctum/pagination overhead but reject linear growth in N.
|
||||
$this->assertLessThanOrEqual(15, count($queries), sprintf(
|
||||
'Index endpoint may have N+1 (executed %d queries for 5 failures): %s',
|
||||
count($queries),
|
||||
implode("\n", array_column($queries, 'query')),
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -57,7 +57,7 @@ final class FormFieldBindingMigrationTest extends TestCase
|
||||
// validation-rules-backfill, create-validation-rules) +
|
||||
// 2 WS-6 migrations (action-failures, apply-status) +
|
||||
// 2 WS-5a migrations (drop-binding-cols, create-bindings) = 16.
|
||||
$this->artisan('migrate:rollback', ['--step' => 20])->assertSuccessful();
|
||||
$this->artisan('migrate:rollback', ['--step' => 21])->assertSuccessful();
|
||||
$this->assertFalse(Schema::hasTable('form_field_bindings'));
|
||||
$this->assertTrue(Schema::hasColumn('form_fields', 'binding'));
|
||||
$this->assertTrue(Schema::hasColumn('form_field_library', 'default_binding'));
|
||||
@@ -119,7 +119,7 @@ final class FormFieldBindingMigrationTest extends TestCase
|
||||
public function test_rollback_reconstructs_json_and_drops_table(): void
|
||||
{
|
||||
// Walk back the full WS-5d + WS-5c + WS-6 + WS-5b + WS-5a stack (16 migrations).
|
||||
$this->artisan('migrate:rollback', ['--step' => 20])->assertSuccessful();
|
||||
$this->artisan('migrate:rollback', ['--step' => 21])->assertSuccessful();
|
||||
[$fieldAId] = $this->seedFieldsWithBindingJson();
|
||||
[$libAId] = $this->seedLibraryWithBindingJson();
|
||||
|
||||
@@ -134,7 +134,7 @@ final class FormFieldBindingMigrationTest extends TestCase
|
||||
// the pre-WS-5b state (conditional-logic, validation-rules, configs
|
||||
// and options tables gone, validation_rules + options JSON columns
|
||||
// reappear on source tables; binding contract intact).
|
||||
$this->artisan('migrate:rollback', ['--step' => 18])->assertSuccessful();
|
||||
$this->artisan('migrate:rollback', ['--step' => 19])->assertSuccessful();
|
||||
$this->assertFalse(Schema::hasTable('form_field_options'));
|
||||
$this->assertFalse(Schema::hasTable('form_field_conditional_logic_groups'));
|
||||
$this->assertFalse(Schema::hasTable('form_field_conditional_logic_conditions'));
|
||||
|
||||
@@ -49,7 +49,7 @@ final class ConditionalLogicBackfillTest extends TestCase
|
||||
// create-options + WS-5c drop-cl-col + WS-5c backfill-cl
|
||||
// migrations to land in the conditional-logic JSON-era state with
|
||||
// no relational form_field_options table yet.
|
||||
$this->artisan('migrate:rollback', ['--step' => 9])->assertSuccessful();
|
||||
$this->artisan('migrate:rollback', ['--step' => 10])->assertSuccessful();
|
||||
$this->assertTrue(Schema::hasColumn('form_fields', 'conditional_logic'));
|
||||
|
||||
$fieldId = $this->seedFieldWithJson([
|
||||
@@ -170,7 +170,7 @@ final class ConditionalLogicBackfillTest extends TestCase
|
||||
]);
|
||||
|
||||
// Roll back only the backfill migration — writes the JSON back.
|
||||
$this->artisan('migrate:rollback', ['--step' => 9])->assertSuccessful();
|
||||
$this->artisan('migrate:rollback', ['--step' => 10])->assertSuccessful();
|
||||
|
||||
$reconstructed = DB::table('form_fields')
|
||||
->where('id', $fieldId)
|
||||
@@ -203,7 +203,7 @@ final class ConditionalLogicBackfillTest extends TestCase
|
||||
|
||||
public function test_unknown_top_level_key_fails_migration(): void
|
||||
{
|
||||
$this->artisan('migrate:rollback', ['--step' => 9])->assertSuccessful();
|
||||
$this->artisan('migrate:rollback', ['--step' => 10])->assertSuccessful();
|
||||
|
||||
$this->seedFieldWithJson([
|
||||
'hide_when' => ['all' => [['field_slug' => 'x', 'operator' => 'equals', 'value' => 1]]],
|
||||
@@ -216,7 +216,7 @@ final class ConditionalLogicBackfillTest extends TestCase
|
||||
|
||||
public function test_unknown_comparison_operator_fails_migration(): void
|
||||
{
|
||||
$this->artisan('migrate:rollback', ['--step' => 9])->assertSuccessful();
|
||||
$this->artisan('migrate:rollback', ['--step' => 10])->assertSuccessful();
|
||||
|
||||
$this->seedFieldWithJson([
|
||||
'show_when' => ['all' => [['field_slug' => 'x', 'operator' => 'matches_regex', 'value' => 'y']]],
|
||||
|
||||
@@ -30,7 +30,7 @@ final class FormFieldConfigBackfillAndDropTest extends TestCase
|
||||
// Roll back 4 WS-5c migrations + 2 WS-6 migrations + 5 WS-5b
|
||||
// migrations = 11, to get the pre-WS-5b state where the JSON column
|
||||
// still exists on form_fields / form_field_library.
|
||||
$this->artisan('migrate:rollback', ['--step' => 15])->assertSuccessful();
|
||||
$this->artisan('migrate:rollback', ['--step' => 16])->assertSuccessful();
|
||||
$this->assertTrue(Schema::hasColumn('form_fields', 'validation_rules'));
|
||||
|
||||
$fieldId = $this->seedField([
|
||||
|
||||
@@ -47,7 +47,7 @@ final class FormFieldOptionsBackfillTest extends TestCase
|
||||
// Roll back only the backfill migration (latest WS-5d step).
|
||||
// Leaves the form_field_options table in place, JSON columns
|
||||
// present on the source tables, and snapshots in pre-WS-5d shape.
|
||||
$this->artisan('migrate:rollback', ['--step' => 5])->assertSuccessful();
|
||||
$this->artisan('migrate:rollback', ['--step' => 6])->assertSuccessful();
|
||||
$this->assertTrue(Schema::hasTable('form_field_options'));
|
||||
$this->assertTrue(Schema::hasColumn('form_fields', 'options'));
|
||||
|
||||
@@ -136,7 +136,7 @@ final class FormFieldOptionsBackfillTest extends TestCase
|
||||
|
||||
public function test_rollback_reconstructs_json_columns_and_snapshots(): void
|
||||
{
|
||||
$this->artisan('migrate:rollback', ['--step' => 5])->assertSuccessful();
|
||||
$this->artisan('migrate:rollback', ['--step' => 6])->assertSuccessful();
|
||||
[$selectId, $multiId, $libraryId] = $this->seedFieldsAndLibraryWithJson();
|
||||
$submissionId = $this->seedSubmissionWithSnapshot($selectId);
|
||||
|
||||
@@ -149,7 +149,7 @@ final class FormFieldOptionsBackfillTest extends TestCase
|
||||
|
||||
// Step back over only the backfill migration → JSON columns repopulate
|
||||
// and snapshots revert to flat-string-array shape.
|
||||
$this->artisan('migrate:rollback', ['--step' => 5])->assertSuccessful();
|
||||
$this->artisan('migrate:rollback', ['--step' => 6])->assertSuccessful();
|
||||
$this->assertSame(0, DB::table('form_field_options')->count());
|
||||
|
||||
$select = DB::table('form_fields')->where('id', $selectId)->first();
|
||||
@@ -168,7 +168,7 @@ final class FormFieldOptionsBackfillTest extends TestCase
|
||||
|
||||
public function test_fails_when_options_present_on_non_option_field_type(): void
|
||||
{
|
||||
$this->artisan('migrate:rollback', ['--step' => 5])->assertSuccessful();
|
||||
$this->artisan('migrate:rollback', ['--step' => 6])->assertSuccessful();
|
||||
$this->seedFieldWithOptions('TAG_PICKER', ['Veiligheid', 'Horeca']);
|
||||
|
||||
$this->expectException(\RuntimeException::class);
|
||||
@@ -178,7 +178,7 @@ final class FormFieldOptionsBackfillTest extends TestCase
|
||||
|
||||
public function test_fails_when_options_contains_non_string_entry(): void
|
||||
{
|
||||
$this->artisan('migrate:rollback', ['--step' => 5])->assertSuccessful();
|
||||
$this->artisan('migrate:rollback', ['--step' => 6])->assertSuccessful();
|
||||
|
||||
$this->seedFieldWithOptionsRaw('SELECT', json_encode([
|
||||
['label' => 'A'],
|
||||
@@ -192,7 +192,7 @@ final class FormFieldOptionsBackfillTest extends TestCase
|
||||
|
||||
public function test_fails_when_options_is_object_shape(): void
|
||||
{
|
||||
$this->artisan('migrate:rollback', ['--step' => 5])->assertSuccessful();
|
||||
$this->artisan('migrate:rollback', ['--step' => 6])->assertSuccessful();
|
||||
|
||||
$this->seedFieldWithOptionsRaw('SELECT', json_encode([
|
||||
'XS' => 'Extra small',
|
||||
@@ -206,7 +206,7 @@ final class FormFieldOptionsBackfillTest extends TestCase
|
||||
|
||||
public function test_fails_on_translations_length_mismatch(): void
|
||||
{
|
||||
$this->artisan('migrate:rollback', ['--step' => 5])->assertSuccessful();
|
||||
$this->artisan('migrate:rollback', ['--step' => 6])->assertSuccessful();
|
||||
$this->seedFieldWithOptionsRaw('SELECT', json_encode(['XS', 'S', 'M']), json_encode([
|
||||
'de' => ['options' => ['Klein', 'Mittel']], // 2 vs 3
|
||||
]));
|
||||
@@ -218,7 +218,7 @@ final class FormFieldOptionsBackfillTest extends TestCase
|
||||
|
||||
public function test_fails_on_non_string_translation(): void
|
||||
{
|
||||
$this->artisan('migrate:rollback', ['--step' => 5])->assertSuccessful();
|
||||
$this->artisan('migrate:rollback', ['--step' => 6])->assertSuccessful();
|
||||
$this->seedFieldWithOptionsRaw('SELECT', json_encode(['XS', 'S']), json_encode([
|
||||
'de' => ['options' => ['Klein', 42]],
|
||||
]));
|
||||
@@ -230,7 +230,7 @@ final class FormFieldOptionsBackfillTest extends TestCase
|
||||
|
||||
public function test_fails_on_oversized_translation(): void
|
||||
{
|
||||
$this->artisan('migrate:rollback', ['--step' => 5])->assertSuccessful();
|
||||
$this->artisan('migrate:rollback', ['--step' => 6])->assertSuccessful();
|
||||
$this->seedFieldWithOptionsRaw('SELECT', json_encode(['XS']), json_encode([
|
||||
'de' => ['options' => [str_repeat('x', 256)]],
|
||||
]));
|
||||
@@ -242,7 +242,7 @@ final class FormFieldOptionsBackfillTest extends TestCase
|
||||
|
||||
public function test_fails_when_snapshot_options_present_on_non_option_field_type(): void
|
||||
{
|
||||
$this->artisan('migrate:rollback', ['--step' => 5])->assertSuccessful();
|
||||
$this->artisan('migrate:rollback', ['--step' => 6])->assertSuccessful();
|
||||
$this->seedTemplateWithSnapshotRaw([
|
||||
'fields' => [[
|
||||
'id' => (string) Str::ulid(),
|
||||
|
||||
@@ -115,8 +115,15 @@ final class Ws6FoundationMigrationTest extends TestCase
|
||||
$retryAttempts = require database_path(
|
||||
'migrations/2026_04_28_180000_create_form_submission_action_failure_retry_attempts_table.php',
|
||||
);
|
||||
// Sessie 3c also adds exception_trace to the parent table — chain
|
||||
// its down() before the parent's drop so the column ordering on
|
||||
// restore matches the production migration order.
|
||||
$exceptionTrace = require database_path(
|
||||
'migrations/2026_04_28_181000_add_exception_trace_to_form_submission_action_failures.php',
|
||||
);
|
||||
|
||||
$retryAttempts->down();
|
||||
$exceptionTrace->down();
|
||||
$createFailures->down();
|
||||
$applyStatus->down();
|
||||
|
||||
@@ -133,6 +140,7 @@ final class Ws6FoundationMigrationTest extends TestCase
|
||||
// Restore state for any subsequent tests in this class.
|
||||
$applyStatus->up();
|
||||
$createFailures->up();
|
||||
$exceptionTrace->up();
|
||||
$retryAttempts->up();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ final class FormFieldValidationRuleBackfillTest extends TestCase
|
||||
// validation-rules-backfill + create-validation-rules) = 14.
|
||||
// Brings us to the pre-WS-5b state: validation_rules JSON column
|
||||
// present, no relational tables for WS-5b/c/d.
|
||||
$this->artisan('migrate:rollback', ['--step' => 18])->assertSuccessful();
|
||||
$this->artisan('migrate:rollback', ['--step' => 19])->assertSuccessful();
|
||||
$this->assertFalse(Schema::hasTable('form_field_validation_rules'));
|
||||
$this->assertTrue(Schema::hasColumn('form_fields', 'validation_rules'));
|
||||
|
||||
@@ -114,7 +114,7 @@ final class FormFieldValidationRuleBackfillTest extends TestCase
|
||||
// (validation_rules JSON column present; no relational tables for
|
||||
// WS-5b). Step count: drop-cols + configs-backfill + create-configs
|
||||
// + validation-rules-backfill + create-validation-rules = 5.
|
||||
$this->artisan('migrate:rollback', ['--step' => 18])->assertSuccessful();
|
||||
$this->artisan('migrate:rollback', ['--step' => 19])->assertSuccessful();
|
||||
|
||||
$fieldId = $this->seedFieldWithJson([
|
||||
'field_type' => 'TAG_PICKER',
|
||||
@@ -138,7 +138,7 @@ final class FormFieldValidationRuleBackfillTest extends TestCase
|
||||
// (validation_rules JSON column present; no relational tables for
|
||||
// WS-5b). Step count: drop-cols + configs-backfill + create-configs
|
||||
// + validation-rules-backfill + create-validation-rules = 5.
|
||||
$this->artisan('migrate:rollback', ['--step' => 18])->assertSuccessful();
|
||||
$this->artisan('migrate:rollback', ['--step' => 19])->assertSuccessful();
|
||||
|
||||
$fieldId = $this->seedFieldWithJson([
|
||||
'field_type' => 'TEXT',
|
||||
@@ -165,7 +165,7 @@ final class FormFieldValidationRuleBackfillTest extends TestCase
|
||||
// (validation_rules JSON column present; no relational tables for
|
||||
// WS-5b). Step count: drop-cols + configs-backfill + create-configs
|
||||
// + validation-rules-backfill + create-validation-rules = 5.
|
||||
$this->artisan('migrate:rollback', ['--step' => 18])->assertSuccessful();
|
||||
$this->artisan('migrate:rollback', ['--step' => 19])->assertSuccessful();
|
||||
|
||||
$this->seedFieldWithJson([
|
||||
'field_type' => 'TEXT',
|
||||
@@ -182,7 +182,7 @@ final class FormFieldValidationRuleBackfillTest extends TestCase
|
||||
// (validation_rules JSON column present; no relational tables for
|
||||
// WS-5b). Step count: drop-cols + configs-backfill + create-configs
|
||||
// + validation-rules-backfill + create-validation-rules = 5.
|
||||
$this->artisan('migrate:rollback', ['--step' => 18])->assertSuccessful();
|
||||
$this->artisan('migrate:rollback', ['--step' => 19])->assertSuccessful();
|
||||
|
||||
$this->seedFieldWithJson([
|
||||
'field_type' => 'BOOLEAN',
|
||||
@@ -201,7 +201,7 @@ final class FormFieldValidationRuleBackfillTest extends TestCase
|
||||
// full-back-then-full-forward cycle — rolling back all WS-5b
|
||||
// migrations restores the pre-WS-5b state (columns present on
|
||||
// source tables; validation rules relational table gone).
|
||||
$this->artisan('migrate:rollback', ['--step' => 18])->assertSuccessful();
|
||||
$this->artisan('migrate:rollback', ['--step' => 19])->assertSuccessful();
|
||||
[$numberId] = $this->seedFields();
|
||||
|
||||
$this->artisan('migrate')->assertSuccessful();
|
||||
@@ -216,7 +216,7 @@ final class FormFieldValidationRuleBackfillTest extends TestCase
|
||||
|
||||
// Roll back WS-5b fully → column reappears and carries canonical JSON
|
||||
// reconstructed from the relational rows.
|
||||
$this->artisan('migrate:rollback', ['--step' => 18])->assertSuccessful();
|
||||
$this->artisan('migrate:rollback', ['--step' => 19])->assertSuccessful();
|
||||
$this->assertTrue(Schema::hasColumn('form_fields', 'validation_rules'));
|
||||
|
||||
$field = DB::table('form_fields')->where('id', $numberId)->first();
|
||||
|
||||
208
apps/app/.eslintrc.cjs
Normal file
208
apps/app/.eslintrc.cjs
Normal file
@@ -0,0 +1,208 @@
|
||||
// Sessie 3c (WS-6) — closes the apps/app ESLint config gap.
|
||||
// Adapted from the Vuexy reference (resources/vuexy-admin-v10.11.1/.../full-version/.eslintrc.cjs)
|
||||
// minus the Vuexy-internal lint rules (valid-appcardcode-*, internal regex
|
||||
// rules) that don't apply outside the demo project. Plugin set matches
|
||||
// what's installed in apps/app's package.json.
|
||||
module.exports = {
|
||||
root: true,
|
||||
env: {
|
||||
browser: true,
|
||||
node: true,
|
||||
es2022: true,
|
||||
},
|
||||
extends: [
|
||||
'@antfu/eslint-config-vue',
|
||||
'plugin:vue/vue3-recommended',
|
||||
'plugin:import/recommended',
|
||||
'plugin:import/typescript',
|
||||
'plugin:promise/recommended',
|
||||
'plugin:sonarjs/recommended',
|
||||
'plugin:@typescript-eslint/recommended',
|
||||
'plugin:case-police/recommended',
|
||||
'plugin:regexp/recommended',
|
||||
],
|
||||
parser: 'vue-eslint-parser',
|
||||
parserOptions: {
|
||||
ecmaVersion: 13,
|
||||
parser: '@typescript-eslint/parser',
|
||||
sourceType: 'module',
|
||||
},
|
||||
plugins: [
|
||||
'vue',
|
||||
'@typescript-eslint',
|
||||
'regex',
|
||||
'regexp',
|
||||
],
|
||||
ignorePatterns: [
|
||||
'src/plugins/iconify/*.js',
|
||||
'node_modules',
|
||||
'dist',
|
||||
'*.d.ts',
|
||||
'vendor',
|
||||
'*.json',
|
||||
],
|
||||
rules: {
|
||||
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
|
||||
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
|
||||
|
||||
'comma-spacing': ['error', { before: false, after: true }],
|
||||
'key-spacing': ['error', { afterColon: true }],
|
||||
'n/prefer-global/process': ['off'],
|
||||
'sonarjs/cognitive-complexity': ['off'],
|
||||
|
||||
'vue/first-attribute-linebreak': ['error', {
|
||||
singleline: 'beside',
|
||||
multiline: 'below',
|
||||
}],
|
||||
|
||||
'antfu/top-level-function': 'off',
|
||||
|
||||
// Project rule (CLAUDE.md frontend rules): no `any`. Override the
|
||||
// Vuexy reference (which sets this off) — Crewli's stricter posture.
|
||||
'@typescript-eslint/no-explicit-any': 'error',
|
||||
|
||||
'indent': ['error', 2],
|
||||
'comma-dangle': ['error', 'always-multiline'],
|
||||
'object-curly-spacing': ['error', 'always'],
|
||||
'camelcase': 'error',
|
||||
'max-len': 'off',
|
||||
'semi': ['error', 'never'],
|
||||
'arrow-parens': ['error', 'as-needed'],
|
||||
'newline-before-return': 'error',
|
||||
|
||||
'lines-around-comment': [
|
||||
'error',
|
||||
{
|
||||
beforeBlockComment: true,
|
||||
beforeLineComment: true,
|
||||
allowBlockStart: true,
|
||||
allowClassStart: true,
|
||||
allowObjectStart: true,
|
||||
allowArrayStart: true,
|
||||
ignorePattern: '!SECTION',
|
||||
},
|
||||
],
|
||||
|
||||
'@typescript-eslint/no-unused-vars': ['error', {
|
||||
varsIgnorePattern: '^_+$',
|
||||
argsIgnorePattern: '^_+$',
|
||||
}],
|
||||
|
||||
'array-element-newline': ['error', 'consistent'],
|
||||
'array-bracket-newline': ['error', 'consistent'],
|
||||
|
||||
'vue/multi-word-component-names': 'off',
|
||||
|
||||
'padding-line-between-statements': [
|
||||
'error',
|
||||
{ blankLine: 'always', prev: 'expression', next: 'const' },
|
||||
{ blankLine: 'always', prev: 'const', next: 'expression' },
|
||||
{ blankLine: 'always', prev: 'multiline-const', next: '*' },
|
||||
{ blankLine: 'always', prev: '*', next: 'multiline-const' },
|
||||
],
|
||||
|
||||
'import/prefer-default-export': 'off',
|
||||
'import/newline-after-import': ['error', { count: 1 }],
|
||||
'no-restricted-imports': ['error', 'vuetify/components', {
|
||||
name: 'vue3-apexcharts',
|
||||
message: 'apexcharts are auto imported',
|
||||
}],
|
||||
|
||||
'import/extensions': [
|
||||
'error',
|
||||
'ignorePackages',
|
||||
{
|
||||
js: 'never',
|
||||
jsx: 'never',
|
||||
ts: 'never',
|
||||
tsx: 'never',
|
||||
},
|
||||
],
|
||||
|
||||
'import/no-unresolved': [2, {
|
||||
ignore: [
|
||||
'~pages$',
|
||||
'virtual:meta-layouts',
|
||||
'#auth$',
|
||||
'#components$',
|
||||
'.*\\?raw',
|
||||
],
|
||||
}],
|
||||
|
||||
'no-shadow': 'off',
|
||||
'@typescript-eslint/no-shadow': ['error'],
|
||||
'@typescript-eslint/consistent-type-imports': 'error',
|
||||
|
||||
// CLAUDE.md frontend convention — backend enums are mirrored as
|
||||
// `as const` objects WITH a same-named `type` alias. The two live
|
||||
// in different namespaces (value vs. type) and are intentional;
|
||||
// both base `no-redeclare` and the typed variant flag them anyway.
|
||||
'no-redeclare': 'off',
|
||||
'@typescript-eslint/no-redeclare': 'off',
|
||||
|
||||
'promise/always-return': 'off',
|
||||
'promise/catch-or-return': 'off',
|
||||
|
||||
'vue/block-tag-newline': 'error',
|
||||
'vue/component-api-style': 'error',
|
||||
'vue/component-name-in-template-casing': ['error', 'PascalCase', {
|
||||
registeredComponentsOnly: false,
|
||||
ignores: ['/^swiper-/'],
|
||||
}],
|
||||
'vue/custom-event-name-casing': ['error', 'camelCase', {
|
||||
ignores: [
|
||||
'/^(click):[a-z]+((\\d)|([A-Z0-9][a-z0-9]+))*([A-Z])?/',
|
||||
],
|
||||
}],
|
||||
'vue/define-macros-order': 'error',
|
||||
'vue/html-comment-content-newline': 'error',
|
||||
'vue/html-comment-content-spacing': 'error',
|
||||
'vue/html-comment-indent': 'error',
|
||||
'vue/match-component-file-name': 'error',
|
||||
'vue/no-child-content': 'error',
|
||||
'vue/require-default-prop': 'off',
|
||||
|
||||
'vue/no-duplicate-attr-inheritance': 'error',
|
||||
'vue/no-empty-component-block': 'error',
|
||||
'vue/no-multiple-objects-in-class': 'error',
|
||||
'vue/no-reserved-component-names': 'error',
|
||||
'vue/no-template-target-blank': 'error',
|
||||
'vue/no-useless-mustaches': 'error',
|
||||
'vue/no-useless-v-bind': 'error',
|
||||
'vue/padding-line-between-blocks': 'error',
|
||||
'vue/prefer-separate-static-class': 'error',
|
||||
'vue/prefer-true-attribute-shorthand': 'error',
|
||||
'vue/v-on-function-call': 'error',
|
||||
'vue/no-restricted-class': ['error', '/^(p|m)(l|r)-/'],
|
||||
'vue/valid-v-slot': ['error', { allowModifiers: true }],
|
||||
|
||||
'vue/no-irregular-whitespace': 'error',
|
||||
'vue/template-curly-spacing': 'error',
|
||||
|
||||
'sonarjs/no-duplicate-string': 'off',
|
||||
'sonarjs/no-nested-template-literals': 'off',
|
||||
|
||||
'regex/invalid': [
|
||||
'error',
|
||||
[
|
||||
{
|
||||
regex: '@/assets/images',
|
||||
replacement: '@images',
|
||||
message: 'Use \'@images\' path alias for image imports',
|
||||
},
|
||||
{
|
||||
regex: '@/assets/styles',
|
||||
replacement: '@styles',
|
||||
message: 'Use \'@styles\' path alias for importing styles from \'src/assets/styles\'',
|
||||
},
|
||||
],
|
||||
'\\.eslintrc\\.cjs',
|
||||
],
|
||||
},
|
||||
settings: {
|
||||
'import/resolver': {
|
||||
node: true,
|
||||
typescript: {},
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -21,7 +21,8 @@ const stateLabel = { open: 'Open', resolved: 'Opgelost', dismissed: 'Dismissed'
|
||||
const stateColor = { open: 'error', resolved: 'success', dismissed: 'warning' } as const
|
||||
|
||||
function formatDateTime(iso: string | null): string {
|
||||
if (!iso) return '—'
|
||||
if (!iso)
|
||||
return '—'
|
||||
|
||||
return new Date(iso).toLocaleDateString('nl-NL', {
|
||||
day: '2-digit',
|
||||
@@ -39,13 +40,13 @@ const resolveDialogOpen = ref(false)
|
||||
const dismissDialogOpen = ref(false)
|
||||
|
||||
function copyText(text: string): void {
|
||||
if (navigator?.clipboard) {
|
||||
if (navigator?.clipboard)
|
||||
void navigator.clipboard.writeText(text)
|
||||
}
|
||||
}
|
||||
|
||||
const formattedContext = computed(() => {
|
||||
if (!failure.value?.context) return null
|
||||
if (!failure.value?.context)
|
||||
return null
|
||||
try {
|
||||
return JSON.stringify(failure.value.context, null, 2)
|
||||
}
|
||||
@@ -53,6 +54,12 @@ const formattedContext = computed(() => {
|
||||
return null
|
||||
}
|
||||
})
|
||||
|
||||
const traceExpanded = ref(false)
|
||||
|
||||
function formatAttemptOutcome(outcome: 'succeeded' | 'failed'): string {
|
||||
return outcome === 'succeeded' ? 'Geslaagd' : 'Mislukt'
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -78,7 +85,7 @@ const formattedContext = computed(() => {
|
||||
<template #append>
|
||||
<VBtn
|
||||
variant="text"
|
||||
@click="refetch()"
|
||||
@click="refetch"
|
||||
>
|
||||
Opnieuw proberen
|
||||
</VBtn>
|
||||
@@ -105,6 +112,14 @@ const formattedContext = computed(() => {
|
||||
<p class="text-body-2 text-disabled mb-0">
|
||||
Failed {{ formatDateTime(failure.failed_at) }} · Listener: {{ listenerShortName(failure.listener_class) }}
|
||||
</p>
|
||||
<p
|
||||
v-if="failure.organisation_name || failure.form_schema_label"
|
||||
class="text-body-2 text-disabled mb-0"
|
||||
>
|
||||
<span v-if="failure.organisation_name">{{ failure.organisation_name }}</span>
|
||||
<span v-if="failure.organisation_name && failure.form_schema_label"> · </span>
|
||||
<span v-if="failure.form_schema_label">{{ failure.form_schema_label }}</span>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<!-- Actions -->
|
||||
@@ -165,6 +180,25 @@ const formattedContext = computed(() => {
|
||||
>
|
||||
Bericht kopiëren
|
||||
</VBtn>
|
||||
|
||||
<div
|
||||
v-if="failure.exception_trace"
|
||||
class="mt-4"
|
||||
>
|
||||
<VBtn
|
||||
variant="text"
|
||||
size="small"
|
||||
:prepend-icon="traceExpanded ? 'tabler-chevron-down' : 'tabler-chevron-right'"
|
||||
@click="traceExpanded = !traceExpanded"
|
||||
>
|
||||
Stack trace
|
||||
</VBtn>
|
||||
<pre
|
||||
v-if="traceExpanded"
|
||||
class="text-caption mt-2"
|
||||
style="white-space: pre-wrap; max-height: 360px; overflow: auto; background: rgb(var(--v-theme-surface)); padding: 0.75rem; border-radius: 4px;"
|
||||
>{{ failure.exception_trace }}</pre>
|
||||
</div>
|
||||
</VCardText>
|
||||
</VCard>
|
||||
|
||||
@@ -175,7 +209,8 @@ const formattedContext = computed(() => {
|
||||
class="mb-4"
|
||||
>
|
||||
<VCardText>
|
||||
<pre class="text-body-2"
|
||||
<pre
|
||||
class="text-body-2"
|
||||
style="white-space: pre-wrap; max-height: 300px; overflow: auto;"
|
||||
>{{ formattedContext }}</pre>
|
||||
<VBtn
|
||||
@@ -228,6 +263,12 @@ const formattedContext = computed(() => {
|
||||
<div class="text-body-2">
|
||||
<strong>Opgelost</strong>
|
||||
<span class="text-caption text-disabled ms-2">{{ formatDateTime(failure.resolved_at) }}</span>
|
||||
<p
|
||||
v-if="failure.resolved_by_user_name"
|
||||
class="text-caption mb-0"
|
||||
>
|
||||
door {{ failure.resolved_by_user_name }}
|
||||
</p>
|
||||
<p
|
||||
v-if="failure.resolved_note"
|
||||
class="text-caption mt-1 mb-0"
|
||||
@@ -245,6 +286,12 @@ const formattedContext = computed(() => {
|
||||
<div class="text-body-2">
|
||||
<strong>Dismissed</strong> ({{ failure.dismissed_reason_type }})
|
||||
<span class="text-caption text-disabled ms-2">{{ formatDateTime(failure.dismissed_at) }}</span>
|
||||
<p
|
||||
v-if="failure.dismissed_by_user_name"
|
||||
class="text-caption mb-0"
|
||||
>
|
||||
door {{ failure.dismissed_by_user_name }}
|
||||
</p>
|
||||
<p
|
||||
v-if="failure.dismissed_reason_note"
|
||||
class="text-caption mt-1 mb-0"
|
||||
@@ -307,32 +354,47 @@ const formattedContext = computed(() => {
|
||||
</VCardText>
|
||||
</VCard>
|
||||
|
||||
<!-- Retry history card -->
|
||||
<!-- Retry history card — per-attempt detail (sessie 3c) -->
|
||||
<VCard
|
||||
title="Retry-geschiedenis"
|
||||
class="mb-4"
|
||||
>
|
||||
<VCardText>
|
||||
<p
|
||||
v-if="failure.retry_count === 0"
|
||||
v-if="!failure.retry_history?.length"
|
||||
class="text-body-2 text-disabled mb-0"
|
||||
>
|
||||
Nog niet opnieuw geprobeerd.
|
||||
</p>
|
||||
<p
|
||||
<VTimeline
|
||||
v-else
|
||||
class="text-body-2 mb-0"
|
||||
density="compact"
|
||||
side="end"
|
||||
>
|
||||
<VChip
|
||||
variant="outlined"
|
||||
<VTimelineItem
|
||||
v-for="attempt in failure.retry_history"
|
||||
:key="attempt.id"
|
||||
:dot-color="attempt.outcome === 'succeeded' ? 'success' : 'error'"
|
||||
size="small"
|
||||
>
|
||||
{{ failure.retry_count }} pogingen
|
||||
</VChip>
|
||||
<span class="text-caption text-disabled ms-2">
|
||||
Per-poging-detail (timestamp + outcome) is nog niet beschikbaar in v1.
|
||||
</span>
|
||||
</p>
|
||||
<div class="text-body-2">
|
||||
<strong>{{ formatAttemptOutcome(attempt.outcome) }}</strong>
|
||||
<span class="text-caption text-disabled ms-2">{{ formatDateTime(attempt.attempted_at) }}</span>
|
||||
<p
|
||||
v-if="attempt.attempted_by_user_name"
|
||||
class="text-caption mb-0"
|
||||
>
|
||||
door {{ attempt.attempted_by_user_name }}
|
||||
</p>
|
||||
<p
|
||||
v-if="attempt.exception_message"
|
||||
class="text-caption mt-1 mb-0"
|
||||
>
|
||||
<code>{{ attempt.exception_class }}</code>: {{ attempt.exception_message }}
|
||||
</p>
|
||||
</div>
|
||||
</VTimelineItem>
|
||||
</VTimeline>
|
||||
</VCardText>
|
||||
</VCard>
|
||||
</VCol>
|
||||
@@ -344,21 +406,21 @@ const formattedContext = computed(() => {
|
||||
:failure="failure"
|
||||
:scope="scope"
|
||||
:org-id="orgId"
|
||||
@success="refetch()"
|
||||
@success="refetch"
|
||||
/>
|
||||
<ResolveFailureDialog
|
||||
v-model="resolveDialogOpen"
|
||||
:failure="failure"
|
||||
:scope="scope"
|
||||
:org-id="orgId"
|
||||
@success="refetch()"
|
||||
@success="refetch"
|
||||
/>
|
||||
<DismissFailureDialog
|
||||
v-model="dismissDialogOpen"
|
||||
:failure="failure"
|
||||
:scope="scope"
|
||||
:org-id="orgId"
|
||||
@success="refetch()"
|
||||
@success="refetch"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -16,16 +16,24 @@ const props = defineProps<{
|
||||
|
||||
const router = useRouter()
|
||||
|
||||
// Filter state — URL-synced via router push so views are shareable.
|
||||
// Filter state — these now drive server-side params (sessie 3c).
|
||||
const stateFilter = ref<FormFailureState | 'all'>('open')
|
||||
const search = ref('')
|
||||
const searchDebounced = refDebounced(search, 400)
|
||||
const listenerClass = ref('')
|
||||
const failedAtFrom = ref('')
|
||||
const failedAtTo = ref('')
|
||||
const page = ref(1)
|
||||
const itemsPerPage = ref(25)
|
||||
|
||||
const params = computed(() => ({
|
||||
page: page.value,
|
||||
per_page: itemsPerPage.value,
|
||||
state: stateFilter.value,
|
||||
search: searchDebounced.value,
|
||||
listener_class: listenerClass.value,
|
||||
failed_at_from: failedAtFrom.value,
|
||||
failed_at_to: failedAtTo.value,
|
||||
}))
|
||||
|
||||
const orgIdRef = computed(() => props.orgId)
|
||||
@@ -33,30 +41,7 @@ const orgIdRef = computed(() => props.orgId)
|
||||
const { data, isLoading, isError, refetch } = useFormFailures(params, props.scope, orgIdRef)
|
||||
const { data: kpis } = useFormFailuresKpis(props.scope, orgIdRef)
|
||||
|
||||
// The backend currently only ships paginated indexes (no server-side
|
||||
// filters). Apply state + search + listener filters client-side over
|
||||
// the current page. Acceptable for the "open failures across orgs"
|
||||
// volumes Crewli sees in v1; tracked for backend pagination work
|
||||
// post-launch.
|
||||
const allItems = computed(() => data.value?.data ?? [])
|
||||
|
||||
const filtered = computed(() => {
|
||||
let rows = allItems.value
|
||||
if (stateFilter.value !== 'all') {
|
||||
rows = rows.filter(r => r.state === stateFilter.value)
|
||||
}
|
||||
const q = searchDebounced.value.trim().toLowerCase()
|
||||
if (q !== '') {
|
||||
rows = rows.filter(r =>
|
||||
r.exception_class.toLowerCase().includes(q)
|
||||
|| r.exception_message.toLowerCase().includes(q)
|
||||
|| r.id.toLowerCase().includes(q)
|
||||
|| r.form_submission_id.toLowerCase().includes(q),
|
||||
)
|
||||
}
|
||||
|
||||
return rows
|
||||
})
|
||||
const items = computed(() => data.value?.data ?? [])
|
||||
|
||||
const stateOptions = [
|
||||
{ title: 'Open', value: 'open' as FormFailureState },
|
||||
@@ -101,7 +86,6 @@ function truncate(s: string, n = 80): string {
|
||||
return s.length > n ? `${s.slice(0, n)}…` : s
|
||||
}
|
||||
|
||||
// Action dialogs — driven by selected row.
|
||||
const retryDialogOpen = ref(false)
|
||||
const resolveDialogOpen = ref(false)
|
||||
const dismissDialogOpen = ref(false)
|
||||
@@ -121,17 +105,20 @@ function openDismiss(f: FormFailure) {
|
||||
}
|
||||
|
||||
function goToDetail(f: FormFailure) {
|
||||
if (props.scope === 'platform') {
|
||||
if (props.scope === 'platform')
|
||||
router.push({ name: 'platform-form-failures-id', params: { id: f.id } })
|
||||
}
|
||||
else {
|
||||
|
||||
else
|
||||
router.push({ name: 'organisation-form-failures-id', params: { id: f.id } })
|
||||
}
|
||||
}
|
||||
|
||||
function clearFilters() {
|
||||
stateFilter.value = 'open'
|
||||
search.value = ''
|
||||
listenerClass.value = ''
|
||||
failedAtFrom.value = ''
|
||||
failedAtTo.value = ''
|
||||
page.value = 1
|
||||
}
|
||||
|
||||
function setStateFilter(s: FormFailureState | 'all') {
|
||||
@@ -142,7 +129,7 @@ function setStateFilter(s: FormFailureState | 'all') {
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<!-- KPI tiles -->
|
||||
<!-- KPI tiles — server-side aggregate (sessie 3c). -->
|
||||
<VRow class="mb-4">
|
||||
<VCol
|
||||
cols="12"
|
||||
@@ -182,7 +169,7 @@ function setStateFilter(s: FormFailureState | 'all') {
|
||||
>
|
||||
<VCardText>
|
||||
<p class="text-caption text-disabled mb-1">
|
||||
Opgelost
|
||||
Opgelost (30d)
|
||||
</p>
|
||||
<h5 class="text-h5">
|
||||
<VIcon
|
||||
@@ -191,7 +178,7 @@ function setStateFilter(s: FormFailureState | 'all') {
|
||||
size="20"
|
||||
class="me-1"
|
||||
/>
|
||||
{{ kpis?.resolved ?? 0 }}
|
||||
{{ kpis?.resolved_30d ?? 0 }}
|
||||
</h5>
|
||||
</VCardText>
|
||||
</VCard>
|
||||
@@ -208,7 +195,7 @@ function setStateFilter(s: FormFailureState | 'all') {
|
||||
>
|
||||
<VCardText>
|
||||
<p class="text-caption text-disabled mb-1">
|
||||
Dismissed
|
||||
Dismissed (30d)
|
||||
</p>
|
||||
<h5 class="text-h5">
|
||||
<VIcon
|
||||
@@ -217,7 +204,7 @@ function setStateFilter(s: FormFailureState | 'all') {
|
||||
size="20"
|
||||
class="me-1"
|
||||
/>
|
||||
{{ kpis?.dismissed ?? 0 }}
|
||||
{{ kpis?.dismissed_30d ?? 0 }}
|
||||
</h5>
|
||||
</VCardText>
|
||||
</VCard>
|
||||
@@ -228,13 +215,11 @@ function setStateFilter(s: FormFailureState | 'all') {
|
||||
>
|
||||
<VCard
|
||||
density="compact"
|
||||
class="cursor-pointer"
|
||||
:variant="stateFilter === 'all' ? 'elevated' : 'outlined'"
|
||||
@click="setStateFilter('all')"
|
||||
variant="outlined"
|
||||
>
|
||||
<VCardText>
|
||||
<p class="text-caption text-disabled mb-1">
|
||||
Totaal
|
||||
Submissions
|
||||
</p>
|
||||
<h5 class="text-h5">
|
||||
<VIcon
|
||||
@@ -243,14 +228,13 @@ function setStateFilter(s: FormFailureState | 'all') {
|
||||
size="20"
|
||||
class="me-1"
|
||||
/>
|
||||
{{ kpis?.total ?? 0 }}
|
||||
{{ kpis?.total_submissions ?? 0 }}
|
||||
</h5>
|
||||
</VCardText>
|
||||
</VCard>
|
||||
</VCol>
|
||||
</VRow>
|
||||
|
||||
<!-- Error -->
|
||||
<VAlert
|
||||
v-if="isError"
|
||||
type="error"
|
||||
@@ -260,7 +244,7 @@ function setStateFilter(s: FormFailureState | 'all') {
|
||||
<template #append>
|
||||
<VBtn
|
||||
variant="text"
|
||||
@click="refetch()"
|
||||
@click="refetch"
|
||||
>
|
||||
Opnieuw proberen
|
||||
</VBtn>
|
||||
@@ -268,7 +252,6 @@ function setStateFilter(s: FormFailureState | 'all') {
|
||||
</VAlert>
|
||||
|
||||
<VCard>
|
||||
<!-- Filter bar -->
|
||||
<VCardText>
|
||||
<VRow>
|
||||
<VCol
|
||||
@@ -297,17 +280,50 @@ function setStateFilter(s: FormFailureState | 'all') {
|
||||
>
|
||||
<AppTextField
|
||||
v-model="search"
|
||||
placeholder="Zoek op exception, ID..."
|
||||
placeholder="Zoek op exception message..."
|
||||
prepend-inner-icon="tabler-search"
|
||||
clearable
|
||||
/>
|
||||
</VCol>
|
||||
<VCol
|
||||
cols="12"
|
||||
md="4"
|
||||
>
|
||||
<AppTextField
|
||||
v-model="listenerClass"
|
||||
label="Listener class"
|
||||
placeholder="App\\Listeners\\..."
|
||||
clearable
|
||||
/>
|
||||
</VCol>
|
||||
<VCol
|
||||
cols="6"
|
||||
md="4"
|
||||
>
|
||||
<AppTextField
|
||||
v-model="failedAtFrom"
|
||||
label="Vanaf"
|
||||
type="date"
|
||||
clearable
|
||||
/>
|
||||
</VCol>
|
||||
<VCol
|
||||
cols="6"
|
||||
md="4"
|
||||
>
|
||||
<AppTextField
|
||||
v-model="failedAtTo"
|
||||
label="Tot"
|
||||
type="date"
|
||||
clearable
|
||||
/>
|
||||
</VCol>
|
||||
</VRow>
|
||||
</VCardText>
|
||||
|
||||
<VDataTableServer
|
||||
:headers="headers"
|
||||
:items="filtered"
|
||||
:items="items"
|
||||
:items-length="data?.meta?.total ?? 0"
|
||||
:loading="isLoading"
|
||||
:items-per-page="itemsPerPage"
|
||||
@@ -433,27 +449,26 @@ function setStateFilter(s: FormFailureState | 'all') {
|
||||
</VDataTableServer>
|
||||
</VCard>
|
||||
|
||||
<!-- Action dialogs -->
|
||||
<RetryFailureDialog
|
||||
v-model="retryDialogOpen"
|
||||
:failure="selectedFailure"
|
||||
:scope="scope"
|
||||
:org-id="orgId"
|
||||
@success="refetch()"
|
||||
@success="refetch"
|
||||
/>
|
||||
<ResolveFailureDialog
|
||||
v-model="resolveDialogOpen"
|
||||
:failure="selectedFailure"
|
||||
:scope="scope"
|
||||
:org-id="orgId"
|
||||
@success="refetch()"
|
||||
@success="refetch"
|
||||
/>
|
||||
<DismissFailureDialog
|
||||
v-model="dismissDialogOpen"
|
||||
:failure="selectedFailure"
|
||||
:scope="scope"
|
||||
:org-id="orgId"
|
||||
@success="refetch()"
|
||||
@success="refetch"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -2,7 +2,11 @@ import { QueryClient, VueQueryPlugin } from '@tanstack/vue-query'
|
||||
import { flushPromises, mount } from '@vue/test-utils'
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
|
||||
import DismissFailureDialog from '../DismissFailureDialog.vue'
|
||||
import type { FormFailure } from '@/types/form-failures'
|
||||
|
||||
const mockPost = vi.fn()
|
||||
|
||||
vi.mock('@/lib/axios', () => ({
|
||||
apiClient: {
|
||||
get: vi.fn(),
|
||||
@@ -10,9 +14,6 @@ vi.mock('@/lib/axios', () => ({
|
||||
},
|
||||
}))
|
||||
|
||||
import DismissFailureDialog from '../DismissFailureDialog.vue'
|
||||
import type { FormFailure } from '@/types/form-failures'
|
||||
|
||||
function makeFailure(overrides: Partial<FormFailure> = {}): FormFailure {
|
||||
return {
|
||||
id: '01ABC',
|
||||
@@ -22,14 +23,23 @@ function makeFailure(overrides: Partial<FormFailure> = {}): FormFailure {
|
||||
failed_at: '2026-04-28T12:00:00Z',
|
||||
exception_class: 'RuntimeException',
|
||||
exception_message: 'boom',
|
||||
exception_trace: null,
|
||||
context: null,
|
||||
retry_count: 0,
|
||||
resolved_at: null,
|
||||
resolved_by_user_id: null,
|
||||
resolved_by_user_name: null,
|
||||
resolved_note: null,
|
||||
dismissed_at: null,
|
||||
dismissed_by_user_id: null,
|
||||
dismissed_by_user_name: null,
|
||||
dismissed_reason_type: null,
|
||||
dismissed_reason_note: null,
|
||||
state: 'open',
|
||||
organisation_id: null,
|
||||
organisation_name: null,
|
||||
form_schema_id: null,
|
||||
form_schema_label: null,
|
||||
...overrides,
|
||||
}
|
||||
}
|
||||
@@ -97,9 +107,11 @@ describe('DismissFailureDialog', () => {
|
||||
|
||||
it('requires note for "other" reason', async () => {
|
||||
const w = mountDialog({ modelValue: true, failure: makeFailure() })
|
||||
|
||||
await w.find('select').setValue('other')
|
||||
|
||||
const dismissBtn = w.findAll('button').find(b => b.text() === 'Dismiss')
|
||||
|
||||
expect((dismissBtn?.element as HTMLButtonElement).disabled).toBe(true)
|
||||
|
||||
await w.find('textarea').setValue('explanation')
|
||||
@@ -110,9 +122,12 @@ describe('DismissFailureDialog', () => {
|
||||
mockPost.mockResolvedValue({ data: { data: makeFailure({ state: 'dismissed' }) } })
|
||||
|
||||
const w = mountDialog({ modelValue: true, failure: makeFailure() })
|
||||
|
||||
await w.find('select').setValue('other')
|
||||
await w.find('textarea').setValue('manual triage')
|
||||
|
||||
const dismissBtn = w.findAll('button').find(b => b.text() === 'Dismiss')
|
||||
|
||||
await dismissBtn?.trigger('click')
|
||||
await flushPromises()
|
||||
|
||||
@@ -126,8 +141,11 @@ describe('DismissFailureDialog', () => {
|
||||
mockPost.mockResolvedValue({ data: { data: makeFailure({ state: 'dismissed' }) } })
|
||||
|
||||
const w = mountDialog({ modelValue: true, failure: makeFailure() })
|
||||
|
||||
await w.find('select').setValue('schema_deleted')
|
||||
|
||||
const dismissBtn = w.findAll('button').find(b => b.text() === 'Dismiss')
|
||||
|
||||
await dismissBtn?.trigger('click')
|
||||
await flushPromises()
|
||||
|
||||
|
||||
@@ -2,7 +2,11 @@ import { QueryClient, VueQueryPlugin } from '@tanstack/vue-query'
|
||||
import { flushPromises, mount } from '@vue/test-utils'
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
|
||||
import FormFailureDetail from '../FormFailureDetail.vue'
|
||||
import type { FormFailure } from '@/types/form-failures'
|
||||
|
||||
const mockGet = vi.fn()
|
||||
|
||||
vi.mock('@/lib/axios', () => ({
|
||||
apiClient: {
|
||||
get: (...args: unknown[]) => mockGet(...args),
|
||||
@@ -10,9 +14,6 @@ vi.mock('@/lib/axios', () => ({
|
||||
},
|
||||
}))
|
||||
|
||||
import FormFailureDetail from '../FormFailureDetail.vue'
|
||||
import type { FormFailure } from '@/types/form-failures'
|
||||
|
||||
function makeFailure(overrides: Partial<FormFailure> = {}): FormFailure {
|
||||
return {
|
||||
id: '01ABCDEFGHIJ',
|
||||
@@ -22,14 +23,23 @@ function makeFailure(overrides: Partial<FormFailure> = {}): FormFailure {
|
||||
failed_at: '2026-04-28T12:00:00Z',
|
||||
exception_class: 'RuntimeException',
|
||||
exception_message: 'something broke',
|
||||
exception_trace: null,
|
||||
context: { target_entity: 'person', target_attribute: 'email' },
|
||||
retry_count: 0,
|
||||
resolved_at: null,
|
||||
resolved_by_user_id: null,
|
||||
resolved_by_user_name: null,
|
||||
resolved_note: null,
|
||||
dismissed_at: null,
|
||||
dismissed_by_user_id: null,
|
||||
dismissed_by_user_name: null,
|
||||
dismissed_reason_type: null,
|
||||
dismissed_reason_note: null,
|
||||
state: 'open',
|
||||
organisation_id: null,
|
||||
organisation_name: null,
|
||||
form_schema_id: null,
|
||||
form_schema_label: null,
|
||||
...overrides,
|
||||
}
|
||||
}
|
||||
@@ -86,6 +96,7 @@ describe('FormFailureDetail', () => {
|
||||
|
||||
it('renders header with state badge for open failure', async () => {
|
||||
const w = mountDetail(makeFailure({ state: 'open' }))
|
||||
|
||||
await flushPromises()
|
||||
await flushPromises()
|
||||
|
||||
@@ -95,15 +106,18 @@ describe('FormFailureDetail', () => {
|
||||
// Open state badge
|
||||
const chips = w.findAll('span[data-color]')
|
||||
const stateChip = chips.find(c => c.attributes('data-color') === 'error')
|
||||
|
||||
expect(stateChip).toBeTruthy()
|
||||
})
|
||||
|
||||
it('renders all 6 cards: Exception, Context, Tijdlijn, Inzending, Listener, Retry-geschiedenis', async () => {
|
||||
const w = mountDetail(makeFailure())
|
||||
|
||||
await flushPromises()
|
||||
await flushPromises()
|
||||
|
||||
const text = w.text()
|
||||
|
||||
expect(text).toContain('Exception')
|
||||
expect(text).toContain('Context')
|
||||
expect(text).toContain('Tijdlijn')
|
||||
@@ -114,6 +128,7 @@ describe('FormFailureDetail', () => {
|
||||
|
||||
it('disables action buttons for resolved state', async () => {
|
||||
const w = mountDetail(makeFailure({ state: 'resolved', resolved_at: '2026-04-29T10:00:00Z' }))
|
||||
|
||||
await flushPromises()
|
||||
await flushPromises()
|
||||
|
||||
@@ -129,24 +144,29 @@ describe('FormFailureDetail', () => {
|
||||
|
||||
it('disables action buttons for dismissed state', async () => {
|
||||
const w = mountDetail(makeFailure({ state: 'dismissed', dismissed_at: '2026-04-29T10:00:00Z', dismissed_reason_type: 'schema_deleted' }))
|
||||
|
||||
await flushPromises()
|
||||
await flushPromises()
|
||||
|
||||
const retry = w.findAll('button').find(b => b.text() === 'Retry')
|
||||
|
||||
expect((retry?.element as HTMLButtonElement).disabled).toBe(true)
|
||||
})
|
||||
|
||||
it('enables action buttons for open state', async () => {
|
||||
const w = mountDetail(makeFailure({ state: 'open' }))
|
||||
|
||||
await flushPromises()
|
||||
await flushPromises()
|
||||
|
||||
const retry = w.findAll('button').find(b => b.text() === 'Retry')
|
||||
|
||||
expect((retry?.element as HTMLButtonElement).disabled).toBe(false)
|
||||
})
|
||||
|
||||
it('renders "In afwachting van actie..." for open with no retries', async () => {
|
||||
const w = mountDetail(makeFailure({ state: 'open', retry_count: 0 }))
|
||||
|
||||
await flushPromises()
|
||||
await flushPromises()
|
||||
|
||||
@@ -159,6 +179,7 @@ describe('FormFailureDetail', () => {
|
||||
resolved_at: '2026-04-29T10:00:00Z',
|
||||
resolved_note: 'fixed via direct edit',
|
||||
}))
|
||||
|
||||
await flushPromises()
|
||||
await flushPromises()
|
||||
|
||||
|
||||
@@ -2,6 +2,9 @@ import { QueryClient, VueQueryPlugin } from '@tanstack/vue-query'
|
||||
import { flushPromises, mount } from '@vue/test-utils'
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
|
||||
import FormFailuresTable from '../FormFailuresTable.vue'
|
||||
import type { FormFailure, FormFailuresKpis } from '@/types/form-failures'
|
||||
|
||||
const mockGet = vi.fn()
|
||||
const mockPost = vi.fn()
|
||||
const pushSpy = vi.fn()
|
||||
@@ -18,9 +21,6 @@ vi.mock('vue-router', () => ({
|
||||
useRouter: () => ({ push: pushSpy, replace: vi.fn() }),
|
||||
}))
|
||||
|
||||
import FormFailuresTable from '../FormFailuresTable.vue'
|
||||
import type { FormFailure } from '@/types/form-failures'
|
||||
|
||||
function makeFailure(overrides: Partial<FormFailure> = {}): FormFailure {
|
||||
return {
|
||||
id: '01ABC123456789',
|
||||
@@ -30,14 +30,23 @@ function makeFailure(overrides: Partial<FormFailure> = {}): FormFailure {
|
||||
failed_at: '2026-04-28T12:00:00Z',
|
||||
exception_class: 'RuntimeException',
|
||||
exception_message: 'something broke',
|
||||
exception_trace: null,
|
||||
context: null,
|
||||
retry_count: 0,
|
||||
resolved_at: null,
|
||||
resolved_by_user_id: null,
|
||||
resolved_by_user_name: null,
|
||||
resolved_note: null,
|
||||
dismissed_at: null,
|
||||
dismissed_by_user_id: null,
|
||||
dismissed_by_user_name: null,
|
||||
dismissed_reason_type: null,
|
||||
dismissed_reason_note: null,
|
||||
state: 'open',
|
||||
organisation_id: null,
|
||||
organisation_name: null,
|
||||
form_schema_id: null,
|
||||
form_schema_label: null,
|
||||
...overrides,
|
||||
}
|
||||
}
|
||||
@@ -59,8 +68,8 @@ const stubs = {
|
||||
VIcon: { template: '<i :class="icon"></i>', props: ['icon', 'size', 'color'] },
|
||||
VChip: { template: '<span class="v-chip-stub" :data-color="color"><slot/></span>', props: ['color', 'size', 'variant'] },
|
||||
AppTextField: {
|
||||
template: '<input :value="modelValue" @input="$emit(\'update:modelValue\', $event.target.value)"/>',
|
||||
props: ['modelValue', 'placeholder', 'prependInnerIcon', 'clearable'],
|
||||
template: '<input :value="modelValue" :placeholder="placeholder" :data-label="label" :type="type" @input="$emit(\'update:modelValue\', $event.target.value)"/>',
|
||||
props: ['modelValue', 'placeholder', 'prependInnerIcon', 'clearable', 'label', 'type'],
|
||||
},
|
||||
VDataTableServer: {
|
||||
template: `<div class="v-data-table-stub">
|
||||
@@ -90,11 +99,16 @@ const stubs = {
|
||||
DismissFailureDialog: { template: '<div class="dismiss-dialog-stub"></div>' },
|
||||
}
|
||||
|
||||
function mountTable(items: FormFailure[]) {
|
||||
// Mocks for both the list and the kpi list calls (composable issues
|
||||
// a single per_page=100 list that drives both).
|
||||
mockGet.mockResolvedValue({
|
||||
data: { data: items, links: {}, meta: { current_page: 1, per_page: 25, total: items.length, last_page: 1 } },
|
||||
function mountTable(items: FormFailure[], kpis: FormFailuresKpis = { open: 0, resolved_30d: 0, dismissed_30d: 0, total_submissions: 0 }) {
|
||||
// Sessie 3c — list and kpi endpoints return different shapes; the mock
|
||||
// routes by URL so both queries get well-typed payloads.
|
||||
mockGet.mockImplementation((url: string) => {
|
||||
if (url.endsWith('/kpis'))
|
||||
return Promise.resolve({ data: { data: kpis } })
|
||||
|
||||
return Promise.resolve({
|
||||
data: { data: items, links: {}, meta: { current_page: 1, per_page: 25, total: items.length, last_page: 1 } },
|
||||
})
|
||||
})
|
||||
|
||||
const client = new QueryClient({ defaultOptions: { queries: { retry: false } } })
|
||||
@@ -115,65 +129,90 @@ beforeEach(() => {
|
||||
})
|
||||
|
||||
describe('FormFailuresTable', () => {
|
||||
it('renders KPI tiles with computed counts from list data', async () => {
|
||||
const w = mountTable([
|
||||
makeFailure({ id: 'A', state: 'open' }),
|
||||
makeFailure({ id: 'B', state: 'resolved' }),
|
||||
makeFailure({ id: 'C', state: 'dismissed' }),
|
||||
makeFailure({ id: 'D', state: 'open' }),
|
||||
])
|
||||
it('renders KPI tiles with values from the /kpis endpoint', async () => {
|
||||
const w = mountTable(
|
||||
[makeFailure({ id: 'A', state: 'open' })],
|
||||
{ open: 7, resolved_30d: 3, dismissed_30d: 1, total_submissions: 42 },
|
||||
)
|
||||
|
||||
await flushPromises()
|
||||
await flushPromises()
|
||||
|
||||
const text = w.text()
|
||||
|
||||
expect(text).toContain('Open failures')
|
||||
expect(text).toContain('Opgelost')
|
||||
expect(text).toContain('Dismissed')
|
||||
expect(text).toContain('Totaal')
|
||||
expect(text).toContain('Opgelost (30d)')
|
||||
expect(text).toContain('Dismissed (30d)')
|
||||
expect(text).toContain('Submissions')
|
||||
expect(text).toContain('7')
|
||||
expect(text).toContain('42')
|
||||
})
|
||||
|
||||
it('shows the open-state chip for an open failure row', async () => {
|
||||
const w = mountTable([makeFailure({ state: 'open' })])
|
||||
|
||||
await flushPromises()
|
||||
await flushPromises()
|
||||
|
||||
const chip = w.find('.v-chip-stub')
|
||||
|
||||
expect(chip.exists()).toBe(true)
|
||||
expect(chip.attributes('data-color')).toBe('error')
|
||||
})
|
||||
|
||||
it('shows the resolved-state chip color for a resolved failure', async () => {
|
||||
it('renders rows the server returned regardless of state filter (server-side filter)', async () => {
|
||||
// Server-side filtering means whatever the API returns gets rendered;
|
||||
// the client no longer hides rows post-fetch.
|
||||
const w = mountTable([makeFailure({ state: 'resolved' })])
|
||||
|
||||
await flushPromises()
|
||||
await flushPromises()
|
||||
|
||||
// stateFilter defaults to 'open'; resolved row gets filtered out.
|
||||
expect(w.findAll('.v-chip-stub')).toHaveLength(0)
|
||||
const chip = w.find('.v-chip-stub')
|
||||
|
||||
expect(chip.exists()).toBe(true)
|
||||
expect(chip.attributes('data-color')).toBe('success')
|
||||
})
|
||||
|
||||
it('renders empty state when there are no rows', async () => {
|
||||
const w = mountTable([])
|
||||
|
||||
await flushPromises()
|
||||
await flushPromises()
|
||||
|
||||
expect(w.text()).toContain('Geen failures gevonden')
|
||||
})
|
||||
|
||||
it('does not show retry button for resolved rows when state filter is "all"', async () => {
|
||||
it('does not show retry button for resolved rows', async () => {
|
||||
const w = mountTable([makeFailure({ state: 'resolved' })])
|
||||
|
||||
await flushPromises()
|
||||
await flushPromises()
|
||||
|
||||
// Click "Alle" toggle button
|
||||
const buttons = w.findAll('button')
|
||||
const allBtn = buttons.find(b => b.text() === 'Alle')
|
||||
expect(allBtn).toBeTruthy()
|
||||
await allBtn?.trigger('click')
|
||||
await flushPromises()
|
||||
|
||||
// For resolved row, retry button is not rendered (template guards
|
||||
// on item.state === 'open').
|
||||
// Template guard: retry button only renders for state === 'open'.
|
||||
const buttonTexts = w.findAll('button').map(b => b.text())
|
||||
|
||||
expect(buttonTexts).not.toContain('Retry')
|
||||
})
|
||||
|
||||
it('forwards search input as a query param to the index endpoint', async () => {
|
||||
const w = mountTable([])
|
||||
|
||||
await flushPromises()
|
||||
|
||||
const search = w.find('input[placeholder="Zoek op exception message..."]')
|
||||
|
||||
expect(search.exists()).toBe(true)
|
||||
await search.setValue('crowd_type')
|
||||
await flushPromises()
|
||||
|
||||
// Debounce default = 400ms; flush timers.
|
||||
await new Promise(resolve => setTimeout(resolve, 450))
|
||||
await flushPromises()
|
||||
|
||||
const indexCalls = mockGet.mock.calls.filter(c => !String(c[0]).endsWith('/kpis'))
|
||||
const lastCall = indexCalls[indexCalls.length - 1]
|
||||
|
||||
expect(lastCall[1]?.params?.search).toBe('crowd_type')
|
||||
})
|
||||
})
|
||||
|
||||
@@ -2,7 +2,11 @@ import { QueryClient, VueQueryPlugin } from '@tanstack/vue-query'
|
||||
import { flushPromises, mount } from '@vue/test-utils'
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
|
||||
import ResolveFailureDialog from '../ResolveFailureDialog.vue'
|
||||
import type { FormFailure } from '@/types/form-failures'
|
||||
|
||||
const mockPost = vi.fn()
|
||||
|
||||
vi.mock('@/lib/axios', () => ({
|
||||
apiClient: {
|
||||
get: vi.fn(),
|
||||
@@ -10,9 +14,6 @@ vi.mock('@/lib/axios', () => ({
|
||||
},
|
||||
}))
|
||||
|
||||
import ResolveFailureDialog from '../ResolveFailureDialog.vue'
|
||||
import type { FormFailure } from '@/types/form-failures'
|
||||
|
||||
function makeFailure(overrides: Partial<FormFailure> = {}): FormFailure {
|
||||
return {
|
||||
id: '01ABC',
|
||||
@@ -22,14 +23,23 @@ function makeFailure(overrides: Partial<FormFailure> = {}): FormFailure {
|
||||
failed_at: '2026-04-28T12:00:00Z',
|
||||
exception_class: 'RuntimeException',
|
||||
exception_message: 'boom',
|
||||
exception_trace: null,
|
||||
context: null,
|
||||
retry_count: 0,
|
||||
resolved_at: null,
|
||||
resolved_by_user_id: null,
|
||||
resolved_by_user_name: null,
|
||||
resolved_note: null,
|
||||
dismissed_at: null,
|
||||
dismissed_by_user_id: null,
|
||||
dismissed_by_user_name: null,
|
||||
dismissed_reason_type: null,
|
||||
dismissed_reason_note: null,
|
||||
state: 'open',
|
||||
organisation_id: null,
|
||||
organisation_name: null,
|
||||
form_schema_id: null,
|
||||
form_schema_label: null,
|
||||
...overrides,
|
||||
}
|
||||
}
|
||||
@@ -76,8 +86,11 @@ describe('ResolveFailureDialog', () => {
|
||||
mockPost.mockResolvedValue({ data: { data: makeFailure({ state: 'resolved' }) } })
|
||||
|
||||
const w = mountDialog({ modelValue: true, failure: makeFailure() })
|
||||
|
||||
await w.find('textarea').setValue('handmatige correctie')
|
||||
|
||||
const confirm = w.findAll('button').find(b => b.text() === 'Markeren als opgelost')
|
||||
|
||||
await confirm?.trigger('click')
|
||||
await flushPromises()
|
||||
|
||||
@@ -90,6 +103,7 @@ describe('ResolveFailureDialog', () => {
|
||||
|
||||
const w = mountDialog({ modelValue: true, failure: makeFailure() })
|
||||
const confirm = w.findAll('button').find(b => b.text() === 'Markeren als opgelost')
|
||||
|
||||
await confirm?.trigger('click')
|
||||
await flushPromises()
|
||||
|
||||
|
||||
@@ -2,7 +2,11 @@ import { QueryClient, VueQueryPlugin } from '@tanstack/vue-query'
|
||||
import { flushPromises, mount } from '@vue/test-utils'
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
|
||||
import RetryFailureDialog from '../RetryFailureDialog.vue'
|
||||
import type { FormFailure } from '@/types/form-failures'
|
||||
|
||||
const mockPost = vi.fn()
|
||||
|
||||
vi.mock('@/lib/axios', () => ({
|
||||
apiClient: {
|
||||
get: vi.fn(),
|
||||
@@ -10,9 +14,6 @@ vi.mock('@/lib/axios', () => ({
|
||||
},
|
||||
}))
|
||||
|
||||
import RetryFailureDialog from '../RetryFailureDialog.vue'
|
||||
import type { FormFailure } from '@/types/form-failures'
|
||||
|
||||
function makeFailure(overrides: Partial<FormFailure> = {}): FormFailure {
|
||||
return {
|
||||
id: '01ABC',
|
||||
@@ -22,14 +23,23 @@ function makeFailure(overrides: Partial<FormFailure> = {}): FormFailure {
|
||||
failed_at: '2026-04-28T12:00:00Z',
|
||||
exception_class: 'RuntimeException',
|
||||
exception_message: 'boom',
|
||||
exception_trace: null,
|
||||
context: null,
|
||||
retry_count: 0,
|
||||
resolved_at: null,
|
||||
resolved_by_user_id: null,
|
||||
resolved_by_user_name: null,
|
||||
resolved_note: null,
|
||||
dismissed_at: null,
|
||||
dismissed_by_user_id: null,
|
||||
dismissed_by_user_name: null,
|
||||
dismissed_reason_type: null,
|
||||
dismissed_reason_note: null,
|
||||
state: 'open',
|
||||
organisation_id: null,
|
||||
organisation_name: null,
|
||||
form_schema_id: null,
|
||||
form_schema_label: null,
|
||||
...overrides,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,15 @@ import { mount } from '@vue/test-utils'
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
import { defineComponent, h, ref } from 'vue'
|
||||
|
||||
import {
|
||||
useDismissFailure,
|
||||
useFormFailure,
|
||||
useFormFailures,
|
||||
useFormFailuresKpis,
|
||||
useResolveFailure,
|
||||
useRetryFailure,
|
||||
} from '../useFormFailures'
|
||||
|
||||
const mockGet = vi.fn()
|
||||
const mockPost = vi.fn()
|
||||
|
||||
@@ -13,14 +22,6 @@ vi.mock('@/lib/axios', () => ({
|
||||
},
|
||||
}))
|
||||
|
||||
import {
|
||||
useDismissFailure,
|
||||
useFormFailure,
|
||||
useFormFailures,
|
||||
useResolveFailure,
|
||||
useRetryFailure,
|
||||
} from '../useFormFailures'
|
||||
|
||||
function flushAsync(): Promise<void> {
|
||||
return new Promise(resolve => setTimeout(resolve, 0))
|
||||
}
|
||||
@@ -82,6 +83,62 @@ describe('useFormFailures (list)', () => {
|
||||
|
||||
expect(mockGet).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('forwards server-side filters and strips empty values', async () => {
|
||||
mockGet.mockResolvedValue({ data: { data: [], links: {}, meta: { current_page: 1, per_page: 25, total: 0, last_page: 1 } } })
|
||||
|
||||
mountWithQuery(() => useFormFailures(
|
||||
ref({
|
||||
page: 2,
|
||||
per_page: 25,
|
||||
state: 'open',
|
||||
search: ' crowd_type ',
|
||||
listener_class: 'App\\Listeners\\FormBuilder\\ApplyBindingsOnFormSubmit',
|
||||
failed_at_from: '2026-01-01',
|
||||
failed_at_to: '',
|
||||
}),
|
||||
'platform',
|
||||
))
|
||||
await flushAsync()
|
||||
|
||||
expect(mockGet).toHaveBeenCalledWith('/admin/form-failures', {
|
||||
params: {
|
||||
page: 2,
|
||||
per_page: 25,
|
||||
state: 'open',
|
||||
search: 'crowd_type',
|
||||
listener_class: 'App\\Listeners\\FormBuilder\\ApplyBindingsOnFormSubmit',
|
||||
failed_at_from: '2026-01-01',
|
||||
},
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('useFormFailuresKpis', () => {
|
||||
it('GETs the platform /kpis endpoint and unwraps data', async () => {
|
||||
mockGet.mockResolvedValue({ data: { data: { open: 3, resolved_30d: 5, dismissed_30d: 1, total_submissions: 42 } } })
|
||||
|
||||
const { vm } = mountWithQuery(() => useFormFailuresKpis('platform'))
|
||||
|
||||
await flushAsync()
|
||||
|
||||
expect(mockGet).toHaveBeenCalledWith('/admin/form-failures/kpis')
|
||||
expect((vm.result as { data: { value: unknown } }).data.value).toEqual({
|
||||
open: 3,
|
||||
resolved_30d: 5,
|
||||
dismissed_30d: 1,
|
||||
total_submissions: 42,
|
||||
})
|
||||
})
|
||||
|
||||
it('GETs the org-scoped /kpis endpoint', async () => {
|
||||
mockGet.mockResolvedValue({ data: { data: { open: 0, resolved_30d: 0, dismissed_30d: 0, total_submissions: 0 } } })
|
||||
|
||||
mountWithQuery(() => useFormFailuresKpis('org', ref('01H-org-id')))
|
||||
await flushAsync()
|
||||
|
||||
expect(mockGet).toHaveBeenCalledWith('/organisations/01H-org-id/form-failures/kpis')
|
||||
})
|
||||
})
|
||||
|
||||
describe('useFormFailure (single)', () => {
|
||||
@@ -115,6 +172,7 @@ describe('useResolveFailure', () => {
|
||||
mockPost.mockResolvedValue({ data: { data: { id: 'X', state: 'resolved' } } })
|
||||
|
||||
const { vm } = mountWithQuery(() => useResolveFailure('platform'))
|
||||
|
||||
await vm.result.mutateAsync({ failureId: 'X', payload: { note: 'fixed' } })
|
||||
|
||||
expect(mockPost).toHaveBeenCalledWith('/admin/form-failures/X/resolve', { note: 'fixed' })
|
||||
@@ -124,6 +182,7 @@ describe('useResolveFailure', () => {
|
||||
mockPost.mockResolvedValue({ data: { data: { id: 'X', state: 'resolved' } } })
|
||||
|
||||
const { vm } = mountWithQuery(() => useResolveFailure('platform'))
|
||||
|
||||
await vm.result.mutateAsync({ failureId: 'X', payload: { note: ' ' } })
|
||||
|
||||
expect(mockPost).toHaveBeenCalledWith('/admin/form-failures/X/resolve', {})
|
||||
@@ -135,6 +194,7 @@ describe('useDismissFailure', () => {
|
||||
mockPost.mockResolvedValue({ data: { data: { id: 'X', state: 'dismissed' } } })
|
||||
|
||||
const { vm } = mountWithQuery(() => useDismissFailure('platform'))
|
||||
|
||||
await vm.result.mutateAsync({
|
||||
failureId: 'X',
|
||||
payload: { reason_type: 'other', note: 'manual triage' },
|
||||
@@ -150,6 +210,7 @@ describe('useDismissFailure', () => {
|
||||
mockPost.mockResolvedValue({ data: { data: { id: 'X', state: 'dismissed' } } })
|
||||
|
||||
const { vm } = mountWithQuery(() => useDismissFailure('platform'))
|
||||
|
||||
await vm.result.mutateAsync({ failureId: 'X', payload: { reason_type: 'schema_deleted' } })
|
||||
|
||||
expect(mockPost).toHaveBeenCalledWith(
|
||||
|
||||
@@ -12,7 +12,7 @@ import type {
|
||||
|
||||
/**
|
||||
* TanStack Vue Query composables for the FormSubmissionActionFailure
|
||||
* admin endpoints landed in WS-6 sessie 2.
|
||||
* admin endpoints.
|
||||
*
|
||||
* Routes (matching api/routes/api.php):
|
||||
* - Platform (super_admin): /api/v1/admin/form-failures
|
||||
@@ -21,6 +21,10 @@ import type {
|
||||
* Both scopes share the same controller methods + resource shape; the
|
||||
* scope argument selects the URL prefix and the cache key family. The
|
||||
* org-scope variant additionally requires `orgId`.
|
||||
*
|
||||
* Sessie 3c — index now accepts server-side filters (state/search/
|
||||
* failed_at_from/failed_at_to/listener_class) and a separate `/kpis`
|
||||
* endpoint replaces the client-side bucketing of an oversized list.
|
||||
*/
|
||||
|
||||
interface PaginatedResponse<T> {
|
||||
@@ -41,14 +45,12 @@ interface SingleResponse<T> {
|
||||
export type FormFailureScope = 'platform' | 'org'
|
||||
|
||||
function basePath(scope: FormFailureScope, orgId?: MaybeRef<string | undefined>): string {
|
||||
if (scope === 'platform') {
|
||||
if (scope === 'platform')
|
||||
return '/admin/form-failures'
|
||||
}
|
||||
|
||||
const id = unref(orgId)
|
||||
if (!id) {
|
||||
if (!id)
|
||||
throw new Error('useFormFailures: org scope requires orgId')
|
||||
}
|
||||
|
||||
return `/organisations/${id}/form-failures`
|
||||
}
|
||||
@@ -57,6 +59,30 @@ function listKey(scope: FormFailureScope, orgId: MaybeRef<string | undefined>, p
|
||||
return ['form-failures', scope, unref(orgId) ?? null, unref(params)]
|
||||
}
|
||||
|
||||
/**
|
||||
* Strip empty/undefined keys so the URL stays clean and the React Query
|
||||
* key family doesn't fragment over stable (vs. dirty) inputs.
|
||||
*/
|
||||
function buildIndexParams(p: FormFailuresListParams): Record<string, string | number> {
|
||||
const out: Record<string, string | number> = {}
|
||||
if (p.page !== undefined)
|
||||
out.page = p.page
|
||||
if (p.per_page !== undefined)
|
||||
out.per_page = p.per_page
|
||||
if (p.state !== undefined && p.state !== null)
|
||||
out.state = p.state
|
||||
if (p.listener_class && p.listener_class.trim() !== '')
|
||||
out.listener_class = p.listener_class
|
||||
if (p.failed_at_from && p.failed_at_from.trim() !== '')
|
||||
out.failed_at_from = p.failed_at_from
|
||||
if (p.failed_at_to && p.failed_at_to.trim() !== '')
|
||||
out.failed_at_to = p.failed_at_to
|
||||
if (p.search && p.search.trim() !== '')
|
||||
out.search = p.search.trim()
|
||||
|
||||
return out
|
||||
}
|
||||
|
||||
export function useFormFailures(
|
||||
params: MaybeRef<FormFailuresListParams>,
|
||||
scope: FormFailureScope,
|
||||
@@ -66,11 +92,9 @@ export function useFormFailures(
|
||||
queryKey: computed(() => listKey(scope, orgId, params)),
|
||||
queryFn: async () => {
|
||||
const p = unref(params)
|
||||
|
||||
const { data } = await apiClient.get<PaginatedResponse<FormFailure>>(basePath(scope, orgId), {
|
||||
params: {
|
||||
page: p.page,
|
||||
per_page: p.per_page,
|
||||
},
|
||||
params: buildIndexParams(p),
|
||||
})
|
||||
|
||||
return data
|
||||
@@ -80,33 +104,18 @@ export function useFormFailures(
|
||||
}
|
||||
|
||||
/**
|
||||
* KPI counts derived client-side via 3 parallel state-filtered list calls
|
||||
* + the unfiltered total. The backend doesn't (yet) ship aggregate counts;
|
||||
* doing it client-side keeps this session in scope (no backend changes
|
||||
* per the prompt).
|
||||
* Server-side KPI aggregate. Single COUNT-per-metric query — independent
|
||||
* of tenant volume. Replaces sessie 3b's client-side bucketing.
|
||||
*/
|
||||
export function useFormFailuresKpis(scope: FormFailureScope, orgId?: MaybeRef<string | undefined>) {
|
||||
return useQuery({
|
||||
queryKey: ['form-failures-kpis', scope, computed(() => unref(orgId) ?? null)],
|
||||
queryFn: async (): Promise<FormFailuresKpis> => {
|
||||
const path = basePath(scope, orgId)
|
||||
const [allRes] = await Promise.all([
|
||||
apiClient.get<PaginatedResponse<FormFailure>>(path, { params: { per_page: 100 } }),
|
||||
])
|
||||
const { data } = await apiClient.get<SingleResponse<FormFailuresKpis>>(
|
||||
`${basePath(scope, orgId)}/kpis`,
|
||||
)
|
||||
|
||||
// Backend currently lists everything in failed_at-DESC order; bucket
|
||||
// by client-side `state`. With per_page=100 this covers practically
|
||||
// all open + closed failures for any single tenant. Backlog item
|
||||
// tracks moving to a server-side count endpoint.
|
||||
const all = allRes.data.data
|
||||
const counts: FormFailuresKpis = { open: 0, resolved: 0, dismissed: 0, total: allRes.data.meta.total }
|
||||
for (const f of all) {
|
||||
if (f.state === 'open') counts.open += 1
|
||||
else if (f.state === 'resolved') counts.resolved += 1
|
||||
else if (f.state === 'dismissed') counts.dismissed += 1
|
||||
}
|
||||
|
||||
return counts
|
||||
return data.data
|
||||
},
|
||||
enabled: () => scope === 'platform' || !!unref(orgId),
|
||||
})
|
||||
@@ -134,8 +143,10 @@ function invalidateFamily(qc: ReturnType<typeof useQueryClient>, scope: FormFail
|
||||
qc.invalidateQueries({ queryKey: ['form-failures', scope] })
|
||||
qc.invalidateQueries({ queryKey: ['form-failures-kpis', scope] })
|
||||
qc.invalidateQueries({ queryKey: ['form-failure', scope] })
|
||||
|
||||
// Pipeline retry succeeds → submission state may also change.
|
||||
qc.invalidateQueries({ queryKey: ['form-submissions'] })
|
||||
|
||||
// Touch orgId to silence "unused" lint when scope === 'platform'.
|
||||
void unref(orgId)
|
||||
}
|
||||
@@ -164,9 +175,8 @@ export function useResolveFailure(scope: FormFailureScope, orgId?: MaybeRef<stri
|
||||
// FormRequest treats an absent key and a null value identically,
|
||||
// but keeping the payload tight avoids audit-log noise.
|
||||
const body: Record<string, string> = {}
|
||||
if (payload.note && payload.note.trim() !== '') {
|
||||
if (payload.note && payload.note.trim() !== '')
|
||||
body.note = payload.note.trim()
|
||||
}
|
||||
|
||||
const { data } = await apiClient.post<SingleResponse<FormFailure>>(
|
||||
`${basePath(scope, orgId)}/${failureId}/resolve`,
|
||||
@@ -185,9 +195,8 @@ export function useDismissFailure(scope: FormFailureScope, orgId?: MaybeRef<stri
|
||||
return useMutation({
|
||||
mutationFn: async ({ failureId, payload }: { failureId: string; payload: DismissFailurePayload }) => {
|
||||
const body: Record<string, string> = { reason_type: payload.reason_type }
|
||||
if (payload.note && payload.note.trim() !== '') {
|
||||
if (payload.note && payload.note.trim() !== '')
|
||||
body.note = payload.note.trim()
|
||||
}
|
||||
|
||||
const { data } = await apiClient.post<SingleResponse<FormFailure>>(
|
||||
`${basePath(scope, orgId)}/${failureId}/dismiss`,
|
||||
|
||||
@@ -11,7 +11,24 @@ export type FormFailureDismissalReason =
|
||||
| 'data_quality_issue'
|
||||
| 'other'
|
||||
|
||||
/** The shape returned by the controller's `show` / index endpoints. */
|
||||
export type FormFailureRetryOutcome = 'succeeded' | 'failed'
|
||||
|
||||
/** Per-attempt retry record exposed inside FormFailure.retry_history. */
|
||||
export interface FormFailureRetryAttempt {
|
||||
id: string
|
||||
attempted_at: string
|
||||
attempted_by_user_id: string | null
|
||||
attempted_by_user_name: string | null
|
||||
outcome: FormFailureRetryOutcome
|
||||
exception_class: string | null
|
||||
exception_message: string | null
|
||||
}
|
||||
|
||||
/**
|
||||
* The shape returned by the controller's `show` / index endpoints.
|
||||
* Index payloads omit `retry_history` (it's only eager-loaded on the
|
||||
* detail endpoint) — the field is optional on the type.
|
||||
*/
|
||||
export interface FormFailure {
|
||||
id: string
|
||||
form_submission_id: string
|
||||
@@ -20,37 +37,43 @@ export interface FormFailure {
|
||||
failed_at: string
|
||||
exception_class: string
|
||||
exception_message: string
|
||||
exception_trace: string | null
|
||||
context: Record<string, unknown> | null
|
||||
retry_count: number
|
||||
resolved_at: string | null
|
||||
resolved_by_user_id: string | null
|
||||
resolved_by_user_name: string | null
|
||||
resolved_note: string | null
|
||||
dismissed_at: string | null
|
||||
dismissed_by_user_id: string | null
|
||||
dismissed_by_user_name: string | null
|
||||
dismissed_reason_type: FormFailureDismissalReason | null
|
||||
dismissed_reason_note: string | null
|
||||
state: FormFailureState
|
||||
organisation_id: string | null
|
||||
organisation_name: string | null
|
||||
form_schema_id: string | null
|
||||
form_schema_label: string | null
|
||||
retry_history?: FormFailureRetryAttempt[]
|
||||
}
|
||||
|
||||
/** Filter / pagination params for the list endpoint. */
|
||||
/** Filter / pagination params forwarded to the index endpoint. */
|
||||
export interface FormFailuresListParams {
|
||||
page?: number
|
||||
per_page?: number
|
||||
// Note: backend currently ships only `latest('failed_at')->paginate(50)`
|
||||
// (sessie 2 controller); filters are applied client-side. The shape
|
||||
// here is what the UI tracks; only `page` is forwarded as a query
|
||||
// parameter today.
|
||||
state?: FormFailureState | 'all'
|
||||
listener?: string
|
||||
listener_class?: string
|
||||
failed_at_from?: string
|
||||
failed_at_to?: string
|
||||
search?: string
|
||||
}
|
||||
|
||||
/** KPI counts derived client-side via parallel state-filtered list calls. */
|
||||
/** Server-side aggregate counters returned by the `/kpis` endpoint. */
|
||||
export interface FormFailuresKpis {
|
||||
open: number
|
||||
resolved: number
|
||||
dismissed: number
|
||||
total: number
|
||||
resolved_30d: number
|
||||
dismissed_30d: number
|
||||
total_submissions: number
|
||||
}
|
||||
|
||||
export interface ResolveFailurePayload {
|
||||
|
||||
@@ -11,7 +11,9 @@
|
||||
> tracking on the parent. Parent's `retry_count` stays as denormalised
|
||||
> cache; service layer (`FormFailureRetryService`) keeps both in sync.
|
||||
> `canBeRetried()` now correctly checks both `resolved_at` AND
|
||||
> `dismissed_at` (sessie 2 Q2 closure).
|
||||
> `dismissed_at` (sessie 2 Q2 closure). Also adds `exception_trace`
|
||||
> (longtext nullable) on `form_submission_action_failures` for the
|
||||
> admin-UI triage view.
|
||||
> RFC-WS-6.md §3 Q5 addendum.
|
||||
>
|
||||
> - v2.8: WS-6 session 3a.5 — `companies.kvk_number` column added
|
||||
@@ -2593,6 +2595,7 @@ that aggregates the user's submitted, non-test `form_submissions`.
|
||||
| `failed_at` | timestamp | |
|
||||
| `exception_class` | string(255) | |
|
||||
| `exception_message` | text | |
|
||||
| `exception_trace` | longtext nullable | Full PHP stack trace for triage (admin-UI). **v2.9 — WS-6 sessie 3c** |
|
||||
| `context` | json | Free-form: `{target_entity, target_attribute, value_excerpt, merge_strategy}` |
|
||||
| `retry_count` | tinyint unsigned | default: 0 |
|
||||
| `resolved_at` | timestamp nullable | Set when retry succeeds OR organiser marks resolved |
|
||||
|
||||
Reference in New Issue
Block a user