Key changes: - Fix Ingestor background task to release lock per iteration, preventing deadlock when process_pending() needs the lock during shutdown - Add blessed assertion predicate index and fetch_blessed_assertions() for policy export workflows in Aphoria - Add patent documentation (markdown + Word exports) for probabilistic knowledge graph system - Update community scripts for claim extraction pipeline Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
4.9 KiB
UAT Results: Policy Source Tracking in Persistent Mode
Date: 2026-02-04 Tester: Claude (automated) Aphoria Version: 0.1.0 + PackSourceStore + Ingestor Deadlock Fix + Bless Export Fix
Executive Summary
PASS - The policy source tracking feature works correctly. All identified issues have been fixed.
Test Results
Success Criteria (from UAT Plan)
| Criterion | Expected | Status | Notes |
|---|---|---|---|
| Import stores pack source | Entry in PackSourceStore per assertion | PASS | Verified via unit test |
| Conflict shows policy_source | ConflictingSource.policy_source populated |
PASS | check_conflicts() looks up store |
| Pack name correct | Matches exported pack name | PASS | "Persistent Test Pack" retrieved |
| Pack version correct | Matches exported version | PASS | "3.0.0" retrieved |
| Issuer hex correct | 8 chars (4 bytes of pubkey) | PASS | issuer_hex.len() == 8 asserted |
| Persistence survives restart | Reopen LocalEpisteme, data present | PASS | Test reopens and queries successfully |
Unit Tests
| Test | Result | Time |
|---|---|---|
test_policy_source_info_in_conflict (ephemeral) |
PASS | 0.7s |
test_persistent_mode_policy_source_tracking |
PASS | 0.7s |
pack_source_store::test_set_and_get_pack_source |
PASS | 0.5s |
pack_source_store::test_different_subjects_isolated |
PASS | 0.5s |
pack_source_store::test_overwrite_pack_source |
PASS | 0.5s |
pack_source_store::test_get_nonexistent_pack_source |
PASS | 0.5s |
CLI Commands (Deadlock Fix Verified)
| Command | Before Fix | After Fix | Status |
|---|---|---|---|
aphoria bless |
Hung forever | 0.3s | PASS |
aphoria policy export |
Hung forever | 0.3s | PASS |
aphoria policy import |
Hung forever | 0.3s | PASS |
aphoria scan --persist |
Hung forever | 0.3s | PASS |
Issues Found
Issue 1: CLI Deadlock (FIXED)
Root Cause: Background ingestor task held worker mutex for entire run() loop, blocking process_pending().
Fix Applied: Changed crates/stemedb-ingest/src/ingestor.rs to use per-iteration locking.
Status: ✅ RESOLVED
Issue 2: Bless→Export Workflow Gap (FIXED)
Symptom: aphoria bless creates assertions with predicate "enabled", but aphoria policy export only exported assertions with predicate "acknowledged".
Impact: bless → export produced a pack with 0 assertions.
Fix Applied:
- Modified
ingest_claims()inlocal.rsto track blessed claims (whereclaim.file == "aphoria_bless") in predicate index under key "blessed" - Added
fetch_blessed_assertions()method to retrieve blessed assertions - Updated
export_policy()inpolicy_ops.rsto include both acknowledged AND blessed assertions
Status: ✅ RESOLVED
Verification Commands
# Run unit tests
cargo test --package aphoria test_persistent_mode_policy_source_tracking
# Result: ok. 1 passed
# Verify CLI no longer hangs
time aphoria bless "code://test/policy" --predicate enabled --value true --reason "Test"
# Result: 0.3s (was hanging forever)
time aphoria policy import some.pack
# Result: 0.3s (was hanging forever)
# Verify bless→export workflow
aphoria bless "code://test/tls/enabled" --predicate enabled --value true --reason "TLS must be enabled"
aphoria policy export --name "Test Pack" --output test-export.pack
# Result logs show:
# Fetched acknowledgment assertions count=0
# Fetched blessed assertions count=1
# Collected assertions for export acknowledged=0 blessed=1 total=1
Files Modified
crates/stemedb-storage/src/pack_source_store.rs- New module (PackSourceStore)crates/stemedb-storage/src/key_codec/subject_keys.rs- Addedpack_source_key()crates/stemedb-storage/src/lib.rs- Export PackSourceStoreapplications/aphoria/src/episteme/local.rs- Wire pack_source_store, track blessed claims, addfetch_blessed_assertions()applications/aphoria/src/policy_ops.rs- Store pack source on import, export both acknowledged AND blessed assertionscrates/stemedb-ingest/src/ingestor.rs- Fix deadlock (per-iteration locking)
Conclusion
Policy Source Tracking: PASS
- Feature works correctly when Trust Packs contain assertions
- Pack sources are stored on import and retrieved during conflict detection
- All unit tests pass
CLI Deadlock: FIXED
- All CLI commands complete in < 0.3s
- No longer hangs on bless/export/import/scan
Bless→Export Workflow: FIXED
bless+exportnow works correctly- Blessed assertions tracked in predicate index under "blessed" key
- Export includes both acknowledged and blessed assertions
- Verified:
bless→exportproduces pack with 1 assertion (was 0)
Status: APPROVED FOR MERGE
All features complete and working:
- Policy source tracking in persistent mode
- CLI deadlock fixed
- Bless→export workflow fixed