spec_scout 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.idea/.gitignore +10 -0
- data/.idea/Projects.iml +41 -0
- data/.idea/copilot.data.migration.ask2agent.xml +6 -0
- data/.idea/modules.xml +8 -0
- data/.idea/vcs.xml +6 -0
- data/.rspec_status +236 -0
- data/Gemfile +11 -0
- data/Gemfile.lock +72 -0
- data/LICENSE +21 -0
- data/README.md +433 -0
- data/Rakefile +12 -0
- data/examples/README.md +321 -0
- data/examples/best_practices.md +401 -0
- data/examples/configurations/basic_config.rb +24 -0
- data/examples/configurations/ci_config.rb +35 -0
- data/examples/configurations/conservative_config.rb +32 -0
- data/examples/configurations/development_config.rb +37 -0
- data/examples/configurations/performance_focused_config.rb +38 -0
- data/examples/output_formatter_demo.rb +67 -0
- data/examples/sample_outputs/console_output_high_confidence.txt +27 -0
- data/examples/sample_outputs/console_output_medium_confidence.txt +27 -0
- data/examples/sample_outputs/console_output_no_action.txt +27 -0
- data/examples/sample_outputs/console_output_risk_detected.txt +27 -0
- data/examples/sample_outputs/json_output_high_confidence.json +108 -0
- data/examples/sample_outputs/json_output_no_action.json +108 -0
- data/examples/workflows/basic_workflow.md +159 -0
- data/examples/workflows/ci_integration.md +372 -0
- data/exe/spec_scout +7 -0
- data/lib/spec_scout/agent_result.rb +44 -0
- data/lib/spec_scout/agents/database_agent.rb +113 -0
- data/lib/spec_scout/agents/factory_agent.rb +179 -0
- data/lib/spec_scout/agents/intent_agent.rb +223 -0
- data/lib/spec_scout/agents/risk_agent.rb +290 -0
- data/lib/spec_scout/base_agent.rb +72 -0
- data/lib/spec_scout/cli.rb +158 -0
- data/lib/spec_scout/configuration.rb +162 -0
- data/lib/spec_scout/consensus_engine.rb +535 -0
- data/lib/spec_scout/enforcement_handler.rb +182 -0
- data/lib/spec_scout/output_formatter.rb +307 -0
- data/lib/spec_scout/profile_data.rb +37 -0
- data/lib/spec_scout/profile_normalizer.rb +238 -0
- data/lib/spec_scout/recommendation.rb +62 -0
- data/lib/spec_scout/safety_validator.rb +127 -0
- data/lib/spec_scout/spec_scout.rb +519 -0
- data/lib/spec_scout/testprof_integration.rb +206 -0
- data/lib/spec_scout/version.rb +5 -0
- data/lib/spec_scout.rb +43 -0
- metadata +166 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Basic SpecScout configuration for most Rails applications
|
|
4
|
+
# Place this in spec/spec_helper.rb or test/test_helper.rb
|
|
5
|
+
|
|
6
|
+
require 'spec_scout'
|
|
7
|
+
|
|
8
|
+
SpecScout.configure do |config|
|
|
9
|
+
# Enable SpecScout analysis
|
|
10
|
+
config.enable = true
|
|
11
|
+
|
|
12
|
+
# Use TestProf for profiling data
|
|
13
|
+
config.use_test_prof = true
|
|
14
|
+
|
|
15
|
+
# Enable all agents for comprehensive analysis
|
|
16
|
+
config.enabled_agents = %i[database factory intent risk]
|
|
17
|
+
|
|
18
|
+
# Console output for development
|
|
19
|
+
config.output_format = :console
|
|
20
|
+
|
|
21
|
+
# Safety settings (recommended)
|
|
22
|
+
config.auto_apply_enabled = false
|
|
23
|
+
config.blocking_mode_enabled = false
|
|
24
|
+
end
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# CI-friendly SpecScout configuration
|
|
4
|
+
# Optimized for continuous integration environments
|
|
5
|
+
|
|
6
|
+
require 'spec_scout'
|
|
7
|
+
|
|
8
|
+
SpecScout.configure do |config|
|
|
9
|
+
# Enable SpecScout in CI
|
|
10
|
+
config.enable = true
|
|
11
|
+
|
|
12
|
+
# Use TestProf integration
|
|
13
|
+
config.use_test_prof = true
|
|
14
|
+
|
|
15
|
+
# Enable enforcement mode for CI
|
|
16
|
+
config.enforcement_mode = true
|
|
17
|
+
config.fail_on_high_confidence = true
|
|
18
|
+
|
|
19
|
+
# Focus on performance-critical agents
|
|
20
|
+
config.enabled_agents = %i[database factory]
|
|
21
|
+
|
|
22
|
+
# JSON output for CI processing
|
|
23
|
+
config.output_format = :json
|
|
24
|
+
|
|
25
|
+
# Safety settings
|
|
26
|
+
config.auto_apply_enabled = false
|
|
27
|
+
config.blocking_mode_enabled = false
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# Example CI usage:
|
|
31
|
+
# bundle exec spec_scout --enforce --output json > spec_scout_results.json
|
|
32
|
+
#
|
|
33
|
+
# Exit codes:
|
|
34
|
+
# 0 - No high confidence recommendations
|
|
35
|
+
# 1 - High confidence recommendations found (CI should fail)
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Conservative SpecScout configuration
|
|
4
|
+
# Focuses on safe optimizations and avoids risky changes
|
|
5
|
+
|
|
6
|
+
require 'spec_scout'
|
|
7
|
+
|
|
8
|
+
SpecScout.configure do |config|
|
|
9
|
+
# Enable SpecScout
|
|
10
|
+
config.enable = true
|
|
11
|
+
|
|
12
|
+
# Use TestProf integration
|
|
13
|
+
config.use_test_prof = true
|
|
14
|
+
|
|
15
|
+
# Enable risk agent to identify unsafe optimizations
|
|
16
|
+
# Disable intent agent to avoid boundary-related recommendations
|
|
17
|
+
config.enabled_agents = %i[database factory risk]
|
|
18
|
+
|
|
19
|
+
# Console output for manual review
|
|
20
|
+
config.output_format = :console
|
|
21
|
+
|
|
22
|
+
# Non-enforcement mode for safety
|
|
23
|
+
config.enforcement_mode = false
|
|
24
|
+
config.fail_on_high_confidence = false
|
|
25
|
+
|
|
26
|
+
# Safety settings (always recommended)
|
|
27
|
+
config.auto_apply_enabled = false
|
|
28
|
+
config.blocking_mode_enabled = false
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# This configuration prioritizes safety over optimization speed
|
|
32
|
+
# Recommendations will be conservative and well-validated
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Development-focused SpecScout configuration
|
|
4
|
+
# Optimized for local development and debugging
|
|
5
|
+
|
|
6
|
+
require 'spec_scout'
|
|
7
|
+
|
|
8
|
+
SpecScout.configure do |config|
|
|
9
|
+
# Enable SpecScout for development
|
|
10
|
+
config.enable = true
|
|
11
|
+
|
|
12
|
+
# Use TestProf integration
|
|
13
|
+
config.use_test_prof = true
|
|
14
|
+
|
|
15
|
+
# Enable all agents for comprehensive feedback
|
|
16
|
+
config.enabled_agents = %i[database factory intent risk]
|
|
17
|
+
|
|
18
|
+
# Console output for immediate feedback
|
|
19
|
+
config.output_format = :console
|
|
20
|
+
|
|
21
|
+
# Non-enforcement mode for development
|
|
22
|
+
config.enforcement_mode = false
|
|
23
|
+
config.fail_on_high_confidence = false
|
|
24
|
+
|
|
25
|
+
# Safety settings
|
|
26
|
+
config.auto_apply_enabled = false
|
|
27
|
+
config.blocking_mode_enabled = false
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# Enable debug mode for development
|
|
31
|
+
ENV['SPEC_SCOUT_DEBUG'] = '1' if Rails.env.development?
|
|
32
|
+
|
|
33
|
+
# Example development workflow:
|
|
34
|
+
# 1. Run specs: bundle exec rspec spec/models/user_spec.rb
|
|
35
|
+
# 2. Review SpecScout recommendations
|
|
36
|
+
# 3. Apply optimizations manually
|
|
37
|
+
# 4. Re-run specs to verify improvements
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Performance-focused SpecScout configuration
|
|
4
|
+
# Optimized for maximum test suite speed improvements
|
|
5
|
+
|
|
6
|
+
require 'spec_scout'
|
|
7
|
+
|
|
8
|
+
SpecScout.configure do |config|
|
|
9
|
+
# Enable SpecScout
|
|
10
|
+
config.enable = true
|
|
11
|
+
|
|
12
|
+
# Use TestProf integration
|
|
13
|
+
config.use_test_prof = true
|
|
14
|
+
|
|
15
|
+
# Focus on performance-critical agents
|
|
16
|
+
# Skip risk agent for more aggressive optimizations
|
|
17
|
+
config.enabled_agents = %i[database factory intent]
|
|
18
|
+
|
|
19
|
+
# JSON output for automated processing
|
|
20
|
+
config.output_format = :json
|
|
21
|
+
|
|
22
|
+
# Enable enforcement for performance gains
|
|
23
|
+
config.enforcement_mode = true
|
|
24
|
+
config.fail_on_high_confidence = true
|
|
25
|
+
|
|
26
|
+
# Safety settings (still recommended)
|
|
27
|
+
config.auto_apply_enabled = false
|
|
28
|
+
config.blocking_mode_enabled = false
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# This configuration prioritizes performance improvements
|
|
32
|
+
# Use with caution - test thoroughly after applying recommendations
|
|
33
|
+
#
|
|
34
|
+
# Recommended workflow:
|
|
35
|
+
# 1. Run with enforcement to identify high-impact optimizations
|
|
36
|
+
# 2. Apply recommendations in small batches
|
|
37
|
+
# 3. Run full test suite after each batch
|
|
38
|
+
# 4. Monitor for any behavioral changes
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
# Demo script showing OutputFormatter in action
|
|
5
|
+
require_relative '../lib/spec_scout'
|
|
6
|
+
|
|
7
|
+
# Create sample profile data
|
|
8
|
+
profile_data = SpecScout::ProfileData.new(
|
|
9
|
+
example_location: 'spec/models/user_spec.rb:42',
|
|
10
|
+
spec_type: :model,
|
|
11
|
+
runtime_ms: 38,
|
|
12
|
+
factories: { user: { strategy: :create, count: 1 } },
|
|
13
|
+
db: { total_queries: 6, inserts: 1, selects: 5 },
|
|
14
|
+
events: {},
|
|
15
|
+
metadata: {}
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
# Create sample agent results
|
|
19
|
+
agent_results = [
|
|
20
|
+
SpecScout::AgentResult.new(
|
|
21
|
+
agent_name: :database,
|
|
22
|
+
verdict: :db_unnecessary,
|
|
23
|
+
confidence: :high,
|
|
24
|
+
reasoning: 'No database writes detected',
|
|
25
|
+
metadata: {}
|
|
26
|
+
),
|
|
27
|
+
SpecScout::AgentResult.new(
|
|
28
|
+
agent_name: :factory,
|
|
29
|
+
verdict: :prefer_build_stubbed,
|
|
30
|
+
confidence: :medium,
|
|
31
|
+
reasoning: 'Factory can use build_stubbed',
|
|
32
|
+
metadata: {}
|
|
33
|
+
),
|
|
34
|
+
SpecScout::AgentResult.new(
|
|
35
|
+
agent_name: :intent,
|
|
36
|
+
verdict: :unit_test_behavior,
|
|
37
|
+
confidence: :high,
|
|
38
|
+
reasoning: 'Test behaves like unit test',
|
|
39
|
+
metadata: {}
|
|
40
|
+
),
|
|
41
|
+
SpecScout::AgentResult.new(
|
|
42
|
+
agent_name: :risk,
|
|
43
|
+
verdict: :safe_to_optimize,
|
|
44
|
+
confidence: :high,
|
|
45
|
+
reasoning: 'No side effects detected',
|
|
46
|
+
metadata: {}
|
|
47
|
+
)
|
|
48
|
+
]
|
|
49
|
+
|
|
50
|
+
# Create sample recommendation
|
|
51
|
+
recommendation = SpecScout::Recommendation.new(
|
|
52
|
+
spec_location: 'spec/models/user_spec.rb:42',
|
|
53
|
+
action: :replace_factory_strategy,
|
|
54
|
+
from_value: 'create(:user)',
|
|
55
|
+
to_value: 'build_stubbed(:user)',
|
|
56
|
+
confidence: :high,
|
|
57
|
+
explanation: [
|
|
58
|
+
'Strong agreement supports optimization recommendation',
|
|
59
|
+
'4 agent(s) agree on optimize_persistence approach',
|
|
60
|
+
'No risk factors detected'
|
|
61
|
+
],
|
|
62
|
+
agent_results: agent_results
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
# Format and display the recommendation
|
|
66
|
+
formatter = SpecScout::OutputFormatter.new(recommendation, profile_data)
|
|
67
|
+
puts formatter.format_recommendation
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
✔ Spec Scout Recommendation
|
|
2
|
+
|
|
3
|
+
spec/models/user_spec.rb:42
|
|
4
|
+
|
|
5
|
+
Summary:
|
|
6
|
+
- Factory :user used `create` (3x)
|
|
7
|
+
- Factory :post used `create` (2x)
|
|
8
|
+
- DB inserts: 5, selects: 8
|
|
9
|
+
- Runtime: 245ms
|
|
10
|
+
- Type: model spec
|
|
11
|
+
|
|
12
|
+
Agent Signals:
|
|
13
|
+
- Database Agent: DB unnecessary (✔ HIGH)
|
|
14
|
+
- Factory Agent: prefer build_stubbed (⚠ MEDIUM)
|
|
15
|
+
- Intent Agent: unit test behavior (✔ HIGH)
|
|
16
|
+
- Risk Agent: safe to optimize (✔ HIGH)
|
|
17
|
+
|
|
18
|
+
Final Recommendation:
|
|
19
|
+
✔ Replace `create(:user)` with `build_stubbed(:user)`
|
|
20
|
+
Confidence: ✔ HIGH
|
|
21
|
+
|
|
22
|
+
Reasoning:
|
|
23
|
+
- No database persistence required for this test
|
|
24
|
+
- Factory creates unnecessary database records
|
|
25
|
+
- Test exhibits unit test behavior patterns
|
|
26
|
+
- No risk factors detected (no after_commit callbacks)
|
|
27
|
+
- Potential performance improvement: ~60% faster execution
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
⚠ Spec Scout Recommendation
|
|
2
|
+
|
|
3
|
+
spec/controllers/users_controller_spec.rb:28
|
|
4
|
+
|
|
5
|
+
Summary:
|
|
6
|
+
- Factory :user used `create` (1x)
|
|
7
|
+
- Factory :organization used `create` (1x)
|
|
8
|
+
- DB inserts: 2, selects: 4
|
|
9
|
+
- Runtime: 180ms
|
|
10
|
+
- Type: controller spec
|
|
11
|
+
|
|
12
|
+
Agent Signals:
|
|
13
|
+
- Database Agent: DB unclear (? LOW)
|
|
14
|
+
- Factory Agent: prefer build_stubbed (⚠ MEDIUM)
|
|
15
|
+
- Intent Agent: integration test behavior (⚠ MEDIUM)
|
|
16
|
+
- Risk Agent: potential side effects (⚠ MEDIUM)
|
|
17
|
+
|
|
18
|
+
Final Recommendation:
|
|
19
|
+
⚠ Consider replacing `create(:user)` with `build_stubbed(:user)`
|
|
20
|
+
Confidence: ⚠ MEDIUM
|
|
21
|
+
|
|
22
|
+
Reasoning:
|
|
23
|
+
- Mixed signals from database usage analysis
|
|
24
|
+
- Controller specs may benefit from stubbed factories
|
|
25
|
+
- Some integration behavior detected - review test boundaries
|
|
26
|
+
- Potential side effects identified - proceed with caution
|
|
27
|
+
- Manual verification recommended before applying changes
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
— Spec Scout Recommendation
|
|
2
|
+
|
|
3
|
+
spec/integration/user_workflow_spec.rb:15
|
|
4
|
+
|
|
5
|
+
Summary:
|
|
6
|
+
- Factory :user used `create` (2x)
|
|
7
|
+
- Factory :post used `create` (5x)
|
|
8
|
+
- DB inserts: 7, selects: 12
|
|
9
|
+
- Runtime: 420ms
|
|
10
|
+
- Type: integration spec
|
|
11
|
+
|
|
12
|
+
Agent Signals:
|
|
13
|
+
- Database Agent: DB required (✔ HIGH)
|
|
14
|
+
- Factory Agent: create required (✔ HIGH)
|
|
15
|
+
- Intent Agent: integration test behavior (✔ HIGH)
|
|
16
|
+
- Risk Agent: safe to optimize (✔ HIGH)
|
|
17
|
+
|
|
18
|
+
Final Recommendation:
|
|
19
|
+
— No optimization recommended
|
|
20
|
+
Confidence: ✔ HIGH
|
|
21
|
+
|
|
22
|
+
Reasoning:
|
|
23
|
+
- Database persistence is required for this integration test
|
|
24
|
+
- Factory strategy is appropriate for test type
|
|
25
|
+
- Test correctly exhibits integration behavior
|
|
26
|
+
- Current implementation is optimal for test intent
|
|
27
|
+
- No performance improvements available without changing test scope
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
⚠ Spec Scout Recommendation
|
|
2
|
+
|
|
3
|
+
spec/models/payment_spec.rb:67
|
|
4
|
+
|
|
5
|
+
Summary:
|
|
6
|
+
- Factory :payment used `create` (1x)
|
|
7
|
+
- Factory :user used `create` (1x)
|
|
8
|
+
- DB inserts: 2, selects: 3
|
|
9
|
+
- Runtime: 320ms
|
|
10
|
+
- Type: model spec
|
|
11
|
+
|
|
12
|
+
Agent Signals:
|
|
13
|
+
- Database Agent: DB unnecessary (⚠ MEDIUM)
|
|
14
|
+
- Factory Agent: prefer build_stubbed (⚠ MEDIUM)
|
|
15
|
+
- Intent Agent: unit test behavior (✔ HIGH)
|
|
16
|
+
- Risk Agent: high risk detected (⚠ HIGH)
|
|
17
|
+
|
|
18
|
+
Final Recommendation:
|
|
19
|
+
⚠ Assess risk factors before optimizing
|
|
20
|
+
Confidence: ? LOW
|
|
21
|
+
|
|
22
|
+
Reasoning:
|
|
23
|
+
- after_commit callbacks detected in Payment model
|
|
24
|
+
- Complex callback chain may depend on database persistence
|
|
25
|
+
- Optimization could break callback-dependent functionality
|
|
26
|
+
- Manual review required before applying factory strategy changes
|
|
27
|
+
- Consider testing callback behavior separately if optimization is desired
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
{
|
|
2
|
+
"spec_location": "spec/models/user_spec.rb:42",
|
|
3
|
+
"action": "replace_factory_strategy",
|
|
4
|
+
"from_value": "create(:user)",
|
|
5
|
+
"to_value": "build_stubbed(:user)",
|
|
6
|
+
"confidence": "high",
|
|
7
|
+
"explanation": [
|
|
8
|
+
"No database persistence required for this test",
|
|
9
|
+
"Factory creates unnecessary database records",
|
|
10
|
+
"Test exhibits unit test behavior patterns",
|
|
11
|
+
"No risk factors detected (no after_commit callbacks)",
|
|
12
|
+
"Potential performance improvement: ~60% faster execution"
|
|
13
|
+
],
|
|
14
|
+
"agent_results": [
|
|
15
|
+
{
|
|
16
|
+
"agent_name": "database",
|
|
17
|
+
"verdict": "db_unnecessary",
|
|
18
|
+
"confidence": "high",
|
|
19
|
+
"reasoning": "No database writes or reloads detected in test execution",
|
|
20
|
+
"metadata": {
|
|
21
|
+
"insert_count": 3,
|
|
22
|
+
"select_count": 8,
|
|
23
|
+
"reload_detected": false,
|
|
24
|
+
"transaction_usage": false
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"agent_name": "factory",
|
|
29
|
+
"verdict": "prefer_build_stubbed",
|
|
30
|
+
"confidence": "medium",
|
|
31
|
+
"reasoning": "Factory usage pattern suggests build_stubbed would be sufficient",
|
|
32
|
+
"metadata": {
|
|
33
|
+
"factory_strategies": {
|
|
34
|
+
"user": "create",
|
|
35
|
+
"post": "create"
|
|
36
|
+
},
|
|
37
|
+
"association_access": false,
|
|
38
|
+
"persistence_required": false
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"agent_name": "intent",
|
|
43
|
+
"verdict": "unit_test_behavior",
|
|
44
|
+
"confidence": "high",
|
|
45
|
+
"reasoning": "Test exhibits unit test patterns with isolated model testing",
|
|
46
|
+
"metadata": {
|
|
47
|
+
"spec_type": "model",
|
|
48
|
+
"file_location": "spec/models/",
|
|
49
|
+
"integration_boundaries": false,
|
|
50
|
+
"external_dependencies": false
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"agent_name": "risk",
|
|
55
|
+
"verdict": "safe_to_optimize",
|
|
56
|
+
"confidence": "high",
|
|
57
|
+
"reasoning": "No risk factors detected - safe to apply optimization",
|
|
58
|
+
"metadata": {
|
|
59
|
+
"after_commit_callbacks": false,
|
|
60
|
+
"complex_callbacks": false,
|
|
61
|
+
"side_effects": false,
|
|
62
|
+
"external_integrations": false
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
],
|
|
66
|
+
"profile_data": {
|
|
67
|
+
"example_location": "spec/models/user_spec.rb:42",
|
|
68
|
+
"spec_type": "model",
|
|
69
|
+
"runtime_ms": 245,
|
|
70
|
+
"factories": {
|
|
71
|
+
"user": {
|
|
72
|
+
"strategy": "create",
|
|
73
|
+
"count": 3
|
|
74
|
+
},
|
|
75
|
+
"post": {
|
|
76
|
+
"strategy": "create",
|
|
77
|
+
"count": 2
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
"db": {
|
|
81
|
+
"total_queries": 13,
|
|
82
|
+
"inserts": 5,
|
|
83
|
+
"selects": 8,
|
|
84
|
+
"updates": 0,
|
|
85
|
+
"deletes": 0
|
|
86
|
+
},
|
|
87
|
+
"events": {
|
|
88
|
+
"sql.active_record": {
|
|
89
|
+
"count": 13,
|
|
90
|
+
"time": 0.15
|
|
91
|
+
},
|
|
92
|
+
"factory_bot.run_factory": {
|
|
93
|
+
"count": 5,
|
|
94
|
+
"time": 0.08
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
"metadata": {
|
|
98
|
+
"testprof_version": "1.3.0",
|
|
99
|
+
"rails_version": "7.0.4"
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
"metadata": {
|
|
103
|
+
"timestamp": "2024-01-15T10:30:00Z",
|
|
104
|
+
"spec_scout_version": "1.0.0",
|
|
105
|
+
"analysis_duration_ms": 12,
|
|
106
|
+
"agents_executed": ["database", "factory", "intent", "risk"]
|
|
107
|
+
}
|
|
108
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
{
|
|
2
|
+
"spec_location": "spec/integration/user_workflow_spec.rb:15",
|
|
3
|
+
"action": "no_action",
|
|
4
|
+
"from_value": "",
|
|
5
|
+
"to_value": "",
|
|
6
|
+
"confidence": "high",
|
|
7
|
+
"explanation": [
|
|
8
|
+
"Database persistence is required for this integration test",
|
|
9
|
+
"Factory strategy is appropriate for test type",
|
|
10
|
+
"Test correctly exhibits integration behavior",
|
|
11
|
+
"Current implementation is optimal for test intent",
|
|
12
|
+
"No performance improvements available without changing test scope"
|
|
13
|
+
],
|
|
14
|
+
"agent_results": [
|
|
15
|
+
{
|
|
16
|
+
"agent_name": "database",
|
|
17
|
+
"verdict": "db_required",
|
|
18
|
+
"confidence": "high",
|
|
19
|
+
"reasoning": "Integration test requires database persistence for proper behavior",
|
|
20
|
+
"metadata": {
|
|
21
|
+
"insert_count": 7,
|
|
22
|
+
"select_count": 12,
|
|
23
|
+
"reload_detected": true,
|
|
24
|
+
"transaction_usage": true
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"agent_name": "factory",
|
|
29
|
+
"verdict": "create_required",
|
|
30
|
+
"confidence": "high",
|
|
31
|
+
"reasoning": "Factory persistence is necessary for integration test workflow",
|
|
32
|
+
"metadata": {
|
|
33
|
+
"factory_strategies": {
|
|
34
|
+
"user": "create",
|
|
35
|
+
"post": "create"
|
|
36
|
+
},
|
|
37
|
+
"association_access": true,
|
|
38
|
+
"persistence_required": true
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"agent_name": "intent",
|
|
43
|
+
"verdict": "integration_test_behavior",
|
|
44
|
+
"confidence": "high",
|
|
45
|
+
"reasoning": "Test correctly exhibits integration behavior with multiple system interactions",
|
|
46
|
+
"metadata": {
|
|
47
|
+
"spec_type": "integration",
|
|
48
|
+
"file_location": "spec/integration/",
|
|
49
|
+
"integration_boundaries": true,
|
|
50
|
+
"external_dependencies": true
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"agent_name": "risk",
|
|
55
|
+
"verdict": "safe_to_optimize",
|
|
56
|
+
"confidence": "high",
|
|
57
|
+
"reasoning": "No optimization risks detected, but no optimizations recommended",
|
|
58
|
+
"metadata": {
|
|
59
|
+
"after_commit_callbacks": false,
|
|
60
|
+
"complex_callbacks": false,
|
|
61
|
+
"side_effects": false,
|
|
62
|
+
"external_integrations": true
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
],
|
|
66
|
+
"profile_data": {
|
|
67
|
+
"example_location": "spec/integration/user_workflow_spec.rb:15",
|
|
68
|
+
"spec_type": "integration",
|
|
69
|
+
"runtime_ms": 420,
|
|
70
|
+
"factories": {
|
|
71
|
+
"user": {
|
|
72
|
+
"strategy": "create",
|
|
73
|
+
"count": 2
|
|
74
|
+
},
|
|
75
|
+
"post": {
|
|
76
|
+
"strategy": "create",
|
|
77
|
+
"count": 5
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
"db": {
|
|
81
|
+
"total_queries": 19,
|
|
82
|
+
"inserts": 7,
|
|
83
|
+
"selects": 12,
|
|
84
|
+
"updates": 0,
|
|
85
|
+
"deletes": 0
|
|
86
|
+
},
|
|
87
|
+
"events": {
|
|
88
|
+
"sql.active_record": {
|
|
89
|
+
"count": 19,
|
|
90
|
+
"time": 0.28
|
|
91
|
+
},
|
|
92
|
+
"factory_bot.run_factory": {
|
|
93
|
+
"count": 7,
|
|
94
|
+
"time": 0.12
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
"metadata": {
|
|
98
|
+
"testprof_version": "1.3.0",
|
|
99
|
+
"rails_version": "7.0.4"
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
"metadata": {
|
|
103
|
+
"timestamp": "2024-01-15T10:32:15Z",
|
|
104
|
+
"spec_scout_version": "1.0.0",
|
|
105
|
+
"analysis_duration_ms": 8,
|
|
106
|
+
"agents_executed": ["database", "factory", "intent", "risk"]
|
|
107
|
+
}
|
|
108
|
+
}
|