Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions Cyrano/scripts/add-license-headers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,11 @@ async function processFile(filePath: string, stats: FileStats): Promise<void> {
writeFileSync(filePath, newContent, 'utf-8');
stats.added++;
stats.processed++;
// nosemgrep: javascript.lang.security.audit.unsafe-formatstring.unsafe-formatstring
console.log(`✓ Added header to: ${filePath}`);
} catch (error) {
stats.errors++;
// nosemgrep: javascript.lang.security.audit.unsafe-formatstring.unsafe-formatstring
console.error(`✗ Error processing ${filePath}:`, error instanceof Error ? error.message : error);
}
}
Expand Down Expand Up @@ -154,6 +156,7 @@ async function processDirectory(dirPath: string, stats: FileStats): Promise<void
}
}
} catch (error) {
// nosemgrep: javascript.lang.security.audit.unsafe-formatstring.unsafe-formatstring
console.error(`Error processing directory ${dirPath}:`, error instanceof Error ? error.message : error);
}
}
Expand All @@ -162,10 +165,12 @@ async function main() {
const rootDir = process.argv[2] || join(process.cwd(), 'src');

if (!existsSync(rootDir)) {
// nosemgrep: javascript.lang.security.audit.unsafe-formatstring.unsafe-formatstring
console.error(`Directory not found: ${rootDir}`);
process.exit(1);
}

// nosemgrep: javascript.lang.security.audit.unsafe-formatstring.unsafe-formatstring
console.log(`Adding license headers to files in: ${rootDir}`);
console.log('---\n');

Expand All @@ -180,9 +185,13 @@ async function main() {

console.log('\n---');
console.log('Summary:');
// nosemgrep: javascript.lang.security.audit.unsafe-formatstring.unsafe-formatstring
console.log(` Files processed: ${stats.processed}`);
// nosemgrep: javascript.lang.security.audit.unsafe-formatstring.unsafe-formatstring
console.log(` Headers added: ${stats.added}`);
// nosemgrep: javascript.lang.security.audit.unsafe-formatstring.unsafe-formatstring
console.log(` Files skipped: ${stats.skipped}`);
// nosemgrep: javascript.lang.security.audit.unsafe-formatstring.unsafe-formatstring
console.log(` Errors: ${stats.errors}`);
}

Expand Down
4 changes: 2 additions & 2 deletions Cyrano/src/engines/custodian/services/alert.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class AlertService {
break;
}
} catch (error) {
console.error(`[Alert Service] Failed to send alert via ${contact.method}:`, error);
console.error('[Alert Service] Failed to send alert via', contact.method, ':', error);
}
}

Expand Down Expand Up @@ -166,7 +166,7 @@ class AlertService {
break;
}
} catch (error) {
console.error(`[Alert Service] ASAP notification failed via ${contact.method}:`, error);
console.error('[Alert Service] ASAP notification failed via', contact.method, ':', error);
Copy link

Copilot AI Jan 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The console.error format uses standalone colon ':' separators, which creates awkward output formatting (e.g., "[Alert Service] Failed to send alert via email : Error"). This is inconsistent with the cleaner format used in secure-storage.ts where colons are part of the message string. Consider using consistent formatting across all files in this PR.

Suggested change
console.error('[Alert Service] ASAP notification failed via', contact.method, ':', error);
console.error(`[Alert Service] ASAP notification failed via ${contact.method}:`, error);

Copilot uses AI. Check for mistakes.
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions Cyrano/src/engines/goodcounsel/services/client-analyzer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export class ClientAnalyzer {
const recommendations = await this.generateRecommendations(client);
allRecommendations.push(...recommendations);
} catch (error) {
console.error(`Error generating recommendations for client ${client.id}:`, error);
console.error('Error generating recommendations for client', client.id, ':', error);
// Continue with other clients even if one fails
}
}
Expand All @@ -117,7 +117,7 @@ export class ClientAnalyzer {
const urgent = recommendations.filter(rec => rec.priority === 'urgent');
urgentRecommendations.push(...urgent);
} catch (error) {
console.error(`Error generating urgent recommendations for client ${client.id}:`, error);
console.error('Error generating urgent recommendations for client', client.id, ':', error);
}
}

Expand Down
12 changes: 6 additions & 6 deletions Cyrano/src/modules/arkiver/queue/database-queue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ export class DatabaseJobQueue implements JobQueue {

return true;
} catch (error) {
console.error(`Failed to update job status for ${jobId}:`, error);
console.error('Failed to update job status for', jobId, ':', error);
return false;
}
}
Expand All @@ -180,7 +180,7 @@ export class DatabaseJobQueue implements JobQueue {

return true;
} catch (error) {
console.error(`Failed to update job progress for ${jobId}:`, error);
console.error('Failed to update job progress for', jobId, ':', error);
return false;
}
}
Expand All @@ -202,7 +202,7 @@ export class DatabaseJobQueue implements JobQueue {

return true;
} catch (error) {
console.error(`Failed to complete job ${jobId}:`, error);
console.error('Failed to complete job', jobId, ':', error);
return false;
}
}
Expand Down Expand Up @@ -232,7 +232,7 @@ export class DatabaseJobQueue implements JobQueue {

return true;
} catch (err) {
console.error(`Failed to fail job ${jobId}:`, err);
console.error('Failed to fail job', jobId, ':', err);
return false;
}
}
Expand Down Expand Up @@ -260,7 +260,7 @@ export class DatabaseJobQueue implements JobQueue {

return true;
} catch (error) {
console.error(`Failed to cancel job ${jobId}:`, error);
console.error('Failed to cancel job', jobId, ':', error);
return false;
}
}
Expand Down Expand Up @@ -323,7 +323,7 @@ export class DatabaseJobQueue implements JobQueue {

return true;
} catch (error) {
console.error(`Failed to retry job ${jobId}:`, error);
console.error('Failed to retry job', jobId, ':', error);
Copy link

Copilot AI Jan 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The console.error format uses standalone colon ':' separators throughout this file, which creates awkward output formatting (e.g., "Failed to update job status for jobId : Error"). This is inconsistent with the cleaner format used in secure-storage.ts where colons are part of the message string. Consider using consistent formatting across all files in this PR.

Suggested change
console.error('Failed to retry job', jobId, ':', error);
console.error('Failed to retry job:', jobId, error);

Copilot uses AI. Check for mistakes.
return false;
}
}
Expand Down
4 changes: 2 additions & 2 deletions Cyrano/src/modules/arkiver/storage/local.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ export class LocalStorageProvider implements StorageProvider {

return await fs.readFile(fullPath);
} catch (error) {
console.error(`Failed to download file ${storagePath}:`, error);
console.error('Failed to download file', storagePath, ':', error);
return null;
}
}
Expand All @@ -211,7 +211,7 @@ export class LocalStorageProvider implements StorageProvider {

return true;
} catch (error) {
console.error(`Failed to delete file ${storagePath}:`, error);
console.error('Failed to delete file', storagePath, ':', error);
return false;
}
}
Expand Down
2 changes: 1 addition & 1 deletion Cyrano/src/services/resource-loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export class ResourceLoader {

return buffer;
} catch (error) {
console.error(`Failed to download resource ${resource.id} from ${resource.url}:`, error);
console.error('Failed to download resource', resource.id, 'from', resource.url, ':', error);
Copy link

Copilot AI Jan 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The console.error output format with standalone colon ':' separators is inconsistent with most other fixes in this PR. The output will appear as "Failed to download resource [id] from [url] : Error", which is awkward. Most other changes in this PR use simple comma separation without standalone punctuation separators.

Suggested change
console.error('Failed to download resource', resource.id, 'from', resource.url, ':', error);
console.error(`Failed to download resource ${resource.id} from ${resource.url}`, error);

Copilot uses AI. Check for mistakes.
throw error;
}
}
Expand Down
4 changes: 2 additions & 2 deletions Cyrano/src/utils/error-sanitizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,14 @@ export function sanitizeErrorMessage(error: unknown, context?: string): string {
*/
export function logDetailedError(error: unknown, context?: string): void {
if (error instanceof Error) {
console.error(`[ERROR] ${context || 'Unhandled error'}:`, {
console.error('[ERROR]', context || 'Unhandled error', '-', {
message: error.message,
stack: error.stack,
name: error.name,
timestamp: new Date().toISOString(),
});
} else {
console.error(`[ERROR] ${context || 'Unhandled error'}:`, {
console.error('[ERROR]', context || 'Unhandled error', '-', {
Comment on lines +78 to +85
Copy link

Copilot AI Jan 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The use of a standalone dash '-' as a separator argument makes the console output format awkward (e.g., "[ERROR] Unhandled error - { message: ... }"). This inconsistent formatting differs from other console.error patterns in this PR. Consider removing the standalone dash and using consistent comma-separated arguments like the rest of the changes.

Copilot uses AI. Check for mistakes.
error: String(error),
timestamp: new Date().toISOString(),
});
Expand Down
2 changes: 1 addition & 1 deletion apps/lexfiat/client/src/lib/demo-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ export async function loadDemoDocumentContent(document: DemoDocument): Promise<s
return await response.text();
}
} catch (error) {
console.error(`Failed to load demo document ${document.filename}:`, error);
console.error('Failed to load demo document', document.filename, ':', error);
Copy link

Copilot AI Jan 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The console.error output format is inconsistent and harder to read compared to other fixes in this PR. The standalone colon ':' as a separate argument makes the log output awkward (e.g., "Failed to load demo document example.pdf : Error message"). Consider using the same pattern as other files in this PR without the standalone colon separator.

Suggested change
console.error('Failed to load demo document', document.filename, ':', error);
console.error(`Failed to load demo document ${document.filename}:`, error);

Copilot uses AI. Check for mistakes.
}
}
return null;
Expand Down
20 changes: 10 additions & 10 deletions apps/lexfiat/client/src/lib/secure-storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export function safeGetItem(key: string): string | null {
// The caller should sanitize when rendering
return value;
} catch (error) {
console.error(`Failed to get localStorage item ${key}:`, error);
console.error('Failed to get localStorage item:', key, error);
return null;
}
}
Expand Down Expand Up @@ -53,7 +53,7 @@ export function safeSetItem(key: string, value: string): void {

localStorage.setItem(key, value);
} catch (error) {
console.error(`Failed to set localStorage item ${key}:`, error);
console.error('Failed to set localStorage item:', key, error);
throw error;
}
}
Expand All @@ -74,7 +74,7 @@ export function safeGetJSON<T>(key: string): T | null {
// Sanitize parsed data
return sanitizeStorageData(parsed) as T;
} catch (error) {
console.error(`Failed to parse JSON from localStorage item ${key}:`, error);
console.error('Failed to parse JSON from localStorage item:', key, error);
return null;
}
}
Expand All @@ -88,7 +88,7 @@ export function safeSetJSON(key: string, value: any): void {
const jsonString = JSON.stringify(value);
safeSetItem(key, jsonString);
} catch (error) {
console.error(`Failed to stringify JSON for localStorage item ${key}:`, error);
console.error('Failed to stringify JSON for localStorage item:', key, error);
throw error;
}
}
Expand All @@ -100,7 +100,7 @@ export function safeRemoveItem(key: string): void {
try {
localStorage.removeItem(key);
} catch (error) {
console.error(`Failed to remove localStorage item ${key}:`, error);
console.error('Failed to remove localStorage item:', key, error);
}
}

Expand All @@ -112,7 +112,7 @@ export const safeSessionStorage = {
try {
return sessionStorage.getItem(key);
} catch (error) {
console.error(`Failed to get sessionStorage item ${key}:`, error);
console.error('Failed to get sessionStorage item:', key, error);
return null;
}
},
Expand All @@ -127,7 +127,7 @@ export const safeSessionStorage = {
}
sessionStorage.setItem(key, value);
} catch (error) {
console.error(`Failed to set sessionStorage item ${key}:`, error);
console.error('Failed to set sessionStorage item:', key, error);
throw error;
}
},
Expand All @@ -139,7 +139,7 @@ export const safeSessionStorage = {
const parsed = JSON.parse(value);
return sanitizeStorageData(parsed) as T;
} catch (error) {
console.error(`Failed to parse JSON from sessionStorage item ${key}:`, error);
console.error('Failed to parse JSON from sessionStorage item:', key, error);
return null;
}
},
Expand All @@ -149,7 +149,7 @@ export const safeSessionStorage = {
const jsonString = JSON.stringify(value);
sessionStorage.setItem(key, jsonString);
} catch (error) {
console.error(`Failed to stringify JSON for sessionStorage item ${key}:`, error);
console.error('Failed to stringify JSON for sessionStorage item:', key, error);
throw error;
}
},
Expand All @@ -158,7 +158,7 @@ export const safeSessionStorage = {
try {
sessionStorage.removeItem(key);
} catch (error) {
console.error(`Failed to remove sessionStorage item ${key}:`, error);
console.error('Failed to remove sessionStorage item:', key, error);
}
},
};
Loading