Self-hosted project management for devs and their clients: tickets, time tracking, docs and meetings, with an AI assistant that cites its sources. AGPL-3.0.
Ruby agplai-assistantdockerdsgvogdprhotwireissue-trackerjira-alternativeknowledge-basellmmcp-servermeeting-notesopen-sourceproject-managementredmine-alternativeruby-on-railsself-hostedticketingtime-tracking
Pin the early exit of the knowledge lookup at offset equal to total
Guido Boyke3237c54efb63
diff --git a/spec/services/knowledge/lookup_spec.rb b/spec/services/knowledge/lookup_spec.rbindex 05d8404..293ac36 100644--- a/spec/services/knowledge/lookup_spec.rb+++ b/spec/services/knowledge/lookup_spec.rb@@ -227,6 +227,20 @@ RSpec.describe Knowledge::Lookup, :ci_guard doexpect(statements.grep(/\ASELECT "(notes|documents)"\.\*/)).to be_emptyend+ # The page right after the last one starts exactly at the total (offset == total).+ it 'reads no rows for the page right after the last one either' do+ note('Only')+ statements = []+ callback = ->(*, payload) { statements << payload[:sql] }++ result = ActiveSupport::Notifications.subscribed(callback, 'sql.active_record') do+ lookup.page(options(page: 2, per_page: 1))+ end++ expect(result.records).to eq([])+ expect(statements.grep(/\ASELECT "(notes|documents)"\.\*/)).to be_empty+ end+it 'returns an empty page beyond the last one, with the full total' donote('Only')