Skip to content

🧪 Add tests for idstack-status#54

Open
savvides wants to merge 1 commit into
mainfrom
add-idstack-status-tests-16130625847682278631
Open

🧪 Add tests for idstack-status#54
savvides wants to merge 1 commit into
mainfrom
add-idstack-status-tests-16130625847682278631

Conversation

@savvides

@savvides savvides commented Jun 6, 2026

Copy link
Copy Markdown
Owner

🎯 What: The testing gap addressed
The idstack-status command lacked comprehensive and isolated unit tests. The previous tests in integration-test.sh were sparse and didn't cover key functionality such as mock configurations or readiness flags.

📊 Coverage: What scenarios are now tested

  1. No State: Empty .idstack directory scenario.
  2. Project Name Extraction: Extracts correct metadata from project.json.
  3. Timeline State: Parses outputs properly given simulated timeline states.
  4. Learning Logs: Correctly reports discoveries counts.
  5. Exports Tracking: Locates reports inside export subdirectories.
  6. Readiness Scenarios: Validates INCOMPLETE, NOT-READY, and READY TO EXPORT conditions with the --readiness flag based on metric threshold logic.

Result: The improvement in test coverage
test-status.sh isolated unit tests were created, old tests moved out, and added to the suite in smoke-test.sh. Tests successfully run and ensure proper functional checks for idstack-status.


PR created automatically by Jules for task 16130625847682278631 started by @savvides

Added `test/test-status.sh` to thoroughly test `idstack-status` against various states, including missing setups, mock timeline generation, learning logs, and exports. Also moved tests out of `integration-test.sh` and hooked `test-status.sh` inside `smoke-test.sh` for reliable regression checking.

Co-authored-by: savvides <1580637+savvides@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request migrates the integration tests for idstack-status from test/integration-test.sh into a dedicated unit test suite in test/test-status.sh, which is now executed during the smoke test. The feedback recommends wrapping the $STATUS executable in a helper function to avoid word-splitting issues when paths contain spaces, and capturing assertion output to a log file to improve debuggability upon test failures.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread test/test-status.sh
Comment on lines +11 to +12
REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
STATUS="$REPO_ROOT/bin/idstack-status"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

If the repository path contains spaces or special characters (e.g., in CI environments or user directories), executing $STATUS directly inside eval will fail due to word splitting.

To prevent this, define a helper function status that safely wraps the executable with proper double-quoting, and use status instead of $STATUS in the assert calls.

Suggested change
REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
STATUS="$REPO_ROOT/bin/idstack-status"
REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
STATUS="$REPO_ROOT/bin/idstack-status"
status() {
"$STATUS" "$@"
}

Comment thread test/test-status.sh
Comment on lines +14 to +23
assert() {
TOTAL=$((TOTAL + 1))
if eval "$2" >/dev/null 2>&1; then
PASS=$((PASS + 1))
echo " PASS: $1"
else
FAIL=$((FAIL + 1))
echo " FAIL: $1"
fi
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

When an assertion fails, the standard output and error are redirected to /dev/null, making it extremely difficult to debug test failures.

Consider capturing the output of the command to a temporary log file and printing it when the assertion fails to provide helpful diagnostic information.

Suggested change
assert() {
TOTAL=$((TOTAL + 1))
if eval "$2" >/dev/null 2>&1; then
PASS=$((PASS + 1))
echo " PASS: $1"
else
FAIL=$((FAIL + 1))
echo " FAIL: $1"
fi
}
assert() {
TOTAL=$((TOTAL + 1))
local logfile="${WORK:-/tmp}/assert.log"
if eval "$2" >"$logfile" 2>&1; then
PASS=$((PASS + 1))
echo " PASS: $1"
else
FAIL=$((FAIL + 1))
echo " FAIL: $1"
if [ -s "$logfile" ]; then
echo " --- Output ---"
sed 's/^/ /' "$logfile"
echo " --------------"
fi
fi
rm -f "$logfile"
}

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.

1 participant