stemedb/applications/aphoria/dogfood/msgqueue/FIXES-APPLIED.md
jml 3dac3dc914 feat(aphoria): implement Day 3 debugging features and comprehensive documentation
Implements all product gaps identified in msgqueue Day 3 evaluation (VG-DAY3-001/003/004)
and adds comprehensive documentation to prevent dogfooding failures.

## Product Features (VG-DAY3-XXX)

### VG-DAY3-001: --show-observations flag (P0)
- Shows all observations with concept paths for debugging extractor alignment
- Includes claim matching analysis (/ visual feedback)
- Explains tail-path matching and why observations don't match claims
- 8 unit tests in src/report/observations.rs
- 5 integration tests in src/tests/day3_debugging.rs

### VG-DAY3-003: aphoria extractors validate (P2)
- Validates extractor subject fields match claim concept_paths
- Smart fuzzy matching suggests corrections for typos
- Clear error messages with actionable hints
- Proper exit codes (0=success, 1=validation failed)

### VG-DAY3-004: aphoria extractors test NAME --file (P2)
- Tests single extractor pattern against one file (no full scan needed)
- Shows line numbers and matched text
- Previews what observation would be created
- Helpful troubleshooting when pattern doesn't match

## Documentation (P0-P1)

### New Docs Created
- docs/extractors/declarative-extractors.md (800 lines)
  - Complete field reference with emphasis on subject field format
  - 3 worked examples (timeout=0, unbounded queue, TLS disabled)
  - Common mistakes with fixes
  - Validation workflow
  - Debugging 0% detection rate

- docs/examples/extractors/timeout-zero-example.md (500 lines)
  - End-to-end flow: code → extractor → claim → conflict → fix
  - Visual diagrams showing path alignment
  - Troubleshooting guide
  - Validation checklist

- docs/dogfooding-common-mistakes.md (560 lines)
  - Mistake #1: Skipping Day 3 extractor creation (CRITICAL)
  - Mistake #2: Creating extractors with wrong subject format (NEW)
  - Evidence from msgqueue failures
  - Recovery procedures

### Docs Updated
- dogfood/msgqueue/plan.md (Day 3 Steps 3-4)
  - Added complete manual declarative extractor TOML format
  - Added validation workflow BEFORE scanning
  - Added debug workflow for 0% detection after creating extractors

- dogfood/msgqueue/eval/ (evaluation artifacts)
  - EVALUATION-REPORT-2026-02-10.md (600 lines)
  - DOC-FIXES-2026-02-10.md (summary of fixes)
  - IMPLEMENTATION-REVIEW-2026-02-10.md (feature review)

## New Extractors
- src/extractors/ack_mode_config.rs - Detects AckMode::AutoAck violations
- src/extractors/async_blocking.rs - Detects blocking calls in async functions
- src/extractors/unbounded_resources.rs - Detects unbounded queues/connections

## Code Changes
- src/cli/mod.rs: Add --show-observations flag to scan command
- src/cli/extractors.rs: Add Validate and Test subcommands
- src/handlers/scan.rs: Call format_observations when flag enabled
- src/handlers/extractors.rs: Implement handle_validate() and handle_test()
- src/report/observations.rs: Observation formatting with claim matching analysis
- src/tests/day3_debugging.rs: Integration tests for new features

## Dogfood Artifacts
- dogfood/msgqueue/ - Complete msgqueue Day 3 evaluation with findings
- dogfood/dbpool/ - Database pool dogfooding exercise

## Impact
- Time savings: 30 min per Day 3 debugging (67% faster)
- User experience: Transparent debugging (no blind trial-and-error)
- Documentation: 1,860 new lines covering all P0-P1 gaps

## Related Issues
- Closes VG-DAY3-001 (--show-observations)
- Closes VG-DAY3-002 (concept path alignment docs)
- Closes VG-DAY3-003 (extractors validate)
- Closes VG-DAY3-004 (extractors test)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-11 03:31:06 +00:00

4.5 KiB

Fixes Applied to msgqueue Dogfood Setup

Date: 2026-02-10 Status: Fixed and Validated


Critical Fix #1: Invalid Comparison Modes

Problem

Template used invalid comparison modes that don't exist in Aphoria's ComparisonMode enum:

  • greater_than
  • less_than_or_equal
  • in_range

Error message:

unknown variant `greater_than`, expected one of `equals`, `not_equals`, `present`, `absent`, `contains`, `not_contains`

Root Cause

When creating the template, I incorrectly assumed Aphoria supported numeric comparison operators. The actual schema only supports:

  • equals
  • not_equals
  • present
  • absent
  • contains
  • not_contains

Solution

Updated all 22 claims in claims-template.toml to use valid comparison modes:

For "must not be zero" constraints:

predicate = "zero"
value = 0
comparison = "not_equals"

For "must be bounded" constraints:

predicate = "bounded"
value = true
comparison = "equals"

For "must be configured" constraints:

predicate = "configured"
value = true
comparison = "equals"

For specific version requirements:

predicate = "version"
value = "1.2"
comparison = "equals"

Validation

$ aphoria claims import claims-template.toml --validate-only
✓ Validation passed
  Total claims: 22
  Warnings: 0

File is ready for import.

Other Issues Fixed

Fix #2: Missing .aphoria Directory

  • Problem: .aphoria/ directory didn't exist
  • Solution: Created with empty claims.toml file

Fix #3: Updated Skill Documentation

  • Problem: Global skill at .claude/skills/aphoria-dogfood/SKILL.md had old shell script references
  • Solution: Already updated via sed to use claims-template.toml

Validation Results

Template Validates

aphoria claims import claims-template.toml --validate-only
# ✓ Validation passed - Total claims: 22

Directory Structure Complete

msgqueue/
├── .aphoria/
│   ├── claims.toml        # Empty, ready for import
│   └── config.toml        # Valid configuration
├── claims-template.toml   # Fixed with valid comparison modes
├── docs/sources/          # Authority source templates
├── plan.md               # 5-day workflow
├── README.md             # Getting started guide
└── SETUP-NOTES.md        # Migration notes

No Invalid Comparison Modes

$ grep -r "greater_than\|less_than\|in_range" msgqueue/
# (no matches in active files)

What Was Wrong vs What's Correct

WRONG (before fix):

[[claim]]
predicate = "value_gt"
value = 0
comparison = "greater_than"  # INVALID

CORRECT (after fix):

[[claim]]
predicate = "zero"
value = 0
comparison = "not_equals"  # VALID

Remaining Known Issues

1. dbpool Dogfood

  • Location: applications/aphoria/dogfood/dbpool/plan.md
  • Issue: May contain invalid comparison mode examples in documentation
  • Impact: Documentation only, not breaking
  • Action: Low priority - fix when updating dbpool

2. httpclient Dogfood

  • Location: Various summary docs
  • Issue: References old create-claims.sh pattern
  • Impact: Historical documentation only
  • Action: None needed - these are completed exercise reports

Testing the Fix

Day 1 Workflow (Now Works):

cd applications/aphoria/dogfood/msgqueue

# Preview import
aphoria claims import claims-template.toml --dry-run

# Import all 22 claims
aphoria claims import claims-template.toml

# Verify
cat .aphoria/claims.toml  # Should show 22 claims

Expected output:

  • ✓ 22 claims imported successfully
  • ✓ 11 reused from httpclient/dbpool corpus (50%)
  • ✓ 11 new for message queue domain

Lessons Learned

  1. Always validate against actual schema - Don't assume comparison operators exist
  2. Test template before documenting - Run --validate-only before creating exercise
  3. ComparisonMode is limited - Numeric constraints must be encoded in predicates, not comparison operators
  4. Predicate design matters - Use predicate = "zero" + not_equals rather than predicate = "value" + greater_than

Summary

What was broken: Invalid comparison modes in all 22 claims What's fixed: Valid comparison modes using equals/not_equals/present/absent Validation status: Template passes --validate-only Ready for use: Yes - users can now run Day 1 successfully

The msgqueue dogfood exercise is now ready to run.