Skip to content

Commit 76a2956

Browse files
authored
Merge pull request #776 from SlideRuleEarth/carlos-dev4
Regression with new Duckdb: Error loading file,reading metadata or cr…
2 parents 16f8bb0 + fc5a7bb commit 76a2956

File tree

3 files changed

+49
-3
lines changed

3 files changed

+49
-3
lines changed

web-client/src/stores/fieldNameStore.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,8 +370,14 @@ export const useFieldNameStore = defineStore('fieldNameStore', () => {
370370
if (recordInfo && recordInfo.z) {
371371
hFieldCache.value[reqId] = recordInfo.z
372372
return recordInfo.z
373+
} else {
374+
if (recordInfo) {
375+
logger.warn('Recordinfo found but no z field', { reqId, recordInfo })
376+
} else {
377+
logger.warn('No recordinfo found in getHFieldName for reqId:', { reqId })
378+
}
373379
}
374-
logger.debug('No z field in recordinfo, falling back to hardcoded', { reqId })
380+
logger.warn('No z field in recordinfo, falling back to hardcoded', { reqId })
375381
// Fall back to hardcoded
376382
return getCachedValue(hFieldCache.value, reqId, getHFieldNameForAPIStr)
377383
}

web-client/src/utils/SrDuckDb.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -466,12 +466,13 @@ export class DuckDBClient {
466466
try {
467467
await duckDB.registerFileURL(name, url, DuckDBDataProtocol.HTTP, true)
468468
} catch (error: any) {
469-
if ('File already registered' in error) {
469+
const errorMsg = error instanceof Error ? error.message : String(error)
470+
if (errorMsg.includes('File already registered')) {
470471
isRegistered = true
471472
//console.log('insertOpfsParquet File already registered');
472473
} else {
473474
logger.error('insertOpfsParquet registerFileURL error', {
474-
error: error instanceof Error ? error.message : String(error)
475+
error: errorMsg
475476
})
476477
throw error
477478
}

web-client/src/utils/workerDomUtils.ts

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,45 @@ export async function processRunSlideRuleClicked(rc: SrRunContext | null = null)
503503
if (reqParamsStore.getMissionValue() === 'ICESat-2') {
504504
if (reqParamsStore.getIceSat2API()) {
505505
srReqRec.parameters = reqParamsStore.getAtlxxReqParams(srReqRec.req_id) as AtlxxReqParams
506+
507+
// Validate parameter consistency with API
508+
const api = reqParamsStore.getIceSat2API()
509+
const hasFit = !!srReqRec.parameters?.parms?.fit
510+
const hasPhoreal = !!srReqRec.parameters?.parms?.phoreal
511+
512+
// Valid APIs for fit: 'atl03' (will become 'atl03x-surface'), 'atl03x-surface'
513+
// Valid APIs for phoreal: 'atl03' (will become 'atl03x-phoreal'), 'atl03x-phoreal'
514+
const validApisForFit = ['atl03', 'atl03x-surface']
515+
const validApisForPhoreal = ['atl03', 'atl03x-phoreal']
516+
517+
if (hasFit && !validApisForFit.includes(api)) {
518+
useSrToastStore().error(
519+
'Parameter Mismatch',
520+
`Parameters contain 'fit' but API is '${api}'. The 'fit' parameter requires API 'atl03' or 'atl03x-surface'. Please check your parameters.`
521+
)
522+
logger.error('API and parameter mismatch', {
523+
api,
524+
hasFit,
525+
expectedApis: validApisForFit
526+
})
527+
requestsStore.setConsoleMsg('Parameter validation failed')
528+
return
529+
}
530+
531+
if (hasPhoreal && !validApisForPhoreal.includes(api)) {
532+
useSrToastStore().error(
533+
'Parameter Mismatch',
534+
`Parameters contain 'phoreal' but API is '${api}'. The 'phoreal' parameter requires API 'atl03' or 'atl03x-phoreal'. Please check your parameters.`
535+
)
536+
logger.error('API and parameter mismatch', {
537+
api,
538+
hasPhoreal,
539+
expectedApis: validApisForPhoreal
540+
})
541+
requestsStore.setConsoleMsg('Parameter validation failed')
542+
return
543+
}
544+
506545
if (reqParamsStore.getIceSat2API() === 'atl03' && srReqRec.parameters?.parms?.fit) {
507546
srReqRec.func = 'atl03x-surface'
508547
} else if (

0 commit comments

Comments
 (0)