Merge branch 'develop' into codex/connected-agent-bot-owner

This commit is contained in:
Sojan Jose
2026-07-07 19:18:29 -07:00
committed by GitHub
88 changed files with 2822 additions and 83 deletions
+26
View File
@@ -50,6 +50,21 @@ RSpec.describe Account do
end
end
describe 'captain defaults for new accounts' do
it 'does not store Captain model overrides or enable premium Captain features' do
InstallationConfig.find_or_initialize_by(name: 'ACCOUNT_LEVEL_FEATURE_DEFAULTS').update!(
value: Featurable::FEATURE_LIST,
locked: true
)
account = create(:account)
expect(account).not_to be_feature_enabled('captain_integration')
expect(account).not_to be_feature_enabled('captain_integration_v2')
expect(account.captain_models).to be_nil
end
end
describe 'conversation unread counts feature flag' do
let(:account) { create(:account) }
let(:inbox) { create(:inbox, account: account) }
@@ -337,6 +352,10 @@ RSpec.describe Account do
let(:account) { create(:account) }
describe 'with no saved preferences' do
before do
account.update!(captain_models: nil)
end
it 'returns defaults from llm.yml' do
prefs = account.captain_preferences
@@ -346,6 +365,13 @@ RSpec.describe Account do
expect(prefs[:models][feature]).to eq(Llm::Models.default_model_for(feature))
end
end
it 'returns GPT-5.2 for assistant when Captain V2 is enabled' do
account.enable_features!('captain_integration_v2')
expect(account.captain_preferences[:models]['assistant']).to eq('gpt-5.2')
expect(account.reload.captain_models).to be_nil
end
end
describe 'with saved model preferences' do
@@ -58,15 +58,6 @@ RSpec.describe CaptainFeaturable do
end
describe 'model accessor methods' do
context 'when no models are explicitly configured' do
it 'returns default models for all features' do
Llm::Models.feature_keys.each do |feature_key|
expected_default = Llm::Models.default_model_for(feature_key)
expect(account.send("captain_#{feature_key}_model")).to eq(expected_default)
end
end
end
context 'when models are explicitly configured' do
before do
account.update!(captain_models: {
+25
View File
@@ -7,6 +7,31 @@ RSpec.describe Team do
it { is_expected.to have_many(:team_members) }
end
describe 'name normalization' do
let(:account) { create(:account) }
it 'downcases the name' do
team = create(:team, account: account, name: 'Customer Support')
expect(team.name).to eq('customer support')
end
it 'strips control characters and surrounding whitespace' do
team = create(:team, account: account, name: " Sales\n")
expect(team.name).to eq('sales')
end
it 'removes control characters embedded within the name' do
team = create(:team, account: account, name: "su\npport")
expect(team.name).to eq('support')
end
it 'is invalid when the name reduces to blank after sanitization' do
team = build(:team, account: account, name: "\t\n ")
expect(team).not_to be_valid
expect(team.errors[:name]).to include(I18n.t('errors.validations.presence'))
end
end
describe '#add_members' do
let(:team) { FactoryBot.create(:team) }