polyrun 3.2.0-java
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/CHANGELOG.md +234 -0
- data/CODE_OF_CONDUCT.md +26 -0
- data/CONTRIBUTING.md +23 -0
- data/LICENSE +21 -0
- data/README.md +251 -0
- data/SECURITY.md +25 -0
- data/bin/polyrun +6 -0
- data/docs/QUALITY.md +82 -0
- data/docs/QUALITY_CONFIGURATION.md +95 -0
- data/docs/SETUP_PROFILE.md +139 -0
- data/lib/polyrun/benchmark/pressure/cooker.rb +191 -0
- data/lib/polyrun/benchmark/pressure/process_sample.rb +127 -0
- data/lib/polyrun/benchmark/pressure.rb +144 -0
- data/lib/polyrun/benchmark/profile.rb +191 -0
- data/lib/polyrun/benchmark/report.rb +87 -0
- data/lib/polyrun/cli/benchmark_commands.rb +66 -0
- data/lib/polyrun/cli/ci_shard_hooks.rb +129 -0
- data/lib/polyrun/cli/ci_shard_run_command.rb +177 -0
- data/lib/polyrun/cli/ci_shard_run_parse.rb +68 -0
- data/lib/polyrun/cli/config_command.rb +42 -0
- data/lib/polyrun/cli/coverage_commands.rb +150 -0
- data/lib/polyrun/cli/coverage_merge_io.rb +150 -0
- data/lib/polyrun/cli/database_commands.rb +163 -0
- data/lib/polyrun/cli/default_run.rb +144 -0
- data/lib/polyrun/cli/doctor_command.rb +94 -0
- data/lib/polyrun/cli/env_commands.rb +43 -0
- data/lib/polyrun/cli/failure_commands.rb +99 -0
- data/lib/polyrun/cli/graph_command.rb +68 -0
- data/lib/polyrun/cli/help.rb +83 -0
- data/lib/polyrun/cli/helpers.rb +162 -0
- data/lib/polyrun/cli/hooks_command.rb +97 -0
- data/lib/polyrun/cli/init_command.rb +108 -0
- data/lib/polyrun/cli/mutation_command.rb +67 -0
- data/lib/polyrun/cli/partition_diagnostics.rb +22 -0
- data/lib/polyrun/cli/plan_command.rb +184 -0
- data/lib/polyrun/cli/prepare_command.rb +70 -0
- data/lib/polyrun/cli/prepare_recipe.rb +82 -0
- data/lib/polyrun/cli/quality_commands.rb +65 -0
- data/lib/polyrun/cli/queue_command.rb +161 -0
- data/lib/polyrun/cli/quick_command.rb +13 -0
- data/lib/polyrun/cli/report_commands.rb +108 -0
- data/lib/polyrun/cli/run_queue_command.rb +127 -0
- data/lib/polyrun/cli/run_shards_command.rb +164 -0
- data/lib/polyrun/cli/run_shards_parallel_children.rb +112 -0
- data/lib/polyrun/cli/run_shards_parallel_wait.rb +252 -0
- data/lib/polyrun/cli/run_shards_plan_boot_phases.rb +207 -0
- data/lib/polyrun/cli/run_shards_plan_options.rb +74 -0
- data/lib/polyrun/cli/run_shards_planning.rb +123 -0
- data/lib/polyrun/cli/run_shards_run.rb +171 -0
- data/lib/polyrun/cli/run_shards_worker_interrupt.rb +101 -0
- data/lib/polyrun/cli/skip_env.rb +34 -0
- data/lib/polyrun/cli/spec_quality_commands.rb +149 -0
- data/lib/polyrun/cli/start_bootstrap.rb +126 -0
- data/lib/polyrun/cli/timing_command.rb +31 -0
- data/lib/polyrun/cli/tool_options.rb +48 -0
- data/lib/polyrun/cli/validate_command.rb +26 -0
- data/lib/polyrun/cli.rb +272 -0
- data/lib/polyrun/config/dotted_path.rb +21 -0
- data/lib/polyrun/config/effective.rb +82 -0
- data/lib/polyrun/config/resolver.rb +114 -0
- data/lib/polyrun/config/schema.rb +39 -0
- data/lib/polyrun/config/suite.rb +109 -0
- data/lib/polyrun/config/tool_defaults.rb +42 -0
- data/lib/polyrun/config/tool_validation.rb +79 -0
- data/lib/polyrun/config/tools.rb +120 -0
- data/lib/polyrun/config.rb +97 -0
- data/lib/polyrun/coverage/cobertura_zero_lines.rb +32 -0
- data/lib/polyrun/coverage/collector.rb +169 -0
- data/lib/polyrun/coverage/collector_blob.rb +53 -0
- data/lib/polyrun/coverage/collector_finish.rb +98 -0
- data/lib/polyrun/coverage/collector_fragment_meta.rb +57 -0
- data/lib/polyrun/coverage/config_resolve.rb +131 -0
- data/lib/polyrun/coverage/example_diff.rb +184 -0
- data/lib/polyrun/coverage/example_diff_snapshot.rb +44 -0
- data/lib/polyrun/coverage/example_diff_track_filter.rb +51 -0
- data/lib/polyrun/coverage/file_stats_report.rb +36 -0
- data/lib/polyrun/coverage/filter.rb +22 -0
- data/lib/polyrun/coverage/formatter.rb +137 -0
- data/lib/polyrun/coverage/merge/formatters.rb +188 -0
- data/lib/polyrun/coverage/merge/formatters_html.rb +221 -0
- data/lib/polyrun/coverage/merge/html/_file_list.html.erb +21 -0
- data/lib/polyrun/coverage/merge/html/_file_section.html.erb +26 -0
- data/lib/polyrun/coverage/merge/html/_groups_table.html.erb +18 -0
- data/lib/polyrun/coverage/merge/html/_overview.html.erb +47 -0
- data/lib/polyrun/coverage/merge/html/report.css +147 -0
- data/lib/polyrun/coverage/merge/html/report.js +48 -0
- data/lib/polyrun/coverage/merge/html/template.html.erb +30 -0
- data/lib/polyrun/coverage/merge.rb +160 -0
- data/lib/polyrun/coverage/merge_fragment_meta.rb +58 -0
- data/lib/polyrun/coverage/merge_merge_two.rb +168 -0
- data/lib/polyrun/coverage/merge_native.rb +39 -0
- data/lib/polyrun/coverage/rails.rb +126 -0
- data/lib/polyrun/coverage/reporting.rb +41 -0
- data/lib/polyrun/coverage/result.rb +18 -0
- data/lib/polyrun/coverage/track_files.rb +150 -0
- data/lib/polyrun/data/cached_fixtures.rb +122 -0
- data/lib/polyrun/data/factory_counts.rb +48 -0
- data/lib/polyrun/data/factory_instrumentation.rb +50 -0
- data/lib/polyrun/data/fixtures.rb +68 -0
- data/lib/polyrun/data/parallel_provisioning.rb +93 -0
- data/lib/polyrun/data/snapshot.rb +84 -0
- data/lib/polyrun/database/clone_shards.rb +106 -0
- data/lib/polyrun/database/provision.rb +83 -0
- data/lib/polyrun/database/shard.rb +64 -0
- data/lib/polyrun/database/url_builder/connection/infer.rb +53 -0
- data/lib/polyrun/database/url_builder/connection/url_builders.rb +43 -0
- data/lib/polyrun/database/url_builder/connection.rb +191 -0
- data/lib/polyrun/database/url_builder/template_prepare.rb +21 -0
- data/lib/polyrun/database/url_builder.rb +188 -0
- data/lib/polyrun/debug.rb +81 -0
- data/lib/polyrun/env/ci.rb +65 -0
- data/lib/polyrun/error.rb +3 -0
- data/lib/polyrun/export/csv.rb +25 -0
- data/lib/polyrun/export/markdown.rb +47 -0
- data/lib/polyrun/graph/client.rb +64 -0
- data/lib/polyrun/graph/error.rb +13 -0
- data/lib/polyrun/graph/index.rb +75 -0
- data/lib/polyrun/graph/inspect.rb +58 -0
- data/lib/polyrun/graph/plan.rb +134 -0
- data/lib/polyrun/graph/planner.rb +117 -0
- data/lib/polyrun/graph/syntax.rb +114 -0
- data/lib/polyrun/graph/transaction.rb +81 -0
- data/lib/polyrun/graph/worker.rb +55 -0
- data/lib/polyrun/graph/workspace.rb +117 -0
- data/lib/polyrun/hooks/dsl.rb +128 -0
- data/lib/polyrun/hooks/shell_runner.rb +33 -0
- data/lib/polyrun/hooks/worker_runner.rb +27 -0
- data/lib/polyrun/hooks/worker_shell.rb +50 -0
- data/lib/polyrun/hooks.rb +190 -0
- data/lib/polyrun/log.rb +86 -0
- data/lib/polyrun/minitest_support.rb +60 -0
- data/lib/polyrun/mutation/candidates.rb +91 -0
- data/lib/polyrun/mutation/operators.rb +51 -0
- data/lib/polyrun/mutation/runner.rb +133 -0
- data/lib/polyrun/mutation/subjects.rb +88 -0
- data/lib/polyrun/partition/constraints.rb +80 -0
- data/lib/polyrun/partition/hrw.rb +70 -0
- data/lib/polyrun/partition/min_heap.rb +64 -0
- data/lib/polyrun/partition/paths.rb +175 -0
- data/lib/polyrun/partition/paths_build.rb +141 -0
- data/lib/polyrun/partition/plan.rb +250 -0
- data/lib/polyrun/partition/plan_lpt.rb +91 -0
- data/lib/polyrun/partition/plan_sharding.rb +56 -0
- data/lib/polyrun/partition/reports.rb +139 -0
- data/lib/polyrun/partition/stable_shuffle.rb +18 -0
- data/lib/polyrun/partition/suite.rb +120 -0
- data/lib/polyrun/partition/timing_diagnostics.rb +138 -0
- data/lib/polyrun/partition/timing_keys.rb +86 -0
- data/lib/polyrun/prepare/artifacts.rb +40 -0
- data/lib/polyrun/prepare/assets.rb +64 -0
- data/lib/polyrun/process_stdio.rb +96 -0
- data/lib/polyrun/quality/command.rb +84 -0
- data/lib/polyrun/quality/measure.rb +38 -0
- data/lib/polyrun/quality/observe.rb +53 -0
- data/lib/polyrun/quality/observe_hook.rb +103 -0
- data/lib/polyrun/quality/sandbox.rb +70 -0
- data/lib/polyrun/queue/duration.rb +30 -0
- data/lib/polyrun/queue/file_store.rb +413 -0
- data/lib/polyrun/queue/file_store_intent.rb +188 -0
- data/lib/polyrun/queue/file_store_pending.rb +48 -0
- data/lib/polyrun/queue/worker_loop.rb +73 -0
- data/lib/polyrun/quick/assertions.rb +32 -0
- data/lib/polyrun/quick/config.rb +56 -0
- data/lib/polyrun/quick/errors.rb +6 -0
- data/lib/polyrun/quick/example_group.rb +111 -0
- data/lib/polyrun/quick/example_runner.rb +129 -0
- data/lib/polyrun/quick/matchers.rb +159 -0
- data/lib/polyrun/quick/matchers_predicates.rb +122 -0
- data/lib/polyrun/quick/reporter.rb +76 -0
- data/lib/polyrun/quick/runner.rb +224 -0
- data/lib/polyrun/quick.rb +1 -0
- data/lib/polyrun/railtie.rb +7 -0
- data/lib/polyrun/reporting/failure_merge.rb +171 -0
- data/lib/polyrun/reporting/junit.rb +126 -0
- data/lib/polyrun/reporting/junit_emit.rb +58 -0
- data/lib/polyrun/reporting/junit_report.rb +87 -0
- data/lib/polyrun/reporting/rspec_failure_fragment_formatter.rb +95 -0
- data/lib/polyrun/reporting/rspec_junit.rb +39 -0
- data/lib/polyrun/rspec_support/active_record_timeout_recovery.rb +51 -0
- data/lib/polyrun/rspec_support/example_debug.rb +167 -0
- data/lib/polyrun/rspec_support/example_debug_instrumentation.rb +73 -0
- data/lib/polyrun/rspec_support/sharded_formatter_compat.rb +57 -0
- data/lib/polyrun/rspec_support.rb +110 -0
- data/lib/polyrun/spec_quality/config.rb +139 -0
- data/lib/polyrun/spec_quality/fragment.rb +39 -0
- data/lib/polyrun/spec_quality/merge.rb +78 -0
- data/lib/polyrun/spec_quality/minitest_hook.rb +42 -0
- data/lib/polyrun/spec_quality/plan_loader.rb +47 -0
- data/lib/polyrun/spec_quality/profile.rb +102 -0
- data/lib/polyrun/spec_quality/report.rb +363 -0
- data/lib/polyrun/spec_quality/rspec_hook.rb +55 -0
- data/lib/polyrun/spec_quality/sql_counter.rb +34 -0
- data/lib/polyrun/spec_quality.rb +212 -0
- data/lib/polyrun/sus_support.rb +55 -0
- data/lib/polyrun/templates/POLYRUN.md +51 -0
- data/lib/polyrun/templates/ci_matrix.polyrun.yml +22 -0
- data/lib/polyrun/templates/minimal_gem.polyrun.yml +13 -0
- data/lib/polyrun/templates/polyrun_hooks_spec_quality.rb +12 -0
- data/lib/polyrun/templates/polyrun_spec_quality.yml +20 -0
- data/lib/polyrun/templates/rails_prepare.polyrun.yml +51 -0
- data/lib/polyrun/templates/rails_prepare_task.rake +16 -0
- data/lib/polyrun/timing/merge.rb +36 -0
- data/lib/polyrun/timing/rspec_example_formatter.rb +60 -0
- data/lib/polyrun/timing/stats.rb +76 -0
- data/lib/polyrun/timing/summary.rb +78 -0
- data/lib/polyrun/timing/variance_report.rb +51 -0
- data/lib/polyrun/version.rb +3 -0
- data/lib/polyrun/worker_output.rb +181 -0
- data/lib/polyrun/worker_output_forwarders.rb +94 -0
- data/lib/polyrun/worker_ping.rb +77 -0
- data/lib/polyrun.rb +59 -0
- data/polyrun.gemspec +49 -0
- data/sig/polyrun/cli.rbs +6 -0
- data/sig/polyrun/config.rbs +20 -0
- data/sig/polyrun/debug.rbs +12 -0
- data/sig/polyrun/log.rbs +12 -0
- data/sig/polyrun/minitest_support.rbs +7 -0
- data/sig/polyrun/quick.rbs +19 -0
- data/sig/polyrun/rspec_support.rbs +21 -0
- data/sig/polyrun/sus_support.rbs +7 -0
- data/sig/polyrun/worker_output.rbs +11 -0
- data/sig/polyrun/worker_ping.rbs +10 -0
- data/sig/polyrun.rbs +11 -0
- metadata +463 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
require "json"
|
|
2
|
+
require "tmpdir"
|
|
3
|
+
require_relative "command"
|
|
4
|
+
|
|
5
|
+
module Polyrun
|
|
6
|
+
module Quality
|
|
7
|
+
module Observe
|
|
8
|
+
module_function
|
|
9
|
+
|
|
10
|
+
def call(command, root:, output:, timeout: 300, limit: 10_000, max_output: Command::DEFAULT_OUTPUT_LIMIT, max_artifact_bytes: 16_777_216)
|
|
11
|
+
raise ArgumentError, "max entries must be positive" unless limit.is_a?(Integer) && limit.positive?
|
|
12
|
+
|
|
13
|
+
output = File.expand_path(output)
|
|
14
|
+
Dir.mktmpdir("polyrun-observe", File.dirname(output)) do |directory|
|
|
15
|
+
artifact = File.join(directory, "trace.json")
|
|
16
|
+
result = Command.call(command, root: root, timeout: timeout, max_output: max_output, env: environment(root, artifact, limit))
|
|
17
|
+
present = File.file?(artifact)
|
|
18
|
+
if present
|
|
19
|
+
validate_artifact!(artifact, max_artifact_bytes)
|
|
20
|
+
File.rename(artifact, output)
|
|
21
|
+
end
|
|
22
|
+
result["ok"] = result["exitstatus"].zero? && present
|
|
23
|
+
result["code"] = if !result["exitstatus"].zero?
|
|
24
|
+
"COMMAND_FAILED"
|
|
25
|
+
elsif present
|
|
26
|
+
"OBSERVED"
|
|
27
|
+
else
|
|
28
|
+
"TRACE_MISSING"
|
|
29
|
+
end
|
|
30
|
+
result
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def environment(root, artifact, limit)
|
|
35
|
+
library = File.expand_path("../..", __dir__)
|
|
36
|
+
{"POLYRUN_OBSERVE_ROOT" => File.realpath(root), "POLYRUN_OBSERVE_OUTPUT" => artifact,
|
|
37
|
+
"POLYRUN_OBSERVE_LIMIT" => limit.to_s, "POLYRUN_OBSERVE_RUBYOPT" => ENV["RUBYOPT"],
|
|
38
|
+
"RUBYLIB" => [library, ENV["RUBYLIB"]].compact.join(File::PATH_SEPARATOR),
|
|
39
|
+
"RUBYOPT" => "#{ENV["RUBYOPT"]} -rpolyrun/quality/observe_hook"}
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def validate_artifact!(path, max_bytes)
|
|
43
|
+
raise ArgumentError, "observation artifact is too large" if File.size(path) > max_bytes
|
|
44
|
+
|
|
45
|
+
trace = JSON.parse(File.read(path))
|
|
46
|
+
unless trace.is_a?(Hash) && trace["calls"].is_a?(Array) && trace["provenance"] == "observed"
|
|
47
|
+
raise ArgumentError, "invalid observation artifact"
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
private_class_method :environment, :validate_artifact!
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
require "json"
|
|
2
|
+
|
|
3
|
+
module Polyrun
|
|
4
|
+
module Quality
|
|
5
|
+
module ObserveHook
|
|
6
|
+
class Recorder
|
|
7
|
+
def initialize(root, output, limit)
|
|
8
|
+
@root = File.realpath(root) + "/"
|
|
9
|
+
@output = output
|
|
10
|
+
@limit = limit
|
|
11
|
+
@calls = {}
|
|
12
|
+
@paths = {}
|
|
13
|
+
@owners = {}
|
|
14
|
+
@entries = 0
|
|
15
|
+
@truncated = false
|
|
16
|
+
@process = Process.pid
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def record(event)
|
|
20
|
+
path = relative_path(event.path)
|
|
21
|
+
return unless path
|
|
22
|
+
|
|
23
|
+
owner = event.defined_class
|
|
24
|
+
name = event.method_id
|
|
25
|
+
methods = @calls.dig(path, owner)
|
|
26
|
+
count = methods && methods[name]
|
|
27
|
+
if count
|
|
28
|
+
methods[name] = count + 1
|
|
29
|
+
elsif @entries < @limit
|
|
30
|
+
identity = owner_identity(event)
|
|
31
|
+
return unless identity
|
|
32
|
+
|
|
33
|
+
@owners[owner] = identity
|
|
34
|
+
methods ||= ((@calls[path] ||= {})[owner] ||= {})
|
|
35
|
+
methods[name] = 1
|
|
36
|
+
@entries += 1
|
|
37
|
+
else
|
|
38
|
+
@truncated = true
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def write
|
|
43
|
+
return unless Process.pid == @process
|
|
44
|
+
|
|
45
|
+
rows = @calls.flat_map do |path, owners|
|
|
46
|
+
owners.flat_map do |owner, methods|
|
|
47
|
+
name, separator = @owners.fetch(owner)
|
|
48
|
+
methods.map do |method, count|
|
|
49
|
+
{"path" => path, "owner" => name, "method" => method.to_s, "subject" => "#{name}#{separator}#{method}", "count" => count}
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
File.write(@output, JSON.generate("calls" => rows, "truncated" => @truncated, "provenance" => "observed"))
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
private
|
|
57
|
+
|
|
58
|
+
def relative_path(source)
|
|
59
|
+
path = @paths[source]
|
|
60
|
+
if path.nil?
|
|
61
|
+
resolved = File.file?(source) ? File.realpath(source) : nil
|
|
62
|
+
path = resolved&.start_with?(@root) ? resolved.delete_prefix(@root) : false
|
|
63
|
+
@paths[source] = path if @paths.size < @limit
|
|
64
|
+
end
|
|
65
|
+
path
|
|
66
|
+
rescue Errno::ENOENT
|
|
67
|
+
false
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
def owner_identity(event)
|
|
71
|
+
owner = event.defined_class
|
|
72
|
+
name = owner.name
|
|
73
|
+
separator = "#"
|
|
74
|
+
if owner.singleton_class? && event.self.is_a?(Module)
|
|
75
|
+
name = event.self.name
|
|
76
|
+
separator = "."
|
|
77
|
+
end
|
|
78
|
+
[name, separator] if name.is_a?(String) && !name.empty?
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
module_function
|
|
83
|
+
|
|
84
|
+
def install
|
|
85
|
+
root = ENV.delete("POLYRUN_OBSERVE_ROOT")
|
|
86
|
+
output = ENV.delete("POLYRUN_OBSERVE_OUTPUT")
|
|
87
|
+
limit = Integer(ENV.delete("POLYRUN_OBSERVE_LIMIT") || "10000")
|
|
88
|
+
ENV["RUBYOPT"] = ENV.delete("POLYRUN_OBSERVE_RUBYOPT")
|
|
89
|
+
return unless root && output
|
|
90
|
+
|
|
91
|
+
recorder = Recorder.new(root, output, limit)
|
|
92
|
+
trace = TracePoint.new(:call) { |event| recorder.record(event) }
|
|
93
|
+
at_exit do
|
|
94
|
+
trace.disable
|
|
95
|
+
recorder.write
|
|
96
|
+
end
|
|
97
|
+
trace.enable
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
end
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
Polyrun::Quality::ObserveHook.install
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
require "digest"
|
|
2
|
+
require "fileutils"
|
|
3
|
+
require "find"
|
|
4
|
+
require_relative "../config/tools"
|
|
5
|
+
|
|
6
|
+
module Polyrun
|
|
7
|
+
module Quality
|
|
8
|
+
class Sandbox
|
|
9
|
+
attr_reader :bytes
|
|
10
|
+
|
|
11
|
+
def initialize(root, settings: {})
|
|
12
|
+
@settings = Config::Tools.merge(Config::ToolDefaults::STAGING, Config::Tools.stringify(settings))
|
|
13
|
+
errors = Config::ToolValidation.check(@settings, Config::ToolDefaults::STAGING, "staging")
|
|
14
|
+
raise ArgumentError, errors.join("; ") unless errors.empty?
|
|
15
|
+
|
|
16
|
+
@root = File.realpath(root)
|
|
17
|
+
@bytes = 0
|
|
18
|
+
@files = inventory
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def copy_to(destination)
|
|
22
|
+
@files.each do |relative, expected|
|
|
23
|
+
source = File.join(@root, relative)
|
|
24
|
+
raise ArgumentError, "project changed while staging" unless File.file?(source) && !File.symlink?(source) && Digest::SHA256.file(source).hexdigest == expected
|
|
25
|
+
|
|
26
|
+
target = File.join(destination, relative)
|
|
27
|
+
FileUtils.mkdir_p(File.dirname(target))
|
|
28
|
+
FileUtils.copy_file(source, target, true)
|
|
29
|
+
raise ArgumentError, "project changed while staging" unless Digest::SHA256.file(target).hexdigest == expected
|
|
30
|
+
end
|
|
31
|
+
destination
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def self.environment(destination)
|
|
35
|
+
{"BUNDLE_GEMFILE" => File.file?(File.join(destination, "Gemfile")) ? File.join(destination, "Gemfile") : nil,
|
|
36
|
+
"RUBYLIB" => [File.join(destination, "lib"), ENV["RUBYLIB"]].compact.join(File::PATH_SEPARATOR)}
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
private
|
|
40
|
+
|
|
41
|
+
def inventory
|
|
42
|
+
files = {}
|
|
43
|
+
Find.find(@root) do |path|
|
|
44
|
+
next if path == @root
|
|
45
|
+
|
|
46
|
+
name = File.basename(path)
|
|
47
|
+
relative = path.delete_prefix("#{@root}/")
|
|
48
|
+
if excluded?(name) || @settings["exclude_paths"].any? { |pattern| File.fnmatch?(pattern, relative, File::FNM_PATHNAME) }
|
|
49
|
+
Find.prune if File.directory?(path)
|
|
50
|
+
next
|
|
51
|
+
end
|
|
52
|
+
raise ArgumentError, "symbolic links are not supported in staged projects" if File.symlink?(path)
|
|
53
|
+
next unless File.file?(path)
|
|
54
|
+
|
|
55
|
+
@bytes += File.size(path)
|
|
56
|
+
raise ArgumentError, "staged project exceeds configured file or byte limit" if @bytes > @settings["max_bytes"] || files.size >= @settings["max_files"]
|
|
57
|
+
|
|
58
|
+
files[path.delete_prefix("#{@root}/")] = Digest::SHA256.file(path).hexdigest
|
|
59
|
+
end
|
|
60
|
+
files
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def excluded?(name)
|
|
64
|
+
return true if name.start_with?(".") && !@settings["include_hidden"].include?(name)
|
|
65
|
+
|
|
66
|
+
@settings["exclude"].any? { |pattern| File.fnmatch?(pattern, name) } || name.end_with?(".key")
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
require "json"
|
|
2
|
+
require "optparse"
|
|
3
|
+
require "shellwords"
|
|
4
|
+
|
|
5
|
+
module Polyrun
|
|
6
|
+
module Queue
|
|
7
|
+
# Parse duration strings like 10m, 1h, 600s into seconds.
|
|
8
|
+
module Duration
|
|
9
|
+
module_function
|
|
10
|
+
|
|
11
|
+
def parse_seconds(text)
|
|
12
|
+
s = text.to_s.strip
|
|
13
|
+
return Float(s) if s.match?(/\A\d+(\.\d+)?\z/)
|
|
14
|
+
|
|
15
|
+
m = s.match(/\A(\d+(?:\.\d+)?)(s|m|h|d)\z/i)
|
|
16
|
+
raise Polyrun::Error, "invalid duration: #{text.inspect}" unless m
|
|
17
|
+
|
|
18
|
+
val = Float(m[1])
|
|
19
|
+
case m[2].downcase
|
|
20
|
+
when "s" then val
|
|
21
|
+
when "m" then val * 60
|
|
22
|
+
when "h" then val * 3600
|
|
23
|
+
when "d" then val * 86_400
|
|
24
|
+
else
|
|
25
|
+
raise Polyrun::Error, "invalid duration: #{text.inspect}"
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
@@ -0,0 +1,413 @@
|
|
|
1
|
+
# rubocop:disable Polyrun/FileLength, Metrics/ClassLength -- file-backed queue chunks + leases
|
|
2
|
+
require "fileutils"
|
|
3
|
+
require "json"
|
|
4
|
+
require "securerandom"
|
|
5
|
+
require "time"
|
|
6
|
+
module Polyrun
|
|
7
|
+
module Queue
|
|
8
|
+
# File-backed queue (spec_queue.md): +queue.json+, +pending/*.json+ chunks, +done.jsonl+, +leases.json+ (OS flock).
|
|
9
|
+
#
|
|
10
|
+
# Path lifecycle (lease transitions):
|
|
11
|
+
# init! → paths in pending chunks only
|
|
12
|
+
# claim! → pending −batch → active lease in leases.json
|
|
13
|
+
# ack! → lease removed; paths appended to done.jsonl
|
|
14
|
+
# reclaim! → stale or matching lease → paths returned to pending
|
|
15
|
+
# reclaim_lease! → one lease by id → paths returned to pending
|
|
16
|
+
class FileStore
|
|
17
|
+
CHUNK_SIZE = 500
|
|
18
|
+
|
|
19
|
+
attr_reader :root
|
|
20
|
+
|
|
21
|
+
def initialize(root)
|
|
22
|
+
@root = File.expand_path(root)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def init!(items)
|
|
26
|
+
FileUtils.mkdir_p(@root)
|
|
27
|
+
raise Polyrun::Error, "queue already exists: #{queue_path}" if File.file?(queue_path)
|
|
28
|
+
|
|
29
|
+
items = items.map(&:to_s)
|
|
30
|
+
meta = base_meta(items.size)
|
|
31
|
+
FileUtils.mkdir_p(pending_dir)
|
|
32
|
+
write_pending_chunks!(items, meta)
|
|
33
|
+
atomic_write(queue_path, JSON.generate(meta))
|
|
34
|
+
atomic_write(ledger_path, "")
|
|
35
|
+
true
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def claim!(worker_id:, batch_size:)
|
|
39
|
+
batch_size = Integer(batch_size)
|
|
40
|
+
raise Polyrun::Error, "batch_size must be >= 1" if batch_size < 1
|
|
41
|
+
|
|
42
|
+
lease_id = nil
|
|
43
|
+
batch = []
|
|
44
|
+
with_lock do
|
|
45
|
+
meta = load_meta!
|
|
46
|
+
batch = take_pending_batch!(meta, batch_size)
|
|
47
|
+
unless batch.empty?
|
|
48
|
+
lease_id = SecureRandom.uuid
|
|
49
|
+
now = Time.now.utc.iso8601
|
|
50
|
+
write_intent!(
|
|
51
|
+
"op" => "claim",
|
|
52
|
+
"lease_id" => lease_id,
|
|
53
|
+
"worker_id" => worker_id.to_s,
|
|
54
|
+
"paths" => batch
|
|
55
|
+
)
|
|
56
|
+
leases = read_leases
|
|
57
|
+
leases[lease_id] = {
|
|
58
|
+
"worker_id" => worker_id.to_s,
|
|
59
|
+
"paths" => batch,
|
|
60
|
+
"claimed_at" => now,
|
|
61
|
+
"heartbeat_at" => now,
|
|
62
|
+
"attempts" => 0
|
|
63
|
+
}
|
|
64
|
+
write_meta!(meta)
|
|
65
|
+
write_leases!(leases)
|
|
66
|
+
clear_intent!
|
|
67
|
+
append_ledger(
|
|
68
|
+
"CLAIM" => lease_id,
|
|
69
|
+
"worker_id" => worker_id.to_s,
|
|
70
|
+
"paths" => batch,
|
|
71
|
+
"pending_remaining" => meta["pending_count"]
|
|
72
|
+
)
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
{"lease_id" => lease_id, "paths" => batch}
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
def ack!(lease_id:, worker_id:)
|
|
79
|
+
with_lock do
|
|
80
|
+
leases = read_leases
|
|
81
|
+
lease = leases[lease_id]
|
|
82
|
+
raise Polyrun::Error, "unknown lease: #{lease_id}" unless lease
|
|
83
|
+
|
|
84
|
+
if lease["worker_id"].to_s != worker_id.to_s
|
|
85
|
+
raise Polyrun::Error, "lease worker mismatch"
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
paths = lease["paths"] || []
|
|
89
|
+
write_intent!(
|
|
90
|
+
"op" => "ack",
|
|
91
|
+
"lease_id" => lease_id,
|
|
92
|
+
"worker_id" => worker_id.to_s,
|
|
93
|
+
"paths" => paths
|
|
94
|
+
)
|
|
95
|
+
# done.jsonl before removing the lease so a crash still has durable completion evidence.
|
|
96
|
+
append_done_lines!(paths)
|
|
97
|
+
meta = load_meta!
|
|
98
|
+
meta["done_count"] = Integer(meta["done_count"]) + paths.size
|
|
99
|
+
write_meta!(meta)
|
|
100
|
+
leases.delete(lease_id)
|
|
101
|
+
write_leases!(leases)
|
|
102
|
+
clear_intent!
|
|
103
|
+
append_ledger("ACK" => lease_id, "worker_id" => worker_id.to_s, "paths" => paths)
|
|
104
|
+
end
|
|
105
|
+
true
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
# Marks a subset of a lease's paths done; removes the lease when none remain.
|
|
109
|
+
def ack_paths!(lease_id:, worker_id:, paths:)
|
|
110
|
+
paths = Array(paths).map(&:to_s)
|
|
111
|
+
raise Polyrun::Error, "ack_paths! requires at least one path" if paths.empty?
|
|
112
|
+
|
|
113
|
+
with_lock do
|
|
114
|
+
leases = read_leases
|
|
115
|
+
lease = leases[lease_id]
|
|
116
|
+
raise Polyrun::Error, "unknown lease: #{lease_id}" unless lease
|
|
117
|
+
|
|
118
|
+
if lease["worker_id"].to_s != worker_id.to_s
|
|
119
|
+
raise Polyrun::Error, "lease worker mismatch"
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
held = Array(lease["paths"]).map(&:to_s)
|
|
123
|
+
unknown = paths - held
|
|
124
|
+
raise Polyrun::Error, "ack_paths! paths not on lease: #{unknown.join(", ")}" unless unknown.empty?
|
|
125
|
+
|
|
126
|
+
write_intent!(
|
|
127
|
+
"op" => "ack_paths",
|
|
128
|
+
"lease_id" => lease_id,
|
|
129
|
+
"worker_id" => worker_id.to_s,
|
|
130
|
+
"paths" => paths
|
|
131
|
+
)
|
|
132
|
+
apply_ack_side_effects!(leases, lease_id, lease, paths, worker_id)
|
|
133
|
+
clear_intent!
|
|
134
|
+
end
|
|
135
|
+
true
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
def heartbeat!(lease_id:, worker_id:)
|
|
139
|
+
with_lock do
|
|
140
|
+
leases = read_leases
|
|
141
|
+
lease = leases[lease_id]
|
|
142
|
+
raise Polyrun::Error, "unknown lease: #{lease_id}" unless lease
|
|
143
|
+
|
|
144
|
+
if lease["worker_id"].to_s != worker_id.to_s
|
|
145
|
+
raise Polyrun::Error, "lease worker mismatch"
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
lease["heartbeat_at"] = Time.now.utc.iso8601
|
|
149
|
+
leases[lease_id] = lease
|
|
150
|
+
write_leases!(leases)
|
|
151
|
+
end
|
|
152
|
+
true
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
def status(detailed: false)
|
|
156
|
+
with_lock do
|
|
157
|
+
meta = load_meta!
|
|
158
|
+
leases = read_leases
|
|
159
|
+
base = {
|
|
160
|
+
"pending" => Integer(meta["pending_count"]),
|
|
161
|
+
"done" => Integer(meta["done_count"]),
|
|
162
|
+
"leases" => leases.keys.size
|
|
163
|
+
}
|
|
164
|
+
return base unless detailed
|
|
165
|
+
|
|
166
|
+
base.merge("lease_details" => lease_details(leases))
|
|
167
|
+
end
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
# Reclaim leases older than +older_than+ seconds and/or matching +worker_id+ when set.
|
|
171
|
+
# @return [Integer] number of paths returned to pending
|
|
172
|
+
def reclaim!(older_than: nil, worker_id: nil)
|
|
173
|
+
reclaimed_paths = 0
|
|
174
|
+
with_lock do
|
|
175
|
+
meta = load_meta!
|
|
176
|
+
leases = read_leases
|
|
177
|
+
keep = {}
|
|
178
|
+
leases.each do |lease_id, lease|
|
|
179
|
+
if reclaim_lease?(lease, older_than: older_than, worker_id: worker_id)
|
|
180
|
+
paths = lease["paths"] || []
|
|
181
|
+
bumped = lease.merge("attempts" => Integer(lease["attempts"] || 0) + 1)
|
|
182
|
+
write_intent!(
|
|
183
|
+
"op" => "reclaim",
|
|
184
|
+
"lease_id" => lease_id,
|
|
185
|
+
"worker_id" => lease["worker_id"],
|
|
186
|
+
"paths" => paths,
|
|
187
|
+
"attempts" => bumped["attempts"]
|
|
188
|
+
)
|
|
189
|
+
quarantine_or_return_paths!(meta, paths, bumped)
|
|
190
|
+
reclaimed_paths += paths.size
|
|
191
|
+
append_ledger(
|
|
192
|
+
"RECLAIM" => lease_id,
|
|
193
|
+
"worker_id" => lease["worker_id"],
|
|
194
|
+
"paths" => paths,
|
|
195
|
+
"attempts" => bumped["attempts"]
|
|
196
|
+
)
|
|
197
|
+
clear_intent!
|
|
198
|
+
else
|
|
199
|
+
keep[lease_id] = lease
|
|
200
|
+
end
|
|
201
|
+
end
|
|
202
|
+
write_leases!(keep)
|
|
203
|
+
write_meta!(meta)
|
|
204
|
+
end
|
|
205
|
+
reclaimed_paths
|
|
206
|
+
end
|
|
207
|
+
|
|
208
|
+
def reclaim_lease!(lease_id)
|
|
209
|
+
reclaimed = 0
|
|
210
|
+
with_lock do
|
|
211
|
+
leases = read_leases
|
|
212
|
+
lease = leases[lease_id]
|
|
213
|
+
return 0 unless lease
|
|
214
|
+
|
|
215
|
+
paths = lease["paths"] || []
|
|
216
|
+
bumped = lease.merge("attempts" => Integer(lease["attempts"] || 0) + 1)
|
|
217
|
+
write_intent!(
|
|
218
|
+
"op" => "reclaim_lease",
|
|
219
|
+
"lease_id" => lease_id,
|
|
220
|
+
"worker_id" => lease["worker_id"],
|
|
221
|
+
"paths" => paths,
|
|
222
|
+
"attempts" => bumped["attempts"]
|
|
223
|
+
)
|
|
224
|
+
leases.delete(lease_id)
|
|
225
|
+
write_leases!(leases)
|
|
226
|
+
meta = load_meta!
|
|
227
|
+
quarantine_or_return_paths!(meta, paths, bumped)
|
|
228
|
+
write_meta!(meta)
|
|
229
|
+
reclaimed = paths.size
|
|
230
|
+
append_ledger(
|
|
231
|
+
"RECLAIM" => lease_id,
|
|
232
|
+
"worker_id" => lease["worker_id"],
|
|
233
|
+
"paths" => paths,
|
|
234
|
+
"attempts" => bumped["attempts"]
|
|
235
|
+
)
|
|
236
|
+
clear_intent!
|
|
237
|
+
end
|
|
238
|
+
reclaimed
|
|
239
|
+
end
|
|
240
|
+
|
|
241
|
+
private
|
|
242
|
+
|
|
243
|
+
def reclaim_lease?(lease, older_than:, worker_id:)
|
|
244
|
+
if worker_id && lease["worker_id"].to_s != worker_id.to_s
|
|
245
|
+
return false
|
|
246
|
+
end
|
|
247
|
+
if older_than
|
|
248
|
+
stamp = lease["heartbeat_at"].to_s
|
|
249
|
+
stamp = lease["claimed_at"].to_s if stamp.empty?
|
|
250
|
+
touched = Time.parse(stamp)
|
|
251
|
+
return (Time.now - touched) >= older_than
|
|
252
|
+
end
|
|
253
|
+
!!worker_id
|
|
254
|
+
rescue ArgumentError
|
|
255
|
+
true
|
|
256
|
+
end
|
|
257
|
+
|
|
258
|
+
def lease_details(leases)
|
|
259
|
+
now = Time.now
|
|
260
|
+
leases.map do |lease_id, lease|
|
|
261
|
+
stamp = lease["heartbeat_at"].to_s
|
|
262
|
+
stamp = lease["claimed_at"].to_s if stamp.empty?
|
|
263
|
+
touched = Time.parse(stamp)
|
|
264
|
+
{
|
|
265
|
+
"lease_id" => lease_id,
|
|
266
|
+
"worker_id" => lease["worker_id"],
|
|
267
|
+
"paths_count" => (lease["paths"] || []).size,
|
|
268
|
+
"claimed_at" => lease["claimed_at"],
|
|
269
|
+
"heartbeat_at" => lease["heartbeat_at"],
|
|
270
|
+
"age_seconds" => (now - touched).round(1)
|
|
271
|
+
}
|
|
272
|
+
rescue ArgumentError
|
|
273
|
+
{
|
|
274
|
+
"lease_id" => lease_id,
|
|
275
|
+
"worker_id" => lease["worker_id"],
|
|
276
|
+
"paths_count" => (lease["paths"] || []).size,
|
|
277
|
+
"claimed_at" => lease["claimed_at"],
|
|
278
|
+
"heartbeat_at" => lease["heartbeat_at"],
|
|
279
|
+
"age_seconds" => nil
|
|
280
|
+
}
|
|
281
|
+
end
|
|
282
|
+
end
|
|
283
|
+
|
|
284
|
+
def return_paths_to_pending!(meta, paths)
|
|
285
|
+
return if paths.empty?
|
|
286
|
+
|
|
287
|
+
meta["pending_count"] = Integer(meta["pending_count"]) + paths.size
|
|
288
|
+
files = sorted_chunk_files
|
|
289
|
+
if files.empty?
|
|
290
|
+
FileUtils.mkdir_p(pending_dir)
|
|
291
|
+
atomic_write(File.join(pending_dir, "000001.json"), JSON.generate(paths.map(&:to_s)))
|
|
292
|
+
else
|
|
293
|
+
head = files.first
|
|
294
|
+
chunk = JSON.parse(File.read(head))
|
|
295
|
+
chunk = paths.map(&:to_s) + chunk
|
|
296
|
+
atomic_write(head, JSON.generate(chunk))
|
|
297
|
+
end
|
|
298
|
+
end
|
|
299
|
+
|
|
300
|
+
def queue_path
|
|
301
|
+
File.join(@root, "queue.json")
|
|
302
|
+
end
|
|
303
|
+
|
|
304
|
+
def leases_path
|
|
305
|
+
File.join(@root, "leases.json")
|
|
306
|
+
end
|
|
307
|
+
|
|
308
|
+
def ledger_path
|
|
309
|
+
File.join(@root, "ledger.jsonl")
|
|
310
|
+
end
|
|
311
|
+
|
|
312
|
+
def lock_path
|
|
313
|
+
File.join(@root, "lock")
|
|
314
|
+
end
|
|
315
|
+
|
|
316
|
+
def pending_dir
|
|
317
|
+
File.join(@root, "pending")
|
|
318
|
+
end
|
|
319
|
+
|
|
320
|
+
def done_path
|
|
321
|
+
File.join(@root, "done.jsonl")
|
|
322
|
+
end
|
|
323
|
+
|
|
324
|
+
def with_lock
|
|
325
|
+
FileUtils.mkdir_p(@root)
|
|
326
|
+
File.open(lock_path, File::CREAT | File::RDWR) do |f|
|
|
327
|
+
f.flock(File::LOCK_EX)
|
|
328
|
+
recover_intent!
|
|
329
|
+
yield
|
|
330
|
+
end
|
|
331
|
+
end
|
|
332
|
+
|
|
333
|
+
def base_meta(pending_count)
|
|
334
|
+
{
|
|
335
|
+
"created_at" => Time.now.utc.iso8601,
|
|
336
|
+
"pending_count" => pending_count,
|
|
337
|
+
"done_count" => 0,
|
|
338
|
+
"chunk_size" => CHUNK_SIZE
|
|
339
|
+
}
|
|
340
|
+
end
|
|
341
|
+
|
|
342
|
+
def meta_chunk_size(meta)
|
|
343
|
+
(meta["chunk_size"] || CHUNK_SIZE).to_i
|
|
344
|
+
end
|
|
345
|
+
|
|
346
|
+
def load_meta!
|
|
347
|
+
p = queue_path
|
|
348
|
+
raise Polyrun::Error, "queue not initialized; run queue init" unless File.file?(p)
|
|
349
|
+
|
|
350
|
+
data = JSON.parse(File.read(p))
|
|
351
|
+
raise Polyrun::Error, "invalid queue.json: #{p}" unless meta_ok?(data)
|
|
352
|
+
|
|
353
|
+
data
|
|
354
|
+
end
|
|
355
|
+
|
|
356
|
+
def meta_ok?(data)
|
|
357
|
+
data.is_a?(Hash) &&
|
|
358
|
+
data.key?("pending_count") &&
|
|
359
|
+
data.key?("done_count") &&
|
|
360
|
+
data.key?("chunk_size")
|
|
361
|
+
end
|
|
362
|
+
|
|
363
|
+
def write_pending_chunks!(items, meta)
|
|
364
|
+
chunk_size = meta_chunk_size(meta)
|
|
365
|
+
FileUtils.mkdir_p(pending_dir)
|
|
366
|
+
items.each_slice(chunk_size).with_index(1) do |slice, idx|
|
|
367
|
+
atomic_write(File.join(pending_dir, format("%06d.json", idx)), JSON.generate(slice))
|
|
368
|
+
end
|
|
369
|
+
end
|
|
370
|
+
|
|
371
|
+
def write_meta!(meta)
|
|
372
|
+
atomic_write(queue_path, JSON.generate(meta))
|
|
373
|
+
end
|
|
374
|
+
|
|
375
|
+
def append_done_lines!(paths)
|
|
376
|
+
return if paths.empty?
|
|
377
|
+
|
|
378
|
+
File.open(done_path, "a") do |io|
|
|
379
|
+
paths.each { |p| io.puts(JSON.generate(p.to_s)) }
|
|
380
|
+
end
|
|
381
|
+
end
|
|
382
|
+
|
|
383
|
+
def read_leases
|
|
384
|
+
return {} unless File.file?(leases_path)
|
|
385
|
+
|
|
386
|
+
JSON.parse(File.read(leases_path))
|
|
387
|
+
end
|
|
388
|
+
|
|
389
|
+
def write_leases!(h)
|
|
390
|
+
atomic_write(leases_path, JSON.generate(h))
|
|
391
|
+
end
|
|
392
|
+
|
|
393
|
+
def append_ledger(entry)
|
|
394
|
+
line = JSON.generate(entry.merge("at" => Time.now.utc.iso8601)) + "\n"
|
|
395
|
+
File.open(ledger_path, "a") { |f| f.write(line) }
|
|
396
|
+
end
|
|
397
|
+
|
|
398
|
+
def atomic_write(path, body, fsync: false)
|
|
399
|
+
tmp = "#{path}.tmp.#{$$}"
|
|
400
|
+
File.open(tmp, File::WRONLY | File::CREAT | File::TRUNC) do |io|
|
|
401
|
+
io.write(body)
|
|
402
|
+
io.flush
|
|
403
|
+
io.fsync if fsync
|
|
404
|
+
end
|
|
405
|
+
File.rename(tmp, path)
|
|
406
|
+
end
|
|
407
|
+
end
|
|
408
|
+
end
|
|
409
|
+
end
|
|
410
|
+
|
|
411
|
+
require_relative "file_store_pending"
|
|
412
|
+
require_relative "file_store_intent"
|
|
413
|
+
# rubocop:enable Polyrun/FileLength, Metrics/ClassLength
|