Skip to content

Commit f0cef25

Browse files
authored
Merge pull request #40 from ivan09069/copilot/fix-63361b52-b6ed-47f9-adb4-f40c1916873a
Add Accuracy Gate CI workflow with error-handled scripts for improved PR reliability
2 parents 995d782 + da844e9 commit f0cef25

File tree

5 files changed

+56
-0
lines changed

5 files changed

+56
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Accuracy Gate
2+
on: [pull_request]
3+
jobs:
4+
verify:
5+
runs-on: ubuntu-latest
6+
timeout-minutes: 25
7+
steps:
8+
- uses: actions/checkout@v4
9+
- uses: actions/setup-node@v4
10+
with: { node-version: '20', cache: 'npm' }
11+
- name: Verify
12+
run: |
13+
chmod +x scripts/*.sh || true
14+
./scripts/verify.sh
15+
- uses: actions/upload-artifact@v4
16+
if: always()
17+
with: { name: logs, path: logs }

docs/problem-solving-checklist.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Problem-Solving Accuracy Checklist
2+
- Define: goal, constraints, assumptions, stakeholders, success criteria, deadline.
3+
- Evidence: inputs, data sources, error budgets, known edge cases.
4+
- Plan: options with trade-offs, chosen path, rollback.
5+
- Execute: deterministic seed, idempotent steps, timeouts, retries (bounded).
6+
- Validate: assertions, golden tests, invariants, acceptance criteria met.
7+
- Document: decisions, risks, follow-ups; attach logs/artifacts.

scripts/common.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env bash
2+
set -Eeuo pipefail
3+
IFS=$'\n\t'
4+
LOG_DIR="${LOG_DIR:-./logs}"; mkdir -p "$LOG_DIR"
5+
LOG_FILE="${LOG_FILE:-$LOG_DIR/run_$(date -u +%Y%m%dT%H%M%SZ).log}"
6+
7+
log() { printf "[%s] %s\n" "$(date -u +%FT%TZ)" "$*" | tee -a "$LOG_FILE"; }
8+
trap 'status=$?; line=${BASH_LINENO[0]:-?}; log "ERR status=$status line=$line cmd=${BASH_COMMAND}"; exit $status' ERR
9+
trap 'log "EXIT status=$?"' EXIT
10+
11+
retry() { local tries="${2:-3}" delay="${3:-2}" n=0; until "$1"; do n=$((n+1)); (( n>=tries )) && return 1; sleep $((delay*n)); done; }

scripts/run.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
process.on('unhandledRejection', e => { console.error('[unhandledRejection]', e); process.exit(1); });
2+
process.on('uncaughtException', e => { console.error('[uncaughtException]', e); process.exit(1); });
3+
export async function solve({define, plan, execute, validate}) {
4+
const ctx = { startedAt: new Date().toISOString() };
5+
const spec = await define(); if (!spec?.goal || !spec?.constraints) throw new Error('Invalid spec');
6+
const steps = await plan(spec); if (!Array.isArray(steps) || !steps.length) throw new Error('Empty plan');
7+
const result = await execute(steps, spec);
8+
const verdict = await validate(result, spec); if (verdict !== true) throw new Error('Validation failed');
9+
return { result, audit: { spec, steps, endedAt: new Date().toISOString() } };
10+
}

scripts/verify.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env bash
2+
set -Eeuo pipefail
3+
source "$(dirname "$0")/common.sh"
4+
log "Start verification"
5+
: "${CI:=false}" "${SEED:=42}"
6+
export NODE_OPTIONS="--max-old-space-size=4096"
7+
retry "npm ci" 3 3
8+
npm run lint --if-present
9+
npm run typecheck --if-present
10+
npm test --if-present -- --ci --runInBand --seed="$SEED" --reporters=default --reporters=jest-junit || npm test --if-present -- --ci --runInBand
11+
log "Verification complete"

0 commit comments

Comments
 (0)