Summary
Two core pipeline jobs remain untested: ExtractVotesJob (vote extraction from minutes) and Topics::AutoTriageJob (the job wrapper around TriageTool).
What's already covered
ExtractTopicsJob — 8 tests in test/jobs/extract_topics_job_test.rb (skip non-topic-worthy, skip Routine, create topics, document text inclusion, packet context, catch-all refinement)
Topics::TriageTool — 3 tests in test/services/topics/triage_tool_test.rb (automated events, tiered thresholds, community context)
Topics::TriageTool descriptions — 1 test in test/services/topics/triage_tool_description_test.rb (enqueues GenerateDescriptionJob on approval)
Jobs still needing tests
ExtractVotesJob (app/jobs/extract_votes_job.rb)
- Extracts motions and voting records from minutes documents
- Creates
Motion and Vote records
- Links votes to
Member records via Member.resolve
Test scenarios:
- Stub AI response with vote data → creates
Motion + Vote records
- Correctly maps member names to existing
Member records via Member.resolve
- Handles unanimous votes, split votes, abstentions, absences
- Idempotent re-run clears and rebuilds
- Updates
Topic.last_activity_at via Motion callback
- Handles AI service errors gracefully
Topics::AutoTriageJob (app/jobs/topics/auto_triage_job.rb)
- Job wrapper that runs
Topics::TriageTool on proposed topics
Test scenarios:
- Enqueues and runs without error when proposed topics exist
- Handles empty proposed topic queue
- Handles AI service errors gracefully
Approach
- Stub
Ai::OpenAiService responses with realistic JSON fixtures
- Follow patterns from existing
extract_topics_job_test.rb
Summary
Two core pipeline jobs remain untested:
ExtractVotesJob(vote extraction from minutes) andTopics::AutoTriageJob(the job wrapper aroundTriageTool).What's already covered
ExtractTopicsJob— 8 tests intest/jobs/extract_topics_job_test.rb(skip non-topic-worthy, skip Routine, create topics, document text inclusion, packet context, catch-all refinement)Topics::TriageTool— 3 tests intest/services/topics/triage_tool_test.rb(automated events, tiered thresholds, community context)Topics::TriageTooldescriptions — 1 test intest/services/topics/triage_tool_description_test.rb(enqueues GenerateDescriptionJob on approval)Jobs still needing tests
ExtractVotesJob(app/jobs/extract_votes_job.rb)MotionandVoterecordsMemberrecords viaMember.resolveTest scenarios:
Motion+VoterecordsMemberrecords viaMember.resolveTopic.last_activity_atvia Motion callbackTopics::AutoTriageJob(app/jobs/topics/auto_triage_job.rb)Topics::TriageToolon proposed topicsTest scenarios:
Approach
Ai::OpenAiServiceresponses with realistic JSON fixturesextract_topics_job_test.rb