Questions about relationship analyses too
CI / test (push) Successful in 1m6s
CI / build (push) Successful in 5m1s
CI / deploy (push) Skipped

- The answer sees both charts and the comparison; both people see the questions
- Heading, hint and example question per analysis kind

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
This commit is contained in:
feco
2026-11-18 21:51:38 +00:00
co-authored by Claude Opus 5.5
parent 02e4e225f0
commit 029a001ca6
11 changed files with 116 additions and 29 deletions
+51
View File
@@ -828,4 +828,55 @@ mod analyses {
sqlx::query_scalar("SELECT status FROM analyses WHERE id = $1").bind(id).fetch_one(&db).await.unwrap();
assert_eq!(status, "done");
}
#[sqlx::test(migrator = "db::MIGRATOR")]
async fn answers_a_question_about_a_relationship_with_both_charts(db: PgPool) {
let s = setup(&db).await;
let response = fixture("synastry-response.json");
let (chart2, synastry, analysis) = (Uuid::now_v7(), Uuid::now_v7(), Uuid::now_v7());
sqlx::query(
"INSERT INTO charts (id, owner_id, label, is_primary, kind, birth_data, result, chart_hash) \
VALUES ($1, $2, 'Partner', false, 'person', '{}', $3, 'hash2')",
)
.bind(chart2)
.bind(s.user)
.bind(&response["person2"])
.execute(&db)
.await
.unwrap();
sqlx::query(
"INSERT INTO synastries (id, owner_id, chart1_id, chart2_id, result, synastry_hash) \
VALUES ($1, $2, $3, $4, $5, 'sh')",
)
.bind(synastry)
.bind(s.user)
.bind(s.chart)
.bind(chart2)
.bind(&response)
.execute(&db)
.await
.unwrap();
sqlx::query(
"INSERT INTO analyses (id, kind, synastry_id, requested_by, language, model, prompt_version, cache_key, \
status, content) VALUES ($1, 'synastry', $2, $3, 'hu', 'test/model', 'v1', 'k', 'done', $4)",
)
.bind(analysis)
.bind(synastry)
.bind(s.user)
.bind(content(Kind::Synastry))
.execute(&db)
.await
.unwrap();
let id = ask(&db, analysis, s.user, "Mire figyeljünk egy vitában?", "pending", None).await;
let (fake, url) = fake_openrouter(vec![reply(&json!({"answer": "Arra, hogy..."}))]).await;
let a = analyzer(&db, &url);
assert!(answer_once(&a).await);
let status: String =
sqlx::query_scalar("SELECT status FROM questions WHERE id = $1").bind(id).fetch_one(&db).await.unwrap();
assert_eq!(status, "done");
let requests = fake.requests.lock().unwrap();
let user = requests[0]["messages"][1]["content"].as_str().unwrap();
assert!(user.starts_with("Képletadatok:\n\nSYNASTRY") && user.contains("Person 2"), "both charts");
assert!(!user.contains("Szeged") && !user.contains("Pécs"));
}
}