Skip to content

feat(integration-tests): add --verbose flag to runner.sh#11

Merged
yu-iskw merged 7 commits intomainfrom
claude/add-verbose-flag-B15SH
Feb 5, 2026
Merged

feat(integration-tests): add --verbose flag to runner.sh#11
yu-iskw merged 7 commits intomainfrom
claude/add-verbose-flag-B15SH

Conversation

@yu-iskw
Copy link
Copy Markdown
Owner

@yu-iskw yu-iskw commented Feb 5, 2026

User description

Add comprehensive verbose logging to integration test runner to help understand
how 'caf' works at a glance. The verbose flag enables:

  • Environment diagnostics (working directory, user, shell, PATH)
  • Command availability checks (tree, git, pnpm, caf)
  • Repository structure display using tree command
  • Debug logs for git clone operations
  • Installed skills/subagents directory structure visualization
  • Final test summary with complete skills and subagents listings

Changes:

  • runner.sh: Add --verbose/-v flag with debug_log() and show_structure() helpers
  • runner.sh: Add --help/-h flag with usage information
  • Dockerfile: Install 'tree' command for better directory visualization
  • Makefile: Add 'test-verbose' target for easy verbose test execution

Usage:
./runner.sh --verbose
make test-verbose

https://claude.ai/code/session_01PV7rMwWhzGUphMgySRjX5r


PR Type

Enhancement


Description

  • Add comprehensive verbose logging to integration test runner with debug output

  • Implement --verbose and --help flags with environment diagnostics

  • Display repository and directory structures using tree command

  • Add debug logs for git clone operations and skill installations

  • Enable verbose mode by default in GitHub Actions CI workflow

  • Install tree command in Docker image for better visualization


Diagram Walkthrough

flowchart LR
  A["runner.sh"] -->|"Add --verbose flag"| B["Debug Logging"]
  A -->|"Add helper functions"| C["show_structure()"]
  A -->|"Add helper functions"| D["debug_log()"]
  B -->|"Output environment info"| E["Diagnostics"]
  C -->|"Display directory trees"| F["Visualization"]
  G["Dockerfile"] -->|"Install tree"| F
  H["Makefile"] -->|"Add test-verbose target"| I["CI Integration"]
  J["GitHub Actions"] -->|"Use test-verbose"| I
Loading

File Walkthrough

Relevant files
Enhancement
runner.sh
Add verbose flag with debug logging and diagnostics           

integration_tests/scripts/runner.sh

  • Add --verbose/-v and --help/-h command-line argument parsing
  • Implement debug_log() function for conditional debug output with blue
    color coding
  • Implement show_structure() function to display directory trees using
    tree command or ls fallback
  • Add environment diagnostics section showing working directory, user,
    shell, PATH, and command availability
  • Add debug logs throughout test scenarios for git clone operations and
    workspace initialization
  • Add directory structure visualization after each skill/subagent
    installation
  • Add final test summary section with complete skills and subagents
    listings
+109/-0 
Makefile
Add test-verbose make target                                                         

integration_tests/Makefile

  • Add test-verbose target to phony targets declaration
  • Implement test-verbose target that builds image and runs container
    with --verbose flag
+4/-1     
Configuration changes
test.yml
Enable verbose mode in CI workflow                                             

.github/workflows/test.yml

  • Update integration tests job to run with --verbose flag by default
  • Change test command from make -C integration_tests test to make -C
    integration_tests test-verbose
+1/-1     
Dependencies
Dockerfile
Install tree command for visualization                                     

integration_tests/Dockerfile

  • Add tree command to system dependencies installation
  • Install tree alongside git, make, and ca-certificates for directory
    visualization
+1/-1     

Add comprehensive verbose logging to integration test runner to help understand
how 'caf' works at a glance. The verbose flag enables:

- Environment diagnostics (working directory, user, shell, PATH)
- Command availability checks (tree, git, pnpm, caf)
- Repository structure display using tree command
- Debug logs for git clone operations
- Installed skills/subagents directory structure visualization
- Final test summary with complete skills and subagents listings

Changes:
- runner.sh: Add --verbose/-v flag with debug_log() and show_structure() helpers
- runner.sh: Add --help/-h flag with usage information
- Dockerfile: Install 'tree' command for better directory visualization
- Makefile: Add 'test-verbose' target for easy verbose test execution

Usage:
  ./runner.sh --verbose
  make test-verbose

https://claude.ai/code/session_01PV7rMwWhzGUphMgySRjX5r
Update the integration tests job in the GitHub Actions workflow to run with
the --verbose flag. This will provide detailed debug logs in CI runs, showing:
- Environment diagnostics and command availability
- Repository structures with tree visualization
- Skills and subagents directory structures
- Complete test summary with all installed components

This helps with debugging CI failures and understanding how the CAF CLI
works in the CI environment.

https://claude.ai/code/session_01PV7rMwWhzGUphMgySRjX5r
@qodo-code-review
Copy link
Copy Markdown

qodo-code-review Bot commented Feb 5, 2026

PR Compliance Guide 🔍

Below is a summary of compliance checks for this PR:

Security Compliance
Sensitive info exposure

Description: Verbose mode prints potentially sensitive environment and filesystem information to CI
logs (e.g., PATH, workspace listings, and recursive/hidden file trees via tree -a/ls
-laR
), which can inadvertently expose secrets or credentials if they exist in the
workspace (especially since .github/workflows/test.yml now runs test-verbose by default).
runner.sh [35-359]

Referred Code
# Debug logging function
debug_log() {
  if [ "$VERBOSE" = true ]; then
    echo -e "${BLUE}[DEBUG]${NC} $1"
  fi
}

# Show directory structure with tree if available, otherwise use ls
show_structure() {
  local dir="$1"
  local label="$2"

  if [ "$VERBOSE" = true ]; then
    echo -e "${YELLOW}=== $label ===${NC}"
    if command -v tree &> /dev/null; then
      tree -L 3 -a "$dir" 2>/dev/null || ls -la "$dir"
    else
      debug_log "tree command not available, using ls instead"
      ls -laR "$dir" | head -50
    fi
    echo ""


 ... (clipped 304 lines)
Ticket Compliance
🎫 No ticket provided
  • Create ticket/issue
Codebase Duplication Compliance
Codebase context is not defined

Follow the guide to enable codebase context checks.

Custom Compliance
🟢
Generic: Comprehensive Audit Trails

Objective: To create a detailed and reliable record of critical system actions for security analysis
and compliance.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Meaningful Naming and Self-Documenting Code

Objective: Ensure all identifiers clearly express their purpose and intent, making code
self-documenting

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Secure Error Handling

Objective: To prevent the leakage of sensitive system information through error messages while
providing sufficient detail for internal debugging.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Security-First Input Validation and Data Handling

Objective: Ensure all data inputs are validated, sanitized, and handled securely to prevent
vulnerabilities

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

🔴
Generic: Robust Error Handling and Edge Case Management

Objective: Ensure comprehensive error handling that provides meaningful context and graceful
degradation

Status:
Fragile arg parsing: The new argument parsing loop uses shift inside a for arg in "$@" construct and
silently ignores unknown flags, which can mis-handle inputs and makes failures harder to
diagnose.

Referred Code
# Parse arguments
VERBOSE=false
for arg in "$@"; do
  case $arg in
    --verbose|-v)
      VERBOSE=true
      shift
      ;;
    --help|-h)
      echo "Usage: $0 [OPTIONS]"
      echo ""
      echo "Options:"
      echo "  --verbose, -v    Enable verbose output with debug logs and directory structures"
      echo "  --help, -h       Show this help message"
      echo ""
      echo "Example:"
      echo "  $0 --verbose"
      exit 0
      ;;
    *)
      ;;


 ... (clipped 2 lines)

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Secure Logging Practices

Objective: To ensure logs are useful for debugging and auditing without exposing sensitive
information like PII, PHI, or cardholder data.

Status:
Potential sensitive output: Verbose mode logs environment and filesystem details (e.g., whoami, $PATH, recursive
directory listings) which could inadvertently expose sensitive information in CI logs
depending on the runtime environment.

Referred Code
if [ "$VERBOSE" = true ]; then
  echo -e "${YELLOW}=== Environment Diagnostics ===${NC}"
  debug_log "Verbose mode enabled"
  debug_log "Working directory: $(pwd)"
  debug_log "User: $(whoami)"
  debug_log "Shell: $SHELL"
  debug_log "PATH: $PATH"

  echo -e "${BLUE}[DEBUG]${NC} Available commands:"
  command -v tree &> /dev/null && echo "  ✓ tree" || echo "  ✗ tree (will use ls instead)"
  command -v git &> /dev/null && echo "  ✓ git" || echo "  ✗ git"
  command -v pnpm &> /dev/null && echo "  ✓ pnpm" || echo "  ✗ pnpm"
  command -v caf &> /dev/null && echo "  ✓ caf" || echo "  ✗ caf"

  debug_log "CAF version: $(caf --version 2>&1 || echo 'not available')"
  echo ""
fi

Learn more about managing compliance generic rules or creating your own custom rules

  • Update
Compliance status legend 🟢 - Fully Compliant
🟡 - Partial Compliant
🔴 - Not Compliant
⚪ - Requires Further Human Verification
🏷️ - Compliance label

@qodo-code-review
Copy link
Copy Markdown

qodo-code-review Bot commented Feb 5, 2026

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
High-level
Consider making verbose logging opt-in for CI

Change the CI pipeline to run the standard, non-verbose test by default to
reduce log noise. The new verbose mode can be reserved for debugging purposes.

Examples:

.github/workflows/test.yml [75]
        run: make -C integration_tests test-verbose

Solution Walkthrough:

Before:

# .github/workflows/test.yml
...
  - name: Run Integration Tests
    run: make -C integration_tests test-verbose

# integration_tests/Makefile
...
test: build
	docker run --rm $(IMAGE_NAME)

test-verbose: build
	docker run --rm $(IMAGE_NAME) --verbose

After:

# .github/workflows/test.yml
...
  - name: Run Integration Tests
    run: make -C integration_tests test

# integration_tests/Makefile
...
test: build
	docker run --rm $(IMAGE_NAME)

test-verbose: build
	docker run --rm $(IMAGE_NAME) --verbose
Suggestion importance[1-10]: 7

__

Why: The suggestion correctly identifies that enabling verbose logging by default in CI can make logs noisy, which is a valid developer experience concern, though not a functional bug.

Medium
General
Improve directory structure display logic
Suggestion Impact:Implemented a check to ensure the target directory exists before attempting to display its structure, returning early with a debug log if missing. Also adjusted the ls fallback to handle failure more explicitly when tree is unavailable, though tree error suppression and recursive fallback for tree failure were not fully implemented as suggested.

code diff:

   if [ "$VERBOSE" = true ]; then
     echo -e "${YELLOW}=== $label ===${NC}"
+    if [ ! -d "$dir" ]; then
+      debug_log "Directory does not exist: $dir"
+      return 0
+    fi
     if command -v tree &> /dev/null; then
       tree -L 3 -a "$dir" 2>/dev/null || ls -la "$dir"
     else
       debug_log "tree command not available, using ls instead"
-      ls -laR "$dir" | head -50
+      ls -laR "$dir" 2>/dev/null | head -50 || echo "Failed to list directory"
     fi

Improve the show_structure function by adding a check for directory existence
before processing. Also, make the fallback logic consistent by using a recursive
ls in all failure cases and avoid suppressing potentially useful error messages
from the tree command.

integration_tests/scripts/runner.sh [42-57]

 # Show directory structure with tree if available, otherwise use ls
 show_structure() {
   local dir="$1"
   local label="$2"
 
   if [ "$VERBOSE" = true ]; then
     echo -e "${YELLOW}=== $label ===${NC}"
+    if [ ! -d "$dir" ]; then
+      debug_log "Directory '$dir' not found for structure display."
+      echo ""
+      return
+    fi
+
     if command -v tree &> /dev/null; then
-      tree -L 3 -a "$dir" 2>/dev/null || ls -la "$dir"
+      if ! tree -L 3 -a "$dir"; then
+        debug_log "tree command failed, using ls instead"
+        ls -laR "$dir" | head -50
+      fi
     else
       debug_log "tree command not available, using ls instead"
       ls -laR "$dir" | head -50
     fi
     echo ""
   fi
 }

[Suggestion processed]

Suggestion importance[1-10]: 7

__

Why: This suggestion correctly identifies multiple issues in the show_structure function, including lack of directory existence check, inconsistent fallback logic, and error suppression, offering a more robust and reliable implementation.

Medium
Use while loop for argument parsing
Suggestion Impact:The commit removed an incorrect `shift` inside the `for`-loop case branch, partially addressing the argument-consumption issue highlighted by the suggestion, but it did not convert the parsing loop to a `while [ $# -gt 0 ]` pattern.

code diff:

@@ -14,7 +14,6 @@
   case $arg in
     --verbose|-v)
       VERBOSE=true
-      shift
       ;;

Replace the for loop used for argument parsing with a while [ $# -gt 0 ] loop.
This ensures arguments are consumed correctly with shift and prevents potential
issues with flag handling.

integration_tests/scripts/runner.sh [13-33]

-for arg in "$@"; do
-  case $arg in
+while [ $# -gt 0 ]; do
+  case "$1" in
     --verbose|-v)
       VERBOSE=true
-      shift
       ;;
     --help|-h)
       echo "Usage: $0 [OPTIONS]"
       ...
       exit 0
       ;;
     *)
+      break
       ;;
   esac
+  shift
 done

[To ensure code accuracy, apply this suggestion manually]

Suggestion importance[1-10]: 7

__

Why: The suggestion correctly identifies that using a for loop with shift for argument parsing is incorrect and proposes the standard while loop pattern, which improves the script's robustness and maintainability.

Medium
Possible issue
Enable pipefail for pipeline errors

Enable the pipefail option by changing set -e to set -eo pipefail. This ensures
that a pipeline command will return a failure status if any of its components
fail, not just the last one.

integration_tests/scripts/runner.sh [1-2]

 #!/bin/bash
 set -e
+set -o pipefail

[To ensure code accuracy, apply this suggestion manually]

Suggestion importance[1-10]: 5

__

Why: This suggestion correctly recommends enabling pipefail to ensure that failures within a pipeline are caught, which is a shell scripting best practice that improves the script's reliability.

Low
  • Update

claude and others added 5 commits February 5, 2026 21:23
…loop

The runner.sh script had a bug where `shift` was being used inside a
`for arg in "$@"` loop. This is incorrect because:
- `shift` modifies the positional parameters ($@) during iteration
- The for loop has already captured the argument values
- This causes errors when the script tries to shift during iteration

Fixed by removing the `shift` commands, which aren't needed in a for loop
since we're just checking each argument value directly.

This resolves the GitHub Actions failure in run 21728851590.

https://claude.ai/code/session_01PV7rMwWhzGUphMgySRjX5r
…ture

The show_structure function was failing when called on directories that
don't exist yet (e.g., .claude/skills before any skills are installed).
With 'set -e' enabled, these failures caused the script to exit with code 2.

Changes:
- Add directory existence check before attempting to list contents
- Return gracefully with debug message if directory doesn't exist
- Add error handling to ls command to prevent script termination
- Add fallback message if directory listing fails

This prevents the script from crashing when verbose mode tries to show
directory structures that haven't been created yet.

Fixes GitHub Actions failure in run 21729027803.

https://claude.ai/code/session_01PV7rMwWhzGUphMgySRjX5r
Replace && || constructs with proper if-then-else blocks to ensure
compatibility with 'set -e'. The && || pattern can cause unexpected
failures because:
- A && B || C runs C if either A fails OR B fails
- With 'set -e', this can cause premature script termination

Changes:
- Replace command availability checks with if-then-else blocks
- Improve show_structure function with nested if blocks
- Add explicit 'return 0' to ensure function always succeeds
- Ensure all error paths are handled gracefully

This makes the script more robust and prevents exit code 2 failures
when running with strict error handling enabled.

Fixes GitHub Actions failure in run 21729120119.

https://claude.ai/code/session_01PV7rMwWhzGUphMgySRjX5r
…runner.sh

The Dockerfile was using CMD which caused docker run arguments to be
interpreted by Node.js instead of being passed to the bash script.
This resulted in the error: "node: bad option: --verbose"

Changed from CMD to ENTRYPOINT so that:
- The runner.sh script is the main process
- Arguments passed to docker run are forwarded directly to the script
- The --verbose flag is properly received by the bash script

This ensures `docker run --rm caf-integration-test --verbose` correctly
passes the --verbose flag to runner.sh instead of to the node runtime.

Fixes the "node: bad option: --verbose" error in GitHub Actions.

https://claude.ai/code/session_01PV7rMwWhzGUphMgySRjX5r
Signed-off-by: Yu Ishikawa <yu-iskw@users.noreply.github.com>
@yu-iskw yu-iskw merged commit 681a59e into main Feb 5, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants