fix: address review findings (rollback mainline, audit flag, confidence gate, test pattern, jq args)

- git revert uses --mainline 1 for merge commits
- inject dispatch passes all args so --audit flag is reachable
- confidence gate defaults to 0.0 (triggers gate) instead of 0.7 (bypasses)
- test-first grep uses word-boundary patterns to avoid false positives
- jq uses --arg instead of string interpolation for safe filtering
This commit is contained in:
2026-04-04 07:42:31 +02:00
parent f2b886880a
commit d9ec148bb3
3 changed files with 14 additions and 9 deletions

View File

@@ -296,7 +296,7 @@ cmd_audit_check() {
# Get lessons injected for this run # Get lessons injected for this run
local injected local injected
injected=$(jq -c "select(.run_id == \"$run_id\")" "$AUDIT_FILE" 2>/dev/null || true) injected=$(jq -c --arg rid "$run_id" 'select(.run_id == $rid)' "$AUDIT_FILE" 2>/dev/null || true)
if [[ -z "$injected" ]]; then if [[ -z "$injected" ]]; then
echo "No audit records for run $run_id." >&2 echo "No audit records for run $run_id." >&2
@@ -319,7 +319,7 @@ cmd_audit_check() {
# Get lesson description # Get lesson description
local lesson_desc local lesson_desc
lesson_desc=$(jq -r "select(.id == \"$lid\") | .description" "$LESSONS_FILE" 2>/dev/null | head -1) lesson_desc=$(jq -r --arg lid "$lid" 'select(.id == $lid) | .description' "$LESSONS_FILE" 2>/dev/null | head -1)
[[ -z "$lesson_desc" ]] && continue [[ -z "$lesson_desc" ]] && continue
# Check keyword overlap between lesson and findings # Check keyword overlap between lesson and findings
@@ -515,7 +515,7 @@ case "$COMMAND" in
cmd_extract "$1" cmd_extract "$1"
;; ;;
inject) inject)
cmd_inject "${1:-}" "${2:-}" cmd_inject "$@"
;; ;;
add) add)
[[ $# -lt 2 ]] && { echo "Usage: $0 add <type> <description>" >&2; exit 1; } [[ $# -lt 2 ]] && { echo "Usage: $0 add <type> <description>" >&2; exit 1; }

View File

@@ -48,7 +48,7 @@ if timeout 300 bash -c "$TEST_CMD"; then
fi fi
echo "Tests FAILED — reverting merge..." echo "Tests FAILED — reverting merge..."
git revert --no-edit HEAD git revert --no-edit --mainline 1 HEAD
# Emit event if event script exists # Emit event if event script exists
if [[ -x "$SCRIPT_DIR/archeflow-event.sh" ]]; then if [[ -x "$SCRIPT_DIR/archeflow-event.sh" ]]; then

View File

@@ -157,10 +157,15 @@ TASK_UNDERSTANDING=$(grep -i "task understanding" "$CONF_FILE" | grep -oE '[0-9]
SOLUTION_COMPLETENESS=$(grep -i "solution completeness" "$CONF_FILE" | grep -oE '[0-9]+\.[0-9]+' | head -1) SOLUTION_COMPLETENESS=$(grep -i "solution completeness" "$CONF_FILE" | grep -oE '[0-9]+\.[0-9]+' | head -1)
RISK_COVERAGE=$(grep -i "risk coverage" "$CONF_FILE" | grep -oE '[0-9]+\.[0-9]+' | head -1) RISK_COVERAGE=$(grep -i "risk coverage" "$CONF_FILE" | grep -oE '[0-9]+\.[0-9]+' | head -1)
# Fallback: if unparseable, treat as 0.7 (safe default — proceed but not overconfident) # Fallback: if unparseable, emit warning and default to 0.0 (triggers gate, not bypasses it)
TASK_UNDERSTANDING="${TASK_UNDERSTANDING:-0.7}" if [[ -z "$TASK_UNDERSTANDING" || -z "$SOLUTION_COMPLETENESS" || -z "$RISK_COVERAGE" ]]; then
SOLUTION_COMPLETENESS="${SOLUTION_COMPLETENESS:-0.7}" echo "WARNING: Could not parse confidence scores from plan-creator.md" >&2
RISK_COVERAGE="${RISK_COVERAGE:-0.7}" ./lib/archeflow-event.sh "$RUN_ID" decision plan "" \
'{"what":"confidence_parse_failure","chosen":"warn","rationale":"one or more scores unparseable"}' "$SEQ_CREATOR_COMPLETE"
fi
TASK_UNDERSTANDING="${TASK_UNDERSTANDING:-0.0}"
SOLUTION_COMPLETENESS="${SOLUTION_COMPLETENESS:-0.0}"
RISK_COVERAGE="${RISK_COVERAGE:-0.0}"
``` ```
**Pause branch** (Task understanding < 0.5): **Pause branch** (Task understanding < 0.5):
@@ -268,7 +273,7 @@ After Maker returns:
After Maker completes, check `do-maker-files.txt` for test files: After Maker completes, check `do-maker-files.txt` for test files:
```bash ```bash
TEST_FILES=$(grep -iE '(test|spec)' ".archeflow/artifacts/${RUN_ID}/do-maker-files.txt" || true) TEST_FILES=$(grep -iE '([/_.-](test|spec)[/_.-]|\.(test|spec)\.|_(test|spec)\.|/tests?/|/__tests__/|/specs?/)' ".archeflow/artifacts/${RUN_ID}/do-maker-files.txt" || true)
``` ```
If `TEST_FILES` is empty and domain is not `writing`: If `TEST_FILES` is empty and domain is not `writing`: