Skip to content

Implement comprehensive debug mode for Doc Detective with step-through and breakpoint debugging#53

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/fix-52
Draft

Implement comprehensive debug mode for Doc Detective with step-through and breakpoint debugging#53
Copilot wants to merge 2 commits intomainfrom
copilot/fix-52

Conversation

Copy link

Copilot AI commented Aug 13, 2025

This PR implements a comprehensive debug mode for Doc Detective that enables developers to pause test execution, inspect state, and control test flow for enhanced debugging capabilities.

Overview

The debug mode provides three key debugging workflows:

  • Breakpoint debugging (--debug): Pauses execution at steps marked with "breakpoint": true
  • Step-through debugging (--stepThrough): Pauses at every step for granular control
  • Failure recovery: Automatic pause on failures with retry/skip/stop options

Key Features

Interactive Debug Interface

# Breakpoint debugging
doc-detective --debug test.spec.json

# Step-through mode  
doc-detective --stepThrough test.spec.json

When paused, users see a comprehensive debug display:

============================================================
🔴 BREAKPOINT - DEBUG PAUSE
============================================================
Step Information:
  ID: step-2
  Description: Second step with breakpoint
  Action: wait
  Parameters: 100

Environment Variables:
  SHELL: /bin/bash
  GITHUB_WORKSPACE: /home/runner/work/.github/.github
  ... and 144 more
============================================================

? What would you like to do?
❯ Continue - Execute next step 
  Stop Test - Terminate test execution

Failure Recovery Options

When a step fails in debug mode, users get four recovery options:

  • Continue: Proceed despite failure
  • Retry Step: Re-execute the failed step
  • Skip Step: Mark as skipped and continue
  • Stop Test: Terminate execution

Schema Integration

Uses existing schema properties with full backward compatibility:

// Config file
{
  "debug": true,           // Enable breakpoint debugging
  "debug": "stepThrough"   // Enable step-through mode
}

// Test steps
{
  "stepId": "important-step",
  "goTo": "https://example.com", 
  "breakpoint": true       // Pause here in debug mode
}

Implementation Details

  • DebugManager class: Centralized debug logic with clean separation of concerns
  • CLI integration: New --debug and --stepThrough flags override config settings
  • Visual interface: Colored output with distinctive headers for different debug modes
  • Error handling: Graceful degradation if debug components fail
  • Testing: Comprehensive unit tests and manual verification of all scenarios

Backward Compatibility

  • Zero impact on existing usage when debug mode is disabled
  • All existing tests continue to pass unchanged
  • Schema extensions use optional properties with sensible defaults
  • No breaking changes to existing APIs

Dependencies Added

  • inquirer@^9.2.0: Interactive command-line prompts
  • chalk@^4.1.2: Terminal color output

Fixes #52.

Warning

Firewall rules blocked me from connecting to one or more addresses

I tried to connect to the following addresses, but was blocked by firewall rules:

  • app.posthog.com
    • Triggering command: node /home/REDACTED/work/.github/.github/core/node_modules/.bin/mocha test/core.test.js test/debug.test.js (dns block)
    • Triggering command: node src/index.js --input ../core/test/debug-test.spec.json --logLevel info (dns block)
    • Triggering command: node src/index.js --input ../core/test/debug-test.spec.json --debug --logLevel info (dns block)
  • googlechromelabs.github.io
    • Triggering command: node scripts/postinstall.js (dns block)
  • hg.mozilla.org
    • Triggering command: node ./dist/install.js (dns block)
  • product-details.mozilla.org
    • Triggering command: node scripts/postinstall.js (dns block)
  • this-domain-does-not-exist-12345.com
    • Triggering command: node src/index.js --input ../core/test/debug-fail-test.spec.json --debug --logLevel info (dns block)
  • www.google.com
    • Triggering command: node /home/REDACTED/work/.github/.github/core/node_modules/.bin/mocha test/core.test.js test/debug.test.js (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: hawkeyexl <5209367+hawkeyexl@users.noreply.github.com>
Copilot AI changed the title [WIP] Debug mode Implement comprehensive debug mode for Doc Detective with step-through and breakpoint debugging Aug 13, 2025
Copilot AI requested a review from hawkeyexl August 13, 2025 03:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Debug mode

2 participants