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
Empty file modified .debugging/test-migrate-verify.sh
100644 → 100755
Empty file.
3 changes: 2 additions & 1 deletion src/commands/migrate/helpers/handle-migrate-action.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import { loadMigrateConfig } from '../../../shared/config/loader.js';
import { detectAndRoute } from '../../../version-router.js';
import { logSystemInfo, ensureHeapSize } from '../../../shared/utils/concurrency.js';
import logger from '../../../shared/utils/logger.js';
import logger, { enableFileLogging } from '../../../shared/utils/logger.js';
import { applyMigrateOptions } from './apply-migrate-options.js';
import { buildMigratePerfConfig } from './build-migrate-perf-config.js';

Expand All @@ -16,6 +16,7 @@ export async function handleMigrateAction(options, shutdownCoordinator) {

const perfConfig = buildMigratePerfConfig(config, options);
ensureHeapSize(perfConfig.maxMemoryMB);
enableFileLogging('migrate');
logSystemInfo(perfConfig);

const { migrateAll, pipelineId } = await detectAndRoute(config.sonarqube);
Expand Down
3 changes: 1 addition & 2 deletions src/commands/migrate/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// -------- Migrate Command --------

import logger, { enableFileLogging } from '../../shared/utils/logger.js';
import logger from '../../shared/utils/logger.js';
import { ShutdownCoordinator } from '../../shared/utils/shutdown.js';
import { handleMigrateAction } from './helpers/handle-migrate-action.js';
import { handleCommandError } from '../transfer/helpers/handle-command-error.js';
Expand Down Expand Up @@ -36,7 +36,6 @@ export function registerMigrateCommand(program) {

try {
if (options.verbose) logger.level = 'debug';
enableFileLogging('migrate');
logger.info('=== CloudVoyager - Full Organization Migration ===');
await handleMigrateAction(options, shutdownCoordinator);
logger.info('=== Migration completed successfully ===');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import { loadMigrateConfig } from '../../../shared/config/loader.js';
import { detectAndRoute } from '../../../version-router.js';
import { resolvePerformanceConfig, logSystemInfo, ensureHeapSize } from '../../../shared/utils/concurrency.js';
import logger from '../../../shared/utils/logger.js';
import logger, { enableFileLogging } from '../../../shared/utils/logger.js';

export async function handleSyncMetadataAction(options, shutdownCoordinator) {
const config = await loadMigrateConfig(options.config);
Expand All @@ -22,6 +22,7 @@ export async function handleSyncMetadataAction(options, shutdownCoordinator) {
...(options.maxMemory && { maxMemoryMB: options.maxMemory })
});
ensureHeapSize(perfConfig.maxMemoryMB);
enableFileLogging('sync-metadata');
logSystemInfo(perfConfig);

migrateConfig.dryRun = false;
Expand Down
3 changes: 1 addition & 2 deletions src/commands/sync-metadata/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// -------- Sync Metadata Command --------

import logger, { enableFileLogging } from '../../shared/utils/logger.js';
import logger from '../../shared/utils/logger.js';
import { ShutdownCoordinator } from '../../shared/utils/shutdown.js';
import { handleSyncMetadataAction } from './helpers/handle-sync-metadata-action.js';
import { handleCommandError } from '../transfer/helpers/handle-command-error.js';
Expand Down Expand Up @@ -28,7 +28,6 @@ export function registerSyncMetadataCommand(program) {

try {
if (options.verbose) logger.level = 'debug';
enableFileLogging('sync-metadata');
logger.info('=== CloudVoyager - Issue & Hotspot Metadata Sync ===');
await handleSyncMetadataAction(options, shutdownCoordinator);
logger.info('=== Metadata sync completed successfully ===');
Expand Down
3 changes: 2 additions & 1 deletion src/commands/transfer/helpers/handle-transfer-action.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { loadConfig, requireProjectKeys } from '../../../shared/config/loader.js
import { detectAndRoute } from '../../../version-router.js';
import { resolvePerformanceConfig, logSystemInfo, ensureHeapSize } from '../../../shared/utils/concurrency.js';
import { ProgressTracker } from '../../../shared/utils/progress.js';
import logger from '../../../shared/utils/logger.js';
import logger, { enableFileLogging } from '../../../shared/utils/logger.js';

export async function handleTransferAction(options, shutdownCoordinator) {
const config = await loadConfig(options.config);
Expand All @@ -30,6 +30,7 @@ export async function handleTransferAction(options, shutdownCoordinator) {
...(options.maxMemory && { maxMemoryMB: options.maxMemory }),
});
ensureHeapSize(perfConfig.maxMemoryMB);
enableFileLogging('transfer');

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

File logging enabled after early log messages and error-prone steps

Medium Severity

Moving enableFileLogging from the index files into the handler functions means it now runs after several logger.info calls and error-prone operations like config loading. In handle-transfer-action.js, two banner messages on lines 20–21 are emitted before enableFileLogging on line 33, so they won't appear in file logs. Similarly, banner messages in each command's index.js (e.g., '=== CloudVoyager - Full Organization Migration ===') are now logged before the handler even calls enableFileLogging. Worse, if config loading or ensureHeapSize throws, enableFileLogging is never reached, so the error logged by handleCommandError in the catch block won't be captured in any log file.

Additional Locations (2)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit ad818c9. Configure here.

logSystemInfo(perfConfig);

const { transferProject, pipelineId } = await detectAndRoute(config.sonarqube);
Expand Down
3 changes: 1 addition & 2 deletions src/commands/transfer/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// -------- Transfer Command --------

import logger, { enableFileLogging } from '../../shared/utils/logger.js';
import logger from '../../shared/utils/logger.js';
import { ShutdownCoordinator } from '../../shared/utils/shutdown.js';
import { handleTransferAction } from './helpers/handle-transfer-action.js';
import { handleCommandError } from './helpers/handle-command-error.js';
Expand Down Expand Up @@ -30,7 +30,6 @@ export function registerTransferCommand(program) {

try {
if (options.verbose) logger.level = 'debug';
enableFileLogging('transfer');
await handleTransferAction(options, shutdownCoordinator);
logger.info('=== Transfer completed successfully ===');
process.exit(0);
Expand Down
3 changes: 2 additions & 1 deletion src/commands/verify/helpers/handle-verify-action.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import { loadMigrateConfig } from '../../../shared/config/loader.js';
import { verifyAll } from '../../../shared/verification/verify-pipeline.js';
import { resolvePerformanceConfig, logSystemInfo, ensureHeapSize } from '../../../shared/utils/concurrency.js';
import logger from '../../../shared/utils/logger.js';
import logger, { enableFileLogging } from '../../../shared/utils/logger.js';
import { parseOnlyComponents } from './parse-only-components.js';

export async function handleVerifyAction(options) {
Expand All @@ -21,6 +21,7 @@ export async function handleVerifyAction(options) {
...(options.maxMemory && { maxMemoryMB: options.maxMemory })
});
ensureHeapSize(perfConfig.maxMemoryMB);
enableFileLogging('verify');
logSystemInfo(perfConfig);

const results = await verifyAll({
Expand Down
3 changes: 1 addition & 2 deletions src/commands/verify/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// -------- Verify Command --------

import logger, { enableFileLogging } from '../../shared/utils/logger.js';
import logger from '../../shared/utils/logger.js';
import { CloudVoyagerError } from '../../shared/utils/errors.js';
import { handleVerifyAction } from './helpers/handle-verify-action.js';

Expand All @@ -22,7 +22,6 @@ export function registerVerifyCommand(program) {
.action(async (options) => {
try {
if (options.verbose) logger.level = 'debug';
enableFileLogging('verify');
logger.info('=== CloudVoyager - Migration Verification ===');
await handleVerifyAction(options);
logger.info('=== Verification completed successfully — all checks passed ===');
Expand Down