Skip to content

sickn33/agentic-awesome-skills / plugins/aasb-aas-qa-test-automation/skills/systematic-debugging

systematic-debugging

Verified

Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes

FileKindSize
CREATION-LOG.mdmarkdown4.4 KB
SKILL.mdskill md11.1 KB
condition-based-waiting-example.tsscript2.2 KB
condition-based-waiting.mdmarkdown3.9 KB
defense-in-depth.mdmarkdown4.3 KB
find-polluter.shscript3.4 KB
root-cause-tracing.mdmarkdown5.9 KB
test-academic.mdmarkdown876 B
test-pressure-1.mdmarkdown2.1 KB
test-pressure-2.mdmarkdown2.4 KB
test-pressure-3.mdmarkdown2.8 KB

condition-based-waiting-example.ts

View on GitHub
// Complete implementation of condition-based waiting utilities
// From: Lace test infrastructure improvements (2025-10-03)
// Context: Fixed 15 flaky tests by replacing arbitrary timeouts

import type { ThreadManager } from '~/threads/thread-manager';
import type { LaceEvent, LaceEventType } from '~/threads/types';

// Requires the source project's Lace interfaces. Polling reads must be synchronous.
// Bounds cannot interrupt a blocking getter; rejected getters stop without another timer.
async function poll<T>(read: () => T | undefined, description: string, timeoutMs: number): Promise<T> {
  if (!Number.isFinite(timeoutMs) || timeoutMs < 0) throw new Error('Invalid timeout');
  const deadline = performance.now() + timeoutMs;
  while (true) {
    const value = read();
    if (value !== undefined) return value;
    if (performance.now() >= deadline) throw new Error(`Timeout waiting for ${description}`);
    await new Promise<void>(resolve => setTimeout(resolve, 10));
  }
}

export function waitForEvent(manager: ThreadManager, threadId: string,
  eventType: LaceEventType, timeoutMs = 5000): Promise<LaceEvent> {
  return poll(() => manager.getEvents(threadId).find(event => event.type === eventType),
    eventType, timeoutMs);
}

export function waitForEventCount(manager: ThreadManager, threadId: string,
  eventType: LaceEventType, count: number, timeoutMs = 5000): Promise<LaceEvent[]> {
  if (!Number.isInteger(count) || count < 1) return Promise.reject(new Error('Invalid count'));
  return poll(() => {
    const events = manager.getEvents(threadId).filter(event => event.type === eventType);
    return events.length >= count ? events : undefined;
  }, `${count} ${eventType} events`, timeoutMs);
}

export function waitForEventMatch(manager: ThreadManager, threadId: string,
  predicate: (event: LaceEvent) => boolean, description: string,
  timeoutMs = 5000): Promise<LaceEvent> {
  return poll(() => manager.getEvents(threadId).find(predicate), description, timeoutMs);
}

// Scope observations to the current thread/request and await the actual tool events
// before cancelling or asserting. Historical source outcomes (15 repaired cases,
// 60% to 100% observed pass rate) are not a guarantee for other tests.
finishing-a-development-branchobra/superpowersUse when implementation is complete, all tests pass, and you need to decide how to integrate the workStars: 322kUpdated Claude CodeCodexVerifiedInstall
systematic-debuggingobra/superpowersUse when encountering any bug, test failure, or unexpected behavior, before proposing fixesStars: 322kUpdated Claude CodeCodexVerifiedInstall
test-driven-developmentobra/superpowersUse when implementing any feature or bugfix, before writing implementation codeStars: 322kUpdated Claude CodeCodexVerifiedInstall
skill-creatoranthropics/skillsCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.Stars: 197kUpdated Claude CodeCodexVerifiedInstall