principles 0.0.7 → 0.0.8

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 (331) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +383 -0
  3. data/LICENSE +202 -0
  4. data/NOTICE +4 -0
  5. data/README.md +111 -0
  6. data/exe/principles +20 -0
  7. data/lib/principles/after_commit_hook_options.rb +2 -2
  8. data/lib/principles/cli.rb +50 -42
  9. data/lib/principles/command_line.rb +22 -16
  10. data/lib/principles/command_routes.rb +20 -6
  11. data/lib/principles/controllers/acknowledgement.rb +29 -74
  12. data/lib/principles/controllers/acknowledgements.rb +154 -0
  13. data/lib/principles/controllers/after_commit_report.rb +44 -0
  14. data/lib/principles/controllers/answer.rb +48 -18
  15. data/lib/principles/controllers/answer_phase.rb +20 -3
  16. data/lib/principles/controllers/assessment.rb +32 -11
  17. data/lib/principles/controllers/audit.rb +43 -19
  18. data/lib/principles/controllers/audit_completion.rb +21 -12
  19. data/lib/principles/controllers/command.rb +13 -12
  20. data/lib/principles/controllers/correction.rb +15 -7
  21. data/lib/principles/controllers/first_audit_brief.rb +40 -0
  22. data/lib/principles/controllers/full_audit_request.rb +41 -82
  23. data/lib/principles/controllers/hook_setup.rb +49 -0
  24. data/lib/principles/controllers/inventory.rb +10 -8
  25. data/lib/principles/controllers/mapping.rb +2 -2
  26. data/lib/principles/controllers/member_acknowledgement.rb +32 -21
  27. data/lib/principles/controllers/member_entries.rb +4 -4
  28. data/lib/principles/controllers/member_problems_report.rb +62 -16
  29. data/lib/principles/controllers/members_a_commit_changed.rb +3 -3
  30. data/lib/principles/controllers/members_to_assess.rb +23 -20
  31. data/lib/principles/controllers/meta_principle_setup.rb +5 -6
  32. data/lib/principles/controllers/open_correction.rb +42 -0
  33. data/lib/principles/controllers/parts_to_read.rb +117 -0
  34. data/lib/principles/controllers/repoint.rb +1 -1
  35. data/lib/principles/controllers/running_tool.rb +56 -6
  36. data/lib/principles/controllers/session_start_report.rb +62 -0
  37. data/lib/principles/controllers/survey.rb +2 -2
  38. data/lib/principles/data/audit_files.rb +7 -7
  39. data/lib/principles/data/bounded_file.rb +1 -1
  40. data/lib/principles/data/candidate_files_found.rb +6 -3
  41. data/lib/principles/data/command-steps.json +61 -6
  42. data/lib/principles/data/expected_type.rb +3 -3
  43. data/lib/principles/data/first_parent_log.rb +1 -1
  44. data/lib/principles/data/head_reflog.rb +74 -0
  45. data/lib/principles/data/hook_input.rb +59 -0
  46. data/lib/principles/data/ignored_by_git.rb +2 -2
  47. data/lib/principles/data/known_fields.rb +1 -1
  48. data/lib/principles/data/linked_path.rb +1 -1
  49. data/lib/principles/data/map_files.rb +2 -2
  50. data/lib/principles/data/principles_on_path.rb +83 -0
  51. data/lib/principles/data/principles_subfolder.rb +1 -1
  52. data/lib/principles/data/project_files.rb +10 -3
  53. data/lib/principles/data/repository.rb +14 -7
  54. data/lib/principles/data/running_version.rb +10 -8
  55. data/lib/principles/data/schema_check.rb +5 -5
  56. data/lib/principles/data/schemas/acknowledgement-answer.schema.json +86 -21
  57. data/lib/principles/data/schemas/acknowledgements-answer.schema.json +9 -2
  58. data/lib/principles/data/schemas/assessment-answer.schema.json +43 -22
  59. data/lib/principles/data/schemas/audit-record.schema.json +29 -20
  60. data/lib/principles/data/schemas/command-steps.schema.json +1 -1
  61. data/lib/principles/data/schemas/correction-answer-guide.schema.json +1 -1
  62. data/lib/principles/data/schemas/correction-answer.schema.json +9 -9
  63. data/lib/principles/data/schemas/member-map.schema.json +3 -3
  64. data/lib/principles/data/schemas/repointing-answer.schema.json +1 -1
  65. data/lib/principles/error.rb +4 -4
  66. data/lib/principles/failure_refusal.rb +57 -0
  67. data/lib/principles/invocation_options.rb +4 -4
  68. data/lib/principles/launch.rb +49 -0
  69. data/lib/principles/list_open_findings_options.rb +1 -1
  70. data/lib/principles/models/accepted_loading.rb +2 -2
  71. data/lib/principles/models/acknowledged_check.rb +23 -11
  72. data/lib/principles/models/acknowledgement.rb +34 -18
  73. data/lib/principles/models/acknowledgement_left_as_printed.rb +7 -15
  74. data/lib/principles/models/acknowledgement_refusal.rb +25 -10
  75. data/lib/principles/models/acknowledgements.rb +45 -29
  76. data/lib/principles/models/acknowledgements_across.rb +68 -0
  77. data/lib/principles/models/activation.rb +2 -2
  78. data/lib/principles/models/after_commit_input.rb +115 -0
  79. data/lib/principles/models/agent_loads.rb +1 -1
  80. data/lib/principles/models/answer_fields.rb +2 -2
  81. data/lib/principles/models/answer_place.rb +3 -3
  82. data/lib/principles/models/answer_text.rb +2 -2
  83. data/lib/principles/models/answered_time.rb +4 -4
  84. data/lib/principles/models/assessment_answer.rb +10 -10
  85. data/lib/principles/models/assessment_basis.rb +2 -2
  86. data/lib/principles/models/assessment_left_as_printed.rb +1 -1
  87. data/lib/principles/models/assessment_report.rb +6 -7
  88. data/lib/principles/models/audit.rb +33 -34
  89. data/lib/principles/models/audit_record.rb +54 -28
  90. data/lib/principles/models/audit_records.rb +13 -13
  91. data/lib/principles/models/audit_start.rb +3 -3
  92. data/lib/principles/models/audited_member_lines.rb +1 -1
  93. data/lib/principles/models/candidate_files.rb +18 -10
  94. data/lib/principles/models/candidate_inventory.rb +6 -6
  95. data/lib/principles/models/candidate_outline.rb +9 -9
  96. data/lib/principles/models/carried_assessments.rb +18 -3
  97. data/lib/principles/models/carried_member.rb +5 -5
  98. data/lib/principles/models/changed_regions.rb +92 -0
  99. data/lib/principles/models/check_result_guide.rb +50 -0
  100. data/lib/principles/models/check_since_last_audit.rb +5 -4
  101. data/lib/principles/models/cited_files.rb +4 -4
  102. data/lib/principles/models/command_steps.rb +3 -3
  103. data/lib/principles/models/commits_brought_in.rb +1 -1
  104. data/lib/principles/models/commits_since_base.rb +1 -1
  105. data/lib/principles/models/correction_answer.rb +2 -2
  106. data/lib/principles/models/correction_basis.rb +7 -7
  107. data/lib/principles/models/dated_line.rb +1 -2
  108. data/lib/principles/models/decided_prior_findings.rb +6 -6
  109. data/lib/principles/models/declared_map_changes.rb +5 -5
  110. data/lib/principles/models/disposition.rb +21 -21
  111. data/lib/principles/models/entry_file.rb +1 -1
  112. data/lib/principles/models/entry_files.rb +1 -1
  113. data/lib/principles/models/evidence_item.rb +1 -1
  114. data/lib/principles/models/evidence_lines_since.rb +2 -2
  115. data/lib/principles/models/evidence_replacements.rb +3 -3
  116. data/lib/principles/models/finding_write_ups.rb +12 -5
  117. data/lib/principles/models/findings_left_open.rb +4 -4
  118. data/lib/principles/models/first_full_audit.rb +32 -0
  119. data/lib/principles/models/first_raised_claim.rb +1 -1
  120. data/lib/principles/models/fix_only_fields.rb +1 -1
  121. data/lib/principles/models/head_moves.rb +66 -0
  122. data/lib/principles/models/hook_commands.rb +49 -4
  123. data/lib/principles/models/ignored_candidates.rb +1 -1
  124. data/lib/principles/models/instruction_named.rb +2 -3
  125. data/lib/principles/models/json_digest.rb +2 -2
  126. data/lib/principles/models/json_path_query.rb +1 -1
  127. data/lib/principles/models/kept_prior_finding.rb +9 -9
  128. data/lib/principles/models/last_completed_revision.rb +4 -5
  129. data/lib/principles/models/left_as_printed.rb +2 -2
  130. data/lib/principles/models/line_diff.rb +113 -0
  131. data/lib/principles/models/line_span.rb +1 -1
  132. data/lib/principles/models/list_member_problems_check.rb +4 -4
  133. data/lib/principles/models/listed_members.rb +7 -9
  134. data/lib/principles/models/loaded_files.rb +4 -5
  135. data/lib/principles/models/loading_decision.rb +3 -3
  136. data/lib/principles/models/loading_facts.rb +1 -1
  137. data/lib/principles/models/loads_to_check.rb +1 -1
  138. data/lib/principles/models/located_text.rb +1 -1
  139. data/lib/principles/models/mapped_principles.rb +2 -2
  140. data/lib/principles/models/member.rb +31 -4
  141. data/lib/principles/models/member_assessments.rb +8 -8
  142. data/lib/principles/models/member_elsewhere.rb +4 -4
  143. data/lib/principles/models/member_file.rb +4 -4
  144. data/lib/principles/models/member_grounds.rb +1 -1
  145. data/lib/principles/models/member_hashes_as_written.rb +1 -1
  146. data/lib/principles/models/member_lines.rb +29 -61
  147. data/lib/principles/models/member_loads.rb +2 -2
  148. data/lib/principles/models/member_moves.rb +1 -1
  149. data/lib/principles/models/member_problems.rb +14 -15
  150. data/lib/principles/models/member_repair_moves.rb +15 -9
  151. data/lib/principles/models/member_sighting.rb +10 -10
  152. data/lib/principles/models/member_snapshots.rb +1 -1
  153. data/lib/principles/models/member_state.rb +1 -1
  154. data/lib/principles/models/members_across_principles.rb +77 -0
  155. data/lib/principles/models/members_elsewhere.rb +2 -2
  156. data/lib/principles/models/members_sharing_lines.rb +7 -7
  157. data/lib/principles/models/meta_principle.rb +11 -4
  158. data/lib/principles/models/missing_files.rb +3 -3
  159. data/lib/principles/models/new_findings.rb +4 -4
  160. data/lib/principles/models/open_correction.rb +57 -0
  161. data/lib/principles/models/open_finding.rb +36 -31
  162. data/lib/principles/models/open_findings_elsewhere.rb +2 -2
  163. data/lib/principles/models/other_principles.rb +2 -2
  164. data/lib/principles/models/other_templates_placeholders.rb +17 -16
  165. data/lib/principles/models/outline_budget.rb +7 -7
  166. data/lib/principles/models/outline_group.rb +1 -1
  167. data/lib/principles/models/outline_section.rb +2 -2
  168. data/lib/principles/models/part_named.rb +41 -0
  169. data/lib/principles/models/placement.rb +2 -2
  170. data/lib/principles/models/principle.rb +13 -13
  171. data/lib/principles/models/principle_history.rb +8 -8
  172. data/lib/principles/models/principle_members.rb +14 -7
  173. data/lib/principles/models/principles_folder_move.rb +1 -1
  174. data/lib/principles/models/principles_on_path.rb +29 -0
  175. data/lib/principles/models/principles_package.rb +3 -3
  176. data/lib/principles/models/prior_decision_fields.rb +8 -8
  177. data/lib/principles/models/prior_finding_decision.rb +8 -8
  178. data/lib/principles/models/prior_finding_outcomes.rb +1 -1
  179. data/lib/principles/models/prior_findings.rb +5 -5
  180. data/lib/principles/models/problem_report.rb +26 -8
  181. data/lib/principles/models/project.rb +27 -19
  182. data/lib/principles/models/project_history.rb +18 -12
  183. data/lib/principles/models/quoted_change.rb +8 -8
  184. data/lib/principles/models/recent_decision.rb +3 -3
  185. data/lib/principles/models/record_format.rb +16 -10
  186. data/lib/principles/models/record_judged_against.rb +4 -4
  187. data/lib/principles/models/recorded_entry.rb +17 -8
  188. data/lib/principles/models/recorded_finding.rb +9 -9
  189. data/lib/principles/models/recorded_findings.rb +2 -2
  190. data/lib/principles/models/recorded_hashes.rb +2 -2
  191. data/lib/principles/models/recorded_members.rb +13 -13
  192. data/lib/principles/models/refusal_before_shape.rb +2 -2
  193. data/lib/principles/models/repoint.rb +3 -3
  194. data/lib/principles/models/report_hooks.rb +69 -0
  195. data/lib/principles/models/reported_check.rb +34 -31
  196. data/lib/principles/models/request_id.rb +18 -6
  197. data/lib/principles/models/runs_from.rb +7 -2
  198. data/lib/principles/models/sent_answer.rb +14 -12
  199. data/lib/principles/models/sent_prior_decisions.rb +1 -1
  200. data/lib/principles/models/session_start_input.rb +37 -0
  201. data/lib/principles/models/shape_problems_beside.rb +1 -1
  202. data/lib/principles/models/skill_loads.rb +1 -1
  203. data/lib/principles/models/stale_request.rb +59 -0
  204. data/lib/principles/models/still_holds_restatement.rb +6 -6
  205. data/lib/principles/models/submitted_answer.rb +1 -1
  206. data/lib/principles/models/template_placeholders.rb +6 -6
  207. data/lib/principles/models/text_within.rb +1 -1
  208. data/lib/principles/models/tracked_paths.rb +38 -0
  209. data/lib/principles/models/unchecked_members.rb +2 -2
  210. data/lib/principles/models/uncommitted_files.rb +1 -1
  211. data/lib/principles/models/uncommitted_outside_the_map.rb +2 -2
  212. data/lib/principles/models/waits_on.rb +1 -1
  213. data/lib/principles/models/write_up_opening.rb +5 -5
  214. data/lib/principles/models/write_up_pointer.rb +3 -3
  215. data/lib/principles/models/write_up_repoint.rb +2 -3
  216. data/lib/principles/positional_arguments.rb +13 -6
  217. data/lib/principles/prose_list.rb +1 -1
  218. data/lib/principles/session_start_options.rb +1 -1
  219. data/lib/principles/start_audit_options.rb +46 -12
  220. data/lib/principles/supported_ruby.rb +24 -7
  221. data/lib/principles/version.rb +2 -2
  222. data/lib/principles/views/acknowledged_since_last_audit.rb +2 -2
  223. data/lib/principles/views/acknowledgement_result.rb +97 -11
  224. data/lib/principles/views/activation_in_hand.rb +1 -1
  225. data/lib/principles/views/answered_request.rb +6 -2
  226. data/lib/principles/views/assessed_members.rb +50 -41
  227. data/lib/principles/views/assessment_request.rb +39 -36
  228. data/lib/principles/views/audit_changes.rb +4 -4
  229. data/lib/principles/views/audit_commit.rb +5 -4
  230. data/lib/principles/views/audit_result.rb +92 -53
  231. data/lib/principles/views/candidate_files_result.rb +7 -6
  232. data/lib/principles/views/check_notes.rb +29 -6
  233. data/lib/principles/views/check_result_template.rb +45 -34
  234. data/lib/principles/views/completed_audit_next_step.rb +44 -0
  235. data/lib/principles/views/context_parts.rb +112 -0
  236. data/lib/principles/views/correction_request.rb +44 -25
  237. data/lib/principles/views/diff_since_last_audit.rb +8 -6
  238. data/lib/principles/views/findings_result.rb +17 -6
  239. data/lib/principles/views/first_audit_brief.rb +51 -0
  240. data/lib/principles/views/first_audit_line.rb +45 -0
  241. data/lib/principles/views/help.rb +4 -4
  242. data/lib/principles/views/hook_setup_result.rb +91 -0
  243. data/lib/principles/views/instruction.rb +3 -3
  244. data/lib/principles/views/invocation.rb +14 -6
  245. data/lib/principles/views/json_with_entries_on_lines.rb +6 -35
  246. data/lib/principles/views/landed_since_base.rb +1 -1
  247. data/lib/principles/views/line_history_since_last_audit.rb +35 -0
  248. data/lib/principles/views/lines_shared_with_member.rb +6 -6
  249. data/lib/principles/views/loads_to_check_result.rb +8 -5
  250. data/lib/principles/views/map_added_to.rb +3 -3
  251. data/lib/principles/views/map_result.rb +9 -9
  252. data/lib/principles/views/member_change_since_baseline.rb +44 -23
  253. data/lib/principles/views/member_lines_beside_text.rb +43 -0
  254. data/lib/principles/views/member_repairs.rb +3 -2
  255. data/lib/principles/views/member_row.rb +2 -2
  256. data/lib/principles/views/members_a_commit_changed.rb +13 -10
  257. data/lib/principles/views/members_with_no_baseline.rb +3 -3
  258. data/lib/principles/views/meta_principle_passage.rb +1 -1
  259. data/lib/principles/views/meta_principle_result.rb +12 -5
  260. data/lib/principles/views/one_member_check_result_template.rb +7 -7
  261. data/lib/principles/views/open_findings_elsewhere_result.rb +5 -2
  262. data/lib/principles/views/open_findings_line.rb +25 -36
  263. data/lib/principles/views/other_principles_unjudged_result.rb +6 -3
  264. data/lib/principles/views/outside_the_map_result.rb +5 -2
  265. data/lib/principles/views/package_since_last_audit_result.rb +29 -6
  266. data/lib/principles/views/parts_index_result.rb +60 -0
  267. data/lib/principles/views/principle_read_result.rb +5 -6
  268. data/lib/principles/views/principle_with_changed_members.rb +1 -1
  269. data/lib/principles/views/principles_with_no_completed_audit.rb +1 -2
  270. data/lib/principles/views/printed_json.rb +51 -0
  271. data/lib/principles/views/printed_principle.rb +1 -1
  272. data/lib/principles/views/prior_finding_decisions_result.rb +4 -4
  273. data/lib/principles/views/prior_findings_result.rb +17 -14
  274. data/lib/principles/views/problem_lines.rb +39 -17
  275. data/lib/principles/views/problem_result.rb +40 -37
  276. data/lib/principles/views/prompts/acknowledge-a-change/judge-each-member-once-for-every-principle.md +2 -0
  277. data/lib/principles/views/prompts/acknowledge-a-change/read-the-deferred-findings-it-keeps.md +1 -0
  278. data/lib/principles/views/prompts/acknowledge-a-change/resolve-them-in-a-full-audit.md +1 -0
  279. data/lib/principles/views/prompts/acknowledge-a-change/say-whether-the-change-keeps-the-meaning.md +3 -3
  280. data/lib/principles/views/prompts/assess-every-member/confirm-each-write-up-pointer-the-answer-drops.md +2 -0
  281. data/lib/principles/views/prompts/assess-every-member/have-a-changed-check-reviewed-before-running-it.md +1 -1
  282. data/lib/principles/views/prompts/assess-every-member/have-a-new-check-reviewed-before-running-it.md +1 -1
  283. data/lib/principles/views/prompts/assess-every-member/judge-a-carried-assessment-citing-a-decided-finding.md +3 -0
  284. data/lib/principles/views/prompts/assess-every-member/judge-a-submitted-carried-assessment-citing-a-decided-finding.md +5 -0
  285. data/lib/principles/views/prompts/assess-every-member/judge-the-keeping-under-the-release-since-the-last-audit.md +1 -1
  286. data/lib/principles/views/prompts/assess-every-member/keep-the-printed-review-basis-or-replace-it.md +1 -0
  287. data/lib/principles/views/prompts/assess-every-member/name-the-commit-that-made-the-check.md +1 -0
  288. data/lib/principles/views/prompts/assess-every-member/read-a-trimmed-instruction-whole.md +1 -1
  289. data/lib/principles/views/prompts/assess-every-member/read-the-request-in-parts.md +1 -0
  290. data/lib/principles/views/prompts/assess-every-member/why-each-member-is-judged-again.md +3 -2
  291. data/lib/principles/views/prompts/dispose-of-each-finding/answer-guide.json +1 -1
  292. data/lib/principles/views/prompts/dispose-of-each-finding/confirm-each-deferral-written-up-nowhere.md +2 -0
  293. data/lib/principles/views/prompts/dispose-of-each-finding/retain-assessment-and-correction.md +4 -4
  294. data/lib/principles/views/prompts/find-a-principle-to-map/where-the-inventory-looks.md +2 -2
  295. data/lib/principles/views/prompts/learn-what-a-command-does/list-candidate-files.md +4 -3
  296. data/lib/principles/views/prompts/learn-what-a-command-does/list-member-problems.md +6 -6
  297. data/lib/principles/views/prompts/learn-what-a-command-does/list-open-findings.md +11 -11
  298. data/lib/principles/views/prompts/learn-what-a-command-does/report-after-commit.md +14 -0
  299. data/lib/principles/views/prompts/learn-what-a-command-does/report-at-session-start.md +26 -0
  300. data/lib/principles/views/prompts/learn-what-a-command-does/show-answer-check.md +20 -18
  301. data/lib/principles/views/prompts/learn-what-a-command-does/show-first-audit-brief.md +19 -0
  302. data/lib/principles/views/prompts/learn-what-a-command-does/show-hook-setup.md +13 -0
  303. data/lib/principles/views/prompts/learn-what-a-command-does/show-meta-principle-passage.md +3 -1
  304. data/lib/principles/views/prompts/learn-what-a-command-does/show-open-correction.md +12 -0
  305. data/lib/principles/views/prompts/learn-what-a-command-does/start-audit.md +21 -22
  306. data/lib/principles/views/prompts/learn-what-a-command-does/submit-answer.md +5 -4
  307. data/lib/principles/views/prompts/report-the-completed-audit/commit-only-what-the-audit-changed.md +2 -2
  308. data/lib/principles/views/prompts/run-a-first-audit-in-the-background/follow-the-brief.md +18 -0
  309. data/lib/principles/views/prompts/set-principles-up/offer-the-report-hooks.md +2 -0
  310. data/lib/principles/views/prompts/set-principles-up/wire-the-report-hooks-with-the-user.md +8 -0
  311. data/lib/principles/views/prompts/start-a-session/act-on-the-open-findings.md +3 -4
  312. data/lib/principles/views/prompts/start-a-session/every-loaded-line-costs-every-session.md +1 -1
  313. data/lib/principles/views/prompts/start-a-session/hand-the-first-audit-to-a-subagent.md +3 -0
  314. data/lib/principles/views/prompts/start-a-session/run-each-command-above.md +1 -0
  315. data/lib/principles/views/prompts/start-a-session/start-no-second-first-audit.md +2 -0
  316. data/lib/principles/views/prompts.rb +1 -1
  317. data/lib/principles/views/read_the_change.rb +36 -0
  318. data/lib/principles/views/record_waiting_on_an_upgrade.rb +2 -2
  319. data/lib/principles/views/repoint_result.rb +1 -1
  320. data/lib/principles/views/report_hooks_offer.rb +25 -0
  321. data/lib/principles/views/request_part.rb +5 -5
  322. data/lib/principles/views/request_parts.rb +1 -1
  323. data/lib/principles/views/session_start_report.rb +46 -0
  324. data/lib/principles/views/shell_word.rb +1 -1
  325. data/lib/principles/views/trimmed_instructions_note.rb +30 -0
  326. data/lib/principles/views/visible_text.rb +1 -1
  327. data/lib/principles/views/workflow_diagram.rb +1 -1
  328. data/principles.gemspec +44 -0
  329. metadata +83 -14
  330. data/lib/principles/views/prompts/start-a-session/it-returns-after-each-clear-or-compaction-too.md +0 -1
  331. data/lib/principles/views/prompts/start-a-session/it-returns-at-each-session-start.md +0 -1
@@ -2,7 +2,7 @@
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
3
  "$id": "member-map.schema.json",
4
4
  "title": "Member map",
5
- "description": "A principle's committed map, .principles/maps/ID.json: what the principle is, and each member that carries it. Fields this schema does not name are allowed, so an older version can read a map a newer one wrote (D29).",
5
+ "description": "A principle's committed map, .principles/maps/ID.json: what the principle is, and each member that carries it. Fields this schema does not name are allowed, so an older version can read a map a newer one wrote.",
6
6
  "type": "object",
7
7
  "required": ["description", "members"],
8
8
  "properties": {
@@ -10,7 +10,7 @@
10
10
  "description": { "type": "string", "minLength": 1 },
11
11
  "activation": {
12
12
  "type": "object",
13
- "description": "When the principle's work is in hand, as the agent declared it with change-activation (D38): when files matching one of its globs are read or changed, when its work is invoked, or always. change-activation writes files only with when files; a hand-edited map is not yet checked for that.",
13
+ "description": "When the principle's work is in hand, as the agent declared it with change-activation: when files matching one of its globs are read or changed, when its work is invoked, or always. change-activation writes files only with when files; a hand-edited map is not yet checked for that.",
14
14
  "required": ["when"],
15
15
  "additionalProperties": false,
16
16
  "properties": {
@@ -31,7 +31,7 @@
31
31
  "ending_at": { "type": "string", "minLength": 1 },
32
32
  "role": { "type": "string", "minLength": 1 },
33
33
  "key": { "type": "string", "minLength": 1, "description": "What the member is known by across moves, which its audit record files its hash under. Absent, it is the member's id. move-member stores the old id here on a member's first move, and add-member gives a member a key of its own when its id is the key of a member that moved away." },
34
- "check": { "type": "string", "minLength": 1, "description": "The command that enforces this member, which an audit asks the agent to run and report. This tool never runs it (D30)." }
34
+ "check": { "type": "string", "minLength": 1, "description": "The command that enforces this member, which an audit asks the agent to run and report. This tool never runs it." }
35
35
  }
36
36
  }
37
37
  }
@@ -2,7 +2,7 @@
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
3
  "$id": "repointing-answer.schema.json",
4
4
  "title": "Repointing answer",
5
- "description": "What an agent answers a repoint of a principle's open findings' write-ups with (D59): the request's id and basis, then for each finding a new recorded_at, or null to leave it, and a one-line reason. Fields this tool does not read are refused (D29). Models::Repoint locates each new pointer.",
5
+ "description": "What an agent answers a repoint of a principle's open findings' write-ups with: the request's id and basis, then for each finding a new recorded_at, or null to leave it, and a one-line reason. Fields this tool does not read are refused. Models::Repoint locates each new pointer.",
6
6
  "type": "object",
7
7
  "additionalProperties": false,
8
8
  "required": ["request_id", "basis", "repoints"],
@@ -10,7 +10,7 @@ module Principles
10
10
 
11
11
  # A command a refusal's repair names for values it holds, such as a member id, left unquoted, since a model
12
12
  # cannot quote: the controller prints it through Views::Invocation, the one owner of shell quoting, after its
13
- # purpose and a colon, on a line of its own (D56, #729). options are flags with their values, quoted the same
13
+ # purpose and a colon, on a line of its own. options are flags with their values, quoted the same
14
14
  # way; usage is this tool's own placeholder text, such as "--role ROLE", left for the agent to fill.
15
15
  class RepairCommand
16
16
  #: String
@@ -34,7 +34,7 @@ module Principles
34
34
  #: Hash[String, untyped]
35
35
  attr_reader :payload
36
36
 
37
- # fields are the failing JSON pointers of a malformed file or answer, each with what is wrong there (D29).
37
+ # fields are the failing JSON pointers of a malformed file or answer, each with what is wrong there.
38
38
  #: (String, String, String, ?String?, ?fields: Array[Hash[String, String]]?) -> void
39
39
  def initialize(code, message, repair, path = nil, fields: nil)
40
40
  super(message)
@@ -64,7 +64,7 @@ module Principles
64
64
  end
65
65
 
66
66
  # This refusal with each of its commands printed by the block, after its purpose, a line each after the repair's
67
- # text (D56).
67
+ # text.
68
68
  #: () { (RepairCommand) -> String } -> Error
69
69
  def printing_commands(&)
70
70
  return self if @commands.empty?
@@ -75,7 +75,7 @@ module Principles
75
75
 
76
76
  # This refusal, when it names under did_you_mean the one mapped id an id it was given nearly matches, with its
77
77
  # repair led by the command the block prints for that id; this tool never runs a command on the near miss
78
- # itself (D56, #729). Otherwise this refusal as it is.
78
+ # itself. Otherwise this refusal as it is.
79
79
  #: () { (String) -> String } -> Error
80
80
  def rerun_with_near_miss(&)
81
81
  mapped = payload["did_you_mean"] or return self
@@ -0,0 +1,57 @@
1
+ # typed: strict
2
+ # frozen_string_literal: true
3
+
4
+ require "optparse"
5
+ require_relative "command_line"
6
+
7
+ module Principles
8
+ # The JSON object an agent reads for a failure that is not one of this tool's refusals: a usage error, a file the
9
+ # system would not read or write, or a file of the wrong shape, each with its code and repair.
10
+ class FailureRefusal
11
+ # The repair for a shape error raised from this tool's own code. Such an error cannot say which file was at
12
+ # fault, so the repair names every file a command reads, and blames none.
13
+ SHAPE_REPAIR = "A file this command read is not in the shape this tool writes: the map in " \
14
+ ".principles/maps/ID.json, its audit record in .principles/audits/ID.json, or the answer given " \
15
+ "with --file. Compare it with git, or with the answer to fill its request printed, which " \
16
+ "show-open-correction ID prints for a correction."
17
+
18
+ # executable is the invocation a usage error's repair tells the agent to run --help with.
19
+ #: (StandardError, executable: String) -> void
20
+ def initialize(error, executable:)
21
+ @error = error
22
+ @executable = executable
23
+ freeze
24
+ end
25
+
26
+ # The exit status: 2 for a usage error, 1 for any other.
27
+ #: () -> Integer
28
+ def status = @error.is_a?(OptionParser::ParseError) ? 2 : 1
29
+
30
+ #: () -> Hash[Symbol, String]
31
+ def payload
32
+ case @error
33
+ when OptionParser::ParseError
34
+ failure(status: "usage_error", code: "invalid_invocation", repair: usage_repair)
35
+ when SystemCallError
36
+ failure(status: "refused", code: "filesystem_error",
37
+ repair: "Check the project path and file permissions, then retry.")
38
+ else
39
+ failure(status: "refused", code: "invalid_shape", repair: SHAPE_REPAIR)
40
+ end
41
+ end
42
+
43
+ private
44
+
45
+ # The repair a refused command line carries for the command it names, or the advice to see every command.
46
+ #: () -> String
47
+ def usage_repair
48
+ error = @error
49
+ error.is_a?(CommandLine::UsageRefusal) ? error.repair : "To see every command: #{@executable} --help"
50
+ end
51
+
52
+ #: (status: String, code: String, repair: String) -> Hash[Symbol, String]
53
+ def failure(status:, code:, repair:)
54
+ { status: status, code: code, message: @error.message, repair: repair }
55
+ end
56
+ end
57
+ end
@@ -9,15 +9,15 @@ module Principles
9
9
  class InvocationOptions
10
10
  # The options that take a value; --help, -h and --version take none.
11
11
  VALUE_OPTIONS = %w[project file description path section starting-at ending-at query role
12
- check session-start commits-after hook-event as instruction].freeze #: Array[String]
13
- # The options that take no value, as list-member-problems --short (#291).
12
+ check session-start commits-after hook-event as instruction part].freeze #: Array[String]
13
+ # The options that take no value, as list-member-problems --short.
14
14
  FLAG_OPTIONS = %w[short lines when-invoked always write-ups confirm].freeze #: Array[String]
15
15
  # The options that may be given more than once, each value kept in order, as change-activation --when-files and
16
- # start-audit --member (#1169).
16
+ # start-audit --member.
17
17
  LIST_OPTIONS = %w[when-files also member].freeze #: Array[String]
18
18
  # The words that name an option taking the next word as its value.
19
19
  VALUE_WORDS = (VALUE_OPTIONS + LIST_OPTIONS).map { |name| "--#{name}" }.freeze #: Array[String]
20
- # Every word the parser reads as an option, which an option taking a value refuses as its value (#750).
20
+ # Every word the parser reads as an option, which an option taking a value refuses as its value.
21
21
  WORDS = [*VALUE_WORDS, *FLAG_OPTIONS.map { |name| "--#{name}" }, "--help", "-h",
22
22
  "--version"].freeze #: Array[String]
23
23
 
@@ -0,0 +1,49 @@
1
+ # typed: strict
2
+ # frozen_string_literal: true
3
+
4
+ require_relative "version"
5
+ require_relative "data/running_version"
6
+ require_relative "data/principles_on_path"
7
+ require_relative "controllers/running_tool"
8
+
9
+ module Principles
10
+ # This process as its entry point launched it: the executable that entry point names itself by, the file it was
11
+ # launched as, PATH and the folder it started in, read here so that no layer reads them. It gives every controller
12
+ # the same RunningTool.
13
+ class Launch
14
+ #: (String) -> void
15
+ def initialize(executable)
16
+ @executable = executable
17
+ freeze
18
+ end
19
+
20
+ # This run of the tool: the executable it was invoked as, its version, and what PATH and its folder say of it,
21
+ # each read only when a command needs it.
22
+ #: () -> Controllers::RunningTool
23
+ def running_tool
24
+ Controllers::RunningTool.new(executable: @executable, version: -> { running_version },
25
+ other_on_path: ->(asking) { on_path.other(asking) },
26
+ launched_on_path: -> { on_path.own_first? },
27
+ cwd: started_in)
28
+ end
29
+
30
+ private
31
+
32
+ # The folder this run was started in, by its real path, as a project's root is given, or nil when it is gone.
33
+ #: () -> String?
34
+ def started_in
35
+ File.realpath(Dir.pwd)
36
+ rescue SystemCallError
37
+ nil
38
+ end
39
+
40
+ # The principles on PATH, against this run's own file: the plugin's bin or a RubyGems binstub when either
41
+ # launched it, else this tool's executable.
42
+ #: () -> Data::PrinciplesOnPath
43
+ def on_path = Data::PrinciplesOnPath.new(ENV.fetch("PATH", ""), own: File.expand_path($PROGRAM_NAME))
44
+
45
+ # The version of this tool that is running, as a build stamped it or a checkout's commit gives it.
46
+ #: () -> String
47
+ def running_version = Data::RunningVersion.new(release: RELEASE, built: BUILT_VERSION).to_s
48
+ end
49
+ end
@@ -4,7 +4,7 @@
4
4
  require_relative "invocation_options"
5
5
 
6
6
  module Principles
7
- # The options choosing which form list-open-findings prints, --lines or --short (#1156), and what is wrong with them
7
+ # The options choosing which form list-open-findings prints, --lines or --short, and what is wrong with them
8
8
  # as given, which CommandLine refuses as a usage error.
9
9
  class ListOpenFindingsOptions
10
10
  #: (InvocationOptions) -> void
@@ -7,9 +7,9 @@ module Principles
7
7
  # The domain logic, and the mediation of persistence. models/CLAUDE.md owns the boundary.
8
8
  module Models
9
9
  # The decision a completed audit accepted on a member's loading, kept in the member's record entry with the
10
- # member's text hash, as the next full audit shows it beside the member's row (#502 step 5). It changed since when
10
+ # member's text hash, as the next full audit shows it beside the member's row. It changed since when
11
11
  # what it weighed changed: when the member loads, or the member's own text. A file's size alone moves with every
12
- # edit elsewhere in a shared file, so it does not count (second alpha user on 5bedec4, #515).
12
+ # edit elsewhere in a shared file, so it does not count.
13
13
  class AcceptedLoading
14
14
  # entry is the member's record entry, holding loading_accepted and sha256.
15
15
  #: (Hash[String, untyped]) -> void
@@ -5,6 +5,7 @@ require_relative "../error"
5
5
  require_relative "acknowledgement_refusal"
6
6
  require_relative "answer_place"
7
7
  require_relative "audit_record"
8
+ require_relative "check_result_guide"
8
9
  require_relative "listed_members"
9
10
  require_relative "../prose_list"
10
11
  require_relative "member"
@@ -13,15 +14,15 @@ require_relative "reported_check"
13
14
  module Principles
14
15
  # The domain logic, and the mediation of persistence. models/CLAUDE.md owns the boundary.
15
16
  module Models
16
- # The run of its member's check that a one-member audit's answer reports (D30, D33): checked against the check
17
- # the record ran, carrying the line its last review rested on (D63), and accepted only once it passed, since a
18
- # check that failed or could not run is a full audit's to judge (#1071).
17
+ # The run of its member's check that a one-member audit's answer reports: checked against the check
18
+ # the record ran, carrying the line its last review rested on, and accepted only once it passed, since a
19
+ # check that failed or could not run is a full audit's to judge.
19
20
  class AcknowledgedCheck
20
21
  # Where a one-member audit's answer gives its check_result, which a refusal of a field in it points into.
21
22
  CHECK_RESULT = AnswerPlace.new("/check_result", "The acknowledgement") #: AnswerPlace
22
23
 
23
24
  # record is the completed record the member is judged against. listed is what the member's check lists now,
24
- # when it is this tool's own list-member-problems, which exits 3 while it lists the member (#1276).
25
+ # when it is this tool's own list-member-problems, which exits 3 while it lists the member.
25
26
  #: (member: Member, principle_id: String, record: AuditRecord, ?listed: ListedMembers?) -> void
26
27
  def initialize(member:, principle_id:, record:, listed: nil)
27
28
  @member = member
@@ -39,17 +40,18 @@ module Principles
39
40
  refuse("it has no check, so its answer reports no check_result") if !check && answer.key?("check_result")
40
41
  return unless check
41
42
 
42
- sent = answer["check_result"]
43
+ sent = answer["check_result"] or missing
43
44
  passed(ReportedCheck.new(AnswerPlace.new("", "The acknowledgement"), check,
44
- ran: @record.check_run_for(@member.key), kept: @record.check_review_for(@member.key))
45
+ ran: @record.check_run_for(@member.key), kept: @record.check_review_for(@member.key),
46
+ guide: CheckResultGuide::ACKNOWLEDGEMENT)
45
47
  .result(reported(sent, check)), sent)
46
48
  end
47
49
 
48
50
  private
49
51
 
50
52
  # result, once its check exited 0, or 3 for this tool's own list-member-problems while it lists only members
51
- # this answer acknowledges, which it lists no more once the record is committed (#1276). It always gives an
52
- # exit status, since the answer's schema refuses not_run_reason (#1115). sent is the check_result as given.
53
+ # this answer acknowledges, which it lists no more once the record is committed. It always gives an
54
+ # exit status, since the answer's schema refuses not_run_reason. sent is the check_result as given.
53
55
  #: (Hash[String, untyped], Hash[String, untyped]) -> Hash[String, untyped]
54
56
  def passed(result, sent)
55
57
  status = result.fetch("exit_status")
@@ -61,7 +63,7 @@ module Principles
61
63
 
62
64
  # Whether the member's check is this tool's own list-member-problems and lists only members this answer
63
65
  # acknowledges, refusing a listed_members that is not what it lists now, and a listing of another member,
64
- # which it would still list once the record is committed (#1276).
66
+ # which it would still list once the record is committed.
65
67
  #: (String, Hash[String, untyped]) -> bool
66
68
  def lists_only_the_acknowledged?(command, sent)
67
69
  listed = @listed or return false
@@ -73,7 +75,7 @@ module Principles
73
75
  "answer does not acknowledge, so a full audit judges it")
74
76
  end
75
77
 
76
- # Refuses a listed_members that is not what the member's own list-member-problems check lists now (#1276).
78
+ # Refuses a listed_members that is not what the member's own list-member-problems check lists now.
77
79
  #: (String) -> bot
78
80
  def misreported(command)
79
81
  raise CHECK_RESULT.child("listed_members").refusal(
@@ -83,10 +85,20 @@ module Principles
83
85
  )
84
86
  end
85
87
 
86
- # The check_result the answer reports, its command read as the request printed it when left out (#1166).
88
+ # The check_result the answer reports, its command read as the request printed it when left out.
87
89
  #: (untyped, String) -> untyped
88
90
  def reported(sent, check) = sent.is_a?(Hash) ? { "command" => check, **sent.except("listed_members") } : sent
89
91
 
92
+ # Refuses an answer for a checked member that reports no check_result, naming the instruction and template slot
93
+ # its request prints, not the full audit's answer_guide, which it does not.
94
+ #: () -> bot
95
+ def missing
96
+ raise CHECK_RESULT.refusal(
97
+ Error.new("invalid_check_result", "the member has a check, so its acknowledgement needs a check_result",
98
+ CheckResultGuide::ACKNOWLEDGEMENT.missing)
99
+ )
100
+ end
101
+
90
102
  #: (String) -> bot
91
103
  def refuse(why) = AcknowledgementRefusal.new(@member, @principle_id).refuse(why)
92
104
  end
@@ -5,6 +5,7 @@ require_relative "../error"
5
5
  require_relative "acknowledged_check"
6
6
  require_relative "acknowledgement_left_as_printed"
7
7
  require_relative "acknowledgement_refusal"
8
+ require_relative "acknowledgements"
8
9
  require_relative "request_id"
9
10
  require_relative "audit_record"
10
11
  require_relative "member"
@@ -17,15 +18,15 @@ require_relative "template_placeholders"
17
18
  module Principles
18
19
  # The domain logic, and the mediation of persistence. models/CLAUDE.md owns the boundary.
19
20
  module Models
20
- # A one-member audit (D33): the agent says a committed change to one member keeps its meaning, quoting a line
21
+ # A one-member audit: the agent says a committed change to one member keeps its meaning, quoting a line
21
22
  # from before and after it, so the record's baseline for that member moves on and --short stops repeating it.
22
23
  # Refused outside git, for a member no completed audit assessed, and for an unchanged or checked member.
23
24
  class Acknowledgement
24
25
  PHASE = "acknowledgement"
25
26
  # The text the answer's template prints in each field the agent judges, which an answer may not send back, so
26
- # a template returned as printed acknowledges nothing (#773). It prints no quotes, which an answer leaving them
27
- # out reads as first_changed_lines (#1111, #1166, #1170). After a pure insertion, meaning_kept's says that an
28
- # inserted line usually adds a rule, for an agent that reads the template alone (#1142).
27
+ # a template returned as printed acknowledges nothing. It prints no quotes, which an answer leaving them
28
+ # out reads as first_changed_lines. After a pure insertion, meaning_kept's says that an
29
+ # inserted line usually adds a rule, for an agent that reads the template alone.
29
30
  PLACEHOLDERS = TemplatePlaceholders.new(
30
31
  { "meaning_kept" => "true only if the member still says the same thing",
31
32
  "reason" => "Why, in one line of your own" },
@@ -33,9 +34,9 @@ module Principles
33
34
  "a line, which usually adds a rule" }
34
35
  ) #: TemplatePlaceholders
35
36
  # The text a checked member's template prints where its check's exit status goes, short since the request's
36
- # context says how to run the check (#1170).
37
+ # context says how to run the check.
37
38
  EXIT_STATUS_PLACEHOLDER = ReportedCheck::EXIT_STATUS_PLACEHOLDER #: String
38
- # The fields an answer may not send back as the template printed them, refused before its shape (#773, #1170).
39
+ # The fields an answer may not send back as the template printed them, refused before its shape.
39
40
  LEFT_AS_PRINTED = AcknowledgementLeftAsPrinted.new(
40
41
  PLACEHOLDERS, exit_status: EXIT_STATUS_PLACEHOLDER
41
42
  ) #: AcknowledgementLeftAsPrinted
@@ -58,16 +59,16 @@ module Principles
58
59
  end
59
60
 
60
61
  # The member's lines at its baseline and now, which the answer quotes; refused when the member cannot be found
61
- # where its baseline was read, since there is no line there to quote (#459); #baseline reads a moved member
62
- # where the map then placed it (#547).
62
+ # where its baseline was read, since there is no line there to quote; #baseline reads a moved member
63
+ # where the map then placed it.
63
64
  #: (MemberLines?) -> MemberLines
64
65
  def compared(lines)
65
66
  lines or refuse("it cannot be found in its file at its baseline commit #{last_judged_commit}")
66
67
  end
67
68
 
68
69
  # The member's baseline: the oldest of placements, from the commit it was last judged at on, that holds the
69
- # text the record vouches for, which is later than that commit when its full audit fixed it (#550), and as the
70
- # map then placed it when it has moved since (#547). Refused when none does, since that text is not the
70
+ # text the record vouches for, which is later than that commit when its full audit fixed it, and as the
71
+ # map then placed it when it has moved since. Refused when none does, since that text is not the
71
72
  # audited one.
72
73
  #: (Enumerable[Placement]) -> Placement
73
74
  def baseline(placements)
@@ -76,18 +77,18 @@ module Principles
76
77
  refuse("its text does not match the audit record at #{last_judged_commit} or any later commit")
77
78
  end
78
79
 
79
- # Where the member was at baseline, when that is not where it is now, as after a move (#547).
80
+ # Where the member was at baseline, when that is not where it is now, as after a move.
80
81
  #: (Placement) -> Hash[String, untyped]?
81
82
  def moved_from(baseline)
82
83
  baseline.reference unless baseline.reference == @member.reference
83
84
  end
84
85
 
85
- # The paths the change since baseline spans, which the baseline's placement owns (#551).
86
+ # The paths the change since baseline spans, which the baseline's placement owns.
86
87
  #: (Placement) -> Array[String]
87
88
  def paths_since(baseline) = baseline.paths_to(@member.path)
88
89
 
89
90
  # The commit the member was last judged at, when baseline is later than it, as when the member's own full
90
- # audit fixed it after its base (#550).
91
+ # audit fixed it after its base.
91
92
  #: (Placement) -> String?
92
93
  def audit_base(baseline)
93
94
  judged = last_judged_commit
@@ -118,19 +119,34 @@ module Principles
118
119
  end
119
120
 
120
121
  # The ids of the deferred and the accepted findings the last audit left on this member, which the request
121
- # and the acknowledgement name (D33), the accepted ones since an edit may bear on whether they still hold
122
- # (D35 brief, finding 11).
122
+ # and the acknowledgement name, the accepted ones since an edit may bear on whether they still hold
123
123
  #: () -> Hash[String, Array[String]]
124
124
  def open_findings
125
125
  { "deferred_findings" => findings_on_member("deferred"), "accepted_findings" => findings_on_member("accepted") }
126
126
  end
127
127
 
128
+ # Whether the last audit deferred a finding on this member, which acknowledging it leaves open for a full audit.
129
+ #: () -> bool
130
+ def keeps_deferred_findings? = findings_on_member("deferred").any?
131
+
132
+ # The answer's entry for its member, under members by the member's id as several members' entries are;
133
+ # refused when members leaves it out or holds another member.
134
+ #: (untyped) -> untyped
135
+ def entry_in(answer)
136
+ entries = answer.fetch("members")
137
+ refusal = Acknowledgements.unmatched(missing: [@member.id] - entries.keys, extra: entries.keys - [@member.id],
138
+ named_by: "basis.member_ids")
139
+ raise refusal if refusal
140
+
141
+ entries.fetch(@member.id)
142
+ end
143
+
128
144
  # The record with this member's baseline moved to its text now, once the answer is checked against the
129
145
  # member's lines at the baseline commit and now. The change keeps the check run the answer reported, which the
130
- # member's check_result cannot show was this run when the last audit's passed with the same command (#1112).
146
+ # member's check_result cannot show was this run when the last audit's passed with the same command.
131
147
  # into is the record the change is made to: the one this member is judged against, unless another member's
132
148
  # acknowledgement in the same answer has already changed it. listed is what the member's check lists now, when
133
- # it is this tool's own list-member-problems (#1276).
149
+ # it is this tool's own list-member-problems.
134
150
  #: (untyped, MemberLines, at: String, ?into: AuditRecord?, ?listed: ListedMembers?) -> AuditRecord
135
151
  def accepted(answer, lines, at:, into: nil, listed: nil)
136
152
  checked(answer, lines)
@@ -161,7 +177,7 @@ module Principles
161
177
  def quoted_change(lines) = QuotedChange.new(lines, member_id: @member.id)
162
178
 
163
179
  # The ids of the findings the last audit left open on this member with action, found by key, so a member moved
164
- # since keeps its findings (#547).
180
+ # since keeps its findings.
165
181
  #: (String) -> Array[String]
166
182
  def findings_on_member(action)
167
183
  acknowledgeable.left_open.select { |finding| finding.action == action && finding.on?(@member.key) }.map(&:id)
@@ -10,9 +10,9 @@ module Principles
10
10
  # The domain logic, and the mediation of persistence. models/CLAUDE.md owns the boundary.
11
11
  module Models
12
12
  # The fields a one-member audit's answer leaves as its template printed them, refused in one refusal before the
13
- # answer's shape: its judgement's, meaning_kept and reason (#773), and a checked member's exit_status, which was
14
- # otherwise refused as text with a repair offering the not_run_reason this template refuses (#1170). It holds the
15
- # placeholders the template prints in each; Acknowledgement::LEFT_AS_PRINTED is the one a one-member audit uses.
13
+ # answer's shape: its judgement's, meaning_kept and reason, and a checked member's exit_status, which was
14
+ # otherwise refused as text with a repair offering the not_run_reason this template refuses. It holds the
15
+ # placeholders the template prints in each; Acknowledgement::LEFT_AS_PRINTED is the one every acknowledgement uses.
16
16
  class AcknowledgementLeftAsPrinted
17
17
  include RefusalBeforeShape
18
18
 
@@ -20,20 +20,14 @@ module Principles
20
20
  EXIT_STATUS = "check_result.exit_status" #: String
21
21
 
22
22
  # judged holds the placeholders of the judgement's fields, exit_status the one printed where the status goes;
23
- # with each_member, they are read in each entry of an answer to several members' members, keyed by member id
24
- # (#1169), not in the answer itself.
25
- #: (TemplatePlaceholders, exit_status: String, ?each_member: bool) -> void
26
- def initialize(judged, exit_status:, each_member: false)
23
+ # they are read in each entry of the answer's members, keyed by member id, for one member as for several.
24
+ #: (TemplatePlaceholders, exit_status: String) -> void
25
+ def initialize(judged, exit_status:)
27
26
  @judged = judged
28
27
  @exit_status = exit_status
29
- @each_member = each_member
30
28
  freeze
31
29
  end
32
30
 
33
- # The same fields, read in each entry of an answer to several members (#1169).
34
- #: () -> AcknowledgementLeftAsPrinted
35
- def in_each_member = AcknowledgementLeftAsPrinted.new(@judged, exit_status: @exit_status, each_member: true)
36
-
37
31
  # @override
38
32
  #: (untyped, String, Array[Hash[String, String]]) -> void
39
33
  def refuse_in(answer, _source, shape_problems)
@@ -44,11 +38,9 @@ module Principles
44
38
 
45
39
  private
46
40
 
47
- # Each field left as printed, by name, beside its pointer: in the answer, or in each entry of its members.
41
+ # Each field left as printed in each entry of the answer's members, by name, beside its pointer.
48
42
  #: (Hash[String, untyped]) -> Hash[String, String]
49
43
  def pointers_in(answer)
50
- return left_in(answer).to_h { [it, "/#{it.tr(".", "/")}"] } unless @each_member
51
-
52
44
  members = answer["members"]
53
45
  return {} unless members.is_a?(Hash)
54
46
 
@@ -7,21 +7,22 @@ require_relative "member"
7
7
  module Principles
8
8
  # The domain logic, and the mediation of persistence. models/CLAUDE.md owns the boundary.
9
9
  module Models
10
- # Why a one-member audit cannot judge a member's change (D33), as the audit record finds it: each sends the agent
11
- # to the full audit, but a member whose text is the one last judged needs nothing at all (#553).
10
+ # Why a one-member audit cannot judge a member's change, as the audit record finds it: each sends the agent
11
+ # to the full audit, but a member whose text is the one last judged needs nothing at all.
12
12
  class AcknowledgementRefusal
13
- # Why a one-member audit cannot judge member's change against record, or nil when it can (D33): the record must
13
+ # Why a one-member audit cannot judge member's change against record, or nil when it can: the record must
14
14
  # be completed and have assessed the member, the member's text must differ from the one it assessed, its check
15
- # must be the one the record ran, so none new, changed, removed or last not run escapes a full audit's review
16
- # (D33, #1071). The one owner of these preconditions, which
17
- # list-member-problems asks before offering the audit that Acknowledgement refuses by them (#626, #632); git is
15
+ # must be the one the record ran, so none new, changed, removed or last not run escapes a full audit's review.
16
+ # The one owner of these preconditions, which
17
+ # list-member-problems asks before offering the audit that Acknowledgement refuses by them; git is
18
18
  # the callers' to know.
19
19
  #: (AuditRecord, Member, now_sha256: String?) -> AcknowledgementRefusal?
20
20
  def self.of(record, member, now_sha256:)
21
21
  members = record.members
22
22
  recorded = members.hash_for(member.key)
23
23
  check = members.check_since(member.key, member.check)
24
- reason = if !record.completed? then :not_completed
24
+ reason = if record.open_after_a_completed_audit? then :open
25
+ elsif !record.completed? then :not_completed
25
26
  elsif !recorded then :not_assessed
26
27
  elsif recorded == now_sha256 then :unchanged
27
28
  elsif check != :unchanged then check
@@ -30,7 +31,7 @@ module Principles
30
31
  end
31
32
 
32
33
  # principle_id is the member's principle, whose full audit each refusal names. reason, which raise! raises, is
33
- # :not_completed, :not_assessed, :unchanged, or how the member's check stands to the one the record
34
+ # :open, :not_completed, :not_assessed, :unchanged, or how the member's check stands to the one the record
34
35
  # ran, as RecordedMembers#check_since says; ran is the command that record ran, if any. Without a reason it
35
36
  # only refuses for a reason its caller states.
36
37
  #: (Member, String, ?Symbol?, ?ran: String?) -> void
@@ -54,6 +55,7 @@ module Principles
54
55
  def raise!
55
56
  case @reason
56
57
  when :unchanged then nothing_to_acknowledge
58
+ when :open then open_audit
57
59
  when :not_completed then refuse("#{@principle_id} has no completed audit, so no baseline has been judged")
58
60
  when :not_assessed then refuse("no completed audit assessed #{@member.id}")
59
61
  else refuse("#{check_since_record}, so a full audit reviews it")
@@ -62,7 +64,7 @@ module Principles
62
64
 
63
65
  private
64
66
 
65
- # How the member's check stands to the one the record ran, which a full audit reviews before it runs (#1071).
67
+ # How the member's check stands to the one the record ran, which a full audit reviews before it runs.
66
68
  #: () -> String
67
69
  def check_since_record
68
70
  case @reason
@@ -74,8 +76,21 @@ module Principles
74
76
  end
75
77
  end
76
78
 
79
+ # A full audit open on a completed one, waiting on its correction: the step to finish, not a missing audit to
80
+ # run, after which the member is acknowledged if it still differs from what that audit judged.
81
+ #: () -> bot
82
+ def open_audit
83
+ raise Error.new("cannot_acknowledge",
84
+ "#{@member.id} cannot be acknowledged: #{@principle_id} has a full audit open, waiting on " \
85
+ "its correction",
86
+ "Submit that correction to complete the audit; then acknowledge this member if it is still " \
87
+ "listed as changed.")
88
+ .ending_with([Error::RepairCommand.new(purpose: "To start the full audit again instead",
89
+ command: "start-audit", values: [@principle_id])])
90
+ end
91
+
77
92
  # A member whose text is the one last judged, as after a pure move, needs nothing: not an acknowledgement, and
78
- # not the full audit the other refusals send the agent to (#553).
93
+ # not the full audit the other refusals send the agent to.
79
94
  #: () -> bot
80
95
  def nothing_to_acknowledge
81
96
  raise Error.new("cannot_acknowledge",