principles 0.0.1 → 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.
Files changed (197) hide show
  1. checksums.yaml +4 -4
  2. data/lib/principles/cli.rb +10 -2
  3. data/lib/principles/command_line.rb +46 -35
  4. data/lib/principles/command_routes.rb +4 -3
  5. data/lib/principles/controllers/acknowledgement.rb +84 -18
  6. data/lib/principles/controllers/answer.rb +56 -125
  7. data/lib/principles/controllers/answer_phase.rb +54 -0
  8. data/lib/principles/controllers/assessment.rb +132 -0
  9. data/lib/principles/controllers/audit.rb +45 -140
  10. data/lib/principles/controllers/audit_completion.rb +8 -8
  11. data/lib/principles/controllers/command.rb +29 -14
  12. data/lib/principles/controllers/correction.rb +23 -13
  13. data/lib/principles/controllers/full_audit_request.rb +190 -0
  14. data/lib/principles/controllers/inventory.rb +46 -79
  15. data/lib/principles/controllers/mapping.rb +3 -3
  16. data/lib/principles/controllers/member_entries.rb +24 -12
  17. data/lib/principles/controllers/member_problems_report.rb +79 -0
  18. data/lib/principles/controllers/members_a_commit_changed.rb +12 -3
  19. data/lib/principles/controllers/members_to_assess.rb +35 -20
  20. data/lib/principles/controllers/meta_principle_setup.rb +5 -5
  21. data/lib/principles/controllers/repoint.rb +19 -23
  22. data/lib/principles/controllers/running_tool.rb +1 -1
  23. data/lib/principles/data/audit_files.rb +11 -7
  24. data/lib/principles/data/bounded_file.rb +20 -4
  25. data/lib/principles/data/command-steps.json +14 -13
  26. data/lib/principles/data/map_files.rb +2 -2
  27. data/lib/principles/data/principles_subfolder.rb +8 -1
  28. data/lib/principles/data/project_files.rb +12 -15
  29. data/lib/principles/data/project_root.rb +48 -0
  30. data/lib/principles/data/schema_check.rb +39 -11
  31. data/lib/principles/data/schemas/acknowledgement-answer.schema.json +17 -3
  32. data/lib/principles/data/schemas/answer-guide.schema.json +5 -10
  33. data/lib/principles/data/schemas/assessment-answer.schema.json +18 -9
  34. data/lib/principles/data/schemas/audit-record.schema.json +13 -1
  35. data/lib/principles/data/schemas/command-steps.schema.json +2 -1
  36. data/lib/principles/data/schemas/correction-answer.schema.json +2 -3
  37. data/lib/principles/invocation_options.rb +1 -1
  38. data/lib/principles/models/acknowledgement.rb +73 -84
  39. data/lib/principles/models/acknowledgement_refusal.rb +90 -0
  40. data/lib/principles/models/answer_place.rb +4 -0
  41. data/lib/principles/models/assessment_answer.rb +19 -17
  42. data/lib/principles/models/assessment_left_as_printed.rb +81 -0
  43. data/lib/principles/models/audit.rb +24 -15
  44. data/lib/principles/models/audit_record.rb +19 -20
  45. data/lib/principles/models/audit_records.rb +77 -4
  46. data/lib/principles/models/audit_start.rb +3 -3
  47. data/lib/principles/models/candidate_files.rb +30 -7
  48. data/lib/principles/models/candidate_inventory.rb +23 -6
  49. data/lib/principles/models/candidate_listing.rb +12 -3
  50. data/lib/principles/models/candidate_outline.rb +195 -0
  51. data/lib/principles/models/carried_assessments.rb +1 -1
  52. data/lib/principles/models/carried_member.rb +42 -0
  53. data/lib/principles/models/check_since_last_audit.rb +22 -9
  54. data/lib/principles/models/command_steps.rb +17 -1
  55. data/lib/principles/models/correction_basis.rb +1 -1
  56. data/lib/principles/models/decided_prior_findings.rb +9 -19
  57. data/lib/principles/models/declared_map_changes.rb +13 -12
  58. data/lib/principles/models/disposition.rb +28 -24
  59. data/lib/principles/models/evidence_replacements.rb +8 -1
  60. data/lib/principles/models/fix_only_fields.rb +67 -0
  61. data/lib/principles/models/frontmatter_fields.rb +9 -8
  62. data/lib/principles/models/instruction_named.rb +35 -0
  63. data/lib/principles/models/kept_prior_finding.rb +12 -7
  64. data/lib/principles/models/left_as_printed.rb +39 -0
  65. data/lib/principles/models/loaded_files.rb +5 -3
  66. data/lib/principles/models/loading_decision.rb +9 -2
  67. data/lib/principles/models/{member_maps.rb → mapped_principles.rb} +15 -15
  68. data/lib/principles/models/member.rb +1 -1
  69. data/lib/principles/models/member_assessments.rb +32 -9
  70. data/lib/principles/models/member_file.rb +35 -11
  71. data/lib/principles/models/member_grounds.rb +2 -2
  72. data/lib/principles/models/member_hashes_as_written.rb +44 -0
  73. data/lib/principles/models/member_lines.rb +63 -15
  74. data/lib/principles/models/member_moves.rb +3 -3
  75. data/lib/principles/models/member_problems.rb +50 -24
  76. data/lib/principles/models/member_repair_moves.rb +54 -0
  77. data/lib/principles/models/members_sharing_lines.rb +3 -3
  78. data/lib/principles/models/missing_files.rb +2 -2
  79. data/lib/principles/models/new_findings.rb +55 -0
  80. data/lib/principles/models/open_finding.rb +23 -13
  81. data/lib/principles/models/open_findings_elsewhere.rb +4 -0
  82. data/lib/principles/models/other_principles.rb +1 -1
  83. data/lib/principles/models/other_templates_placeholders.rb +113 -0
  84. data/lib/principles/models/outline_budget.rb +127 -0
  85. data/lib/principles/models/outline_group.rb +31 -0
  86. data/lib/principles/models/outline_section.rb +56 -0
  87. data/lib/principles/models/{member_map.rb → principle.rb} +45 -40
  88. data/lib/principles/models/{member_map_history.rb → principle_history.rb} +38 -15
  89. data/lib/principles/models/{map_members.rb → principle_members.rb} +15 -4
  90. data/lib/principles/models/prior_decision_fields.rb +47 -0
  91. data/lib/principles/models/prior_finding_decision.rb +38 -7
  92. data/lib/principles/models/prior_finding_outcomes.rb +10 -3
  93. data/lib/principles/models/prior_findings.rb +1 -1
  94. data/lib/principles/models/problem_report.rb +7 -3
  95. data/lib/principles/models/project.rb +22 -17
  96. data/lib/principles/models/project_history.rb +2 -2
  97. data/lib/principles/models/quoted_change.rb +137 -0
  98. data/lib/principles/models/recent_decision.rb +90 -0
  99. data/lib/principles/models/record_format.rb +109 -0
  100. data/lib/principles/models/recorded_entry.rb +6 -0
  101. data/lib/principles/models/recorded_finding.rb +4 -0
  102. data/lib/principles/models/recorded_hashes.rb +43 -0
  103. data/lib/principles/models/recorded_members.rb +33 -16
  104. data/lib/principles/models/refusal_before_shape.rb +21 -0
  105. data/lib/principles/models/repoint.rb +13 -0
  106. data/lib/principles/models/reported_check.rb +66 -24
  107. data/lib/principles/models/request_id.rb +24 -4
  108. data/lib/principles/models/sent_answer.rb +51 -0
  109. data/lib/principles/models/sent_prior_decisions.rb +31 -0
  110. data/lib/principles/models/shape_problems_beside.rb +40 -0
  111. data/lib/principles/models/still_holds_restatement.rb +7 -10
  112. data/lib/principles/models/submitted_answer.rb +34 -0
  113. data/lib/principles/models/template_placeholders.rb +71 -0
  114. data/lib/principles/models/text_within.rb +55 -0
  115. data/lib/principles/models/unchecked_members.rb +76 -0
  116. data/lib/principles/models/write_up_opening.rb +21 -4
  117. data/lib/principles/session_start_options.rb +29 -0
  118. data/lib/principles/start_audit_options.rb +52 -0
  119. data/lib/principles/version.rb +2 -2
  120. data/lib/principles/views/acknowledgement_result.rb +15 -7
  121. data/lib/principles/views/answer_head.rb +29 -0
  122. data/lib/principles/views/assessed_members.rb +129 -0
  123. data/lib/principles/views/assessment_request.rb +139 -78
  124. data/lib/principles/views/audit_result.rb +55 -42
  125. data/lib/principles/views/candidate_files_result.rb +41 -19
  126. data/lib/principles/views/check_notes.rb +44 -0
  127. data/lib/principles/views/check_result_template.rb +42 -30
  128. data/lib/principles/views/correction_request.rb +64 -0
  129. data/lib/principles/views/first_audit.rb +71 -0
  130. data/lib/principles/views/help.rb +3 -2
  131. data/lib/principles/views/instruction.rb +74 -0
  132. data/lib/principles/views/json_with_entries_on_lines.rb +51 -0
  133. data/lib/principles/views/loads_to_check_result.rb +13 -6
  134. data/lib/principles/views/map_added_to.rb +31 -0
  135. data/lib/principles/views/map_result.rb +38 -23
  136. data/lib/principles/views/member_change_since_baseline.rb +22 -5
  137. data/lib/principles/views/member_repairs.rb +21 -52
  138. data/lib/principles/views/members_a_commit_changed.rb +40 -10
  139. data/lib/principles/views/meta_principle_result.rb +3 -14
  140. data/lib/principles/views/one_member_check_result_template.rb +43 -0
  141. data/lib/principles/views/open_findings_elsewhere_result.rb +3 -3
  142. data/lib/principles/views/open_findings_line.rb +77 -23
  143. data/lib/principles/views/principle_read_result.rb +37 -28
  144. data/lib/principles/views/prior_finding_decisions_result.rb +13 -14
  145. data/lib/principles/views/prior_findings_result.rb +30 -18
  146. data/lib/principles/views/problem_lines.rb +14 -11
  147. data/lib/principles/views/problem_result.rb +30 -16
  148. data/lib/principles/views/prompts/acknowledge-a-change/run-the-check-and-report-it-passing.md +3 -0
  149. data/lib/principles/views/prompts/acknowledge-a-change/say-whether-the-change-keeps-the-meaning.md +6 -12
  150. data/lib/principles/views/prompts/assess-every-member/answer-guide.json +5 -10
  151. data/lib/principles/views/prompts/assess-every-member/assess-each-member-and-the-set.md +0 -4
  152. data/lib/principles/views/prompts/assess-every-member/claim-an-earlier-first-raised-at.md +7 -0
  153. data/lib/principles/views/prompts/assess-every-member/decide-each-prior-finding.md +6 -17
  154. data/lib/principles/views/prompts/assess-every-member/have-a-changed-check-reviewed-before-running-it.md +2 -2
  155. data/lib/principles/views/prompts/assess-every-member/have-a-new-check-reviewed-before-running-it.md +1 -1
  156. data/lib/principles/views/prompts/assess-every-member/judge-the-set-with-carried-assessments.md +5 -10
  157. data/lib/principles/views/prompts/assess-every-member/keep-or-change-what-a-deferral-waits-on.md +4 -0
  158. data/lib/principles/views/prompts/assess-every-member/read-a-compact-carried-member.md +8 -0
  159. data/lib/principles/views/prompts/assess-every-member/read-a-trimmed-instruction-whole.md +1 -0
  160. data/lib/principles/views/prompts/assess-every-member/review-a-new-or-changed-check-before-running-it.md +9 -0
  161. data/lib/principles/views/prompts/assess-every-member/run-the-check-then-report-it.md +2 -2
  162. data/lib/principles/views/prompts/assess-every-member/run-the-reviewed-check-and-say-what-its-review-rested-on.md +3 -6
  163. data/lib/principles/views/prompts/assess-every-member/say-what-observed-means.md +4 -0
  164. data/lib/principles/views/prompts/dispose-of-each-finding/fix-or-record-each-finding.md +5 -4
  165. data/lib/principles/views/prompts/find-a-principle-to-map/ask-the-owner-after-the-table.md +1 -0
  166. data/lib/principles/views/prompts/find-a-principle-to-map/ask-which-principle-to-map.md +2 -0
  167. data/lib/principles/views/prompts/find-a-principle-to-map/choose-one-principle.md +9 -5
  168. data/lib/principles/views/prompts/find-a-principle-to-map/leave-test-data-out-of-the-survey.md +1 -0
  169. data/lib/principles/views/prompts/find-a-principle-to-map/read-a-cut-section-back.md +3 -0
  170. data/lib/principles/views/prompts/find-a-principle-to-map/read-left-out-files.md +3 -0
  171. data/lib/principles/views/prompts/learn-what-a-command-does/add-member.md +4 -1
  172. data/lib/principles/views/prompts/learn-what-a-command-does/every-command-and-how-they-chain.md +7 -2
  173. data/lib/principles/views/prompts/learn-what-a-command-does/list-candidate-files.md +21 -6
  174. data/lib/principles/views/prompts/learn-what-a-command-does/list-member-problems.md +25 -23
  175. data/lib/principles/views/prompts/learn-what-a-command-does/list-open-findings.md +18 -16
  176. data/lib/principles/views/prompts/learn-what-a-command-does/list-principles.md +4 -2
  177. data/lib/principles/views/prompts/learn-what-a-command-does/select-the-project-root.md +1 -0
  178. data/lib/principles/views/prompts/learn-what-a-command-does/show-answer-check.md +7 -1
  179. data/lib/principles/views/prompts/learn-what-a-command-does/show-audit.md +3 -1
  180. data/lib/principles/views/prompts/learn-what-a-command-does/show-meta-principle-passage.md +7 -6
  181. data/lib/principles/views/prompts/learn-what-a-command-does/show-principle.md +12 -12
  182. data/lib/principles/views/prompts/learn-what-a-command-does/start-audit.md +30 -30
  183. data/lib/principles/views/prompts/learn-what-a-command-does/submit-answer.md +39 -39
  184. data/lib/principles/views/prompts/report-after-a-commit/the-commits-changed-these-members-waiting-on-an-upgrade.md +2 -0
  185. data/lib/principles/views/prompts/report-after-a-commit/the-principles-skill-is-where-to-start.md +1 -0
  186. data/lib/principles/views/prompts/report-the-completed-audit/commit-only-what-the-audit-changed.md +4 -0
  187. data/lib/principles/views/prompts/set-principles-up/first-keeping-audit-after-own-principle.md +10 -0
  188. data/lib/principles/views/prompts/set-principles-up/keep-them-held-between-audits.md +2 -0
  189. data/lib/principles/views/prompts/set-principles-up/name-the-step-each-member-lacks.md +2 -0
  190. data/lib/principles/views/prompts/set-principles-up/place-the-passage-with-the-user.md +11 -7
  191. data/lib/principles/views/prompts/start-a-session/see-the-earlier-line.md +2 -0
  192. data/lib/principles/views/record_waiting_on_an_upgrade.rb +54 -0
  193. data/lib/principles/views/request_part.rb +26 -6
  194. data/lib/principles/views/request_parts.rb +8 -0
  195. metadata +69 -9
  196. data/lib/principles/views/prompts/find-a-principle-to-map/ask-the-owner-before-mapping.md +0 -1
  197. data/lib/principles/views/prompts/set-principles-up/set-up-first.md +0 -2
@@ -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
@@ -0,0 +1,132 @@
1
+ # typed: strict
2
+ # frozen_string_literal: true
3
+
4
+ require "time"
5
+ require_relative "answer_phase"
6
+ require_relative "../models/assessment_left_as_printed"
7
+ require_relative "../models/audit"
8
+ require_relative "../models/request_id"
9
+ require_relative "../models/unchecked_members"
10
+ require_relative "audit_completion"
11
+ require_relative "full_audit_request"
12
+
13
+ module Principles
14
+ # Each runs one command: reads models, applies their rules and prints through a view.
15
+ # controllers/CLAUDE.md owns the boundary.
16
+ module Controllers
17
+ # A full audit's assessment, which submit-answer and show-answer-check hand over: this tool checks the request
18
+ # it answers and each member's assessment, then completes an audit with no findings or asks for the correction
19
+ # of its findings (D35, D50).
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)
29
+ basis = Models::AssessmentBasis.new(response.fetch("basis"))
30
+ judged_against = record_judged_against(audit)
31
+ basis.printed_after.refusing_stale_first(audit.id, @audit_records.find(audit.id)) do
32
+ judged_assessment(response, audit, prior, judged_against, basis)
33
+ end
34
+ end
35
+
36
+ # The prior findings the request an answer's head names listed, refused when that request, given the head's
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)
42
+ basis = Models::AssessmentBasis.new(head.fetch("basis"))
43
+ audit.check_assessment_request(request_id, basis: basis, committed: committed(basis.base, audit.map),
44
+ record: @audit_records.find(audit.id), loads: loads_to_check(audit))
45
+ end
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
+
58
+ private
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
+
64
+ # The assessment's fields and its decisions on the prior findings checked, then the audit completed or its
65
+ # correction asked for.
66
+ #: (untyped, Models::Audit, Models::PriorFindings, Models::RecordJudgedAgainst, Models::AssessmentBasis)
67
+ #| -> [untyped, Array[Models::AuditRecord]]
68
+ def judged_assessment(response, audit, prior, judged_against, basis)
69
+ assessed = audit.assessment(response, judged_against, Time.now.utc.iso8601) do |locator|
70
+ snapshot(locator)
71
+ end
72
+ findings = assessed.findings
73
+ decided = prior.decided(response["prior_finding_decisions"], findings, records: @audit_records) do |locator|
74
+ snapshot(locator)
75
+ end
76
+ correction(audit.assessed_start(basis.base, assessed, grounds(audit)), audit, findings, decided, basis)
77
+ end
78
+
79
+ # Completes an audit with no findings. Otherwise asks the agent to correct them. Each is refused once the last
80
+ # completed record changed after the assessment's request was printed, the completion unless it writes
81
+ # nothing (D50).
82
+ #: (Models::AuditStart, Models::Audit, Array[untyped], Models::DecidedPriorFindings, Models::AssessmentBasis)
83
+ #| -> [untyped, Array[Models::AuditRecord]]
84
+ def correction(start, audit, findings, decided, assessed)
85
+ if findings.empty?
86
+ return handed(AuditCompletion, replacing: assessed.printed_after).completed(start, audit, [], [], decided)
87
+ end
88
+
89
+ correction_request(start, audit, findings, decided, assessed)
90
+ end
91
+
92
+ # The correction request for findings, and outside git the open record that keeps what the audit began from.
93
+ # It is refused before it is printed once the last completed record changed, so no fix is made for an audit
94
+ # that cannot complete (D50). The check results travel in the basis, so the completed record keeps them (D30).
95
+ #: (Models::AuditStart, Models::Audit, Array[untyped], Models::DecidedPriorFindings, Models::AssessmentBasis)
96
+ #| -> [untyped, Array[Models::AuditRecord]]
97
+ def correction_request(start, audit, findings, decided, assessed)
98
+ assessed.printed_after.confirm_unchanged(audit.id, @audit_records.find(audit.id))
99
+ basis = printed_basis(start, findings, decided, assessed)
100
+ [request_to_correct(basis, audit, findings), open_record_changes(start, audit, basis.to_h)]
101
+ end
102
+
103
+ # The correction request for findings, answered under an id that digests its basis and the members now.
104
+ #: (Models::CorrectionBasis, Models::Audit, Array[untyped]) -> Views::CorrectionRequest
105
+ def request_to_correct(basis, audit, findings)
106
+ head = Views::AnswerHead.new(request_id: basis.request_id(audit.id, audit.now).to_s, basis: basis.to_h)
107
+ Views::CorrectionRequest.new(head: head, principle_id: audit.id, findings: findings,
108
+ placeholders: Models::Disposition::TEMPLATE_PLACEHOLDERS)
109
+ end
110
+
111
+ # The basis a correction request prints, for the agent to hand back with its answer.
112
+ # Its revision is the one the assessment was printed after, carried forward, so the correction is refused once
113
+ # that record changes (#646, D50).
114
+ #: (Models::AuditStart, Array[untyped], Models::DecidedPriorFindings, Models::AssessmentBasis)
115
+ #| -> Models::CorrectionBasis
116
+ def printed_basis(start, findings, decided, assessed)
117
+ Models::CorrectionBasis.printed(start, findings: findings, prior: decided, revision: assessed.revision)
118
+ end
119
+
120
+ # Outside git, the open record that keeps what the audit began from, and the last completed record, so a
121
+ # restarted audit still lists its prior findings (D35); in git, nothing.
122
+ #: (Models::AuditStart, Models::Audit, Hash[String, untyped]) -> Array[Models::AuditRecord]
123
+ def open_record_changes(start, audit, basis)
124
+ return [] if start.base
125
+
126
+ last = @audit_records.find(audit.id)&.last_completed
127
+ record = handed(AuditCompletion).record(start, basis.fetch("findings"), "open", audit.now, last)
128
+ @audit_records.changes(record)
129
+ end
130
+ end
131
+ end
132
+ end
@@ -2,33 +2,20 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  require_relative "command"
5
- require_relative "../models/audit"
6
- require_relative "../models/evidence_lines_since"
7
5
  require_relative "../models/findings_left_open"
8
- require_relative "../models/meta_principle"
9
- require_relative "../models/other_principles"
10
6
  require_relative "../models/finding_write_ups"
11
- require_relative "../models/uncommitted_outside_the_map"
12
- require_relative "../views/assessment_request"
13
7
  require_relative "../views/findings_result"
14
- require_relative "../views/loads_to_check_result"
15
- require_relative "../views/open_findings_elsewhere_result"
16
8
  require_relative "../views/open_findings_line"
17
- require_relative "../views/other_principles_unjudged_result"
18
- require_relative "../views/outside_the_map_result"
19
- require_relative "../views/package_since_last_audit_result"
20
- require_relative "../views/prior_findings_result"
21
9
  require_relative "acknowledgement"
22
- require_relative "members_to_assess"
10
+ require_relative "full_audit_request"
23
11
  require_relative "repoint"
24
12
 
25
13
  module Principles
26
14
  # Each runs one command: reads models, applies their rules and prints through a view.
27
15
  # controllers/CLAUDE.md owns the boundary.
28
16
  module Controllers
29
- # Starting and showing an audit: start-audit hands the agent the assessment request, and show-audit
30
- # prints the committed record. Starting writes nothing: the request id is a digest of what the request
31
- # depends on, so Answer checks the answer against the project as it is then (D25).
17
+ # Starting and showing an audit: start-audit hands the agent the assessment request, which FullAuditRequest
18
+ # builds for a full audit, and show-audit prints the committed record.
32
19
  class Audit < Command
33
20
  #: (String, String?, Hash[String, untyped]) -> untyped
34
21
  def call(command, id, options)
@@ -46,34 +33,55 @@ module Principles
46
33
  private
47
34
 
48
35
  # The audit start-audit's options ask for: a one-member audit with --member, a repoint of the open
49
- # 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).
50
38
  #: (String, Hash[String, untyped]) -> Hash[String, untyped]
51
39
  def started_audit(id, options)
52
- return acknowledge(id, options["member"]) if options["member"]
40
+ naming_the_executable { @audit_records.refuse_newer(id, version: @tool.version) }
41
+ return acknowledge(id, options["member"], to_fill: options["as"] == "template") if options["member"]
53
42
  return handed(Repoint).start(id) if options["write_ups"]
54
43
 
55
- naming_the_executable { start_audit(id) }
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)
51
+ naming_the_executable do
52
+ full = handed(FullAuditRequest, principle_id: id)
53
+ next full.instruction(options["instruction"]) if options["instruction"]
54
+
55
+ options["as"] ? full.to_fill : full.printed
56
+ end
56
57
  end
57
58
 
58
59
  # id's committed record. With none, an id no map has is refused as show-principle refuses it, since
59
- # starting its audit would be refused too; a record kept after its map was removed still shows (#577).
60
+ # starting its audit would be refused too; a record kept after its map was removed still shows (#577). One a
61
+ # later copy wrote says its audits wait on an upgrade (D85, V8).
60
62
  #: (String) -> Hash[String, untyped]
61
63
  def shown_audit(id)
62
- @member_maps.find(id) unless @audit_records.exist?(id)
63
- @audit_records.fetch(id).shown.merge("wrote" => [])
64
+ @principles.find(id) unless @audit_records.exist?(id)
65
+ @audit_records.fetch(id).shown.merge(waiting_beside(id), "wrote" => [])
64
66
  end
65
67
 
66
- # A one-member audit of member_id (D33).
67
- #: (String, String) -> Hash[String, untyped]
68
- def acknowledge(id, member_id)
69
- handed(Acknowledgement).start(id, member_id)
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)
70
73
  end
71
74
 
72
- # The findings the last completed audit of map id, or of every map, deferred or accepted (#292, D35).
75
+ # The findings the last completed audit of map id, or of every map, deferred or accepted (#292, D35). Across
76
+ # every map, it names each principle whose record a later copy wrote, so a list left without one that cannot be
77
+ # read does not look whole (D85, V8).
73
78
  #: (String?) -> Hash[String, untyped]
74
79
  def open_findings(id)
75
- listed = Models::FindingWriteUps.of(@project, @audit_records.of(@member_maps.ids_of(id))).listed
76
- Views::FindingsResult.new(invocation).open(listed).merge("wrote" => [])
80
+ listed = Models::FindingWriteUps.of(@project, open_records(id)).listed
81
+ result = Views::FindingsResult.new(invocation).open(listed)
82
+ waiting = id ? [] : @principles.ids.filter_map { waiting_on_an_upgrade(it) }
83
+ result = result.merge("records_waiting_on_an_upgrade" => waiting.map(&:to_h)) unless waiting.empty?
84
+ result.merge("wrote" => [])
77
85
  end
78
86
 
79
87
  # The one line saying how many findings are open and how long the oldest has waited until now, and which
@@ -81,122 +89,19 @@ module Principles
81
89
  # worded for the session's start, startup unless --session-start names another (#717).
82
90
  #: (String?, Hash[String, untyped]) -> Views::Lines
83
91
  def open_findings_line(id, options)
84
- records = @audit_records.of(@member_maps.ids_of(id))
92
+ records = open_records(id)
85
93
  waiting = Models::FindingsLeftOpen.of(records).waiting_at(Time.now.utc)
86
94
  Views::OpenFindingsLine.new(invocation).short(waiting, Models::FindingWriteUps.of(@project, records).not_found,
87
95
  source: options["session_start"] || "startup")
88
96
  end
89
97
 
90
- #: (String) -> untyped
91
- def start_audit(id)
92
- auditable = @member_maps.auditable(id)
93
- base = base_commit(id, auditable)
94
- current = @project.snapshots(auditable)
95
- audit = Models::Audit.new(map: auditable, now: current.hashes)
96
- listing = handed(MembersToAssess, principle_id: id).listed(audit, current)
97
- output = assessment_request(audit, base, listing)
98
- audit_result.present(with_record_notice(output, id, base)).merge("wrote" => [])
99
- end
100
-
101
- # The request, listing the findings the last completed audit left to decide, and with an id that digests them
102
- # (D35) and the revision of that audit's record (#653), but not the findings other principles leave open on
103
- # members sharing these lines (D62).
104
- #: (Models::Audit, String?, MembersToAssess::Listing) -> Hash[String, untyped]
105
- def assessment_request(audit, base, listing)
106
- record = @audit_records.find(audit.id)
107
- prior = audit.prior_findings(record)
108
- loads = loads_to_check(audit).listed
109
- basis = Models::AssessmentBasis.printed(base, record)
110
- audit_result.assessment_request(request_id: audit.assessment_id(basis, prior.digested, loads).to_s,
111
- request: request_to_assess(audit, basis, listing.members,
112
- parts_to_read(audit, prior, listing, loads)))
113
- end
114
-
115
- # What the agent assesses: the members, with what else it reads beside them (D60).
116
- #: (Models::Audit, Models::AssessmentBasis, Array[Hash[String, untyped]], Array[Views::RequestPart])
117
- #| -> Views::AssessmentRequest
118
- def request_to_assess(audit, basis, members, parts)
119
- Views::AssessmentRequest.new(principle_id: audit.id, description: audit.map.description, members: members,
120
- basis: basis.to_h, parts: parts)
121
- end
122
-
123
- # What the agent reads beside the members, in order (D60): the files outside the map that differ from the
124
- # base commit, which a check and the answer's evidence read as they are now (#409); the prior findings
125
- # (D35); the findings other principles leave open on members sharing these lines (D62); and the members to
126
- # check against the activation (#355); each when it lists any; and, on the meta-principle's audit, the release
127
- # since its last audit (D68) and the other principles with members no audit has judged (D71).
128
- #: (Models::Audit, Models::PriorFindings, MembersToAssess::Listing, Hash[String, untyped]?)
129
- #| -> Array[Views::RequestPart]
130
- def parts_to_read(audit, prior, listing, loads)
131
- [outside_the_map(audit), prior_findings_part(prior),
132
- Views::OpenFindingsElsewhereResult.new(listing.open_findings_elsewhere).part,
133
- Views::LoadsToCheckResult.new(invocation, loads, audit.id).part, package_since_last_audit(audit.map),
134
- other_principles_unjudged(audit.map)].compact
135
- end
136
-
137
- # The part listing each other principle with members no audit has judged as they are now, as
138
- # list-member-problems reports them, for the principle whose audit states them; nil for any other (D71).
139
- #: (Models::MemberMap) -> Views::RequestPart?
140
- def other_principles_unjudged(map)
141
- return unless map.keeps_others_held?
142
-
143
- listed = Models::OtherPrinciples.of(@project, but: map.id).unjudged.map do |other, members|
144
- Views::PrincipleWithChangedMembers.new(principle_id: other, members: members)
145
- end
146
- Views::OtherPrinciplesUnjudgedResult.new(listed).part
147
- end
148
-
149
- # The part stating the release of principles the last completed audit ran under beside the one now, and
150
- # whether the passage changed since, for a principle whose audit keeps one; nil for any other (D68).
151
- #: (Models::MemberMap) -> Views::RequestPart?
152
- def package_since_last_audit(map)
153
- now = @tool.release_kept_by(map) or return
154
- last = @audit_records.find(map.id)&.last_completed&.package
155
- Views::PackageSinceLastAuditResult.new(invocation, at_last_audit: last&.version, now: now.version,
156
- passage_changed: last && now.passage_changed_since?(last))
157
- .part
158
- end
159
-
160
- # The part listing the prior findings, in git with each evidence item saying whether its text changed since the
161
- # commit the audit that left them open was based on, and whether it is found now (#858, #877); nil when there are
162
- # none.
163
- #: (Models::PriorFindings) -> Views::RequestPart?
164
- def prior_findings_part(prior)
165
- shown = prior.shown { |item, base| Models::EvidenceLinesSince.of(item, since: base, project: @project).facts }
166
- Views::PriorFindingsResult.new(shown, last_audited_commit: prior.last_audited_commit).part
167
- end
168
-
169
- # The part naming the files outside the map that differ from the base commit, or nil when none do.
170
- #: (Models::Audit) -> Views::RequestPart?
171
- def outside_the_map(audit)
172
- outside = @history.uncommitted_outside(audited_files(audit.id, audit.map))
173
- Views::OutsideTheMapResult.new(outside && Models::UncommittedOutsideTheMap.new(outside).shown).part
174
- end
175
-
176
- # The commit the audit is judged against, over the map and every member's file; nil outside git.
177
- #: (String, Models::MemberMap) -> String?
178
- def base_commit(id, map)
179
- @history.base_commit(id, audited_files(id, map))
180
- end
181
-
182
- # The map's file and every member's file.
183
- #: (String, Models::MemberMap) -> Array[String]
184
- def audited_files(id, map)
185
- [@member_maps.file(id), *map.members.map(&:path)]
186
- end
187
-
188
- # The request, with a notice when the last audit's record was left uncommitted.
189
- #: (Hash[String, untyped], String, String?) -> Hash[String, untyped]
190
- def with_record_notice(output, id, base)
191
- return output unless base && uncommitted_record?(id)
192
-
193
- output.merge("notice" => audit_result.uncommitted_record_notice(@audit_records.file(id)))
194
- end
195
-
196
- # Whether the last audit's record exists but differs from the last commit, so it may be left behind.
197
- #: (String) -> bool
198
- def uncommitted_record?(id)
199
- @audit_records.exist?(id) && @history.uncommitted([@audit_records.file(id)]).any?
98
+ # The records whose open findings list-open-findings reads: id's, refused when a later copy wrote it in a
99
+ # form this copy cannot read, since an empty list would say it has none; or every principle's this copy can
100
+ # read, so one such record does not refuse the rest (D85, V8).
101
+ #: (String?) -> Array[Models::AuditRecord]
102
+ def open_records(id)
103
+ ids = @principles.ids_of(id)
104
+ id ? @audit_records.of(ids) : @audit_records.readable_of(ids)
200
105
  end
201
106
  end
202
107
  end
@@ -54,17 +54,17 @@ module Principles
54
54
  private
55
55
 
56
56
  # What the completed audit prints: its resolved and open findings, as the record it writes holds them, so they
57
- # agree with list-open-findings (#714); what it changed; and each prior finding's decision (D35).
57
+ # agree with list-open-findings (#714); what it changed; each prior finding's decision (D35); and, while
58
+ # principles is not set up, the offer to set it up (D95).
58
59
  #: (Models::AuditStart, Models::Audit, Array[Models::Disposition], Models::DecidedPriorFindings,
59
60
  #| Models::AuditRecord) -> untyped
60
61
  def completion_result(start, audit, dispositions, decided, written)
61
62
  decisions = Views::PriorFindingDecisionsResult.new(kept_ids: decided.kept_ids, closed: decided.closed,
62
- dropped: decided.dropped,
63
- waits_on_dropped: decided.waits_on_dropped,
64
- evidence_replaced: decided.evidence_replaced)
65
- audit_result.completion(principle_id: audit.id, resolved: written.resolved_ids(decided),
66
- open: written.open_ids, changes: changes(start, audit, dispositions, written),
67
- decisions: decisions)
63
+ changed: decided.changed)
64
+ completed = audit_result.completion(principle_id: audit.id, resolved: written.resolved_ids(decided),
65
+ open: written.open_ids,
66
+ changes: changes(start, audit, dispositions, written), decisions: decisions)
67
+ @principles.set_up? ? completed : audit_result.offering_set_up(completed)
68
68
  end
69
69
 
70
70
  # What the audit changed in the project: the files to commit, in git the commits since the base, the
@@ -73,7 +73,7 @@ module Principles
73
73
  def changes(start, audit, dispositions, written)
74
74
  changed = audit.changed_files(dispositions)
75
75
  added = start.added(now: audit.now)
76
- map = @map_changes&.files_to_commit(@member_maps.file(audit.id), added: added) || []
76
+ map = @map_changes&.files_to_commit(@principles.file(audit.id), added: added) || []
77
77
  files = @audit_records.files_to_commit(written, changed + map, start.reported)
78
78
  Views::AuditChanges.new(files_to_commit: files, landed: landed_since_base(start, audit), added: added,
79
79
  other_changed: other_changed(audit, changed),
@@ -8,14 +8,17 @@ require_relative "../models/audit"
8
8
  require_relative "../models/carried_assessments"
9
9
  require_relative "../models/member"
10
10
  require_relative "../models/member_grounds"
11
- require_relative "../models/member_map_history"
11
+ require_relative "../models/member_repair_moves"
12
+ require_relative "../models/principle_history"
12
13
  require_relative "../models/members_sharing_lines"
13
14
  require_relative "../models/project"
15
+ require_relative "../models/record_format"
14
16
  require_relative "../models/record_judged_against"
15
17
  require_relative "../views/audit_result"
16
18
  require_relative "../views/lines_shared_with_member"
17
19
  require_relative "../views/map_result"
18
20
  require_relative "../views/member_repairs"
21
+ require_relative "../views/record_waiting_on_an_upgrade"
19
22
  require_relative "running_tool"
20
23
 
21
24
  module Principles
@@ -37,7 +40,7 @@ module Principles
37
40
  def initialize(project, tool:)
38
41
  @project = project
39
42
  @tool = tool
40
- @member_maps = @project.member_maps #: Models::MemberMaps
43
+ @principles = @project.principles #: Models::MappedPrinciples
41
44
  @audit_records = @project.audit_records #: Models::AuditRecords
42
45
  @history = @project.history #: Models::ProjectHistory
43
46
  end
@@ -51,15 +54,15 @@ module Principles
51
54
  private
52
55
 
53
56
  # The history of principle_id's map, read through the collaborators this controller already holds.
54
- #: (String) -> Models::MemberMapHistory
55
- def map_history(principle_id)
56
- Models::MemberMapHistory.new(id: principle_id, history: @history, member_maps: @member_maps)
57
+ #: (String) -> Models::PrincipleHistory
58
+ def principle_history(principle_id)
59
+ Models::PrincipleHistory.new(id: principle_id, history: @history, principles: @principles)
57
60
  end
58
61
 
59
62
  # Saves the map, and nothing else, then prints the result the block builds from the map as written.
60
- #: (Models::MemberMap) { (Views::PrintedPrinciple) -> Hash[String, untyped] } -> untyped
63
+ #: (Models::Principle) { (Views::PrintedPrinciple) -> Hash[String, untyped] } -> untyped
61
64
  def write_map(map, &)
62
- wrote = @member_maps.save(map)
65
+ wrote = @principles.save(map)
63
66
  yield(printed_principle(map)).merge("wrote" => [wrote])
64
67
  end
65
68
 
@@ -94,8 +97,8 @@ module Principles
94
97
  def repaired(entry, repairs)
95
98
  principle = entry["principle"] or return entry
96
99
  id = entry["id"] or return entry
97
- fields = @member_maps.find(principle).member(id).merge(entry.slice("code")).merge("id" => id)
98
- entry.merge("repair_with" => repairs.commands(principle, fields))
100
+ moves = Models::MemberRepairMoves.new(@principles.find(principle).member(id), code: entry["code"]).to_a
101
+ entry.merge("repair_with" => repairs.commands(principle, id, moves))
99
102
  rescue Error
100
103
  entry
101
104
  end
@@ -118,6 +121,18 @@ module Principles
118
121
  Views::Invocation.new(executable: @tool.executable, project: @project.root)
119
122
  end
120
123
 
124
+ # Principle id as waiting on an upgrade, when a later copy wrote its record (D85, V8).
125
+ #: (String) -> Views::RecordWaitingOnAnUpgrade?
126
+ def waiting_on_an_upgrade(id)
127
+ format = @audit_records.newer_format(id) or return
128
+ Views::RecordWaitingOnAnUpgrade.new(principle: id, format: format.number, first_release: format.first_release,
129
+ newest: Models::RecordFormat::NEWEST, update: format.update_either_way)
130
+ end
131
+
132
+ # The line saying principle id's audits wait on an upgrade, as a field to print beside it, or none (#1067).
133
+ #: (String) -> Hash[String, String]
134
+ def waiting_beside(id) = waiting_on_an_upgrade(id)&.beside || {}
135
+
121
136
  #: () -> Views::AuditResult
122
137
  def audit_result
123
138
  Views::AuditResult.new(invocation)
@@ -142,19 +157,19 @@ module Principles
142
157
  def text(value, field) = Models::AnswerText.new(value).required(field)
143
158
 
144
159
  # The principle as the view prints it, with each member's id beside its locator.
145
- #: (Models::MemberMap, ?members: Array[Hash[String, untyped]]) -> Views::PrintedPrinciple
160
+ #: (Models::Principle, ?members: Array[Hash[String, untyped]]) -> Views::PrintedPrinciple
146
161
  def printed_principle(map, members: map.members_shown)
147
- Views::PrintedPrinciple.new(id: map.id, file: @member_maps.file(map.id), description: map.description,
162
+ Views::PrintedPrinciple.new(id: map.id, file: @principles.file(map.id), description: map.description,
148
163
  members: members, activation: map.activation)
149
164
  end
150
165
 
151
166
  # Each member's hash at base, or nil outside git.
152
- #: (String?, Models::MemberMap) -> Hash[String, String]?
167
+ #: (String?, Models::Principle) -> Hash[String, String]?
153
168
  def committed(base, map) = base ? @history.hashes_at(base, map.members) : nil
154
169
 
155
170
  # When each of the map's members loads, by id, which a full audit's request lists against the activation and
156
171
  # show-principle prints, from the project's hooks as hooks read them.
157
- #: (Models::MemberMap, ?Models::HookCommands) -> Hash[String, Models::MemberLoads]
172
+ #: (Models::Principle, ?Models::HookCommands) -> Hash[String, Models::MemberLoads]
158
173
  def member_loads(map, hooks = @project.hook_commands) = @project.member_loads(map.members, hooks)
159
174
 
160
175
  # The members a full audit lists to check against its activation, each with the decision its last completed
@@ -192,7 +207,7 @@ module Principles
192
207
 
193
208
  # The members sharing a line with member where it is now, in map and in the other maps, as add-member and
194
209
  # show-principle print them (#383, #541).
195
- #: (Models::Member, Models::MemberMap) -> Views::LinesSharedWithMember
210
+ #: (Models::Member, Models::Principle) -> Views::LinesSharedWithMember
196
211
  def lines_shared(member, map)
197
212
  Views::LinesSharedWithMember.new(**Models::MembersSharingLines.of(@project, member).facts_beside(map))
198
213
  end
@@ -1,7 +1,7 @@
1
1
  # typed: strict
2
2
  # frozen_string_literal: true
3
3
 
4
- require_relative "command"
4
+ require_relative "answer_phase"
5
5
  require_relative "../models/audit"
6
6
  require_relative "../models/correction_answer"
7
7
  require_relative "../models/declared_map_changes"
@@ -16,31 +16,41 @@ module Principles
16
16
  # A full audit's correction, which submit-answer and show-answer-check hand over: this tool checks each
17
17
  # disposition, and any members moved or whose role or check a fix changed, against the map and hashes the
18
18
  # audit began from, and completes the audit (D28, D40).
19
- class Correction < Command
19
+ class Correction < AnswerPhase
20
20
  # The result of answering a correction request, and the record change it makes, not yet written. A refused
21
21
  # answer to a request printed before the record changed is refused as stale, so the agent starts again rather
22
22
  # than repairing it (#671).
23
- #: (Models::RequestId, untyped, Models::Audit) -> [untyped, Array[Models::AuditRecord]]
24
- def answered(request_id, response, audit)
23
+ # @override
24
+ #: (Models::SubmittedAnswer) -> [untyped, Array[Models::AuditRecord]]
25
+ def answered(submitted)
26
+ request_id = submitted.request_id
27
+ response = submitted.response
28
+ audit = audit_now(request_id.principle_id)
25
29
  Models::CorrectionBasis.new(response.fetch("basis")).printed_after
26
30
  .refusing_stale_first(audit.id, @audit_records.find(audit.id)) do
27
31
  judged_correction(request_id, response, audit)
28
32
  end
29
33
  end
30
34
 
31
- # What each map entry a fix claims changed, from the map the audit the block gives started from and its map
32
- # now; the audit is built and the base map read only when a fix claims one (#462).
33
- #: (untyped) { () -> Models::Audit } -> Array[Hash[String, untyped]]
34
- def map_entry_changes(response, &)
35
+ # What each map entry a fix in the answer claims changed, from the map its audit started from and its map now;
36
+ # the audit is built and the base map read only when a fix claims one (#462).
37
+ # @override
38
+ #: (Models::SubmittedAnswer) -> Array[Hash[String, untyped]]
39
+ def map_entry_changes(submitted)
40
+ response = submitted.response
35
41
  changes = Models::DeclaredMapChanges.declared_in(response)
36
42
  changes.entry_changes do
37
- audit = yield
43
+ audit = audit_now(submitted.request_id.principle_id)
38
44
  [started_from(Models::CorrectionBasis.new(response.fetch("basis")), audit, changes), audit.map]
39
45
  end
40
46
  end
41
47
 
42
48
  private
43
49
 
50
+ # The placeholders a correction's template printed, its dispositions' (#1084).
51
+ #: (Models::RequestId) -> Hash[String, untyped]?
52
+ def printed_placeholders(_request_id) = Models::Disposition::TEMPLATE_PLACEHOLDERS
53
+
44
54
  # The result of judging a correction answer: its basis, moves and dispositions checked, and the audit completed.
45
55
  #: (Models::RequestId, untyped, Models::Audit) -> [untyped, Array[Models::AuditRecord]]
46
56
  def judged_correction(request_id, response, audit)
@@ -66,17 +76,17 @@ module Principles
66
76
  end
67
77
 
68
78
  # The map the audit began from, read from the base commit when the answer declares changes to the map.
69
- #: (Models::CorrectionBasis, Models::Audit, Models::DeclaredMapChanges) -> Models::MemberMap
79
+ #: (Models::CorrectionBasis, Models::Audit, Models::DeclaredMapChanges) -> Models::Principle
70
80
  def started_from(basis, audit, changes)
71
- audit.map_started_from(basis, changes, map_file: @member_maps.file(audit.id)) do |base|
81
+ audit.map_started_from(basis, changes, map_file: @principles.file(audit.id)) do |base|
72
82
  committed_map(base, audit.id)
73
83
  end
74
84
  end
75
85
 
76
86
  # The map id as the base commit holds it.
77
- #: (String, String) -> Models::MemberMap
87
+ #: (String, String) -> Models::Principle
78
88
  def committed_map(base, id)
79
- map_history(id).map_at(base)
89
+ principle_history(id).map_at(base)
80
90
  end
81
91
 
82
92
  # Each member's hash when the audit began, checked against the request id: from the map it started from at the