eslint and build
Some checks failed
CI / Rustfmt (push) Successful in 22s
CI / Cargo Audit & Deny (push) Failing after 32s
CI / Web Blocking Checks (push) Successful in 47s
CI / Security Blocking Checks (push) Successful in 9s
CI / Clippy (push) Successful in 2m9s
CI / Web Advisory Checks (push) Successful in 37s
CI / Security Advisory Checks (push) Successful in 34s
CI / Tests (push) Failing after 8m37s

This commit is contained in:
2026-03-05 08:18:07 -06:00
parent 179180d604
commit c61fe26713
9 changed files with 51 additions and 27 deletions

View File

@@ -4,7 +4,9 @@ import { useCreatePack, useUpdatePack } from "@/hooks/usePacks";
import type { PackResponse } from "@/api";
import { labelToRef } from "@/lib/format-utils";
import SchemaBuilder from "@/components/common/SchemaBuilder";
import ParamSchemaForm from "@/components/common/ParamSchemaForm";
import ParamSchemaForm, {
type ParamSchema,
} from "@/components/common/ParamSchemaForm";
import { RotateCcw } from "lucide-react";
// eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -603,7 +605,7 @@ export default function PackForm({ pack, onSuccess, onCancel }: PackFormProps) {
</p>
</div>
<ParamSchemaForm
schema={confSchema}
schema={confSchema as unknown as ParamSchema}
values={configValues}
onChange={setConfigValues}
errors={errors}

View File

@@ -15,6 +15,7 @@ import type {
TriggerResponse,
ActionResponse,
} from "@/types/api";
import type { CreateRuleRequest, UpdateRuleRequest } from "@/api";
import { labelToRef, extractLocalRef, combineRefs } from "@/lib/format-utils";
// eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -205,7 +206,7 @@ export default function RuleForm({ rule, onSuccess, onCancel }: RuleFormProps) {
// Combine pack ref and local ref to create full ref
const fullRef = combineRefs(selectedPackData?.ref || "", localRef.trim());
const formData: Record<string, JsonValue> = {
const formData: Record<string, JsonValue> & Partial<CreateRuleRequest> = {
pack_ref: selectedPackData?.ref || "",
ref: fullRef,
label: label.trim(),
@@ -232,9 +233,14 @@ export default function RuleForm({ rule, onSuccess, onCancel }: RuleFormProps) {
try {
if (isEditing && rule) {
await updateRule.mutateAsync({ ref: rule.ref, data: formData });
await updateRule.mutateAsync({
ref: rule.ref,
data: formData as unknown as UpdateRuleRequest,
});
} else {
const newRuleResponse = await createRule.mutateAsync(formData);
const newRuleResponse = await createRule.mutateAsync(
formData as unknown as CreateRuleRequest,
);
if (!onSuccess) {
navigate(`/rules/${newRuleResponse.data.ref}`);
}

View File

@@ -68,7 +68,9 @@ export default function TriggerForm({
setPackId(pack.id);
}
// Extract local ref from full ref
setLocalRef(extractLocalRef(initialData.ref, initialData.pack_ref));
setLocalRef(
extractLocalRef(initialData.ref, initialData.pack_ref ?? undefined),
);
}
}
}, [initialData, packs, isEditing]);

View File

@@ -213,7 +213,9 @@ export default function WorkflowInputsPanel({
<SchemaBuilder
value={draftSchema}
onChange={(schema) =>
setDraftSchema(schema as Record<string, ParamDefinition>)
setDraftSchema(
schema as unknown as Record<string, ParamDefinition>,
)
}
placeholder={
modalTarget === "parameters"

View File

@@ -1,6 +1,9 @@
import { useCallback } from "react";
import { useQueryClient } from "@tanstack/react-query";
import { useEntityNotifications } from "@/contexts/WebSocketContext";
import {
useEntityNotifications,
type Notification,
} from "@/contexts/WebSocketContext";
interface UseArtifactStreamOptions {
/**
@@ -62,7 +65,8 @@ export function useArtifactStream(options: UseArtifactStreamOptions = {}) {
const queryClient = useQueryClient();
const handleNotification = useCallback(
(notification: ArtifactNotification) => {
(raw: Notification) => {
const notification = raw as unknown as ArtifactNotification;
const payload = notification.payload;
// If we're filtering by execution ID, only process matching artifacts

View File

@@ -1,6 +1,9 @@
import { useCallback } from "react";
import { useQueryClient } from "@tanstack/react-query";
import { useEntityNotifications } from "@/contexts/WebSocketContext";
import {
useEntityNotifications,
type Notification,
} from "@/contexts/WebSocketContext";
import type { EnforcementSummary } from "@/api";
interface UseEnforcementStreamOptions {
@@ -120,7 +123,8 @@ export function useEnforcementStream(
const queryClient = useQueryClient();
const handleNotification = useCallback(
(notification: EnforcementNotification) => {
(raw: Notification) => {
const notification = raw as unknown as EnforcementNotification;
// Filter by enforcement ID if specified
if (enforcementId && notification.entity_id !== enforcementId) {
return;

View File

@@ -1,7 +1,10 @@
import { useCallback } from "react";
import { useQueryClient } from "@tanstack/react-query";
import { useEntityNotifications } from "@/contexts/WebSocketContext";
import type { ExecutionSummary } from "@/api";
import {
useEntityNotifications,
type Notification,
} from "@/contexts/WebSocketContext";
import type { ExecutionSummary, ExecutionStatus } from "@/api";
interface UseExecutionStreamOptions {
/**
@@ -132,10 +135,8 @@ function executionMatchesParams(
return false;
}
// Check executor filter (may be present)
if (params.executor !== undefined && execution.executor !== params.executor) {
return false;
}
// Note: executor is not part of ExecutionSummary so we cannot filter on it
// from WebSocket payloads. Executor-filtered queries rely on API refetch.
// Note: rule_ref and trigger_ref are NOT checked here because they may not be
// present in WebSocket payloads (they come from enforcement data which is
@@ -152,7 +153,7 @@ function hasUnsupportedFilters(
params: ExecutionQueryParams | undefined,
): boolean {
if (!params) return false;
return !!(params.ruleRef || params.triggerRef);
return !!(params.ruleRef || params.triggerRef || params.executor);
}
/**
@@ -175,21 +176,23 @@ export function useExecutionStream(options: UseExecutionStreamOptions = {}) {
const queryClient = useQueryClient();
const handleNotification = useCallback(
(notification: ExecutionNotification) => {
(notification: Notification) => {
const executionNotification =
notification as unknown as ExecutionNotification;
// Filter by execution ID if specified
if (executionId && notification.entity_id !== executionId) {
if (executionId && executionNotification.entity_id !== executionId) {
return;
}
// Extract execution data from notification payload (flat structure).
// Keep raw payload for old_status inspection, but use cleaned data for cache.
const rawPayload = notification.payload;
const rawPayload = executionNotification.payload;
const oldStatus: string | undefined = rawPayload?.old_status;
const executionData = stripNotificationMeta(rawPayload);
// Update specific execution query if it exists
queryClient.setQueryData(
["executions", notification.entity_id],
["executions", executionNotification.entity_id],
(old: ExecutionDetailCache | undefined) => {
if (!old) return old;
return {
@@ -223,7 +226,7 @@ export function useExecutionStream(options: UseExecutionStreamOptions = {}) {
// Check if execution already exists in the list
const existingIndex = old.data.findIndex(
(exec) => exec.id === notification.entity_id,
(exec) => exec.id === executionNotification.entity_id,
);
// Merge the updated fields to determine if the execution matches the query
@@ -266,7 +269,7 @@ export function useExecutionStream(options: UseExecutionStreamOptions = {}) {
// not in our local data array, total_items must stay accurate.
const virtualOldExecution = {
...mergedExecution,
status: oldStatus,
status: oldStatus as ExecutionStatus,
};
const oldMatchedQuery = executionMatchesParams(
virtualOldExecution,

View File

@@ -551,11 +551,11 @@ function ActionDetail({ actionRef }: { actionRef: string }) {
</span>
<span
className={`px-2 py-1 text-xs rounded ${
execution.status === "Completed"
execution.status === "completed"
? "bg-green-100 text-green-800"
: execution.status === "Failed"
: execution.status === "failed"
? "bg-red-100 text-red-800"
: execution.status === "Running"
: execution.status === "running"
? "bg-blue-100 text-blue-800"
: "bg-gray-100 text-gray-800"
}`}

View File

@@ -219,6 +219,7 @@ export interface ParamDefinition {
secret?: boolean;
default?: unknown;
enum?: string[];
[key: string]: unknown;
}
/** Workflow definition as stored in the YAML file / API */