principles 0.0.4 → 0.0.5
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 +4 -4
- data/lib/principles/cli.rb +3 -1
- data/lib/principles/command_line.rb +35 -7
- data/lib/principles/command_routes.rb +4 -3
- data/lib/principles/controllers/acknowledgement.rb +80 -14
- data/lib/principles/controllers/answer.rb +42 -75
- data/lib/principles/controllers/answer_phase.rb +54 -0
- data/lib/principles/controllers/assessment.rb +33 -9
- data/lib/principles/controllers/audit.rb +17 -6
- data/lib/principles/controllers/audit_completion.rb +6 -4
- data/lib/principles/controllers/command.rb +3 -2
- data/lib/principles/controllers/correction.rb +19 -9
- data/lib/principles/controllers/full_audit_request.rb +10 -0
- data/lib/principles/controllers/inventory.rb +25 -20
- data/lib/principles/controllers/member_problems_report.rb +11 -4
- data/lib/principles/controllers/members_a_commit_changed.rb +2 -1
- data/lib/principles/controllers/members_to_assess.rb +20 -12
- data/lib/principles/controllers/repoint.rb +18 -22
- data/lib/principles/data/bounded_file.rb +9 -4
- data/lib/principles/data/command-steps.json +9 -9
- data/lib/principles/data/project_files.rb +11 -8
- data/lib/principles/data/schema_check.rb +16 -6
- data/lib/principles/data/schemas/acknowledgement-answer.schema.json +17 -3
- data/lib/principles/data/schemas/answer-guide.schema.json +5 -10
- data/lib/principles/data/schemas/audit-record.schema.json +10 -1
- data/lib/principles/data/schemas/command-steps.schema.json +2 -1
- data/lib/principles/invocation_options.rb +1 -1
- data/lib/principles/models/acknowledgement.rb +73 -84
- data/lib/principles/models/acknowledgement_refusal.rb +90 -0
- data/lib/principles/models/answer_place.rb +4 -0
- data/lib/principles/models/assessment_answer.rb +0 -45
- data/lib/principles/models/assessment_left_as_printed.rb +81 -0
- data/lib/principles/models/audit_record.rb +9 -17
- data/lib/principles/models/audit_records.rb +19 -16
- data/lib/principles/models/candidate_files.rb +30 -7
- data/lib/principles/models/candidate_inventory.rb +23 -6
- data/lib/principles/models/candidate_listing.rb +12 -3
- data/lib/principles/models/candidate_outline.rb +195 -0
- data/lib/principles/models/carried_member.rb +42 -0
- data/lib/principles/models/check_since_last_audit.rb +16 -3
- data/lib/principles/models/command_steps.rb +17 -1
- data/lib/principles/models/declared_map_changes.rb +5 -4
- data/lib/principles/models/frontmatter_fields.rb +9 -8
- data/lib/principles/models/instruction_named.rb +35 -0
- data/lib/principles/models/left_as_printed.rb +39 -0
- data/lib/principles/models/member_assessments.rb +9 -31
- data/lib/principles/models/member_file.rb +35 -11
- data/lib/principles/models/member_hashes_as_written.rb +10 -6
- data/lib/principles/models/member_lines.rb +63 -15
- data/lib/principles/models/member_problems.rb +24 -18
- data/lib/principles/models/member_repair_moves.rb +54 -0
- data/lib/principles/models/missing_files.rb +2 -2
- data/lib/principles/models/open_findings_elsewhere.rb +4 -0
- data/lib/principles/models/other_templates_placeholders.rb +81 -42
- data/lib/principles/models/outline_budget.rb +127 -0
- data/lib/principles/models/outline_group.rb +31 -0
- data/lib/principles/models/outline_section.rb +56 -0
- data/lib/principles/models/principle_members.rb +11 -0
- data/lib/principles/models/prior_decision_fields.rb +3 -2
- data/lib/principles/models/prior_finding_decision.rb +14 -4
- data/lib/principles/models/project.rb +10 -19
- data/lib/principles/models/quoted_change.rb +137 -0
- data/lib/principles/models/record_format.rb +6 -2
- data/lib/principles/models/recorded_entry.rb +6 -0
- data/lib/principles/models/recorded_hashes.rb +7 -3
- data/lib/principles/models/recorded_members.rb +27 -15
- data/lib/principles/models/refusal_before_shape.rb +21 -0
- data/lib/principles/models/repoint.rb +13 -0
- data/lib/principles/models/reported_check.rb +3 -13
- data/lib/principles/models/sent_answer.rb +51 -0
- data/lib/principles/models/shape_problems_beside.rb +40 -0
- data/lib/principles/models/submitted_answer.rb +34 -0
- data/lib/principles/models/template_placeholders.rb +34 -4
- data/lib/principles/models/text_within.rb +55 -0
- data/lib/principles/models/unchecked_members.rb +76 -0
- data/lib/principles/models/write_up_opening.rb +21 -4
- data/lib/principles/session_start_options.rb +2 -2
- data/lib/principles/start_audit_options.rb +19 -4
- data/lib/principles/version.rb +2 -2
- data/lib/principles/views/acknowledgement_result.rb +15 -7
- data/lib/principles/views/assessed_members.rb +43 -10
- data/lib/principles/views/assessment_request.rb +89 -30
- data/lib/principles/views/audit_result.rb +19 -2
- data/lib/principles/views/candidate_files_result.rb +41 -19
- data/lib/principles/views/check_notes.rb +44 -0
- data/lib/principles/views/check_result_template.rb +14 -23
- data/lib/principles/views/instruction.rb +74 -0
- data/lib/principles/views/json_with_entries_on_lines.rb +51 -0
- data/lib/principles/views/loads_to_check_result.rb +2 -2
- data/lib/principles/views/map_result.rb +2 -2
- data/lib/principles/views/member_change_since_baseline.rb +22 -5
- data/lib/principles/views/member_repairs.rb +21 -52
- data/lib/principles/views/members_a_commit_changed.rb +16 -6
- data/lib/principles/views/one_member_check_result_template.rb +43 -0
- data/lib/principles/views/open_findings_elsewhere_result.rb +3 -3
- data/lib/principles/views/open_findings_line.rb +77 -23
- data/lib/principles/views/principle_read_result.rb +20 -28
- data/lib/principles/views/prior_findings_result.rb +23 -15
- data/lib/principles/views/prompts/acknowledge-a-change/run-the-check-and-report-it-passing.md +3 -0
- data/lib/principles/views/prompts/acknowledge-a-change/say-whether-the-change-keeps-the-meaning.md +6 -12
- data/lib/principles/views/prompts/assess-every-member/answer-guide.json +5 -10
- data/lib/principles/views/prompts/assess-every-member/assess-each-member-and-the-set.md +0 -4
- data/lib/principles/views/prompts/assess-every-member/claim-an-earlier-first-raised-at.md +7 -0
- data/lib/principles/views/prompts/assess-every-member/decide-each-prior-finding.md +4 -16
- data/lib/principles/views/prompts/assess-every-member/judge-the-set-with-carried-assessments.md +5 -10
- data/lib/principles/views/prompts/assess-every-member/keep-or-change-what-a-deferral-waits-on.md +4 -0
- data/lib/principles/views/prompts/assess-every-member/read-a-compact-carried-member.md +8 -0
- data/lib/principles/views/prompts/assess-every-member/read-a-trimmed-instruction-whole.md +1 -0
- data/lib/principles/views/prompts/assess-every-member/review-a-new-or-changed-check-before-running-it.md +9 -0
- data/lib/principles/views/prompts/assess-every-member/say-what-observed-means.md +4 -0
- data/lib/principles/views/prompts/dispose-of-each-finding/fix-or-record-each-finding.md +4 -3
- data/lib/principles/views/prompts/find-a-principle-to-map/ask-the-owner-after-the-table.md +1 -0
- data/lib/principles/views/prompts/find-a-principle-to-map/ask-which-principle-to-map.md +2 -0
- data/lib/principles/views/prompts/find-a-principle-to-map/choose-one-principle.md +9 -5
- data/lib/principles/views/prompts/find-a-principle-to-map/leave-test-data-out-of-the-survey.md +1 -0
- data/lib/principles/views/prompts/find-a-principle-to-map/read-a-cut-section-back.md +3 -0
- data/lib/principles/views/prompts/find-a-principle-to-map/read-left-out-files.md +3 -0
- data/lib/principles/views/prompts/learn-what-a-command-does/list-candidate-files.md +21 -6
- data/lib/principles/views/prompts/learn-what-a-command-does/list-member-problems.md +4 -4
- data/lib/principles/views/prompts/learn-what-a-command-does/list-open-findings.md +10 -11
- data/lib/principles/views/prompts/learn-what-a-command-does/list-principles.md +1 -2
- data/lib/principles/views/prompts/learn-what-a-command-does/show-answer-check.md +1 -1
- data/lib/principles/views/prompts/learn-what-a-command-does/show-meta-principle-passage.md +5 -5
- data/lib/principles/views/prompts/learn-what-a-command-does/start-audit.md +24 -24
- data/lib/principles/views/prompts/learn-what-a-command-does/submit-answer.md +3 -3
- data/lib/principles/views/prompts/report-after-a-commit/the-principles-skill-is-where-to-start.md +1 -0
- data/lib/principles/views/prompts/set-principles-up/keep-them-held-between-audits.md +2 -0
- data/lib/principles/views/prompts/set-principles-up/name-the-step-each-member-lacks.md +2 -0
- data/lib/principles/views/prompts/set-principles-up/place-the-passage-with-the-user.md +9 -6
- data/lib/principles/views/prompts/start-a-session/see-the-earlier-line.md +2 -0
- data/lib/principles/views/record_waiting_on_an_upgrade.rb +3 -3
- data/lib/principles/views/request_part.rb +16 -8
- data/lib/principles/views/request_parts.rb +4 -0
- metadata +39 -5
- data/lib/principles/views/prompts/find-a-principle-to-map/ask-the-owner-before-mapping.md +0 -1
- data/lib/principles/views/prompts/report-after-a-commit/the-map-and-audit-skill-says-how-to-audit-these-members.md +0 -1
- data/lib/principles/views/prompts/set-principles-up/set-up-first.md +0 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 40e41136c5be852cc2019089d41ab1548144e52138ab51c80211befe32bfa411
|
|
4
|
+
data.tar.gz: 3d7d56d9ba40d0678e39fcd4b7f6ecca2b231ac5b449f07af84617b8e0ad1a91
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ff6dd21e3e9a0e929ae135aaaa587b8781e6bea67ac6547fa8b23ce43d15a75d05a3c9490eaecf1049d76384df1e39eb7e5d6c0605a883dc67ff5051b308f12b
|
|
7
|
+
data.tar.gz: cd61142617ebf7f28eba7b2ae5bc89e1dd18d745fb8d9c763bacf68c6e2dacc7a5cc5f66869c0bf4da24d584134612b4f9ae52a63d682931c342a96217476bb0
|
data/lib/principles/cli.rb
CHANGED
|
@@ -117,9 +117,11 @@ module Principles
|
|
|
117
117
|
end
|
|
118
118
|
end
|
|
119
119
|
|
|
120
|
-
# A result prints as JSON,
|
|
120
|
+
# A result prints as JSON, as JSON laid out with one entry a line, as list-candidate-files does, or as lines with
|
|
121
|
+
# their own exit status, as list-member-problems --short does.
|
|
121
122
|
#: (untyped) -> Integer
|
|
122
123
|
def printed_result(result)
|
|
124
|
+
return printed(visible(result.text)) if result.is_a?(Views::JsonWithEntriesOnLines)
|
|
123
125
|
return printed(visible(JSON.pretty_generate(result))) unless result.is_a?(Views::Lines)
|
|
124
126
|
|
|
125
127
|
@stdout.print(result.stdout)
|
|
@@ -7,11 +7,15 @@ require_relative "after_commit_hook_options"
|
|
|
7
7
|
require_relative "session_start_options"
|
|
8
8
|
require_relative "start_audit_options"
|
|
9
9
|
require_relative "models/command_steps"
|
|
10
|
+
require_relative "prose_list"
|
|
10
11
|
|
|
11
12
|
module Principles
|
|
12
13
|
# One invocation's words: the command, its positional arguments and its options, refused with an
|
|
13
14
|
# OptionParser error when they do not fit what the command takes. CLI decides what to run from it.
|
|
14
15
|
class CommandLine
|
|
16
|
+
# How a refusal names each option a command requires.
|
|
17
|
+
REQUIRED_OPTION_WORDS = { "file" => "--file FILE, or --file - for stdin" }.freeze #: Hash[String, String]
|
|
18
|
+
|
|
15
19
|
# argv is parsed at once; positional names each command's positional arguments, in order; executable is the
|
|
16
20
|
# invocation a refusal tells the agent to run --help with (#562).
|
|
17
21
|
#: (Array[String], positional: Hash[String, Array[String]], executable: String) -> void
|
|
@@ -62,18 +66,16 @@ module Principles
|
|
|
62
66
|
raise OptionParser::InvalidArgument, "unknown command #{name}"
|
|
63
67
|
end
|
|
64
68
|
|
|
65
|
-
# Refuses
|
|
66
|
-
#
|
|
69
|
+
# Refuses every missing argument at once, too many arguments, an option the command does not take or given an
|
|
70
|
+
# option as its value.
|
|
67
71
|
#: () -> void
|
|
68
72
|
def check
|
|
69
73
|
name = command.to_s
|
|
74
|
+
check_missing(name)
|
|
70
75
|
check_arguments(name)
|
|
71
76
|
check_options(name)
|
|
72
77
|
check_values_are_not_options(name)
|
|
73
78
|
check_combined_options(name)
|
|
74
|
-
return unless %w[submit-answer show-answer-check].include?(name) && !@options.value("file")
|
|
75
|
-
|
|
76
|
-
raise OptionParser::MissingArgument, "#{name} needs --file FILE, or --file - for stdin"
|
|
77
79
|
end
|
|
78
80
|
|
|
79
81
|
# The principle id, for a command whose first argument is one.
|
|
@@ -102,9 +104,31 @@ module Principles
|
|
|
102
104
|
@arguments.drop(1)
|
|
103
105
|
end
|
|
104
106
|
|
|
107
|
+
# Each argument the command needs and was not given, named in one refusal: an agent that met one refusal per
|
|
108
|
+
# missing argument repaired them one at a time (#1083). Each option command-steps.json says it requires is one.
|
|
109
|
+
#: (String) -> void
|
|
110
|
+
def check_missing(name)
|
|
111
|
+
missing = missing_arguments + missing_options(name)
|
|
112
|
+
return if missing.empty?
|
|
113
|
+
|
|
114
|
+
raise OptionParser::MissingArgument, "#{name} needs #{ProseList.new(missing)}"
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
# The positional arguments the command needs past those given, as usage names them.
|
|
118
|
+
#: () -> Array[String]
|
|
119
|
+
def missing_arguments = names.drop(values.length).reject { |each| each.end_with?("?") }.map(&:upcase)
|
|
120
|
+
|
|
121
|
+
# The options command name requires and was not given, as a refusal names them.
|
|
122
|
+
#: (String) -> Array[String]
|
|
123
|
+
def missing_options(name)
|
|
124
|
+
required = steps(name)&.requires || []
|
|
125
|
+
required.reject { |option| @options.value(option) }.map { |option| REQUIRED_OPTION_WORDS.fetch(option) }
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
# Too many arguments; check_missing has refused too few.
|
|
105
129
|
#: (String) -> void
|
|
106
130
|
def check_arguments(name)
|
|
107
|
-
return if values.length
|
|
131
|
+
return if values.length <= names.length
|
|
108
132
|
|
|
109
133
|
takes = "#{name} takes #{shown_arguments}".strip.sub(/ takes\z/, " takes no arguments")
|
|
110
134
|
raise OptionParser::InvalidArgument, takes
|
|
@@ -119,7 +143,7 @@ module Principles
|
|
|
119
143
|
# An option a command does not take is refused, so a mistyped command never runs as something else.
|
|
120
144
|
#: (String) -> void
|
|
121
145
|
def check_options(name)
|
|
122
|
-
taken =
|
|
146
|
+
taken = steps(name)&.options || []
|
|
123
147
|
unknown = (@options.given - taken - ["project"]).map { |option| "--#{option}" }
|
|
124
148
|
return if unknown.empty?
|
|
125
149
|
|
|
@@ -165,6 +189,10 @@ module Principles
|
|
|
165
189
|
#: (Array[String]) -> String?
|
|
166
190
|
def named_command(argv) = argv.find { |word| @positional.key?(word) }
|
|
167
191
|
|
|
192
|
+
# What command-steps.json says of the command name, or nil for a name it does not list.
|
|
193
|
+
#: (String) -> Models::CommandSteps::Command?
|
|
194
|
+
def steps(name) = Models::CommandSteps.load.command(name)
|
|
195
|
+
|
|
168
196
|
#: (String) -> String
|
|
169
197
|
def help_repair(name) = "To see what it takes: #{@executable} #{name} --help"
|
|
170
198
|
end
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
# frozen_string_literal: true
|
|
3
3
|
|
|
4
4
|
require_relative "controllers/inventory"
|
|
5
|
+
require_relative "controllers/member_problems_report"
|
|
5
6
|
require_relative "controllers/mapping"
|
|
6
7
|
require_relative "controllers/meta_principle_setup"
|
|
7
8
|
require_relative "controllers/member_entries"
|
|
@@ -32,7 +33,7 @@ module Principles
|
|
|
32
33
|
ROUTES = {
|
|
33
34
|
"list-candidate-files" => Route.new(Controllers::Inventory, []),
|
|
34
35
|
"list-principles" => Route.new(Controllers::Inventory, []),
|
|
35
|
-
"list-member-problems" => Route.new(Controllers::
|
|
36
|
+
"list-member-problems" => Route.new(Controllers::MemberProblemsReport, %w[id?]),
|
|
36
37
|
"show-principle" => Route.new(Controllers::Inventory, %w[id]),
|
|
37
38
|
"show-audit" => Route.new(Controllers::Audit, %w[id]),
|
|
38
39
|
"list-open-findings" => Route.new(Controllers::Audit, %w[id?]),
|
|
@@ -47,8 +48,8 @@ module Principles
|
|
|
47
48
|
"remove-member-check" => Route.new(Controllers::MemberEntries, %w[id member]),
|
|
48
49
|
"remove-member" => Route.new(Controllers::MemberEntries, %w[id member]),
|
|
49
50
|
"start-audit" => Route.new(Controllers::Audit, %w[id]),
|
|
50
|
-
"submit-answer" => Route.new(Controllers::Answer, %w[
|
|
51
|
-
"show-answer-check" => Route.new(Controllers::Answer, %w[
|
|
51
|
+
"submit-answer" => Route.new(Controllers::Answer, %w[request_id]),
|
|
52
|
+
"show-answer-check" => Route.new(Controllers::Answer, %w[request_id])
|
|
52
53
|
}.freeze #: Hash[String, Route]
|
|
53
54
|
|
|
54
55
|
# Each command's positional arguments, in order, as CommandLine takes them.
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
# typed: strict
|
|
2
2
|
# frozen_string_literal: true
|
|
3
3
|
|
|
4
|
+
require "json"
|
|
4
5
|
require "time"
|
|
5
|
-
require_relative "
|
|
6
|
+
require_relative "answer_phase"
|
|
6
7
|
require_relative "../models/acknowledgement"
|
|
8
|
+
require_relative "../models/check_since_last_audit"
|
|
9
|
+
require_relative "../models/reported_check"
|
|
10
|
+
require_relative "../views/one_member_check_result_template"
|
|
7
11
|
require_relative "../views/acknowledgement_result"
|
|
8
12
|
|
|
9
13
|
module Principles
|
|
@@ -12,25 +16,35 @@ module Principles
|
|
|
12
16
|
module Controllers
|
|
13
17
|
# A one-member audit (D33): start-audit ID --member MEMBER asks whether a committed change keeps that member's
|
|
14
18
|
# meaning, and submit-answer moves its baseline in the audit record when the answer holds.
|
|
15
|
-
class Acknowledgement <
|
|
19
|
+
class Acknowledgement < AnswerPhase
|
|
16
20
|
# The request for principle id's member.
|
|
17
21
|
#: (String, String) -> Hash[String, untyped]
|
|
18
22
|
def start(id, member_id)
|
|
19
23
|
naming_the_executable(rerun: one_member_audit(id)) do
|
|
20
|
-
acknowledgement,
|
|
21
|
-
baseline, lines = since_baseline(id, acknowledgement, member)
|
|
22
|
-
change = Views::MemberChangeSinceBaseline.new(
|
|
23
|
-
member: shown(acknowledgement, member, baseline), member_lines: lines.shown,
|
|
24
|
-
commits: commits(acknowledgement, baseline, base), paths: acknowledgement.paths_since(baseline)
|
|
25
|
-
)
|
|
24
|
+
acknowledgement, change, check_result = asked(id, member_id)
|
|
26
25
|
view.request(request_id: acknowledgement.request_id.to_s, principle_id: id, change: change,
|
|
27
|
-
open_findings: acknowledgement.open_findings
|
|
26
|
+
open_findings: acknowledgement.open_findings, placeholders: placeholders(check_result, change))
|
|
27
|
+
.merge("wrote" => [])
|
|
28
28
|
end
|
|
29
29
|
end
|
|
30
30
|
|
|
31
|
-
# The
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
# The answer alone, as start-audit --member --as template prints it, to fill and submit under the request's id
|
|
32
|
+
# (#773).
|
|
33
|
+
#: (String, String) -> Hash[String, untyped]
|
|
34
|
+
def to_fill(id, member_id)
|
|
35
|
+
naming_the_executable(rerun: one_member_audit(id)) do
|
|
36
|
+
acknowledgement, change, check_result = asked(id, member_id)
|
|
37
|
+
view.answer_to_fill(request_id: acknowledgement.request_id.to_s, change: change,
|
|
38
|
+
placeholders: placeholders(check_result, change))
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
# The result of answering, and the record it changes, not yet written.
|
|
43
|
+
# @override
|
|
44
|
+
#: (Models::SubmittedAnswer) -> [Hash[String, untyped], Array[Models::AuditRecord]]
|
|
45
|
+
def answered(submitted)
|
|
46
|
+
request_id = submitted.request_id
|
|
47
|
+
response = submitted.response
|
|
34
48
|
id = request_id.principle_id
|
|
35
49
|
acknowledgement, member, = prepared(id, response.fetch("basis").fetch("member_id"))
|
|
36
50
|
stale(id, member.id) unless acknowledgement.request_id.to_s == request_id.to_s
|
|
@@ -38,8 +52,59 @@ module Principles
|
|
|
38
52
|
[accepted(id, acknowledgement, member, response)]]
|
|
39
53
|
end
|
|
40
54
|
|
|
55
|
+
# The refusals an answer meets before its shape: any phase's, then a placeholder its template printed left in,
|
|
56
|
+
# which the shape would refuse in meaning_kept without naming it (#773).
|
|
57
|
+
#: (Models::RequestId) -> Array[Models::RefusalBeforeShape]
|
|
58
|
+
def before_shape(request_id) = [*super, Models::Acknowledgement::PLACEHOLDERS]
|
|
59
|
+
|
|
41
60
|
private
|
|
42
61
|
|
|
62
|
+
# The placeholders a one-member audit's template prints, which its answer may leave as printed: its own, and
|
|
63
|
+
# check_result's for a check the last audit ran, the only check it acknowledges (#1112). The member is in the
|
|
64
|
+
# answer, not the request id, so this names the check's whether the member has one.
|
|
65
|
+
# @override
|
|
66
|
+
#: (Models::RequestId) -> Hash[String, untyped]?
|
|
67
|
+
def printed_placeholders(_request_id) = placeholders(Models::ReportedCheck::UNCHANGED_PLACEHOLDERS.to_h)
|
|
68
|
+
|
|
69
|
+
# The acknowledgement of principle id's member, its change since its baseline, as the request shows it, and the
|
|
70
|
+
# check_result its answer fills, if the member has a check.
|
|
71
|
+
#: (String, String) -> [Models::Acknowledgement, Views::MemberChangeSinceBaseline, Hash[String, untyped]?]
|
|
72
|
+
def asked(id, member_id)
|
|
73
|
+
acknowledgement, member, base = prepared(id, member_id)
|
|
74
|
+
baseline, lines = since_baseline(id, acknowledgement, member)
|
|
75
|
+
check_result = check_template(id, member)
|
|
76
|
+
[acknowledgement,
|
|
77
|
+
Views::MemberChangeSinceBaseline.new(
|
|
78
|
+
member: shown(acknowledgement, member, baseline), member_lines: lines.shown(taken: bytes_of(check_result)),
|
|
79
|
+
first_changed_lines: acknowledgement.first_changed_lines(lines),
|
|
80
|
+
commits: commits(acknowledgement, baseline, base), paths: acknowledgement.paths_since(baseline)
|
|
81
|
+
), check_result]
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
# The bytes check_result takes as the request prints it, which the member's lines give up (#1119).
|
|
85
|
+
#: (Hash[String, untyped]?) -> Integer
|
|
86
|
+
def bytes_of(check_result) = check_result ? JSON.pretty_generate(check_result).bytesize : 0
|
|
87
|
+
|
|
88
|
+
# The text the template prints in each field the agent writes: its judgement's placeholders, the quotes as the
|
|
89
|
+
# change's first_changed_lines hints them (#1111), and check_result's for a checked member.
|
|
90
|
+
#: (Hash[String, untyped]?, ?Views::MemberChangeSinceBaseline?) -> Hash[String, untyped]
|
|
91
|
+
def placeholders(check_result, change = nil)
|
|
92
|
+
quotes = change&.first_changed_lines.to_h
|
|
93
|
+
{ **Models::Acknowledgement.placeholders_beside(quotes), **quotes,
|
|
94
|
+
**(check_result ? { "check_result" => check_result } : {}) }
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
# The check_result a checked member's answer fills, for the check the last audit ran, which a one-member audit
|
|
98
|
+
# requires (D30, D63, #1071), asking for a passing run alone (#1112); nil for a member without a check.
|
|
99
|
+
#: (String, Models::Member) -> Hash[String, untyped]?
|
|
100
|
+
def check_template(id, member)
|
|
101
|
+
checks = Models::CheckSinceLastAudit.new(id:, history: @history, principles: @principles,
|
|
102
|
+
record: @audit_records.find(id))
|
|
103
|
+
Views::OneMemberCheckResultTemplate.for(checks.entry(member),
|
|
104
|
+
review_basis:
|
|
105
|
+
Models::ReportedCheck::UNCHANGED_PLACEHOLDERS.fetch("review_basis"))
|
|
106
|
+
end
|
|
107
|
+
|
|
43
108
|
# The one-member audit of principle id's member, as a refusal naming a near miss leads its repair with (D56).
|
|
44
109
|
#: (String) -> ^(String) -> String
|
|
45
110
|
def one_member_audit(id)
|
|
@@ -50,14 +115,15 @@ module Principles
|
|
|
50
115
|
#: (String, Models::Acknowledgement, Models::Member, untyped) -> Models::AuditRecord
|
|
51
116
|
def accepted(id, acknowledgement, member, response)
|
|
52
117
|
_baseline, lines = since_baseline(id, acknowledgement, member)
|
|
53
|
-
acknowledgement.accepted(response,
|
|
118
|
+
acknowledgement.accepted(response, lines, at: Time.now.utc.iso8601)
|
|
54
119
|
end
|
|
55
120
|
|
|
56
121
|
# The member as the request shows it, with where it was at its baseline when it has moved since (#547).
|
|
57
122
|
#: (Models::Acknowledgement, Models::Member, Models::Placement) -> Hash[String, untyped]
|
|
58
123
|
def shown(acknowledgement, member, baseline)
|
|
59
124
|
moved_from = acknowledgement.moved_from(baseline)
|
|
60
|
-
{ "id" => member.id, "role" => member.role, "
|
|
125
|
+
{ "id" => member.id, "role" => member.role, **(member.check ? { "check" => member.check } : {}),
|
|
126
|
+
"evidence" => [member.reference],
|
|
61
127
|
**(moved_from ? { "evidence_at_baseline" => [moved_from] } : {}) }
|
|
62
128
|
end
|
|
63
129
|
|
|
@@ -3,14 +3,12 @@
|
|
|
3
3
|
|
|
4
4
|
require_relative "command"
|
|
5
5
|
require_relative "../models/finding_write_ups"
|
|
6
|
-
require_relative "../models/audit"
|
|
7
6
|
require_relative "../models/request_id"
|
|
7
|
+
require_relative "../models/submitted_answer"
|
|
8
8
|
require_relative "acknowledgement"
|
|
9
9
|
require_relative "correction"
|
|
10
10
|
require_relative "repoint"
|
|
11
11
|
require_relative "assessment"
|
|
12
|
-
require_relative "full_audit_request"
|
|
13
|
-
require_relative "../models/other_templates_placeholders"
|
|
14
12
|
|
|
15
13
|
module Principles
|
|
16
14
|
# Each runs one command: reads models, applies their rules and prints through a view.
|
|
@@ -20,13 +18,18 @@ module Principles
|
|
|
20
18
|
# audit completes, writes the committed audit record. Nothing else is stored: each request id is a
|
|
21
19
|
# digest of what the request depends on, so an answer is checked against the project as it is now (D25).
|
|
22
20
|
class Answer < Command
|
|
21
|
+
# The controller that answers for each phase a request id may name.
|
|
22
|
+
PHASE_CONTROLLERS = {
|
|
23
|
+
"assessment" => Assessment, "correction" => Correction, "acknowledgement" => Acknowledgement,
|
|
24
|
+
"repointing" => Repoint
|
|
25
|
+
}.freeze #: Hash[String, Class[AnswerPhase]]
|
|
26
|
+
|
|
23
27
|
#: (String, String?, Hash[String, untyped]) -> untyped
|
|
24
|
-
def call(command,
|
|
28
|
+
def call(command, _id, options)
|
|
25
29
|
naming_the_executable do
|
|
26
30
|
case command
|
|
27
|
-
when "submit-answer" then submit_answer(
|
|
28
|
-
when "show-answer-check"
|
|
29
|
-
check_answer(required_id(id), *submitted(required_id(id), options), options.fetch("file"))
|
|
31
|
+
when "submit-answer" then submit_answer(submitted(options))
|
|
32
|
+
when "show-answer-check" then check_answer(submitted(options), options.fetch("file"))
|
|
30
33
|
else unknown(command)
|
|
31
34
|
end
|
|
32
35
|
end
|
|
@@ -34,50 +37,31 @@ module Principles
|
|
|
34
37
|
|
|
35
38
|
private
|
|
36
39
|
|
|
37
|
-
# The answer from --file, where - means it was read from stdin,
|
|
38
|
-
# the
|
|
39
|
-
# findings a full audit's request listed, which checking its head found (#1052).
|
|
40
|
-
#: (
|
|
41
|
-
def submitted(
|
|
42
|
-
request_id = Models::RequestId.parse(
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
printed_placeholders(request_id)
|
|
47
|
-
end
|
|
48
|
-
[response, prior]
|
|
40
|
+
# The answer from --file, where - means it was read from stdin, to the request REQUEST_ID names, checked against
|
|
41
|
+
# the schema for the phase that id names once its head says it answers a request that still matches the project,
|
|
42
|
+
# with the prior findings a full audit's request listed, which checking its head found (#1052).
|
|
43
|
+
#: (Hash[String, untyped]) -> Models::SubmittedAnswer
|
|
44
|
+
def submitted(options)
|
|
45
|
+
request_id = Models::RequestId.parse(options.fetch("request_id"))
|
|
46
|
+
sent = @project.answer(options.fetch("file"), stdin: options["stdin"], phase: request_id.phase)
|
|
47
|
+
prior = checked_head(request_id, sent.head)
|
|
48
|
+
Models::SubmittedAnswer.new(request_id, sent.checked(phase(request_id).before_shape(request_id)), prior)
|
|
49
49
|
end
|
|
50
50
|
|
|
51
51
|
# Refuses an answer from its head alone: a record a later copy wrote is refused first, read afresh as
|
|
52
52
|
# start-audit reads it, so nothing is written over one that landed mid-audit (D85), then an answer to another
|
|
53
|
-
# request
|
|
54
|
-
# placeholders this release's schema could otherwise refuse first; it gives the prior findings it listed (#1052).
|
|
53
|
+
# request, then whatever the phase checks of its request from the head alone (#1052).
|
|
55
54
|
#: (Models::RequestId, Hash[String, untyped]) -> Models::PriorFindings?
|
|
56
55
|
def checked_head(request_id, head)
|
|
57
56
|
@audit_records.refuse_newer(request_id.principle_id, version: @tool.version)
|
|
58
57
|
request_id.check_answer(head)
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
handed(Assessment).checked_request(request_id, head, audit(request_id.principle_id))
|
|
62
|
-
end
|
|
63
|
-
|
|
64
|
-
# The placeholders the template of the request request_id names printed, which its answer may leave as
|
|
65
|
-
# printed: a full audit's as start-audit --as template prints it now, a correction's from its dispositions'
|
|
66
|
-
# placeholders; any other phase's template prints none (#1084).
|
|
67
|
-
#: (Models::RequestId) -> Models::OtherTemplatesPlaceholders
|
|
68
|
-
def printed_placeholders(request_id)
|
|
69
|
-
Models::OtherTemplatesPlaceholders.besides(
|
|
70
|
-
case request_id.phase
|
|
71
|
-
when "assessment" then handed(FullAuditRequest, principle_id: request_id.principle_id).to_fill
|
|
72
|
-
when "correction" then Models::Disposition::TEMPLATE_PLACEHOLDERS
|
|
73
|
-
end
|
|
74
|
-
)
|
|
58
|
+
phase(request_id).checked_request(request_id, head)
|
|
75
59
|
end
|
|
76
60
|
|
|
77
61
|
# Accepts the answer and writes the record changes it makes.
|
|
78
|
-
#: (
|
|
79
|
-
def submit_answer(
|
|
80
|
-
output, changes = judged(
|
|
62
|
+
#: (Models::SubmittedAnswer) -> untyped
|
|
63
|
+
def submit_answer(submitted)
|
|
64
|
+
output, changes = judged(submitted)
|
|
81
65
|
wrote = changes.map { |record| @audit_records.save(record) }
|
|
82
66
|
audit_result.present(output).merge("wrote" => wrote)
|
|
83
67
|
end
|
|
@@ -85,52 +69,35 @@ module Principles
|
|
|
85
69
|
# Runs every check submit-answer would, and says what it would write, writing nothing; its submit command
|
|
86
70
|
# gives answer_file, the --file value it was checked from, again. An assessment with findings also gives the
|
|
87
71
|
# correction's answer it leads to, to fill (D81 step 3).
|
|
88
|
-
#: (
|
|
89
|
-
def check_answer(
|
|
90
|
-
output, changes = judged(
|
|
91
|
-
audit_result.with_correction_to_fill(acceptable(
|
|
92
|
-
.merge("wrote" => [])
|
|
72
|
+
#: (Models::SubmittedAnswer, String) -> untyped
|
|
73
|
+
def check_answer(submitted, answer_file)
|
|
74
|
+
output, changes = judged(submitted)
|
|
75
|
+
audit_result.with_correction_to_fill(acceptable(submitted, answer_file, changes), output).merge("wrote" => [])
|
|
93
76
|
end
|
|
94
77
|
|
|
95
78
|
# The answer passed every check: what submitting it would write, and its submit command.
|
|
96
|
-
#: (
|
|
97
|
-
def acceptable(
|
|
79
|
+
#: (Models::SubmittedAnswer, String, Array[Models::AuditRecord]) -> Hash[String, untyped]
|
|
80
|
+
def acceptable(submitted, answer_file, changes)
|
|
98
81
|
written_up = Models::FindingWriteUps.of(@project, changes).written_up
|
|
99
82
|
# Only a correction's fixed dispositions claim map entries; for any other answer this is empty, read from
|
|
100
83
|
# no map, and left out.
|
|
101
|
-
audit_result.acceptable(
|
|
84
|
+
audit_result.acceptable(submitted.request_id.to_s,
|
|
85
|
+
changes.map { |record| @audit_records.file(record.principle_id) },
|
|
102
86
|
answer_file:, open_findings_will_print: (written_up unless written_up.empty?),
|
|
103
|
-
map_entry_changes: claimed_map_entry_changes(
|
|
87
|
+
map_entry_changes: claimed_map_entry_changes(submitted))
|
|
104
88
|
end
|
|
105
89
|
|
|
106
|
-
# What each map entry a
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
def claimed_map_entry_changes(request_text, response)
|
|
110
|
-
handed(Correction).map_entry_changes(response) { audit(Models::RequestId.parse(request_text).principle_id) }
|
|
111
|
-
end
|
|
90
|
+
# What each map entry a fix in the answer claims changed, which only a correction's fixes claim.
|
|
91
|
+
#: (Models::SubmittedAnswer) -> Array[Hash[String, untyped]]
|
|
92
|
+
def claimed_map_entry_changes(submitted) = phase(submitted.request_id).map_entry_changes(submitted)
|
|
112
93
|
|
|
113
|
-
# The result of answering, and each record change the answer makes, not yet written
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
def judged(request_text, response, prior)
|
|
117
|
-
request_id = Models::RequestId.parse(request_text)
|
|
118
|
-
case request_id.phase
|
|
119
|
-
when "acknowledgement" then handed(Acknowledgement).answered(request_id, response)
|
|
120
|
-
when "repointing" then handed(Repoint).answered(request_id, response)
|
|
121
|
-
when "assessment"
|
|
122
|
-
checked = prior or raise ArgumentError, "an assessment's prior findings come from checking its head"
|
|
123
|
-
handed(Assessment).answered(response, audit(request_id.principle_id), checked)
|
|
124
|
-
else handed(Correction).answered(request_id, response, audit(request_id.principle_id))
|
|
125
|
-
end
|
|
126
|
-
end
|
|
94
|
+
# The result of answering, and each record change the answer makes, not yet written (D85).
|
|
95
|
+
#: (Models::SubmittedAnswer) -> [untyped, Array[Models::AuditRecord]]
|
|
96
|
+
def judged(submitted) = phase(submitted.request_id).answered(submitted)
|
|
127
97
|
|
|
128
|
-
# The
|
|
129
|
-
#: (
|
|
130
|
-
def
|
|
131
|
-
map = @principles.find(id)
|
|
132
|
-
Models::Audit.new(map: map, now: @project.snapshots(map).hashes)
|
|
133
|
-
end
|
|
98
|
+
# The controller of the phase request_id names, which answers for it.
|
|
99
|
+
#: (Models::RequestId) -> AnswerPhase
|
|
100
|
+
def phase(request_id) = handed(PHASE_CONTROLLERS.fetch(request_id.phase))
|
|
134
101
|
end
|
|
135
102
|
end
|
|
136
103
|
end
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# typed: strict
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
require_relative "command"
|
|
5
|
+
require_relative "../models/audit"
|
|
6
|
+
require_relative "../models/other_templates_placeholders"
|
|
7
|
+
require_relative "../models/refusal_before_shape"
|
|
8
|
+
require_relative "../models/submitted_answer"
|
|
9
|
+
|
|
10
|
+
module Principles
|
|
11
|
+
# Each runs one command: reads models, applies their rules and prints through a view.
|
|
12
|
+
# controllers/CLAUDE.md owns the boundary.
|
|
13
|
+
module Controllers
|
|
14
|
+
# What every phase of an audit shares in answering its request, which submit-answer and show-answer-check hand
|
|
15
|
+
# over: each phase's controller answers for itself, so Answer never asks which phase it holds.
|
|
16
|
+
# @abstract
|
|
17
|
+
class AnswerPhase < Command
|
|
18
|
+
# The result of answering, and each record change the answer makes, not yet written; every phase changes only
|
|
19
|
+
# the request's own principle's record (D85). Sorbet refuses a phase that does not define it, and takes an
|
|
20
|
+
# abstract method only with a forwarding super for its body, which RuboCop would otherwise call useless.
|
|
21
|
+
# @abstract
|
|
22
|
+
#: (Models::SubmittedAnswer) -> [untyped, Array[Models::AuditRecord]]
|
|
23
|
+
def answered(submitted) = super # rubocop:disable Lint/UselessMethodDefinition
|
|
24
|
+
|
|
25
|
+
# The prior findings the request an answer's head names listed, once the phase has checked that request from
|
|
26
|
+
# the head alone: none, unless the phase lists some.
|
|
27
|
+
#: (Models::RequestId, Hash[String, untyped]) -> Models::PriorFindings?
|
|
28
|
+
def checked_request(_request_id, _head) = nil
|
|
29
|
+
|
|
30
|
+
# What each map entry a fix in the answer claims changed, which only a correction's fixes claim.
|
|
31
|
+
#: (Models::SubmittedAnswer) -> Array[Hash[String, untyped]]
|
|
32
|
+
def map_entry_changes(_submitted) = []
|
|
33
|
+
|
|
34
|
+
# The refusals an answer to the request request_id names meets before its shape, in order; any phase's is a
|
|
35
|
+
# placeholder its template did not print (#1084).
|
|
36
|
+
#: (Models::RequestId) -> Array[Models::RefusalBeforeShape]
|
|
37
|
+
def before_shape(request_id) = [Models::OtherTemplatesPlaceholders.besides(printed_placeholders(request_id))]
|
|
38
|
+
|
|
39
|
+
private
|
|
40
|
+
|
|
41
|
+
# The placeholders the template of the request request_id names printed, which its answer may leave as
|
|
42
|
+
# printed: none, unless the phase's template prints some.
|
|
43
|
+
#: (Models::RequestId) -> Hash[String, untyped]?
|
|
44
|
+
def printed_placeholders(_request_id) = nil
|
|
45
|
+
|
|
46
|
+
# The audit of principle id, against its members' hashes now.
|
|
47
|
+
#: (String) -> Models::Audit
|
|
48
|
+
def audit_now(id)
|
|
49
|
+
map = @principles.find(id)
|
|
50
|
+
Models::Audit.new(map: map, now: @project.snapshots(map).hashes)
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
@@ -2,10 +2,13 @@
|
|
|
2
2
|
# frozen_string_literal: true
|
|
3
3
|
|
|
4
4
|
require "time"
|
|
5
|
-
require_relative "
|
|
5
|
+
require_relative "answer_phase"
|
|
6
|
+
require_relative "../models/assessment_left_as_printed"
|
|
6
7
|
require_relative "../models/audit"
|
|
7
8
|
require_relative "../models/request_id"
|
|
9
|
+
require_relative "../models/unchecked_members"
|
|
8
10
|
require_relative "audit_completion"
|
|
11
|
+
require_relative "full_audit_request"
|
|
9
12
|
|
|
10
13
|
module Principles
|
|
11
14
|
# Each runs one command: reads models, applies their rules and prints through a view.
|
|
@@ -14,11 +17,15 @@ module Principles
|
|
|
14
17
|
# A full audit's assessment, which submit-answer and show-answer-check hand over: this tool checks the request
|
|
15
18
|
# it answers and each member's assessment, then completes an audit with no findings or asks for the correction
|
|
16
19
|
# of its findings (D35, D50).
|
|
17
|
-
class Assessment <
|
|
18
|
-
# The result of answering an assessment request
|
|
19
|
-
#
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
class Assessment < AnswerPhase
|
|
21
|
+
# The result of answering an assessment request, which checked_request found unchanged, with the prior findings
|
|
22
|
+
# it listed, and the record change it makes, not yet written.
|
|
23
|
+
# @override
|
|
24
|
+
#: (Models::SubmittedAnswer) -> [untyped, Array[Models::AuditRecord]]
|
|
25
|
+
def answered(submitted)
|
|
26
|
+
response = submitted.response
|
|
27
|
+
prior = submitted.prior_findings
|
|
28
|
+
audit = audit_now(submitted.request_id.principle_id)
|
|
22
29
|
basis = Models::AssessmentBasis.new(response.fetch("basis"))
|
|
23
30
|
judged_against = record_judged_against(audit)
|
|
24
31
|
basis.printed_after.refusing_stale_first(audit.id, @audit_records.find(audit.id)) do
|
|
@@ -27,16 +34,33 @@ module Principles
|
|
|
27
34
|
end
|
|
28
35
|
|
|
29
36
|
# The prior findings the request an answer's head names listed, refused when that request, given the head's
|
|
30
|
-
# basis, no longer matches the project, before the rest of the answer's shape is read
|
|
31
|
-
|
|
32
|
-
|
|
37
|
+
# basis, no longer matches the project, before the rest of the answer's shape is read: checked here alone, since
|
|
38
|
+
# its template prints placeholders this release's schema could otherwise refuse first (#1052).
|
|
39
|
+
#: (Models::RequestId, Hash[String, untyped]) -> Models::PriorFindings
|
|
40
|
+
def checked_request(request_id, head)
|
|
41
|
+
audit = audit_now(request_id.principle_id)
|
|
33
42
|
basis = Models::AssessmentBasis.new(head.fetch("basis"))
|
|
34
43
|
audit.check_assessment_request(request_id, basis: basis, committed: committed(basis.base, audit.map),
|
|
35
44
|
record: @audit_records.find(audit.id), loads: loads_to_check(audit))
|
|
36
45
|
end
|
|
37
46
|
|
|
47
|
+
# The refusals an answer meets before its shape: first a check_result on a member with no check, which the
|
|
48
|
+
# shape would refuse as lacking its command (#1088), then any phase's, whose template is read first, as before,
|
|
49
|
+
# then a judgement left as its template printed it, named with the shape's problems, so one refusal names both
|
|
50
|
+
# (#1109).
|
|
51
|
+
#: (Models::RequestId) -> Array[Models::RefusalBeforeShape]
|
|
52
|
+
def before_shape(request_id)
|
|
53
|
+
any_phase = super
|
|
54
|
+
[Models::UncheckedMembers.new(@principles.find(request_id.principle_id).members), *any_phase,
|
|
55
|
+
Models::AssessmentLeftAsPrinted.new]
|
|
56
|
+
end
|
|
57
|
+
|
|
38
58
|
private
|
|
39
59
|
|
|
60
|
+
# The placeholders a full audit's template printed, as start-audit --as template prints it now (#1084).
|
|
61
|
+
#: (Models::RequestId) -> Hash[String, untyped]?
|
|
62
|
+
def printed_placeholders(request_id) = handed(FullAuditRequest, principle_id: request_id.principle_id).to_fill
|
|
63
|
+
|
|
40
64
|
# The assessment's fields and its decisions on the prior findings checked, then the audit completed or its
|
|
41
65
|
# correction asked for.
|
|
42
66
|
#: (untyped, Models::Audit, Models::PriorFindings, Models::RecordJudgedAgainst, Models::AssessmentBasis)
|
|
@@ -33,15 +33,25 @@ module Principles
|
|
|
33
33
|
private
|
|
34
34
|
|
|
35
35
|
# The audit start-audit's options ask for: a one-member audit with --member, a repoint of the open
|
|
36
|
-
# findings' write-ups with --write-ups (D59), else a full audit
|
|
36
|
+
# findings' write-ups with --write-ups (D59), else a full audit; a full or one-member audit's answer alone with
|
|
37
|
+
# --as template (D81, #773).
|
|
37
38
|
#: (String, Hash[String, untyped]) -> Hash[String, untyped]
|
|
38
39
|
def started_audit(id, options)
|
|
39
40
|
naming_the_executable { @audit_records.refuse_newer(id, version: @tool.version) }
|
|
40
|
-
return acknowledge(id, options["member"]) if options["member"]
|
|
41
|
+
return acknowledge(id, options["member"], to_fill: options["as"] == "template") if options["member"]
|
|
41
42
|
return handed(Repoint).start(id) if options["write_ups"]
|
|
42
43
|
|
|
44
|
+
full_audit(id, options)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# A full audit's request, or with --as template its answer alone, or with --instruction one instruction field
|
|
48
|
+
# of it (D81).
|
|
49
|
+
#: (String, Hash[String, untyped]) -> Hash[String, untyped]
|
|
50
|
+
def full_audit(id, options)
|
|
43
51
|
naming_the_executable do
|
|
44
52
|
full = handed(FullAuditRequest, principle_id: id)
|
|
53
|
+
next full.instruction(options["instruction"]) if options["instruction"]
|
|
54
|
+
|
|
45
55
|
options["as"] ? full.to_fill : full.printed
|
|
46
56
|
end
|
|
47
57
|
end
|
|
@@ -55,10 +65,11 @@ module Principles
|
|
|
55
65
|
@audit_records.fetch(id).shown.merge(waiting_beside(id), "wrote" => [])
|
|
56
66
|
end
|
|
57
67
|
|
|
58
|
-
# A one-member audit of member_id (D33).
|
|
59
|
-
#: (String, String) -> Hash[String, untyped]
|
|
60
|
-
def acknowledge(id, member_id)
|
|
61
|
-
handed(Acknowledgement)
|
|
68
|
+
# A one-member audit of member_id (D33), or its answer alone to fill (#773).
|
|
69
|
+
#: (String, String, to_fill: bool) -> Hash[String, untyped]
|
|
70
|
+
def acknowledge(id, member_id, to_fill:)
|
|
71
|
+
acknowledgement = handed(Acknowledgement)
|
|
72
|
+
to_fill ? acknowledgement.to_fill(id, member_id) : acknowledgement.start(id, member_id)
|
|
62
73
|
end
|
|
63
74
|
|
|
64
75
|
# The findings the last completed audit of map id, or of every map, deferred or accepted (#292, D35). Across
|