principles 0.0.4 → 0.0.6
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/after_commit_hook_options.rb +4 -1
- data/lib/principles/cli.rb +3 -1
- data/lib/principles/command_line.rb +38 -26
- data/lib/principles/command_routes.rb +11 -4
- data/lib/principles/controllers/acknowledgement.rb +93 -17
- data/lib/principles/controllers/answer.rb +45 -76
- data/lib/principles/controllers/answer_phase.rb +54 -0
- data/lib/principles/controllers/assessment.rb +46 -11
- data/lib/principles/controllers/audit.rb +17 -6
- data/lib/principles/controllers/audit_completion.rb +9 -5
- data/lib/principles/controllers/command.rb +5 -4
- data/lib/principles/controllers/correction.rb +22 -10
- data/lib/principles/controllers/full_audit_request.rb +11 -1
- data/lib/principles/controllers/guidance_search_paths.rb +31 -0
- data/lib/principles/controllers/inventory.rb +15 -29
- data/lib/principles/controllers/mapping.rb +9 -1
- data/lib/principles/controllers/member_addition.rb +65 -0
- data/lib/principles/controllers/member_entries.rb +6 -24
- data/lib/principles/controllers/member_problems_report.rb +13 -6
- data/lib/principles/controllers/members_a_commit_changed.rb +2 -1
- data/lib/principles/controllers/members_to_assess.rb +21 -13
- data/lib/principles/controllers/meta_principle_setup.rb +1 -1
- data/lib/principles/controllers/repoint.rb +22 -23
- data/lib/principles/controllers/survey.rb +60 -0
- data/lib/principles/data/audit_files.rb +4 -0
- data/lib/principles/data/bounded_file.rb +9 -4
- data/lib/principles/data/candidate_files_found.rb +48 -13
- data/lib/principles/data/command-steps.json +85 -24
- data/lib/principles/data/committed_tree.rb +84 -0
- data/lib/principles/data/first_parent_log.rb +48 -0
- data/lib/principles/data/first_parent_range.rb +122 -0
- data/lib/principles/data/git_command.rb +37 -0
- data/lib/principles/data/guidance_search_paths_file.rb +107 -0
- data/lib/principles/data/map_files.rb +35 -10
- data/lib/principles/data/principles_directory.rb +40 -0
- data/lib/principles/data/principles_subfolder.rb +39 -16
- data/lib/principles/data/project_files.rb +22 -11
- data/lib/principles/data/repository.rb +55 -29
- data/lib/principles/data/requested_candidate_files.rb +43 -0
- data/lib/principles/data/running_version.rb +3 -5
- data/lib/principles/data/schema_check.rb +16 -6
- data/lib/principles/data/schemas/acknowledgement-answer.schema.json +18 -5
- data/lib/principles/data/schemas/answer-guide.schema.json +255 -68
- 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/data/schemas/correction-answer-guide.schema.json +2 -1
- data/lib/principles/data/schemas/correction-answer.schema.json +6 -0
- data/lib/principles/data/schemas/guidance-search-paths.schema.json +13 -0
- data/lib/principles/data/schemas/member-map-history.schema.json +20 -0
- data/lib/principles/data/verified_head.rb +162 -0
- data/lib/principles/invocation_options.rb +3 -3
- data/lib/principles/models/acknowledgement.rb +95 -84
- data/lib/principles/models/acknowledgement_left_as_printed.rb +51 -0
- 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_entry_protecting_map.rb +28 -0
- data/lib/principles/models/audit_record.rb +12 -16
- data/lib/principles/models/audit_records.rb +52 -23
- data/lib/principles/models/candidate_files.rb +44 -10
- data/lib/principles/models/candidate_inventory.rb +69 -8
- data/lib/principles/models/candidate_outline.rb +195 -0
- data/lib/principles/models/captured_head.rb +72 -0
- data/lib/principles/models/carried_member.rb +42 -0
- data/lib/principles/models/check_since_last_audit.rb +20 -11
- data/lib/principles/models/command_steps.rb +17 -1
- data/lib/principles/models/declared_map_changes.rb +29 -12
- data/lib/principles/models/declared_member_removals.rb +75 -0
- data/lib/principles/models/disposition.rb +4 -2
- data/lib/principles/models/fix_only_fields.rb +12 -0
- data/lib/principles/models/frontmatter_fields.rb +9 -8
- data/lib/principles/models/guidance_search_path.rb +26 -0
- data/lib/principles/models/guidance_search_paths.rb +57 -0
- data/lib/principles/models/instruction_named.rb +35 -0
- data/lib/principles/models/left_as_printed.rb +39 -0
- data/lib/principles/models/line_span.rb +6 -0
- data/lib/principles/models/loaded_files.rb +1 -2
- data/lib/principles/models/loading_scope.rb +61 -0
- data/lib/principles/models/locator.rb +6 -0
- data/lib/principles/models/mapped_principles.rb +39 -37
- data/lib/principles/models/member_assessments.rb +9 -31
- data/lib/principles/models/member_file.rb +20 -47
- data/lib/principles/models/member_hashes_as_written.rb +10 -6
- data/lib/principles/models/member_history.rb +7 -5
- data/lib/principles/models/member_lines.rb +63 -15
- data/lib/principles/models/member_loading_scopes.rb +49 -0
- data/lib/principles/models/member_loads.rb +4 -0
- data/lib/principles/models/member_mapping_run.rb +30 -0
- data/lib/principles/models/member_moves.rb +4 -0
- data/lib/principles/models/member_problems.rb +63 -33
- data/lib/principles/models/member_region.rb +129 -0
- data/lib/principles/models/member_repair_moves.rb +52 -0
- data/lib/principles/models/member_snapshots.rb +14 -1
- data/lib/principles/models/members_in_consecutive_sections.rb +56 -0
- data/lib/principles/models/meta_principle.rb +14 -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 +142 -0
- data/lib/principles/models/outline_group.rb +31 -0
- data/lib/principles/models/outline_section.rb +56 -0
- data/lib/principles/models/principle.rb +14 -7
- data/lib/principles/models/principle_file_revision.rb +48 -0
- data/lib/principles/models/principle_history.rb +46 -19
- data/lib/principles/models/principle_lineage.rb +118 -0
- data/lib/principles/models/principle_map_revision.rb +39 -0
- data/lib/principles/models/principle_mapping_history.rb +132 -0
- data/lib/principles/models/principle_members.rb +25 -0
- data/lib/principles/models/principle_predecessor.rb +45 -0
- data/lib/principles/models/principle_publication.rb +177 -0
- data/lib/principles/models/principle_revision.rb +104 -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/problem_report.rb +17 -5
- data/lib/principles/models/project.rb +46 -39
- data/lib/principles/models/project_history.rb +45 -25
- data/lib/principles/models/quoted_change.rb +137 -0
- data/lib/principles/models/record_format.rb +12 -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 +5 -14
- data/lib/principles/models/sent_answer.rb +61 -0
- data/lib/principles/models/shape_problems_beside.rb +40 -0
- data/lib/principles/models/submitted_answer.rb +34 -0
- data/lib/principles/models/survey_search_paths.rb +26 -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/uncommitted_files.rb +50 -0
- data/lib/principles/models/unknown_principle.rb +29 -0
- data/lib/principles/models/write_up_opening.rb +21 -4
- data/lib/principles/positional_arguments.rb +37 -0
- 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 +23 -11
- data/lib/principles/views/added_member.rb +41 -0
- data/lib/principles/views/answered_request.rb +21 -0
- data/lib/principles/views/assessed_members.rb +43 -10
- data/lib/principles/views/assessment_request.rb +91 -31
- data/lib/principles/views/audit_result.rb +40 -28
- data/lib/principles/views/candidate_files_result.rb +85 -19
- data/lib/principles/views/candidate_outlines_result.rb +25 -0
- data/lib/principles/views/check_notes.rb +44 -0
- data/lib/principles/views/check_result_template.rb +14 -23
- data/lib/principles/views/consecutive_sections_elsewhere.rb +27 -0
- data/lib/principles/views/correction_request.rb +32 -1
- data/lib/principles/views/guidance_search_paths_result.rb +26 -0
- data/lib/principles/views/instruction.rb +74 -0
- data/lib/principles/views/json_with_entries_on_lines.rb +59 -0
- data/lib/principles/views/loads_to_check_result.rb +2 -2
- data/lib/principles/views/map_added_to.rb +56 -2
- data/lib/principles/views/map_result.rb +23 -43
- data/lib/principles/views/maps_needing_members_or_audit.rb +47 -0
- data/lib/principles/views/member_change_since_baseline.rb +23 -5
- data/lib/principles/views/member_repairs.rb +22 -52
- data/lib/principles/views/members_a_commit_changed.rb +16 -6
- data/lib/principles/views/new_loading_scope.rb +31 -0
- data/lib/principles/views/one_member_check_result_template.rb +47 -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 +24 -29
- data/lib/principles/views/principles_with_no_completed_audit.rb +9 -3
- data/lib/principles/views/prior_findings_result.rb +23 -15
- data/lib/principles/views/problem_lines.rb +3 -1
- data/lib/principles/views/problem_result.rb +8 -3
- 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 +67 -48
- 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/answer-guide.json +1 -0
- data/lib/principles/views/prompts/dispose-of-each-finding/fix-or-record-each-finding.md +16 -3
- data/lib/principles/views/prompts/dispose-of-each-finding/retain-assessment-and-correction.md +4 -0
- data/lib/principles/views/prompts/find-a-principle-to-map/ask-about-other-guidance-search-paths.md +6 -0
- 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-an-existing-or-new-principle.md +2 -0
- data/lib/principles/views/prompts/find-a-principle-to-map/choose-one-principle.md +11 -5
- data/lib/principles/views/prompts/find-a-principle-to-map/compare-with-mapped-principles.md +11 -0
- 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/find-a-principle-to-map/survey-a-later-range.md +3 -0
- data/lib/principles/views/prompts/find-a-principle-to-map/what-each-command-writes.md +4 -4
- data/lib/principles/views/prompts/find-a-principle-to-map/where-the-inventory-looks.md +5 -4
- data/lib/principles/views/prompts/learn-what-a-command-does/add-guidance-search-path.md +17 -0
- data/lib/principles/views/prompts/learn-what-a-command-does/add-member.md +35 -6
- data/lib/principles/views/prompts/learn-what-a-command-does/create-principle.md +16 -0
- data/lib/principles/views/prompts/learn-what-a-command-does/list-candidate-files.md +55 -7
- data/lib/principles/views/prompts/learn-what-a-command-does/list-member-problems.md +9 -8
- 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/move-member.md +5 -0
- data/lib/principles/views/prompts/learn-what-a-command-does/remove-guidance-search-path.md +13 -0
- data/lib/principles/views/prompts/learn-what-a-command-does/remove-principle.md +25 -0
- data/lib/principles/views/prompts/learn-what-a-command-does/show-answer-check.md +27 -1
- data/lib/principles/views/prompts/learn-what-a-command-does/show-candidate-outlines.md +21 -0
- 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 +51 -54
- data/lib/principles/views/prompts/read-requested-outlines/continue-the-survey.md +7 -0
- 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 +92 -7
- data/lib/principles/models/candidate_listing.rb +0 -32
- 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
|
@@ -14,9 +14,24 @@ module Principles
|
|
|
14
14
|
# outside git, where nothing checked them (#386), and the lists to ask the owner about, each with the paths to
|
|
15
15
|
# name in it (#405, #412).
|
|
16
16
|
class Found
|
|
17
|
+
# What each listed file prints: where it is, how big, where a link leads, and what the survey reads of it.
|
|
18
|
+
PRINTED_FILE_FIELDS = %w[path characters symlink_to changed_in_range description opening_line outline].freeze
|
|
19
|
+
|
|
17
20
|
#: Hash[String, Array[String]]
|
|
18
21
|
attr_reader :owner_asks
|
|
19
22
|
|
|
23
|
+
# Whether the inventory names files whose list items were cut to keep the result short (#1155).
|
|
24
|
+
#: () -> bool
|
|
25
|
+
def cut? = @inventory.key?("outlines_cut")
|
|
26
|
+
|
|
27
|
+
# Whether the inventory names files that print their path and size alone, their outlines left out (#1155).
|
|
28
|
+
#: () -> bool
|
|
29
|
+
def left_out? = @inventory.key?("outlines_left_out")
|
|
30
|
+
|
|
31
|
+
# What the outlines of the files a range changed print, when every cut left them past the budget (#1171).
|
|
32
|
+
#: () -> Integer?
|
|
33
|
+
def range_outlines_bytes = @inventory["range_outlines_bytes"]
|
|
34
|
+
|
|
20
35
|
#: (inventory: Hash[String, untyped], untracked: Array[String]?,
|
|
21
36
|
#| owner_asks: Hash[String, Array[String]]) -> void
|
|
22
37
|
def initialize(inventory:, untracked:, owner_asks:)
|
|
@@ -30,7 +45,7 @@ module Principles
|
|
|
30
45
|
# in git.
|
|
31
46
|
#: () -> Hash[String, untyped]
|
|
32
47
|
def listed
|
|
33
|
-
files = @inventory.fetch("files").map { |file| file.slice(
|
|
48
|
+
files = @inventory.fetch("files").map { |file| file.slice(*PRINTED_FILE_FIELDS) }
|
|
34
49
|
listed = @inventory.merge("files" => files,
|
|
35
50
|
"scope" => Prompts.text("find-a-principle-to-map/where-the-inventory-looks"))
|
|
36
51
|
@untracked ? listed.merge("untracked" => @untracked) : listed
|
|
@@ -47,34 +62,85 @@ module Principles
|
|
|
47
62
|
end
|
|
48
63
|
|
|
49
64
|
# The inventory, and the question of which principle to map, with one item for each list under found's owner_asks
|
|
50
|
-
# to ask the owner about.
|
|
51
|
-
#: (Found, existing_maps: Array[String], map_file: String,
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
65
|
+
# to ask the owner about.
|
|
66
|
+
#: (Found, existing_maps: Array[String], map_file: String,
|
|
67
|
+
#| mapped_principles: Array[Hash[String, untyped]]) -> Hash[String, untyped]
|
|
68
|
+
def question(found, existing_maps:, map_file:, mapped_principles:)
|
|
69
|
+
survey, choice = survey_questions(existing_maps)
|
|
70
|
+
result = { "status" => "question", "inventory" => found.listed, "existing_maps" => existing_maps,
|
|
71
|
+
"writes" => Prompts.text("find-a-principle-to-map/what-each-command-writes", map_file: map_file),
|
|
72
|
+
"question" => principle_question(found, survey: survey, choice: choice),
|
|
73
|
+
"answer_with" => mapping_answer(existing_maps),
|
|
74
|
+
**(mapped_principles.empty? ? {} : { "mapped_principles" => mapped_principles }) }
|
|
75
|
+
existing_maps.empty? ? result : instructions_first(result)
|
|
58
76
|
end
|
|
59
77
|
|
|
60
78
|
private
|
|
61
79
|
|
|
62
|
-
#
|
|
63
|
-
#: () -> String
|
|
64
|
-
def
|
|
65
|
-
|
|
66
|
-
|
|
80
|
+
# Keep the survey's next action and existing-map comparison ahead of a potentially large inventory.
|
|
81
|
+
#: (Hash[String, untyped]) -> Hash[String, untyped]
|
|
82
|
+
def instructions_first(result)
|
|
83
|
+
result.slice("status", "question", "answer_with", "mapped_principles", "existing_maps").merge(result)
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
# The table instructions and its later choice, with or without mapped rules to compare against.
|
|
87
|
+
#: (Array[String]) -> [String, String]
|
|
88
|
+
def survey_questions(existing_maps)
|
|
89
|
+
if existing_maps.empty?
|
|
90
|
+
[Prompts.text("find-a-principle-to-map/choose-one-principle"),
|
|
91
|
+
Prompts.text("find-a-principle-to-map/ask-which-principle-to-map")]
|
|
92
|
+
else
|
|
93
|
+
[Prompts.text("find-a-principle-to-map/compare-with-mapped-principles"),
|
|
94
|
+
Prompts.text("find-a-principle-to-map/choose-an-existing-or-new-principle")]
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
# The map writes available after the table: extending an existing principle or starting a distinct one.
|
|
99
|
+
#: (Array[String]) -> String
|
|
100
|
+
def mapping_answer(existing_maps)
|
|
101
|
+
create = @invocation.in_project("create-principle", usage: CREATE_PRINCIPLE_USAGE)
|
|
102
|
+
return create if existing_maps.empty?
|
|
103
|
+
|
|
104
|
+
add = @invocation.in_project("add-member", usage: "ID PATH --role ROLE")
|
|
105
|
+
"To add a member to an existing principle: #{add}\nTo map a distinct principle: #{create}"
|
|
67
106
|
end
|
|
68
107
|
|
|
69
|
-
#
|
|
70
|
-
|
|
71
|
-
|
|
108
|
+
# The survey, leaving out files possibly test data, and when outlines were cut or left out how to read them, then
|
|
109
|
+
# one item per list to ask the owner about after the table.
|
|
110
|
+
#: (Found, survey: String, choice: String) -> String
|
|
111
|
+
def principle_question(found, survey:, choice:)
|
|
112
|
+
owner_asks = found.owner_asks
|
|
72
113
|
asks = owner_asks.map { |key, paths| "- #{owner_ask(key, named: inline(paths))}" }
|
|
73
|
-
[
|
|
74
|
-
*(
|
|
114
|
+
[survey, *left_out_of_the_survey(owner_asks),
|
|
115
|
+
*budget_notes(found),
|
|
116
|
+
choice,
|
|
117
|
+
Prompts.text("find-a-principle-to-map/ask-about-other-guidance-search-paths"),
|
|
118
|
+
*([Prompts.text("find-a-principle-to-map/ask-the-owner-after-the-table"), *asks].join("\n") if asks.any?)]
|
|
75
119
|
.join("\n\n")
|
|
76
120
|
end
|
|
77
121
|
|
|
122
|
+
# How to read what the budget cut: a cut section back by its lines, and a file whose outline was left out.
|
|
123
|
+
#: (Found) -> Array[String]
|
|
124
|
+
def budget_notes(found)
|
|
125
|
+
[*(Prompts.text("find-a-principle-to-map/read-a-cut-section-back") if found.cut?),
|
|
126
|
+
*(Prompts.text("find-a-principle-to-map/read-left-out-files") if found.left_out?),
|
|
127
|
+
*range_past_budget(found.range_outlines_bytes)]
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
# How to survey a range whose own outlines pass the budget, given what they print; nothing when they do not.
|
|
131
|
+
#: (Integer?) -> Array[String]
|
|
132
|
+
def range_past_budget(bytes)
|
|
133
|
+
bytes ? [Prompts.text("find-a-principle-to-map/survey-a-later-range", bytes: bytes.to_s)] : []
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
# The line leaving files possibly test data out of the survey, when any is listed.
|
|
137
|
+
#: (Hash[String, Array[String]]) -> Array[String]
|
|
138
|
+
def left_out_of_the_survey(owner_asks)
|
|
139
|
+
return [] unless owner_asks.key?("possibly_test_data")
|
|
140
|
+
|
|
141
|
+
[Prompts.text("find-a-principle-to-map/leave-test-data-out-of-the-survey")]
|
|
142
|
+
end
|
|
143
|
+
|
|
78
144
|
# The paths an ask names after its list's name, each quoted, since a path may hold a comma; none, nothing.
|
|
79
145
|
#: (Array[String]) -> String
|
|
80
146
|
def inline(paths) = paths.empty? ? "" : " (#{paths.map { |path| "`#{path}`" }.join(", ")})"
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# typed: strict
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
require_relative "prompts"
|
|
5
|
+
require_relative "json_with_entries_on_lines"
|
|
6
|
+
|
|
7
|
+
module Principles
|
|
8
|
+
module Views
|
|
9
|
+
# The requested outlines, with the same omissions as a survey and the way to request less at once.
|
|
10
|
+
class CandidateOutlinesResult
|
|
11
|
+
#: (Hash[String, untyped]) -> void
|
|
12
|
+
def initialize(inventory)
|
|
13
|
+
@inventory = inventory
|
|
14
|
+
freeze
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
#: () -> JsonWithEntriesOnLines
|
|
18
|
+
def result
|
|
19
|
+
values = { "status" => "ok", "question" => Prompts.text("read-requested-outlines/continue-the-survey"),
|
|
20
|
+
"inventory" => @inventory, "wrote" => [] }
|
|
21
|
+
JsonWithEntriesOnLines.new(values, under: "inventory", key: "files")
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# typed: strict
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
require_relative "prompts"
|
|
5
|
+
|
|
6
|
+
module Principles
|
|
7
|
+
# What this tool prints, from plain values a controller hands it. views/CLAUDE.md owns the boundary.
|
|
8
|
+
module Views
|
|
9
|
+
# What a checked member's exit_status placeholder says of its check beside what to do, in a full audit's template
|
|
10
|
+
# and a one-member audit's alike: any hidden character the command holds (#260), and the line the last audit's
|
|
11
|
+
# review rested on, which a run keeps unless a new one is given (#849).
|
|
12
|
+
class CheckNotes
|
|
13
|
+
# since_last_audit is how the check stands to the last audit's, with the review line that audit kept, if any;
|
|
14
|
+
# hidden_characters names each hidden character in the command.
|
|
15
|
+
#: (Hash[String, untyped]?, Array[String]) -> void
|
|
16
|
+
def initialize(since_last_audit, hidden_characters)
|
|
17
|
+
@since_last_audit = since_last_audit
|
|
18
|
+
@hidden_characters = hidden_characters
|
|
19
|
+
freeze
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
# The note naming the command's hidden characters, where the decision to run it is made; nil when it has none.
|
|
23
|
+
#: () -> String?
|
|
24
|
+
def hidden_characters
|
|
25
|
+
return if @hidden_characters.empty?
|
|
26
|
+
|
|
27
|
+
Prompts.text("assess-every-member/have-hidden-characters-in-a-check-explained",
|
|
28
|
+
characters: @hidden_characters.join("; "))
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# That a run keeps the line the last audit's review rested on, quoted with since when, unless a new one is
|
|
32
|
+
# given, so whether it still holds can be judged from the template (#849); a record from before D63 kept none,
|
|
33
|
+
# so there is nothing to say (#826).
|
|
34
|
+
#: () -> Array[String]
|
|
35
|
+
def kept_review
|
|
36
|
+
return [] unless @since_last_audit&.key?("review_basis")
|
|
37
|
+
|
|
38
|
+
[Prompts.text("assess-every-member/keep-the-last-review-basis-unless-you-give-a-new-one",
|
|
39
|
+
since: @since_last_audit.fetch("review_basis_since"),
|
|
40
|
+
basis: @since_last_audit.fetch("review_basis"))]
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# typed: strict
|
|
2
2
|
# frozen_string_literal: true
|
|
3
3
|
|
|
4
|
+
require_relative "check_notes"
|
|
4
5
|
require_relative "prompts"
|
|
5
6
|
|
|
6
7
|
module Principles
|
|
@@ -12,6 +13,16 @@ module Principles
|
|
|
12
13
|
# since, is reviewed before it runs (#227), so it also gives review_basis to fill (D63), and any hidden character
|
|
13
14
|
# it holds is named where that decision is made (#260).
|
|
14
15
|
class CheckResultTemplate
|
|
16
|
+
# The template for the checked member a request lists as entry, with its check, how that stands to the last
|
|
17
|
+
# audit's and any hidden characters in it; nil for a member without a check.
|
|
18
|
+
#: (Hash[String, untyped], reviewed_placeholders: Hash[String, String],
|
|
19
|
+
#| unchanged_placeholders: Hash[String, String]) -> Hash[String, untyped]?
|
|
20
|
+
def self.for(entry, reviewed_placeholders:, unchanged_placeholders:)
|
|
21
|
+
check = entry["check"] or return
|
|
22
|
+
new(check, entry["check_since_last_audit"], entry.fetch("check_hidden_characters", []),
|
|
23
|
+
reviewed_placeholders:, unchanged_placeholders:).to_h
|
|
24
|
+
end
|
|
25
|
+
|
|
15
26
|
# reviewed_placeholders gives the text of not_run_reason and review_basis, which an answer leaves as printed to
|
|
16
27
|
# give neither, for a check reviewed before it runs; unchanged_placeholders gives it for one the last audit ran,
|
|
17
28
|
# whose review_basis left as printed keeps the line that audit kept (#1010).
|
|
@@ -20,7 +31,7 @@ module Principles
|
|
|
20
31
|
def initialize(check, since_last_audit, hidden_characters = [], reviewed_placeholders:, unchanged_placeholders:)
|
|
21
32
|
@check = check
|
|
22
33
|
@since_last_audit = since_last_audit
|
|
23
|
-
@
|
|
34
|
+
@notes = CheckNotes.new(since_last_audit, hidden_characters) #: CheckNotes
|
|
24
35
|
unchanged = since_last_audit&.fetch("status") == "unchanged"
|
|
25
36
|
@placeholders = unchanged ? unchanged_placeholders : reviewed_placeholders #: Hash[String, String]
|
|
26
37
|
freeze
|
|
@@ -28,21 +39,13 @@ module Principles
|
|
|
28
39
|
|
|
29
40
|
#: () -> Hash[String, untyped]
|
|
30
41
|
def to_h
|
|
31
|
-
{ "command" => @check, "exit_status" => [hidden_characters, run_and_report].compact.join(" "),
|
|
42
|
+
{ "command" => @check, "exit_status" => [@notes.hidden_characters, run_and_report].compact.join(" "),
|
|
32
43
|
"not_run_reason" => @placeholders.fetch("not_run_reason"),
|
|
33
44
|
"review_basis" => @placeholders.fetch("review_basis") }
|
|
34
45
|
end
|
|
35
46
|
|
|
36
47
|
private
|
|
37
48
|
|
|
38
|
-
#: () -> String?
|
|
39
|
-
def hidden_characters
|
|
40
|
-
return if @hidden_characters.empty?
|
|
41
|
-
|
|
42
|
-
Prompts.text("assess-every-member/have-hidden-characters-in-a-check-explained",
|
|
43
|
-
characters: @hidden_characters.join("; "))
|
|
44
|
-
end
|
|
45
|
-
|
|
46
49
|
# What to do before replacing exit_status, then that a named check runs at every full audit, which holds for
|
|
47
50
|
# each status.
|
|
48
51
|
#: () -> String
|
|
@@ -56,7 +59,7 @@ module Principles
|
|
|
56
59
|
#: () -> Array[String]
|
|
57
60
|
def steps
|
|
58
61
|
case @since_last_audit&.fetch("status")
|
|
59
|
-
when "unchanged" then [Prompts.text("assess-every-member/run-the-check-then-report-it"),
|
|
62
|
+
when "unchanged" then [Prompts.text("assess-every-member/run-the-check-then-report-it"), *@notes.kept_review]
|
|
60
63
|
when "changed"
|
|
61
64
|
[Prompts.text("assess-every-member/have-a-changed-check-reviewed-before-running-it",
|
|
62
65
|
changed_in: commit_clause(": commit %s changed it")), run_reviewed]
|
|
@@ -74,18 +77,6 @@ module Principles
|
|
|
74
77
|
commit ? format(format, commit) : ""
|
|
75
78
|
end
|
|
76
79
|
|
|
77
|
-
# That a run keeps the line the last audit's review rested on, quoted with since when, unless a new one is
|
|
78
|
-
# given, so whether it still holds can be judged from the template (#849); a record from before D63 kept none,
|
|
79
|
-
# so there is nothing to say (#826).
|
|
80
|
-
#: () -> Array[String]
|
|
81
|
-
def kept_review
|
|
82
|
-
return [] unless @since_last_audit&.key?("review_basis")
|
|
83
|
-
|
|
84
|
-
[Prompts.text("assess-every-member/keep-the-last-review-basis-unless-you-give-a-new-one",
|
|
85
|
-
since: @since_last_audit.fetch("review_basis_since"),
|
|
86
|
-
basis: @since_last_audit.fetch("review_basis"))]
|
|
87
|
-
end
|
|
88
|
-
|
|
89
80
|
# Run a reviewed check, then report it with what its review rested on.
|
|
90
81
|
#: () -> String
|
|
91
82
|
def run_reviewed
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# typed: strict
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
module Principles
|
|
5
|
+
module Views
|
|
6
|
+
# The optional consecutive-section facts beside an added member and the question they ask the agent.
|
|
7
|
+
class ConsecutiveSectionsElsewhere
|
|
8
|
+
#: (?Array[Hash[String, untyped]]) -> void
|
|
9
|
+
def initialize(facts = [])
|
|
10
|
+
@facts = facts
|
|
11
|
+
freeze
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
#: () -> Hash[String, untyped]
|
|
15
|
+
def to_h = @facts.empty? ? {} : { "consecutive_sections_elsewhere" => @facts }
|
|
16
|
+
|
|
17
|
+
#: () -> String
|
|
18
|
+
def note
|
|
19
|
+
return "" if @facts.empty?
|
|
20
|
+
|
|
21
|
+
"Members of other principles occupy consecutive complete Markdown sections in the same underlying file " \
|
|
22
|
+
"(consecutive_sections_elsewhere). These maps have no completed full audit. " \
|
|
23
|
+
"Do they carry one rule or distinct principles? Location alone does not decide. "
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
# frozen_string_literal: true
|
|
3
3
|
|
|
4
4
|
require_relative "answer_head"
|
|
5
|
+
require_relative "invocation"
|
|
5
6
|
require_relative "prompts"
|
|
6
7
|
|
|
7
8
|
module Principles
|
|
@@ -40,11 +41,41 @@ module Principles
|
|
|
40
41
|
def template
|
|
41
42
|
@head.leading("dispositions" => @findings.map do |finding|
|
|
42
43
|
{ "finding_id" => finding["id"], "action" => @placeholders.fetch("action"),
|
|
43
|
-
"reason" => @placeholders.fetch("reason"), "changed_members" => [], "
|
|
44
|
+
"reason" => @placeholders.fetch("reason"), "changed_members" => [], "removed_members" => [],
|
|
45
|
+
"evidence" => [],
|
|
44
46
|
"reassessment" => @placeholders.fetch("reassessment"), "recorded_at" => nil, "waits_on" => nil }
|
|
45
47
|
end)
|
|
46
48
|
end
|
|
47
49
|
|
|
50
|
+
#: (AuditResult, String, String) -> Hash[String, untyped]
|
|
51
|
+
def presented_with(view, source_request_id, answer_file)
|
|
52
|
+
view.request(view.correction_request(self, source_request_id:, answer_file:))
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
# The correction's answer to save and fill after submitting the checked assessment; keep its submit last.
|
|
56
|
+
#: (Hash[String, untyped], Invocation, String) -> Hash[String, untyped]
|
|
57
|
+
def with_correction_to_fill(acceptable, invocation, answer_file)
|
|
58
|
+
save = "Once this answer is submitted with the last line's command, save correction_template, the " \
|
|
59
|
+
"correction's answer it leads to, to a file outside the project, such as under $TMPDIR, fill only " \
|
|
60
|
+
"its dispositions, and submit it: #{invocation.submit_answer(request_id)}"
|
|
61
|
+
acceptable.merge("correction_template" => template,
|
|
62
|
+
"correction_recovery" => recovery(acceptable.fetch("request_id"), answer_file, invocation),
|
|
63
|
+
"next_action" => "#{save}\n#{acceptable.fetch("next_action")}")
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
# Preserve both inputs before fixes; only a commit-based request has the reviewed replay route.
|
|
67
|
+
#: (String, String, Invocation) -> String
|
|
68
|
+
def recovery(assessment_request_id, assessment_file, invocation)
|
|
69
|
+
keep = Prompts.text("dispose-of-each-finding/retain-assessment-and-correction")
|
|
70
|
+
return keep unless @head.based_on_a_commit?
|
|
71
|
+
|
|
72
|
+
command = invocation.in_project("show-answer-check", assessment_request_id,
|
|
73
|
+
options: ["--file", assessment_file])
|
|
74
|
+
"#{keep}\nAfter submitting the assessment in Git, while its request inputs remain unchanged, " \
|
|
75
|
+
"recover a lost correction with this read-only command. For --file -, supply the saved exact stdin bytes " \
|
|
76
|
+
"again. Stale and newer-record checks still apply:\n#{command}"
|
|
77
|
+
end
|
|
78
|
+
|
|
48
79
|
# What submitting the assessment stored, and what submitting it again would do, so an assessment submitted
|
|
49
80
|
# twice plainly replaced nothing: in git, where the audit has a base commit, nothing; outside git, the open
|
|
50
81
|
# record, which keeps what the audit began from.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# typed: strict
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
require_relative "invocation"
|
|
5
|
+
|
|
6
|
+
module Principles
|
|
7
|
+
# What this tool prints, from plain values a controller hands it. views/CLAUDE.md owns the boundary.
|
|
8
|
+
module Views
|
|
9
|
+
# The recorded list and an immediate read-only survey after a guidance-search-path write.
|
|
10
|
+
class GuidanceSearchPathsResult
|
|
11
|
+
#: (Invocation) -> void
|
|
12
|
+
def initialize(invocation)
|
|
13
|
+
@invocation = invocation
|
|
14
|
+
freeze
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
#: (status: String, globs: Array[String], wrote: Array[String]) -> Hash[String, untyped]
|
|
18
|
+
def result(status:, globs:, wrote:)
|
|
19
|
+
survey = @invocation.in_project("list-candidate-files")
|
|
20
|
+
{ "status" => status, "recorded_guidance_search_paths" => globs, "wrote" => wrote,
|
|
21
|
+
"next_action" => "Commit changed configuration.\n" \
|
|
22
|
+
"Survey again using the saved search paths: #{survey}" }
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# typed: strict
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
module Principles
|
|
5
|
+
# What this tool prints, from plain values a controller hands it. views/CLAUDE.md owns the boundary.
|
|
6
|
+
module Views
|
|
7
|
+
# One instruction a judgement request prints under its own field: its paragraphs, each printed only when the
|
|
8
|
+
# request holds the case it explains, and every one when the agent reads the field whole (D81 step 2, #983).
|
|
9
|
+
class Instruction
|
|
10
|
+
#: String
|
|
11
|
+
attr_reader :field
|
|
12
|
+
|
|
13
|
+
# An instruction of a prompt's paragraphs, each held when the block, given the paragraph, says the request
|
|
14
|
+
# holds its case; key a case by what the paragraph says, never by its position, which an edit moves.
|
|
15
|
+
#: (String, String) { (String) -> bool } -> Instruction
|
|
16
|
+
def self.of_paragraphs(field, text, &held)
|
|
17
|
+
new(field, text.split("\n\n").map { |paragraph| [paragraph, held.call(paragraph)] })
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
# paragraphs are each paragraph, in order, with whether the request holds its case.
|
|
21
|
+
#: (String, Array[[String, bool]]) -> void
|
|
22
|
+
def initialize(field, paragraphs)
|
|
23
|
+
@field = field
|
|
24
|
+
@paragraphs = paragraphs
|
|
25
|
+
freeze
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# The field as the request prints it, with the paragraphs whose case it holds; nothing when it holds none.
|
|
29
|
+
#: () -> Hash[String, String]
|
|
30
|
+
def printed
|
|
31
|
+
held = @paragraphs.select { |_, case_held| case_held }.map(&:first)
|
|
32
|
+
held.empty? ? {} : { @field => held.join("\n\n") }
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
# Every paragraph, whether or not the request holds its case.
|
|
36
|
+
#: () -> String
|
|
37
|
+
def whole = @paragraphs.map(&:first).join("\n\n")
|
|
38
|
+
|
|
39
|
+
# Whether the request prints some paragraphs and leaves others out, so the field read as printed is not whole.
|
|
40
|
+
#: () -> bool
|
|
41
|
+
def trimmed? = @paragraphs.any? { |_, held| held } && @paragraphs.any? { |_, held| !held }
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# The guide to an answer's shapes a judgement request prints under its own field: its entries, each printed only
|
|
45
|
+
# when the request holds the case it shows, and every one when the agent reads the field whole (D81 step 2).
|
|
46
|
+
class GuideInstruction
|
|
47
|
+
#: String
|
|
48
|
+
attr_reader :field
|
|
49
|
+
|
|
50
|
+
# guide is every entry; held says, by entry name, whether the request holds its case. narrowed is, by name, an
|
|
51
|
+
# entry as the request prints it when it holds the entry's case but not every case within it (#983).
|
|
52
|
+
#: (String, Hash[String, untyped], ?narrowed: Hash[String, untyped]) { (String) -> bool } -> void
|
|
53
|
+
def initialize(field, guide, narrowed: {}, &held)
|
|
54
|
+
@field = field
|
|
55
|
+
@guide = guide
|
|
56
|
+
@held = guide.filter_map { |name, entry| [name, narrowed.fetch(name, entry)] if held.call(name) }
|
|
57
|
+
.to_h #: Hash[String, untyped]
|
|
58
|
+
freeze
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
# The field as the request prints it, with the entries whose case it holds; nothing when it holds none.
|
|
62
|
+
#: () -> Hash[String, untyped]
|
|
63
|
+
def printed = @held.empty? ? {} : { @field => @held }
|
|
64
|
+
|
|
65
|
+
# Every entry, whether or not the request holds its case.
|
|
66
|
+
#: () -> Hash[String, untyped]
|
|
67
|
+
def whole = @guide
|
|
68
|
+
|
|
69
|
+
# Whether the request prints some entries and leaves others out, so the field read as printed is not whole.
|
|
70
|
+
#: () -> bool
|
|
71
|
+
def trimmed? = !@held.empty? && @held != @guide
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
end
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# typed: strict
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
require "json"
|
|
5
|
+
|
|
6
|
+
module Principles
|
|
7
|
+
# What this tool prints, from plain values a controller hands it. views/CLAUDE.md owns the boundary.
|
|
8
|
+
module Views
|
|
9
|
+
# A JSON result printed pretty, but for one array whose entries each print compact on a line of their own.
|
|
10
|
+
# list-candidate-files' file entries are that array: pretty-printing cost 17% of a 66 KB result, and one compact
|
|
11
|
+
# line of 36 KB is the worst shape to read by lines (#1155). It is the first case of ticket 007's decision on the
|
|
12
|
+
# output format; every other result prints pretty.
|
|
13
|
+
class JsonWithEntriesOnLines
|
|
14
|
+
# Stands in for the array while the rest prints pretty. Replacement targets its root object and direct key,
|
|
15
|
+
# so an identical project string elsewhere stays untouched regardless of the result's field order.
|
|
16
|
+
MARKER = "\u0000entries on lines of their own\u0000"
|
|
17
|
+
|
|
18
|
+
# The array is result[under][key].
|
|
19
|
+
#: (Hash[String, untyped], under: String, key: String) -> void
|
|
20
|
+
def initialize(result, under:, key:)
|
|
21
|
+
@result = result
|
|
22
|
+
@under = under
|
|
23
|
+
@key = key
|
|
24
|
+
freeze
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
# The result as JSON generates it, so a reader of the values need not know the layout.
|
|
28
|
+
#: (?untyped, *untyped) -> String
|
|
29
|
+
def to_json(state = nil, *) = @result.to_json(state)
|
|
30
|
+
|
|
31
|
+
# The result as printed.
|
|
32
|
+
#: () -> String
|
|
33
|
+
def text
|
|
34
|
+
marked = JSON.pretty_generate(@result.merge(@under => @result.fetch(@under).merge(@key => MARKER)))
|
|
35
|
+
marked.sub(array_place) { "#{Regexp.last_match(1)}#{lines(" ")}" }
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
private
|
|
39
|
+
|
|
40
|
+
# The designated array placeholder at its known depth in JSON.pretty_generate's two-space layout.
|
|
41
|
+
#: () -> Regexp
|
|
42
|
+
def array_place
|
|
43
|
+
parent = Regexp.escape(JSON.generate(@under))
|
|
44
|
+
child = Regexp.escape(JSON.generate(@key))
|
|
45
|
+
marker = Regexp.escape(JSON.generate(MARKER))
|
|
46
|
+
/(^ #{parent}: \{.*?^ #{child}: )#{marker}/m
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# The array's entries, each compact on its own line, one step in from indent.
|
|
50
|
+
#: (String) -> String
|
|
51
|
+
def lines(indent)
|
|
52
|
+
entries = @result.fetch(@under).fetch(@key)
|
|
53
|
+
return "[]" if entries.empty?
|
|
54
|
+
|
|
55
|
+
"[\n#{entries.map { |entry| "#{indent} #{JSON.generate(entry)}" }.join(",\n")}\n#{indent}]"
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
@@ -32,8 +32,8 @@ module Principles
|
|
|
32
32
|
listed = @listed or return
|
|
33
33
|
|
|
34
34
|
decisions = listed.fetch("rows").map { |row| { "member_id" => row.fetch("member_id"), "decision" => nil } }
|
|
35
|
-
RequestPart.new(shown: { "loads_to_check_against_activation" => listed,
|
|
36
|
-
|
|
35
|
+
RequestPart.new(shown: { "loads_to_check_against_activation" => listed },
|
|
36
|
+
instructions: [Instruction.of_paragraphs("loads_to_check_instruction", instruction) { true }],
|
|
37
37
|
slots: { "loading_decisions" => decisions },
|
|
38
38
|
help: { "loading_decisions" => { "decision" => DECISION, **@placeholders } })
|
|
39
39
|
end
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
# typed: strict
|
|
2
2
|
# frozen_string_literal: true
|
|
3
3
|
|
|
4
|
+
require_relative "first_audit"
|
|
5
|
+
require_relative "new_loading_scope"
|
|
6
|
+
|
|
4
7
|
module Principles
|
|
5
8
|
# What this tool prints, from plain values a controller hands it. views/CLAUDE.md owns the boundary.
|
|
6
9
|
module Views
|
|
@@ -10,6 +13,9 @@ module Principles
|
|
|
10
13
|
# what to do after mapping: with a principle's first member, or in git the first since the map's last commit, so
|
|
11
14
|
# members mapped in one sitting do not each repeat it (#1025).
|
|
12
15
|
class MapAddedTo
|
|
16
|
+
COMPLETENESS_QUESTION = "Is every carrier of the same rule mapped, and should any member belong to another " \
|
|
17
|
+
"principle? "
|
|
18
|
+
|
|
13
19
|
#: bool
|
|
14
20
|
attr_reader :keeps_others_held
|
|
15
21
|
|
|
@@ -19,13 +25,61 @@ module Principles
|
|
|
19
25
|
#: bool
|
|
20
26
|
attr_reader :reminded
|
|
21
27
|
|
|
22
|
-
#: (?keeps_others_held: bool, ?correction_may_be_open: bool, ?reminded: bool
|
|
23
|
-
|
|
28
|
+
#: (?keeps_others_held: bool, ?correction_may_be_open: bool, ?reminded: bool,
|
|
29
|
+
#| ?asks_about_completeness: bool, ?new_scope: NewLoadingScope) -> void
|
|
30
|
+
def initialize(keeps_others_held: false, correction_may_be_open: false, reminded: true,
|
|
31
|
+
asks_about_completeness: false, new_scope: NewLoadingScope.new)
|
|
24
32
|
@keeps_others_held = keeps_others_held
|
|
25
33
|
@correction_may_be_open = correction_may_be_open
|
|
26
34
|
@reminded = reminded
|
|
35
|
+
@asks_about_completeness = asks_about_completeness
|
|
36
|
+
@new_scope = new_scope
|
|
27
37
|
freeze
|
|
28
38
|
end
|
|
39
|
+
|
|
40
|
+
# This immutable reminder context with the model's decision to ask about coverage, not a completeness verdict.
|
|
41
|
+
#: (asks: bool) -> MapAddedTo
|
|
42
|
+
def with_completeness_question(asks:)
|
|
43
|
+
MapAddedTo.new(keeps_others_held: @keeps_others_held, correction_may_be_open: @correction_may_be_open,
|
|
44
|
+
reminded: @reminded, asks_about_completeness: asks, new_scope: @new_scope)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# This immutable addition context with the model's new-scope facts, preserving its original reminder flags.
|
|
48
|
+
#: (NewLoadingScope) -> MapAddedTo
|
|
49
|
+
def with_loading_scope(scope)
|
|
50
|
+
MapAddedTo.new(keeps_others_held: @keeps_others_held, correction_may_be_open: @correction_may_be_open,
|
|
51
|
+
reminded: @reminded, asks_about_completeness: @asks_about_completeness, new_scope: scope)
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
#: () -> Hash[String, untyped]
|
|
55
|
+
def added_facts = @new_scope.to_h
|
|
56
|
+
|
|
57
|
+
# The guidance after adding member, from this map's before-save reminder and correction facts.
|
|
58
|
+
#: (PrintedPrinciple, member: String, invocation: Invocation, in_git: bool) -> String
|
|
59
|
+
def after_member(principle, member:, invocation:, in_git:)
|
|
60
|
+
"#{@new_scope.note}#{COMPLETENESS_QUESTION if @asks_about_completeness && @reminded}" \
|
|
61
|
+
"#{claimed_by_a_fix(member, invocation) if @correction_may_be_open && @reminded}" \
|
|
62
|
+
"#{after_adding(principle, invocation, in_git:) if @reminded}"
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
private
|
|
66
|
+
|
|
67
|
+
# How an added member joins an open correction, ending its command's line.
|
|
68
|
+
#: (String, Invocation) -> String
|
|
69
|
+
def claimed_by_a_fix(member, invocation)
|
|
70
|
+
"If you hold a correction request from submit-answer (phase correction) and this member fixes one of its " \
|
|
71
|
+
"findings, name #{member} in the changed_members of the fixed disposition; the next full audit assesses " \
|
|
72
|
+
"it.\nTo submit the correction instead: #{invocation.submit_answer("REQUEST_ID")}\n"
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
# Commit/inspection guidance and the first audit's place, once the map lists every member.
|
|
76
|
+
#: (PrintedPrinciple, Invocation, in_git: bool) -> String
|
|
77
|
+
def after_adding(principle, invocation, in_git:)
|
|
78
|
+
"Commit #{principle.file} as it changes, so the project's history shows each change; in git, start-audit " \
|
|
79
|
+
"refuses a map that is not committed.\n" \
|
|
80
|
+
"To see the map so far: #{invocation.in_project("show-principle", principle.id)}\n" \
|
|
81
|
+
"#{FirstAudit.new(invocation, in_git:).after_mapping(principle.id, keeps_others_held: @keeps_others_held)}"
|
|
82
|
+
end
|
|
29
83
|
end
|
|
30
84
|
end
|
|
31
85
|
end
|