Implement Bootstrap Paradox resolution for V3 site domain lookup

- Modified lookup_site_domain_v3 to strictly strip auth headers for guest lookup
- Enhanced /testing page with FQDN input and improved error visibility
- Updated TODO.md with Technical Debt refactoring roadmap
- Documented Unified Aether AI Agent (UE-AE-01) transition progress in GEMINI.md
This commit is contained in:
Scott Idem
2026-01-07 19:28:09 -05:00
parent ea0d57658f
commit e20898e513
5 changed files with 97 additions and 14 deletions

View File

@@ -110,8 +110,7 @@ export async function lookup_site_domain({
return null;
}
// Updated 2026-01-06
// Updated 2026-01-06
// Updated 2026-01-07
export async function lookup_site_domain_v3({
api_cfg,
fqdn,
@@ -127,6 +126,28 @@ export async function lookup_site_domain_v3({
console.log(`*** lookup_site_domain_v3() *** fqdn=${fqdn}`);
}
// CRITICAL: For the unauthenticated Bootstrap lookup, we must NOT send
// any existing auth tokens or account IDs that might be in the global config.
const guest_api_cfg = { ...api_cfg };
guest_api_cfg.headers = { ...api_cfg.headers };
const auth_props = [
'x-account-id',
'x-aether-api-token',
'Authorization',
'authorization',
'jwt',
'JWT'
];
auth_props.forEach(prop => {
delete guest_api_cfg.headers[prop];
delete guest_api_cfg.headers[prop.toLowerCase()];
delete guest_api_cfg.headers[prop.replaceAll('-', '_')];
});
delete guest_api_cfg.jwt;
delete guest_api_cfg.account_id;
const search_query = {
q: fqdn
};
@@ -134,7 +155,7 @@ export async function lookup_site_domain_v3({
// We use search because we are looking up by a unique field (fqdn) rather than ID.
// The backend should return a list, but since FQDN is unique, it will have 1 item.
const result_li = await api.search_ae_obj_v3({
api_cfg,
api_cfg: guest_api_cfg,
obj_type: 'site_domain',
search_query,
view, // This view should ideally join with site and account for the root lookup

View File

@@ -269,12 +269,54 @@
last_result: final_result
};
}
import { lookup_site_domain_v3 } from '$lib/ae_core/ae_core__site';
let test_fqdn = $state('');
async function test_site_domain_search_v3() {
console.log('*** test_site_domain_search_v3() ***');
v3_test_result = 'loading...';
const fqdn = test_fqdn || window.location.host;
console.log('Testing FQDN:', fqdn);
try {
const result = await lookup_site_domain_v3({
api_cfg: $ae_api,
fqdn,
view: 'default',
log_lvl: 2
});
v3_test_result = {
fqdn,
result,
timestamp: new Date().toISOString()
};
console.log('Site Domain Search V3 Result:', result);
} catch (err: any) {
console.error('Error in test_site_domain_search_v3:', err);
v3_test_result = {
error: err.message || 'Unknown error',
stack: err.stack
};
}
}
</script>
<div class="container h-full mx-auto flex flex-col justify-center items-center p-4 gap-4">
<div class="space-y-10 text-center flex flex-col items-center">
<h1 class="h1">Aether - V3 API Testing</h1>
<div class="flex flex-col gap-2 w-full max-w-sm">
<input
type="text"
class="input"
placeholder="FQDN (optional, defaults to current host)"
bind:value={test_fqdn}
/>
</div>
<div class="flex justify-center flex-wrap gap-2">
<button class="btn variant-filled-primary" onclick={test_v3_get_id}>
Test V3 GET ID
@@ -303,10 +345,13 @@
<button class="btn variant-filled-tertiary" onclick={test_person_v3_load}>
Test Person V3 Load
</button>
<button class="btn variant-filled-warning" onclick={test_site_domain_search_v3}>
Test Site Domain Search V3
</button>
</div>
</div>
{#if v3_test_result}
{#if v3_test_result !== null}
<div class="card p-4 w-full max-w-2xl bg-surface-100-800-token">
<h3 class="h3">Test Result:</h3>
<pre class="text-xs text-left overflow-auto max-h-96">