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
@@ -9,7 +9,7 @@ require_relative "sent_answer"
9
9
  module Principles
10
10
  # The domain logic, and the mediation of persistence. models/CLAUDE.md owns the boundary.
11
11
  module Models
12
- # Several members of one principle acknowledged in one request and one answer (#1169): each member's entry is
12
+ # Several members of one principle acknowledged in one request and one answer: each member's entry is
13
13
  # judged as its own one-member answer would be, and the answer is accepted for every member, in one record, or
14
14
  # refused for all, so no baseline moves unless each does.
15
15
  class Acknowledgements
@@ -19,6 +19,36 @@ module Principles
19
19
  #: (String) -> String
20
20
  def self.entry_pointer(member_id) = "/members/#{member_id.gsub("~", "~0").gsub("/", "~1")}"
21
21
 
22
+ # The refusal of an answer whose members leave out each of missing or answer each of extra, which no member of
23
+ # it is acknowledged under, named_by the basis field that names its members; nil when it does neither.
24
+ #: (missing: Array[String], extra: Array[String], ?named_by: String) -> Error?
25
+ def self.unmatched(missing:, extra:, named_by: "basis.member_ids")
26
+ fields = missing.map { problem(it, "is required, since #{named_by} names it") } +
27
+ extra.map { problem(it, "is not a member #{named_by} names") }
28
+ return if fields.empty?
29
+
30
+ Error.new("invalid_answer", "#{SentAnswer::NAMED} does not answer each member it names, so no member is " \
31
+ "acknowledged", SentAnswer::REPAIR, fields:)
32
+ end
33
+
34
+ # The problem with the answer's entry for member_id, at its JSON pointer.
35
+ #: (String, String) -> Hash[String, String]
36
+ def self.problem(member_id, text) = { "pointer" => entry_pointer(member_id), "problem" => text }
37
+ private_class_method :problem
38
+
39
+ # What the block gives for member_id's entry, a refusal of a field in it pointing at that field in the entry,
40
+ # since a member's acknowledgement points from the entry's root, for one member's answer too.
41
+ #: (String) { () -> AuditRecord } -> AuditRecord
42
+ def self.in_entry(member_id, &)
43
+ yield
44
+ rescue Error => e
45
+ fields = e.payload["fields"]
46
+ raise unless fields
47
+
48
+ entry = Acknowledgements.entry_pointer(member_id)
49
+ raise e.including("fields" => fields.map { it.merge("pointer" => entry + it.fetch("pointer")) })
50
+ end
51
+
22
52
  # The members as members names them, each id beside its one-member request's id, in the order named; refused
23
53
  # when one is named twice, which the answer would then judge once.
24
54
  #: (principle_id: String, members: Array[[String, RequestId]]) -> Acknowledgements
@@ -41,6 +71,15 @@ module Principles
41
71
  freeze
42
72
  end
43
73
 
74
+ # The members it acknowledges, in the order they were named.
75
+ #: () -> Array[String]
76
+ def member_ids = @requests.keys
77
+
78
+ # The members it acknowledges, each as its principle id and member id, as a member's own list-member-problems
79
+ # check lists them.
80
+ #: () -> Array[[String, String]]
81
+ def acknowledging = member_ids.map { [@principle_id, it] }
82
+
44
83
  # The request's id: each member's one-member request id, sorted, so it depends on which members it asks
45
84
  # about and on everything each of their requests depends on, not on the order they were named in.
46
85
  #: () -> RequestId
@@ -57,42 +96,19 @@ module Principles
57
96
  refuse_unmatched(entries.keys)
58
97
  ids = @requests.keys
59
98
  first = ids.fetch(0)
60
- ids.drop(1).reduce(in_entry(first) { accept.call(first, entries.fetch(first), nil) }) do |record, id|
61
- in_entry(id) { accept.call(id, entries.fetch(id), record) }
99
+ accepted_first = Acknowledgements.in_entry(first) { accept.call(first, entries.fetch(first), nil) }
100
+ ids.drop(1).reduce(accepted_first) do |record, id|
101
+ Acknowledgements.in_entry(id) { accept.call(id, entries.fetch(id), record) }
62
102
  end
63
103
  end
64
104
 
65
105
  private
66
106
 
67
- # What the block gives for member_id's entry, a refusal of a field in it pointing at that field in the entry,
68
- # since a member's acknowledgement points from the entry's root as an answer to one member does (#1276).
69
- #: (String) { () -> AuditRecord } -> AuditRecord
70
- def in_entry(member_id, &)
71
- yield
72
- rescue Error => e
73
- fields = e.payload["fields"]
74
- raise unless fields
75
-
76
- entry = Acknowledgements.entry_pointer(member_id)
77
- raise e.including("fields" => fields.map { it.merge("pointer" => entry + it.fetch("pointer")) })
78
- end
79
-
80
107
  # Refuses the answer whole unless its members hold an entry for each member its basis names, and for no other.
81
108
  #: (Array[String]) -> void
82
109
  def refuse_unmatched(answered)
83
- missing = (@requests.keys - answered).map { problem(it, "is required, since basis.member_ids names it") }
84
- extra = (answered - @requests.keys).map { problem(it, "is not a member basis.member_ids names") }
85
- fields = missing + extra
86
- return if fields.empty?
87
-
88
- raise Error.new("invalid_answer", "#{SentAnswer::NAMED} does not answer each member it names, so no member " \
89
- "is acknowledged", SentAnswer::REPAIR, fields:)
90
- end
91
-
92
- # The problem with the answer's entry for member_id, at its JSON pointer.
93
- #: (String, String) -> Hash[String, String]
94
- def problem(member_id, text)
95
- { "pointer" => Acknowledgements.entry_pointer(member_id), "problem" => text }
110
+ refusal = Acknowledgements.unmatched(missing: @requests.keys - answered, extra: answered - @requests.keys)
111
+ raise refusal if refusal
96
112
  end
97
113
  end
98
114
  end
@@ -0,0 +1,68 @@
1
+ # typed: strict
2
+ # frozen_string_literal: true
3
+
4
+ require_relative "acknowledgements"
5
+ require_relative "request_id"
6
+
7
+ module Principles
8
+ # The domain logic, and the mediation of persistence. models/CLAUDE.md owns the boundary.
9
+ module Models
10
+ # Members that several principles map, acknowledged for each of them in one request and one answer: one
11
+ # judgement per member, read as each principle's own acknowledgement of it, so one edit is judged once, not once
12
+ # per principle.
13
+ class AcknowledgementsAcross
14
+ # by_principle holds each principle's acknowledgement of the members it maps, under its id, and checked the ids
15
+ # of the members each one gives a check, under its id.
16
+ #: (Hash[String, Acknowledgements], ?checked: Hash[String, Array[String]]) -> void
17
+ def initialize(by_principle, checked: {})
18
+ @by_principle = by_principle.sort.to_h #: Hash[String, Acknowledgements]
19
+ @checked = checked
20
+ freeze
21
+ end
22
+
23
+ # The request's id: each principle's own request id for its members, sorted, under the first principle's id, so
24
+ # it depends on which principles and members it asks about, not on the order they were named in.
25
+ #: () -> RequestId
26
+ def request_id
27
+ RequestId.for(principle_id: @by_principle.keys.fetch(0), phase: Acknowledgements::PHASE,
28
+ parts: @by_principle.values.map { it.request_id.to_s }.sort)
29
+ end
30
+
31
+ # Every member some principle acknowledges, each once, in the order the principles name them.
32
+ #: () -> Array[String]
33
+ def member_ids = @by_principle.values.flat_map(&:member_ids).uniq
34
+
35
+ # The members it acknowledges for every principle, each as its principle id and member id, which a member's own
36
+ # list-member-problems check may list beside its own principle's.
37
+ #: () -> Array[[String, String]]
38
+ def acknowledging = @by_principle.values.flat_map(&:acknowledging)
39
+
40
+ # Each principle's record with its members' baselines moved, once the answer holds an entry for each member and
41
+ # no other: accept is given each principle's id, its acknowledgements and the answer as one to its members
42
+ # alone, and gives its record, or refuses the whole answer, so no record is written unless each is accepted. A
43
+ # member's check_result reports one run of its check, which answers each principle that checks the member, and
44
+ # is left out of the answer to a principle that does not.
45
+ #: (untyped) { (String, Acknowledgements, untyped) -> AuditRecord } -> Array[AuditRecord]
46
+ def accepted(answer, &accept)
47
+ entries = answer.fetch("members")
48
+ refusal = Acknowledgements.unmatched(missing: member_ids - entries.keys, extra: entries.keys - member_ids)
49
+ raise refusal if refusal
50
+
51
+ @by_principle.map do |id, several|
52
+ accept.call(id, several, answer.merge("members" => entries_for(id, entries.slice(*several.member_ids))))
53
+ end
54
+ end
55
+
56
+ private
57
+
58
+ # entries as principle id reads them: a member's check_result left out where id does not check the member.
59
+ #: (String, Hash[String, untyped]) -> Hash[String, untyped]
60
+ def entries_for(id, entries)
61
+ checked = @checked.fetch(id, [])
62
+ entries.to_h do |member_id, entry|
63
+ [member_id, checked.include?(member_id) ? entry : entry.except("check_result")]
64
+ end
65
+ end
66
+ end
67
+ end
68
+ end
@@ -6,7 +6,7 @@ require_relative "../error"
6
6
  module Principles
7
7
  # The domain logic, and the mediation of persistence. models/CLAUDE.md owns the boundary.
8
8
  module Models
9
- # When a principle's work is in hand, as the agent judged it (D38): when files matching its globs are read or
9
+ # When a principle's work is in hand, as the agent judged it: when files matching its globs are read or
10
10
  # changed, when its work is invoked, or always. This tool stores what the agent declared and does not choose it.
11
11
  class Activation
12
12
  FORMS = "Give exactly one of --when-files GLOB (repeat it for each glob), --when-invoked, or --always."
@@ -40,7 +40,7 @@ module Principles
40
40
 
41
41
  # What a full audit lists against this activation for the agent to weigh: the members that load at every
42
42
  # session start under a files activation; none under always, where the work is in hand in every session; and,
43
- # under invoked, a listing not built yet (#355, #523).
43
+ # under invoked, a listing not built yet.
44
44
  #: () -> String
45
45
  def full_audit_lists
46
46
  case @fields.fetch("when")
@@ -0,0 +1,115 @@
1
+ # typed: strict
2
+ # frozen_string_literal: true
3
+
4
+ require "json"
5
+
6
+ module Principles
7
+ module Models
8
+ # The JSON a host hands its hook after each shell call, as report-after-commit reads it: the event it ran on,
9
+ # when the call started, and the directories whose repositories the call may have committed in. Input it cannot
10
+ # read names no event, so the hook reports nothing rather than refuse.
11
+ class AfterCommitInput
12
+ # The events a host runs the after-commit hook on: Claude Code both, Codex PostToolUse alone.
13
+ EVENTS = %w[PostToolUse PostToolUseFailure].freeze #: Array[String]
14
+ # How many seconds after the call ended a host may start the hook on a loaded machine. The hook cannot tell a
15
+ # late start from a long call, so a move up to this many seconds, and one more, before the call is reported
16
+ # again: a repeat costs a report, where a miss leaves a commit's change unseen until the next session start.
17
+ LATE_START_S = 5
18
+ # Where a cd or a git -C may start: the command's start, or after ;, &, |, ( or ).
19
+ SEGMENTS = /[;&|()]/ #: Regexp
20
+ # A cd or git -C and its target: one word, or one layer of matching double or single quotes.
21
+ TARGET = /\A\s*(cd|git\s+-C)\s+("[^"]*"|'[^']*'|\S+)/ #: Regexp
22
+ # A target holding any of these, or starting with -, is not read, so no expansion is guessed at.
23
+ UNREAD = /["'$\\`]/ #: Regexp
24
+
25
+ # The event the host ran the hook on, or nil when there is nothing to report.
26
+ #: String?
27
+ attr_reader :event
28
+
29
+ # The second the call started, or earlier: see LATE_START_S.
30
+ #: Integer
31
+ attr_reader :started
32
+
33
+ # The hook's input as the process it runs in reads it, the one owner of that reading for the executable, before
34
+ # the rest of this tool loads, and for the command: started at clock, unless environment's PRINCIPLES_HOOK_NOW,
35
+ # a test seam no session sets, gives the second; with home as ~; and for input naming no cwd, the session's
36
+ # directory, as Claude Code names it in CLAUDE_PROJECT_DIR, or pwd.
37
+ #: (String, Hash[String, String], clock: Integer, home: String, pwd: String) -> AfterCommitInput
38
+ def self.read(text, environment, clock:, home:, pwd:)
39
+ new(text, now: Integer(environment.fetch("PRINCIPLES_HOOK_NOW", clock)), home: home,
40
+ fallback: environment.fetch("CLAUDE_PROJECT_DIR", pwd))
41
+ end
42
+
43
+ # now is the second the hook started; home is the home directory a leading ~ names; fallback the session's
44
+ # directory, for input naming no cwd.
45
+ #: (String, now: Integer, home: String, fallback: String) -> void
46
+ def initialize(text, now:, home:, fallback:)
47
+ given = parsed(text)
48
+ @event = EVENTS.find { it == given["hook_event_name"] } #: String?
49
+ @started = started_before(now, given["duration_ms"]) #: Integer
50
+ @cwd = text(given["cwd"]) || fallback #: String
51
+ tool_input = given["tool_input"]
52
+ @command = (text(tool_input["command"]) if tool_input.is_a?(Hash)) || "" #: String
53
+ @home = home
54
+ freeze
55
+ end
56
+
57
+ # The call's cwd, then each directory its command changed into with cd or ran git in with git -C, in order,
58
+ # each resolved from the cd before it. Targets are read by position, not by the shell's rules, so a cd in a
59
+ # subshell is taken as if it ran in turn, and only the first -C of a git is read.
60
+ #: () -> Array[String]
61
+ def directories
62
+ from = @cwd
63
+ targets = @command.split(SEGMENTS).filter_map do |segment|
64
+ word, target = segment.match(TARGET)&.captures
65
+ next unless word && target
66
+
67
+ resolved = resolved(unquoted(target), from) or next
68
+ from = resolved if word == "cd"
69
+ resolved
70
+ end
71
+ [@cwd, *targets]
72
+ end
73
+
74
+ private
75
+
76
+ # When a call that ended by now started, from its duration in milliseconds, rounded up to the second, and a
77
+ # second earlier, since a file's time and this clock both count whole seconds, and LATE_START_S earlier
78
+ # still. A duration that is not a positive whole number, or none, as Codex sends, reads as no time.
79
+ #: (Integer, untyped) -> Integer
80
+ def started_before(now, duration)
81
+ duration = 0 unless duration.is_a?(Integer) && duration.positive?
82
+ now - ((duration + 999) / 1000) - 1 - LATE_START_S
83
+ end
84
+
85
+ # A text field's value, or nil when it gives none.
86
+ #: (untyped) -> String?
87
+ def text(given) = given.is_a?(String) && !given.empty? ? given : nil
88
+
89
+ #: (String) -> String
90
+ def unquoted(target)
91
+ quoted = target.length > 1 && %w[" '].include?(target[0]) && target[0] == target[-1]
92
+ quoted ? target[1...-1].to_s : target
93
+ end
94
+
95
+ # target as a path from the directory from, or nil when it is not read.
96
+ #: (String, String) -> String?
97
+ def resolved(target, from)
98
+ return if target.empty? || target.start_with?("-") || target.match?(UNREAD)
99
+ return target if target.start_with?("/")
100
+ return @home if target == "~"
101
+ return "#{@home}/#{target.delete_prefix("~/")}" if target.start_with?("~/")
102
+
103
+ "#{from}/#{target}"
104
+ end
105
+
106
+ #: (String) -> Hash[String, untyped]
107
+ def parsed(text)
108
+ given = JSON.parse(text)
109
+ given.is_a?(Hash) ? given : {}
110
+ rescue JSON::ParserError
111
+ {}
112
+ end
113
+ end
114
+ end
115
+ end
@@ -10,7 +10,7 @@ module Principles
10
10
  # When Claude Code loads a project subagent's definition. Its description, which Claude reads to decide when
11
11
  # to delegate, loads at session start in the main session; its body is the subagent's own system prompt, loaded
12
12
  # in the subagent's context when Claude delegates to it. Claude Code reads .claude/agents recursively, from
13
- # the start folder up to the repository root, as its subagents documentation says; the #354 experiment saw
13
+ # the start folder up to the repository root, as its subagents documentation says; an experiment saw
14
14
  # a project subagent's description listed at start.
15
15
  class AgentLoads
16
16
  # An agent's definition: a Markdown file at any depth in a .claude/agents folder, at the root or below it.
@@ -21,7 +21,7 @@ module Principles
21
21
  #: (untyped, String) -> String
22
22
  def text(value, field) = AnswerText.new(value).required(field)
23
23
 
24
- # value as text, refused as field at its place in the answer, so one of many entries is found (#787).
24
+ # value as text, refused as field at its place in the answer, so one of many entries is found.
25
25
  #: (untyped, String, AnswerPlace) -> String
26
26
  def text_at(value, field, place)
27
27
  text(value, field)
@@ -56,7 +56,7 @@ module Principles
56
56
  end
57
57
  end
58
58
 
59
- # Where a finding is written up, located at its place in the answer, as the value its record keeps (#768).
59
+ # Where a finding is written up, located at its place in the answer, as the value its record keeps.
60
60
  #: (untyped, AnswerPlace) -> WriteUpPointer
61
61
  def write_up_pointer(reference, place)
62
62
  pointer(reference, place)
@@ -8,9 +8,9 @@ module Principles
8
8
  # The domain logic, and the mediation of persistence. models/CLAUDE.md owns the boundary.
9
9
  module Models
10
10
  # A place in an agent's answer: its JSON pointer, and whose part of the answer it is, such as "Finding F1".
11
- # A refusal about what sits there names both, so the agent can find the one pointer to repair (#702).
11
+ # A refusal about what sits there names both, so the agent can find the one pointer to repair.
12
12
  class AnswerPlace
13
- # What a pointer in an answer may do instead of quoting exactly a passage its file does not hold (#742).
13
+ # What a pointer in an answer may do instead of quoting exactly a passage its file does not hold.
14
14
  ELSEWHERE = " Or point it at text the file holds."
15
15
 
16
16
  #: String
@@ -35,7 +35,7 @@ module Principles
35
35
  #: (String | Integer) -> AnswerPlace
36
36
  def child(name) = AnswerPlace.new("#{@pointer}/#{name}", @subject)
37
37
 
38
- # error, a refusal about what sits here, saying whose it is and where, as a malformed answer's fields do (D29).
38
+ # error, a refusal about what sits here, saying whose it is and where, as a malformed answer's fields do.
39
39
  #: (Error) -> Error
40
40
  def refusal(error)
41
41
  payload = error.payload
@@ -6,7 +6,7 @@ require_relative "../error"
6
6
  module Principles
7
7
  # The domain logic, and the mediation of persistence. models/CLAUDE.md owns the boundary.
8
8
  module Models
9
- # A value an agent gave where its answer asks for text, the one owner of whether it wrote any (#796).
9
+ # A value an agent gave where its answer asks for text, the one owner of whether it wrote any.
10
10
  class AnswerText
11
11
  #: (untyped) -> void
12
12
  def initialize(value)
@@ -22,7 +22,7 @@ module Principles
22
22
  #: () -> bool
23
23
  def one_line? = written? && !@value.include?("\n")
24
24
 
25
- # The text where field requires it: as written, or refused naming field (#798).
25
+ # The text where field requires it: as written, or refused naming field.
26
26
  #: (String) -> String
27
27
  def required(field)
28
28
  unless written?
@@ -7,7 +7,7 @@ module Principles
7
7
  # The domain logic, and the mediation of persistence. models/CLAUDE.md owns the boundary.
8
8
  module Models
9
9
  # A time as an agent wrote it in an answer, such as a sighting's observed_at, which the record compares with
10
- # audited_at only in audited_at's own form: a UTC time to the second (#699).
10
+ # audited_at only in audited_at's own form: a UTC time to the second.
11
11
  class AnsweredTime
12
12
  #: (untyped) -> void
13
13
  def initialize(value)
@@ -35,7 +35,7 @@ module Principles
35
35
  end
36
36
 
37
37
  # The UTC time in audited_at's form that it names exactly, or nil when it names none: a date alone at its
38
- # midnight, and a time to the second with an offset as the same instant (#801). A fraction, or a date no
38
+ # midnight, and a time to the second with an offset as the same instant. A fraction, or a date no
39
39
  # calendar has, names none.
40
40
  #: () -> String?
41
41
  def exact_utc
@@ -49,7 +49,7 @@ module Principles
49
49
  end
50
50
 
51
51
  # It in audited_at's form when it names a time to the second exactly, with any UTC offset, so a clock's own
52
- # offset is the same instant (#1187); otherwise as given, a date alone included, for its sighting to refuse.
52
+ # offset is the same instant; otherwise as given, a date alone included, for its sighting to refuse.
53
53
  #: () -> untyped
54
54
  def in_audited_at_form
55
55
  return @value if date_alone?
@@ -58,7 +58,7 @@ module Principles
58
58
  end
59
59
 
60
60
  # Whether it is later than time, both UTC times in audited_at's form: a sighting is made before the answer that
61
- # reports it (#699), so a repair never prints one later (#801).
61
+ # reports it, so a repair never prints one later.
62
62
  #: (String) -> bool
63
63
  def after?(time) = Time.iso8601(@value) > Time.iso8601(time)
64
64
 
@@ -18,18 +18,18 @@ module Principles
18
18
  # An agent's answer to an assessment request: one assessment per member, an assessment of the set, a
19
19
  # recent decision under it, and findings. The block locates each piece of evidence in the project and
20
20
  # refuses one that does not resolve. members are the audited members, each checked one's assessment reporting
21
- # its check's result (D30); judged_against is the principle's record as it stands, which lists the members
22
- # whose loading it must decide (#355) and the assessments it may carry (D49); answered_at is when it came, which
23
- # no sighting it reports is after (#699).
21
+ # its check's result; judged_against is the principle's record as it stands, which lists the members
22
+ # whose loading it must decide and the assessments it may carry; answered_at is when it came, which
23
+ # no sighting it reports is after.
24
24
  class AssessmentAnswer
25
- # The text the template prints in collective_assessment, which an answer may not send back unchanged (#991).
25
+ # The text the template prints in collective_assessment, which an answer may not send back unchanged.
26
26
  COLLECTIVE_PLACEHOLDER = "How the members reinforce the principle, and any contradiction or missing " \
27
27
  "connection." #: String
28
28
  # How a field --as template's answer leaves as printed is read, printed once at the template's head in
29
- # left_as_printed_rule, where an agent filling it reads, which the answer may send back and this tool ignores
30
- # (#1043, D88).
29
+ # left_as_printed_rule, where an agent filling it reads, which the answer may send back and this tool ignores.
31
30
  LEFT_AS_PRINTED_RULE = "A field left as printed is read as omitted, as is this one: one saying \"else kept\" " \
32
- "keeps what it had, and null drops it where offered." #: String
31
+ "keeps what it had, and null drops it where offered. A sighting sets delivery to " \
32
+ "\"observed\" and adds observation, and observed_at for one before this audit." #: String
33
33
 
34
34
  #: (untyped, PrincipleMembers, answered_at: String, ?judged_against: RecordJudgedAgainst?)
35
35
  #| { (Locator) -> Hash[String, untyped] } -> void
@@ -58,7 +58,7 @@ module Principles
58
58
  def check_results = member_assessments.check_results
59
59
 
60
60
  # By member id, the fields this answer reports for each member's record entry: its assessment, which the next
61
- # full audit may carry forward (D49), its check's result (D30) and its accepted loading decision (#355), once
61
+ # full audit may carry forward, its check's result and its accepted loading decision, once
62
62
  # each listed member's is checked against loads.
63
63
  #: () -> Hash[String, Hash[String, untyped]]
64
64
  def entry_fields
@@ -73,7 +73,7 @@ module Principles
73
73
  end
74
74
 
75
75
  # The paths the recent decision's evidence cites, which the record does not keep but a completed audit asks to
76
- # commit when they differ from HEAD (#860); none when the decision was unavailable.
76
+ # commit when they differ from HEAD; none when the decision was unavailable.
77
77
  #: () -> Array[String]
78
78
  def recent_decision_paths
79
79
  recent_decision.paths
@@ -93,7 +93,7 @@ module Principles
93
93
 
94
94
  #: () -> Array[untyped]
95
95
  def checked_findings
96
- findings = NewFindings.new(@fields.array(@response["findings"], "findings")).raised
96
+ findings = NewFindings.new(@fields.array(@response.fetch("findings", []), "findings")).raised
97
97
  finding_ids = findings.each_with_index.map { |finding, index| finding_id(finding, index) }
98
98
  unless finding_ids.uniq == finding_ids
99
99
  raise Error.new("duplicate_finding", "Finding ids repeat",
@@ -9,7 +9,7 @@ module Principles
9
9
  module Models
10
10
  # What an assessment request prints as its basis, which the agent hands back with the answer: the commit the
11
11
  # audit is based on, nil outside git, and the revision of the last completed audit record when the request was
12
- # printed, nil when there was none, so the answer is refused once that record changed (#653, D50).
12
+ # printed, nil when there was none, so the answer is refused once that record changed.
13
13
  class AssessmentBasis
14
14
  # The basis printed for an audit based on base, after record, the principle's audit record now, if any.
15
15
  #: (String?, AuditRecord?) -> AssessmentBasis
@@ -31,7 +31,7 @@ module Principles
31
31
  def base = @fields["base_commit"]
32
32
 
33
33
  # The last completed record's revision when the request was printed, nil when there was none, which the
34
- # correction the assessment prints carries forward (D50).
34
+ # correction the assessment prints carries forward.
35
35
  #: () -> String?
36
36
  def revision = @fields["last_completed_revision"]
37
37
 
@@ -13,7 +13,7 @@ module Principles
13
13
  # The domain logic, and the mediation of persistence. models/CLAUDE.md owns the boundary.
14
14
  module Models
15
15
  # The judgements a full audit's answer, as sent, leaves as its template printed them: the members', the set's,
16
- # the recent decision's, a raised finding's text fields and a prior finding's decision (#991, #1010, #1040). It
16
+ # the recent decision's, a raised finding's text fields and a prior finding's decision. It
17
17
  # reads only what it finds in the shape it expects, so it may read an answer whose shape is still to be checked.
18
18
  class AssessmentLeftAsPrinted
19
19
  include RefusalBeforeShape
@@ -9,13 +9,13 @@ module Principles
9
9
  # The domain logic, and the mediation of persistence. models/CLAUDE.md owns the boundary.
10
10
  module Models
11
11
  # What an assessment reported beyond its findings, which its audit's record and commit carry: by member id, the
12
- # fields of each member's record entry, such as its assessment (D49) and its check's result (D30), and the paths
12
+ # fields of each member's record entry, such as its assessment and its check's result, and the paths
13
13
  # its recent decision cites, which the record does not keep but the completed audit asks to commit when they
14
- # differ from HEAD (#860). The open record keeps it for the correction to read back, and the correction's basis
15
- # carries only those paths and the record's digest (D87); this is the one owner of how it is carried.
14
+ # differ from HEAD. The open record keeps it for the correction to read back, and the correction's basis
15
+ # carries only those paths and the record's digest; this is the one owner of how it is carried.
16
16
  class AssessmentReport
17
17
  # The report of the answer assessed, each assessment it makes, rather than carries, with the grounds it was
18
- # judged on (D49).
18
+ # judged on.
19
19
  #: (AssessmentAnswer, MemberGrounds) -> AssessmentReport
20
20
  def self.answered(assessed, grounds)
21
21
  fields = assessed.entry_fields.to_h do |id, entry|
@@ -27,8 +27,7 @@ module Principles
27
27
 
28
28
  # The report an open record keeps for its correction to read back: each member's entry without the hash and key
29
29
  # the record adds, under the ids of any members moves moved, with the recent decision's paths, which the basis
30
- # carries (D87). A completed record read back so gives the report that completed it, for an identical retry
31
- # (D24).
30
+ # carries. A completed record read back so gives the report that completed it, for an identical retry.
32
31
  #: (AuditRecord, CorrectionBasis, MemberMoves) -> AssessmentReport
33
32
  def self.recorded(record, basis, moves)
34
33
  fields = record.to_h.fetch("members").transform_values { |entry| entry.except("sha256", "key") }
@@ -52,7 +51,7 @@ module Principles
52
51
  def entry_fields_of(id) = @entry_fields.fetch(id, {})
53
52
 
54
53
  # What a correction basis carries of it: the recent decision's paths, which no record keeps, when there are any.
55
- # The open record keeps the rest (D87).
54
+ # The open record keeps the rest.
56
55
  #: () -> Hash[String, untyped]
57
56
  def basis_fields = @recent_decision_paths.empty? ? {} : { "recent_decision_paths" => @recent_decision_paths }
58
57