Files
skillshare/ai_docs/tests/gitignore_batch_perf_runbook.md
T
Willie ebab63a670 feat(runbook): add build lifecycle hook, verify all 17 runbooks
Add a build hook that runs once before all runbooks, enabling
automatic binary rebuild. Lifecycle is now:
  build (once) → [per runbook: setup → steps → teardown]

Build hook uses os/exec directly (not session executor), outputs
to stderr, and aborts immediately on failure.

Fix all 17 runbooks to pass in devcontainer:
- Adapt to session executor's set -eo pipefail (use cmd || EXIT=$?
  pattern for expected non-zero exits)
- Replace embedded ```bash in heredocs with printf to avoid
  confusing the runbook parser
- Fix negated assertion gotchas (Not FAIL, No such file)
- Remove fragile verify code blocks (multi-block merge issues)
- Fix step number collision (7b → 8, renumber subsequent)
- Use -s flag for batch installs instead of repeated --force
- Add (?m) flag for multi-line regex assertions
2026-03-11 04:53:08 +08:00

2.7 KiB

CLI E2E Runbook: Gitignore Batch Update Performance

Validates that project-mode install completes within a reasonable time even when .skillshare/.gitignore is very large (100K+ lines).

Root cause: ReconcileProjectSkills previously called UpdateGitIgnore per-skill inside WalkDir, re-reading the entire .gitignore each time. Fix: batch-collect entries, then call UpdateGitIgnoreBatch once.

Scope

  • Project-mode repeated install (all skills already exist → skip path) completes within 10 seconds, not hanging
  • .gitignore managed block is correctly maintained after batch update
  • New entries are added when installing to a fresh project
  • Existing entries are not duplicated on re-install

Environment

Run inside devcontainer. Global ss init -g is handled by the setup hook in runbook.json.

Steps

Step 1: Create project environment

mkdir -p ~/test-project
cd ~/test-project
ss init -p --targets claude

Expected:

  • exit_code: 0
  • .skillshare

Step 2: First install (populates .gitignore)

cd ~/test-project
ss install runkids/feature-radar -y -p

Expected:

  • exit_code: 0
  • Installed

Step 3: Verify .gitignore content

cd ~/test-project
grep -c "^skills/" .skillshare/.gitignore
grep "BEGIN SKILLSHARE" .skillshare/.gitignore
grep "END SKILLSHARE" .skillshare/.gitignore

Expected:

  • exit_code: 0
  • regex: (?m)^[1-9]\d*$
  • BEGIN SKILLSHARE
  • END SKILLSHARE

Step 4: Re-install with large .gitignore (performance test)

Inflate .gitignore to simulate a large project, then re-install.

cd ~/test-project
# Inject 100K dummy lines into managed block to simulate large .gitignore
python3 -c "
for i in range(100000):
    print(f\"skills/dummy-skill-{i}/\")
" > /tmp/dummy_lines.txt
# Insert dummy lines before END marker
sed -i "/^# END SKILLSHARE/e cat /tmp/dummy_lines.txt" .skillshare/.gitignore
wc -l .skillshare/.gitignore

Expected:

  • exit_code: 0
  • regex: \d{6,}

Step 5: Timed re-install (must not hang)

cd ~/test-project
timeout 10 ss install runkids/feature-radar -y -p
echo "EXIT_CODE: $?"

Expected:

  • exit_code: 0
  • skipped
  • EXIT_CODE: 0

Step 6: No duplicate entries after re-install

cd ~/test-project
# Count occurrences of each real skill entry (should be exactly 1 each)
for s in feature-radar feature-radar-archive feature-radar-learn feature-radar-ref feature-radar-scan; do
  count=$(grep -c "^skills/$s/$" .skillshare/.gitignore)
  echo "$s: $count"
done

Expected:

  • exit_code: 0
  • feature-radar: 1
  • feature-radar-archive: 1
  • feature-radar-learn: 1
  • feature-radar-ref: 1
  • feature-radar-scan: 1

Pass Criteria

  • All 6 steps pass
  • Step 5 is the critical performance test: must exit 0 within 10s