fix: add missing each-block keys (svelte/require-each-key)

Fixed all 27 remaining instances across 19 files. Keys used:
- Object ID fields where available (e.g. account_id_random, event_file_id)
- index for logger lists with no reliable unique key
- Property name for Object.entries() loops
This commit is contained in:
Scott Idem
2026-03-06 17:54:50 -05:00
parent dd5cf9b63b
commit 48d5fe8995
19 changed files with 163 additions and 163 deletions

View File

@@ -6,17 +6,17 @@
import { get_object } from '$lib/ae_api/api_get_object';
import { post_object } from '$lib/ae_api/api_post_object';
import { patch_object } from '$lib/ae_api/api_patch_object';
import {
Database,
Server,
User,
Users,
import {
Database,
Server,
User,
Users,
UserCheck,
Building2,
MapPin,
Contact,
ShieldCheck,
Globe,
MapPin,
Contact,
ShieldCheck,
Globe,
RefreshCcw,
Trash2,
Bug,
@@ -91,7 +91,7 @@
test_result = 'loading...';
const endpoint = '/v3/crud/journal/';
const params: Record<string, any> = { limit: 1 };
const custom_headers: Record<string, string> = {};
const active_key = trace_use_agent_key ? trace_agent_key : $ae_api.api_secret_key;
custom_headers['x-aether-api-key'] = active_key;
@@ -122,7 +122,7 @@
try {
const url = new URL(endpoint, $ae_api.base_url);
Object.keys(params).forEach(k => url.searchParams.append(k, String(params[k])));
const response = await fetch(url.toString(), {
method: 'GET',
headers: custom_headers
@@ -152,11 +152,11 @@
const test_whoami = () => run_test('Who Am I? (JWT Test)', async () => {
if (!$ae_loc.user_id) throw new Error('No user_id found in session.');
return await load_ae_obj_id__user({
api_cfg: $ae_api,
user_id: $ae_loc.user_id,
try_cache: false,
log_lvl: 1
return await load_ae_obj_id__user({
api_cfg: $ae_api,
user_id: $ae_loc.user_id,
try_cache: false,
log_lvl: 1
});
});
@@ -183,74 +183,74 @@
// Capture current state at test time
const current_ae_api = $ae_api;
const current_ae_loc = $ae_loc;
const endpoint = `/v3/crud/account/${current_ae_loc.account_id || 'ghost'}`;
const data = {
name: current_ae_loc.account_name,
_non_existent_field: 'This should be ignored by the API'
const data = {
name: current_ae_loc.account_name,
_non_existent_field: 'This should be ignored by the API'
};
console.log('Permissive Mode: Starting PATCH test...', { endpoint, headers: current_ae_api.headers });
const result = await patch_object({
api_cfg: current_ae_api,
endpoint,
data,
log_lvl: 1
const result = await patch_object({
api_cfg: current_ae_api,
endpoint,
data,
log_lvl: 1
});
if (!result) throw new Error('API returned false. Check console for 401/403/500 errors.');
return {
return {
message: 'SUCCESS: API accepted request with unknown field (Permissive Mode Active)',
account_id: result.account_id,
id_vision: typeof result.account_id === 'string' ? 'V3 (String)' : 'LEGACY (Integer)',
returned_data: result
returned_data: result
};
});
const test_structured_error = () => run_test('Structured Error Validation (Deliberate 400)', async () => {
const current_ae_api = $ae_api;
// Use the exact Recovery Meetings search pattern to verify why it's throwing 403
const endpoint = `/v3/crud/event/search`;
const search_query = {
const search_query = {
and: [
{ field: "conference", op: "eq", value: 0 },
{ field: "trigger_schema_violation_400", op: "eq", value: "fail" }
]
]
};
console.log('Structured Error: Starting deliberate 400 test with Recovery filters...', { endpoint });
const result = await post_object({
api_cfg: current_ae_api,
endpoint,
const result = await post_object({
api_cfg: current_ae_api,
endpoint,
data: search_query,
log_lvl: 1
log_lvl: 1
});
// In Structured Error Mode, the helper returns the JSON object if it contains meta.details
if (result?.meta?.details) {
return {
success: true,
return {
success: true,
message: 'PASS: Successfully extracted rich error metadata',
source: result.meta.details.category === 'validation' ? 'FastAPI Detail (Wrapped)' : 'V3 Meta Envelope',
details: result.meta.details
details: result.meta.details
};
}
return {
success: false,
return {
success: false,
message: 'FAIL: API returned an error but the helper could not extract metadata.',
raw_result: result
raw_result: result
};
});
// Environment Diagnostics
let is_native = $derived(typeof window !== 'undefined' && !!(window as any).native_app);
let app_mode = $derived($events_loc?.launcher?.app_mode || 'web');
// Derived state for Header Inspection - dynamically reconstruct standard request headers
let active_headers = $derived({
...($ae_api.headers || {}),
@@ -291,7 +291,7 @@
<div class="grid grid-cols-1 xl:grid-cols-[1fr_400px] gap-8">
<main class="space-y-6">
<!-- Environment & Bridge Card -->
<div class="card p-6 variant-soft-tertiary space-y-4 border border-gray-500 shadow-lg">
<header class="flex justify-between items-center border-b border-gray-500 pb-3">
@@ -332,7 +332,7 @@
<span class="text-[10px] font-mono opacity-50 uppercase tracking-tighter">Real-time API Store View</span>
</header>
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
{#each Object.entries(active_headers) as [key, value]}
{#each Object.entries(active_headers) as [key, value] (key)}
<div class="flex justify-between items-center p-3 bg-gray-500/10 rounded border border-gray-500/20">
<span class="text-[10px] font-mono font-bold opacity-70">{key}</span>
<span class="text-xs font-mono {key === 'x-ae-ignore-extra-fields' ? 'text-success-500 font-bold' : ''}">
@@ -426,10 +426,10 @@
Sync Status <span class="text-secondary-500"><Info size={10} /></span>
</span>
<div class="card p-2 text-center text-xs font-bold border border-gray-500 shadow-sm flex items-center justify-center h-[46px] bg-transparent">
{#if $ae_api.jwt === $ae_loc.jwt}
<span class="text-success-600 dark:text-success-400 flex items-center gap-1"><ShieldCheck size={14}/> HANDSHAKE OK</span>
{:else}
<span class="text-error-600 dark:text-error-400 flex items-center gap-1"><ShieldAlert size={14}/> MISMATCH</span>
{#if $ae_api.jwt === $ae_loc.jwt}
<span class="text-success-600 dark:text-success-400 flex items-center gap-1"><ShieldCheck size={14}/> HANDSHAKE OK</span>
{:else}
<span class="text-error-600 dark:text-error-400 flex items-center gap-1"><ShieldAlert size={14}/> MISMATCH</span>
{/if}
</div>
</label>
@@ -468,7 +468,7 @@
<span class="text-secondary-600 font-bold underline decoration-dotted">Use Agent Key</span>
</label>
</div>
<div class="flex flex-wrap gap-6 pt-3 border-t border-gray-500 mt-2" title="Section 6: JWT can be sent via Header (standard) or URL Parameter (for direct links/downloads).">
<span class="text-[10px] uppercase font-bold opacity-50 flex items-center gap-1">JWT Method <span class="text-secondary-500"><Info size={10} /></span>:</span>
<label class="flex items-center gap-3 cursor-pointer">
@@ -481,7 +481,7 @@
</label>
</div>
</div>
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
<button class="btn variant-filled-secondary p-4 font-bold shadow-lg transition-all hover:brightness-110 active:scale-95 flex items-center justify-center gap-2" onclick={run_trace_test} title="Initiate GET request to /v3/crud/journal/ and capture headers.">
<ArrowRightLeft size={16} /> RUN TRACE
@@ -511,8 +511,8 @@
</div>
<div class="space-y-2">
<p class="font-bold opacity-70 tracking-widest uppercase">📥 Received</p>
<div class="bg-black/20 p-4 rounded shadow-inner border border-black/10 overflow-auto max-h-[400px] border-l-4"
class:border-l-success-500={test_result?.success}
<div class="bg-black/20 p-4 rounded shadow-inner border border-black/10 overflow-auto max-h-[400px] border-l-4"
class:border-l-success-500={test_result?.success}
class:border-l-error-500={!test_result?.success}>
<pre>{JSON.stringify(trace_details.response || trace_details.response_error, null, 2)}</pre>
</div>
@@ -579,12 +579,12 @@
{:else} <span class="badge variant-soft-surface opacity-50 italic uppercase">Idle</span> {/if}
</header>
<div class="flex-1 overflow-auto bg-black/20 rounded p-4 font-mono text-xs shadow-inner border border-black/10">
{#if test_result === 'loading...'}
{#if test_result === 'loading...'}
<div class="flex flex-col items-center justify-center h-full gap-4 opacity-30"><RefreshCcw size={32} class="animate-spin"/><p class="italic uppercase">Auditing...</p></div>
{:else if test_result}
{:else if test_result}
<pre class="whitespace-pre-wrap leading-relaxed text-blue-600 dark:text-blue-400">{JSON.stringify(test_result, null, 2)}</pre>
{:else}
<div class="flex flex-col items-center justify-center h-full opacity-20 py-20 text-center"><Zap size={64} class="mb-4" /><p class="font-bold uppercase tracking-widest">Select test to begin</p></div>
{:else}
<div class="flex flex-col items-center justify-center h-full opacity-20 py-20 text-center"><Zap size={64} class="mb-4" /><p class="font-bold uppercase tracking-widest">Select test to begin</p></div>
{/if}
</div>
</div>

View File

@@ -10,7 +10,7 @@
async function nukeServiceWorkers() {
log('Starting Service Worker cleanup...');
if (!('serviceWorker' in navigator)) {
log('Service Workers not supported in this browser.');
return;
@@ -55,14 +55,14 @@
<div class="p-8 max-w-2xl mx-auto font-mono">
<h1 class="text-2xl font-bold mb-4 text-red-600">Service Worker Reset Tool</h1>
<p class="mb-4">Attempting to unregister all service workers and clear caches to fix the TypeError loop.</p>
<div class="bg-gray-100 p-4 rounded border border-gray-300 min-h-[200px]">
{#each status as line}
{#each status as line, i (i)}
<div class="border-b border-gray-200 last:border-0 py-1">{line}</div>
{/each}
</div>
<button
<button
class="mt-4 px-4 py-2 bg-blue-600 text-white rounded hover:bg-blue-700"
onclick={() => window.location.reload()}
>

View File

@@ -150,7 +150,7 @@
</div>
{:else}
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
{#each hosted_files as file}
{#each hosted_files as file (file.id)}
<div class="card p-4 variant-soft-secondary space-y-4">
<div class="flex justify-between items-start">
<div>