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
@@ -11,8 +11,8 @@ module Principles
11
11
  # The domain logic, which loads and saves itself through data/. models/CLAUDE.md owns the boundary.
12
12
  module Models
13
13
  # One candidate file's outline, as the survey reads it in place of the file: its Markdown headings in order, and
14
- # under each its top-level list items. The second alpha user scripted a heading grep over 45 files to survey them,
15
- # and missed a principles section written as one numbered list, so this tool prints both (#1153).
14
+ # under each its top-level list items. One user scripted a heading grep over 45 files to survey them,
15
+ # and missed a principles section written as one numbered list, so this tool prints both.
16
16
  class CandidateOutline
17
17
  HEADING = /\A#+\s/
18
18
  FENCE = /\A\s*(?:```|~~~)/
@@ -25,19 +25,19 @@ module Principles
25
25
  # The most characters of an item printed, cut back to a whole word.
26
26
  ITEM_CHARACTERS = 60
27
27
  # The most characters of the opening line printed, cut back to a sentence end, or else to a whole word. A cut
28
- # mid-clause left 30 of the second alpha user's 45 opening lines a fragment (#1155). The line is short only when
28
+ # mid-clause left 30 of one user's 45 opening lines a fragment. The line is short only when
29
29
  # its first sentence is and the next runs past the cap, or an abbreviation such as "e.g." ends it early; that is
30
30
  # accepted, since the file's path and outline still say what it holds.
31
31
  OPENING_CHARACTERS = 160
32
32
  # The cuts that shorten an outline to fit a budget, in the order they are made, each keeping those before it.
33
- # The last leaves the whole outline out, which a big enough project needs once every other cut is made (#1155).
33
+ # The last leaves the whole outline out, which a big enough project needs once every other cut is made.
34
34
  CUTS = %w[description items headings opening_line outline].freeze
35
35
  # The cuts made on a root entry file, every one but the last, since a host loads it in every session.
36
36
  ENTRY_FILE_CUTS = CUTS.length - 1 #: Integer
37
37
  # The deepest heading level a cut outline keeps once its headings are folded.
38
38
  FOLDED_BELOW = 2
39
39
  # The most characters of a description a cut keeps, cut back to a sentence end, or else to a whole word. The
40
- # second alpha user's descriptions printed 12,537 B uncut, and suggested about 300 (22645b61, #1155).
40
+ # one user's descriptions printed 12,537 B uncut, and suggested about 300.
41
41
  DESCRIPTION_CHARACTERS = 300
42
42
 
43
43
  # A description's key and any block scalar indicator, which its text starts after.
@@ -75,7 +75,7 @@ module Principles
75
75
  #: () -> Array[String]
76
76
  def lines = sections.flat_map(&:lines)
77
77
 
78
- # The outline with its list items cut, each heading that held some followed by how many (#1155).
78
+ # The outline with its list items cut, each heading that held some followed by how many.
79
79
  #: () -> Array[String]
80
80
  def cut_lines = sections.flat_map(&:cut_lines)
81
81
 
@@ -93,7 +93,7 @@ module Principles
93
93
  private
94
94
 
95
95
  # The outline's lines with the first `cuts` of CUTS made: whole, with items cut, or with third-level and deeper
96
- # headings folded into the heading above, whose 11,112 B kept the second alpha user's result over budget.
96
+ # headings folded into the heading above, whose 11,112 B kept one user's result over budget.
97
97
  #: (Integer) -> Array[String]
98
98
  def outline_lines(cuts)
99
99
  return lines unless outline_cut?(cuts)
@@ -144,7 +144,7 @@ module Principles
144
144
  end
145
145
 
146
146
  # The description, past DESCRIPTION_CHARACTERS cut to its last sentence end within them, saying how many more
147
- # characters it holds and the lines of the file that hold it, so the agent reads just those back (#1155).
147
+ # characters it holds and the lines of the file that hold it, so the agent reads just those back.
148
148
  #: () -> String?
149
149
  def cut_description
150
150
  text = description or return nil
@@ -157,7 +157,7 @@ module Principles
157
157
  end
158
158
 
159
159
  # The first prose paragraph of the body, outside headings, lists, tables and code, its hard-wrapped lines
160
- # joined, with links as their text. The first physical line was a fragment in a hard-wrapped file (#1155).
160
+ # joined, with links as their text. The first physical line was a fragment in a hard-wrapped file.
161
161
  #: () -> String?
162
162
  def opening_line
163
163
  body = unfenced
@@ -9,7 +9,7 @@ module Principles
9
9
  # The domain logic, and the mediation of persistence. models/CLAUDE.md owns the boundary.
10
10
  module Models
11
11
  # Which members a full audit carries forward the last full audit's assessment of, and why it asks the agent to
12
- # judge each other one (D48, D49). A member is carried only when the last completed record kept its assessment
12
+ # judge each other one. A member is carried only when the last completed record kept its assessment
13
13
  # and judged it against the same description and question, and its text, id, map entry and loads are as that
14
14
  # audit judged them. Each test compares stored values, so it is this tool's to make; whether the set still
15
15
  # holds, and whether to re-judge a carried member, is the agent's.
@@ -28,7 +28,7 @@ module Principles
28
28
  end
29
29
 
30
30
  # Why the member id must be judged again, or nil when its last assessment is carried forward. A record from
31
- # before assessments were kept assessed each member it recorded, but kept none to carry (#701).
31
+ # before assessments were kept assessed each member it recorded, but kept none to carry.
32
32
  #: (String) -> String?
33
33
  def judge_because(id)
34
34
  last = @last or return "not_assessed_before"
@@ -56,10 +56,25 @@ module Principles
56
56
  end
57
57
 
58
58
  # When the last full audit's sighting of the member id was, if a fresh observation repeats that audit's word for
59
- # word; nil when it does not, or there was none. Whether the sighting is the same is the agent's to say (#680).
59
+ # word; nil when it does not, or there was none. Whether the sighting is the same is the agent's to say.
60
60
  #: (String, String) -> String?
61
61
  def repeated_sighting(id, observation) = recorded(id)&.repeated_sighting(observation)
62
62
 
63
+ # Each member answer carries forward whose kept assessment names a prior finding answer decides other than
64
+ # still_holds, with those ids, for the agent to judge whether that assessment still holds. Read from an answer
65
+ # already checked.
66
+ #: (Hash[String, untyped]) -> Array[Hash[String, untyped]]
67
+ def naming_decided(answer)
68
+ decided = (answer["prior_finding_decisions"] || []).reject { it["decision"] == "still_holds" }
69
+ .map { it.fetch("finding_id") }
70
+ return [] if decided.empty?
71
+
72
+ answer.fetch("member_assessments").select { it["carried_forward"] }.filter_map do |entry|
73
+ ids = recorded(entry.fetch("member_id"))&.naming(decided) || []
74
+ { "member_id" => entry.fetch("member_id"), "finding_ids" => ids } unless ids.empty?
75
+ end
76
+ end
77
+
63
78
  private
64
79
 
65
80
  # Why a member of a record from before assessments were kept is judged again: that audit assessed it, if the
@@ -4,14 +4,14 @@
4
4
  module Principles
5
5
  # The domain logic, and the mediation of persistence. models/CLAUDE.md owns the boundary.
6
6
  module Models
7
- # A carried member's kept assessment with the facts beside it that may mean the agent should judge it again
8
- # (D49), and whether any fires, which decides whether a full audit's request prints the member whole or
9
- # compactly (D93). Whether to judge it again stays the agent's.
7
+ # A carried member's kept assessment with the facts beside it that may mean the agent should judge it again,
8
+ # and whether any fires, which decides whether a full audit's request prints the member whole or
9
+ # compactly. Whether to judge it again stays the agent's.
10
10
  class CarriedMember
11
11
  # kept is the assessment carried forward as the request shows it, with evidence_changed;
12
12
  # file_changed_outside_member says, in git, whether its file changed since the last full audit outside it, nil
13
- # outside git; open_elsewhere, whether another principle leaves a finding open on a member sharing its lines
14
- # (D62); open_here, the ids of the findings this principle leaves open on it.
13
+ # outside git; open_elsewhere, whether another principle leaves a finding open on a member sharing its lines;
14
+ # open_here, the ids of the findings this principle leaves open on it.
15
15
  #: (Hash[String, untyped], file_changed_outside_member: bool?, open_elsewhere: bool, open_here: Array[String])
16
16
  #| -> void
17
17
  def initialize(kept, file_changed_outside_member:, open_elsewhere:, open_here:)
@@ -0,0 +1,92 @@
1
+ # typed: strict
2
+ # frozen_string_literal: true
3
+
4
+ require_relative "line_diff"
5
+
6
+ module Principles
7
+ # The domain logic, which loads and saves itself through data/. models/CLAUDE.md owns the boundary.
8
+ module Models
9
+ # A long member's changed lines as a request shows them: each run of changed lines with up to context unchanged
10
+ # lines around it, as git shows a hunk, runs whose context would meet joined into one region, and each later
11
+ # region counting the unchanged lines skipped before it, so two distant edits never show the text between them.
12
+ class ChangedRegions
13
+ #: (Array[String], Array[String], hunks: Array[LineDiff::Hunk], context: Integer,
14
+ #| ?left_out: Array[String]) -> void
15
+ def initialize(at_baseline, now, hunks:, context:, left_out: [])
16
+ @sides = { "at_baseline" => at_baseline, "now" => now } #: Hash[String, Array[String]]
17
+ @context = context
18
+ @runs = joined(hunks) #: Array[LineDiff::Hunk]
19
+ @left_out = left_out
20
+ freeze
21
+ end
22
+
23
+ # The lines each side shows, across every region, none for a side left out.
24
+ #: () -> Array[Array[String]]
25
+ def lines
26
+ @sides.map { |name, side| @left_out.include?(name) ? [] : @runs.flat_map { side[around(it, name)] || [] } }
27
+ end
28
+
29
+ # Whether one region changed at most one line on each side, whose change first_changed_lines' span shows whole.
30
+ #: () -> bool
31
+ def one_line? = @runs.one? && lines.all? { it.length <= 1 }
32
+
33
+ # These regions with their baseline side's lines left out, saying so, and their side now too when one_line?; the
34
+ # side now of a longer change holds lines no hint shows, so it stays.
35
+ #: () -> ChangedRegions
36
+ def with_sides_left_out
37
+ left_out = one_line? ? @sides.keys : ["at_baseline"]
38
+ ChangedRegions.new(@sides.fetch("at_baseline"), @sides.fetch("now"), hunks: @runs, context: @context,
39
+ left_out: left_out)
40
+ end
41
+
42
+ # One region as changed_region, or several as changed_regions.
43
+ #: () -> Hash[String, untyped]
44
+ def shown
45
+ regions = @runs.each_with_index.map { |hunk, index| region(hunk, index.positive? ? @runs[index - 1] : nil) }
46
+ return { "changed_region" => regions.fetch(0) } if regions.one?
47
+
48
+ { "changed_regions" => regions }
49
+ end
50
+
51
+ private
52
+
53
+ # Each run of changed lines in hunks, joined to the one before it when their context would meet or overlap.
54
+ #: (Array[LineDiff::Hunk]) -> Array[LineDiff::Hunk]
55
+ def joined(hunks)
56
+ found = [] #: Array[LineDiff::Hunk]
57
+ hunks.each do |hunk|
58
+ last = found.last
59
+ next found << hunk unless last && gap(last, hunk) <= 2 * @context
60
+
61
+ found[-1] = LineDiff::Hunk.new(last.at_baseline.begin...hunk.at_baseline.end, last.now.begin...hunk.now.end)
62
+ end
63
+ found
64
+ end
65
+
66
+ # The unchanged lines between two runs, the same on both sides.
67
+ #: (LineDiff::Hunk, LineDiff::Hunk) -> Integer
68
+ def gap(before, after) = after.at_baseline.begin - before.at_baseline.end
69
+
70
+ #: (LineDiff::Hunk, LineDiff::Hunk?) -> Hash[String, untyped]
71
+ def region(hunk, before)
72
+ skipped = before ? { "unchanged_lines_skipped" => gap(before, hunk) - (2 * @context) } : {}
73
+ { **skipped, "context_lines" => @context, **@sides.to_h { |name, side| [name, side_of(hunk, name, side)] } }
74
+ end
75
+
76
+ # One side of a region: the 1-based line it starts at, and its lines, or that they are left out.
77
+ #: (LineDiff::Hunk, String, Array[String]) -> Hash[String, untyped]
78
+ def side_of(hunk, name, side)
79
+ shown = around(hunk, name)
80
+ from = { "from_line" => shown.begin + 1 }
81
+ @left_out.include?(name) ? { **from, "omitted" => "too_long" } : { **from, "lines" => side[shown] || [] }
82
+ end
83
+
84
+ # The lines a run takes on one side with context lines either side, within that side.
85
+ #: (LineDiff::Hunk, String) -> Range[Integer]
86
+ def around(hunk, name)
87
+ changed = name == "now" ? hunk.now : hunk.at_baseline
88
+ [changed.begin - @context, 0].max...[changed.end + @context, @sides.fetch(name).length].min
89
+ end
90
+ end
91
+ end
92
+ end
@@ -0,0 +1,50 @@
1
+ # typed: strict
2
+ # frozen_string_literal: true
3
+
4
+ module Principles
5
+ # The domain logic, and the mediation of persistence. models/CLAUDE.md owns the boundary.
6
+ module Models
7
+ # The guidance a request prints for reporting a member's check, which ReportedCheck's repairs name, so a repair
8
+ # sends the agent only to text its own request holds: a full audit's answer_guide, or what another request prints
9
+ # in its place.
10
+ class CheckResultGuide
11
+ # What to merge a check_result from, in a full audit's request.
12
+ SHAPES = "Merge one inner example from answer_guide.check_result.examples into that member's " \
13
+ "response_template.check_result as copy_from says."
14
+
15
+ # How to report a check_result that gives none, the wrong command, or not exactly one of exit_status and
16
+ # not_run_reason.
17
+ #: String
18
+ attr_reader :missing, :command, :status_or_reason
19
+
20
+ #: (missing: String, command: String, status_or_reason: String) -> void
21
+ def initialize(missing:, command:, status_or_reason:)
22
+ @missing = missing
23
+ @command = command
24
+ @status_or_reason = status_or_reason
25
+ freeze
26
+ end
27
+
28
+ # The guidance a full audit's request prints: context.members and answer_guide.check_result.
29
+ FULL_AUDIT = new(
30
+ missing: "Report the member's check once you have run it, after a review if " \
31
+ "answer_guide.check_result.limits asks for one. #{SHAPES}",
32
+ command: "Report the command exactly as context.members lists it, run after a review if " \
33
+ "answer_guide.check_result.limits asks for one.",
34
+ status_or_reason: "Give exit_status once the command has run, or not_run_reason if it could not, " \
35
+ "including when no review it needed was possible. #{SHAPES}"
36
+ ) #: CheckResultGuide
37
+
38
+ # The guidance a one-member, several-member or across-principles acknowledgement prints instead: the member's
39
+ # check under member.check, its check_instruction and the template's exit_status slot, with no answer_guide.
40
+ ACKNOWLEDGEMENT = new(
41
+ missing: (run_and_report = "Run the member's check as its check_instruction in the request's context says, " \
42
+ "then give its exit status under check_result.exit_status, as the template " \
43
+ "prints it."),
44
+ command: "Leave check_result.command out, or give the member's check exactly as the request's context " \
45
+ "prints it under member.check.",
46
+ status_or_reason: run_and_report
47
+ ) #: CheckResultGuide
48
+ end
49
+ end
50
+ end
@@ -12,7 +12,7 @@ module Principles
12
12
  # Whether a member's check is the one the principle's last audit was given an exit status for, and, when
13
13
  # it is not, the commit that made it what it is now. A check is a command any collaborator can change in the
14
14
  # committed map, and the audit asks the agent to run it, so a check no audit has seen needs a review
15
- # first (#227). This tool states the fact; the review is the agent's step.
15
+ # first. This tool states the fact; the review is the agent's step.
16
16
  class CheckSinceLastAudit
17
17
  #: (principle_history: PrincipleHistory, record: AuditRecord?) -> void
18
18
  def initialize(principle_history:, record:)
@@ -25,7 +25,7 @@ module Principles
25
25
  # "changed", with changed_in the oldest commit of the unbroken run, back from HEAD, whose map holds it,
26
26
  # and, when changed, last_run, the command the last audit ran. Beside an unchanged check, the line saying what its
27
27
  # last review rested on and since when; beside a changed one, last_run_review_basis, that line for the command
28
- # the last audit ran, not this one (D63).
28
+ # the last audit ran, not this one.
29
29
  # changed_in is nil outside git, or when no commit holds it. The walk stops at a map it cannot read, so
30
30
  # changed_in may then name a later commit than the one that set the check: the review is still asked for.
31
31
  #: (Member, String) -> Hash[String, untyped]
@@ -56,9 +56,10 @@ module Principles
56
56
  #: (String, String) -> Symbol
57
57
  def status_of(key, check) = @record ? @record.members.check_since(key, check) : :new
58
58
 
59
- # The line the last audit's record keeps for what the review of its run rested on, and since when (D63).
59
+ # The line the last audit's record keeps for what the review of its run rested on, and since when, as a run
60
+ # keeping it carries it: undated while the audit that first kept it is still open.
60
61
  #: (String) -> Hash[String, untyped]
61
- def review_of(key) = @record&.check_review_for(key) || {}
62
+ def review_of(key) = @record&.check_review_carried_for(key) || {}
62
63
 
63
64
  #: (String, String) -> String?
64
65
  def commit_that_set(key, check)
@@ -9,7 +9,7 @@ module Principles
9
9
  module Models
10
10
  # The files an audit record cites, through its assessments' evidence and its findings' evidence and write-ups, as
11
11
  # the project holds them now: which go with the record when its completed audit is committed, since a clone needs
12
- # every file the record points at (#724), and which no longer exist, though the record still points at them (#861).
12
+ # every file the record points at, and which no longer exist, though the record still points at them.
13
13
  class CitedFiles
14
14
  # paths are the files the record cites; in_git says whether its audit had a base commit to compare with.
15
15
  #: (Array[String], ProjectHistory, in_git: bool) -> void
@@ -22,16 +22,16 @@ module Principles
22
22
 
23
23
  # The files to commit with the record, sorted once each: each file the audit changed; in git, with each cited
24
24
  # file, only those that still differ from HEAD, since a fix the agent already committed needs nothing. A cited
25
- # file deleted since is left out, since adding it would stage a deletion the audit never made (#842); a file its
25
+ # file deleted since is left out, since adding it would stage a deletion the audit never made; a file its
26
26
  # fixes deleted stays. What reported cites that the record does not keep, as the answer's recent decision's
27
- # paths, is cited too (#860).
27
+ # paths, is cited too.
28
28
  #: (Array[String], ?AssessmentReport) -> Array[String]
29
29
  def committed_with(changed, reported = AssessmentReport::NONE)
30
30
  changed = @history.uncommitted(changed + @history.existing(@paths + reported.recent_decision_paths)) if @in_git
31
31
  changed.uniq.sort
32
32
  end
33
33
 
34
- # Each cited file that no longer exists, in git or outside it (#861).
34
+ # Each cited file that no longer exists, in git or outside it.
35
35
  #: () -> Array[String]
36
36
  def missing = @paths - @history.existing(@paths)
37
37
  end
@@ -10,7 +10,7 @@ module Principles
10
10
  module Models
11
11
  # The steps each command runs: which are this tool's and which are the agent's, the refusals each of
12
12
  # this tool's steps can raise, and where each step leads. Each command's --help and the workflow diagram
13
- # are drawn from it (ticket 001 D15). It is built from data Data::CommandStepsFile has already checked
13
+ # are drawn from it. It is built from data Data::CommandStepsFile has already checked
14
14
  # against its schema, and checks what a schema cannot: every step a branch names exists, every refusal
15
15
  # group exists, and every command a step hands over to is real. The prompts it names are checked by
16
16
  # spec/unit/principles/views/prompts_spec.rb, because the domain reads no files.
@@ -45,11 +45,11 @@ module Principles
45
45
  attr_reader :cannot_check
46
46
  #: String?
47
47
  attr_reader :answer_with
48
- # When the agent runs answer_with, where that is the agent's to time, as a first full audit is (#627).
48
+ # When the agent runs answer_with, where that is the agent's to time, as a first full audit is.
49
49
  #: String?
50
50
  attr_reader :answer_when
51
51
  # The form of answer_with the step hands to, where its whole usage would mislead, as a first full audit
52
- # that --member would make a refused one-member audit (#635).
52
+ # that --member would make a refused one-member audit.
53
53
  #: String?
54
54
  attr_reader :answer_usage
55
55
 
@@ -4,7 +4,7 @@
4
4
  module Principles
5
5
  # The domain logic, and the mediation of persistence. models/CLAUDE.md owns the boundary.
6
6
  module Models
7
- # The commits one move of HEAD brought in, by abbreviated id, as the after-commit hook asks about them (D73): one
7
+ # The commits one move of HEAD brought in, by abbreviated id, as the after-commit hook asks about them: one
8
8
  # for a commit or an amend, a lane for a fast-forward, the rewritten commits for a rebase. git chooses how long an
9
9
  # abbreviated id is, so two name the same commit when one starts with the other (review R4).
10
10
  class CommitsBroughtIn
@@ -6,7 +6,7 @@ module Principles
6
6
  module Models
7
7
  # In git, what landed after a completed audit's base commit: for each member the audit changed, the commits
8
8
  # since the base that touched it, and HEAD now. When HEAD differs from the base and none touched one, an empty
9
- # list alone left the agent unsure why an answer on an older base was accepted, so it says so (#740).
9
+ # list alone left the agent unsure why an answer on an older base was accepted, so it says so.
10
10
  class CommitsSinceBase
11
11
  #: (base: String, head: String?, by_member: Hash[String, Array[Hash[String, String]]]) -> void
12
12
  def initialize(base:, head:, by_member:)
@@ -12,7 +12,7 @@ module Principles
12
12
  # An agent's answer to a correction request: one disposition for each finding the assessment raised, each
13
13
  # checked as a Disposition, and no member changed that no fix claims. The block locates each piece of
14
14
  # evidence, and where a finding is recorded, in the project. samples is the answer guide's disposition for
15
- # each action, whose text no field may give back unchanged (#789).
15
+ # each action, whose text no field may give back unchanged.
16
16
  class CorrectionAnswer
17
17
  #: (untyped, Array[untyped], samples: Hash[String, untyped]) { (Locator) -> void } -> void
18
18
  def initialize(response, findings, samples:, &locate)
@@ -52,7 +52,7 @@ module Principles
52
52
  end
53
53
 
54
54
  # Refuses every field the dispositions leave empty, as the template's placeholder or as the answer guide's
55
- # sample in one refusal, so a copied template takes one repair, not one submit per field (#789, #791).
55
+ # sample in one refusal, so a copied template takes one repair, not one submit per field.
56
56
  #: (Array[Disposition]) -> void
57
57
  def refuse_unfinished(dispositions)
58
58
  unfinished = dispositions.flat_map(&:unfinished)
@@ -12,13 +12,13 @@ module Principles
12
12
  module Models
13
13
  # What a correction request depends on, which it prints as its basis and the agent hands back with the answer:
14
14
  # the base commit, the map's version, each finding's members and problem, what the assessment reported beyond its
15
- # findings, as AssessmentReport carries it for the completed record to keep, and the decisions on prior findings
16
- # (D35), which travel to completion as those do. It also carries the last completed record's revision, so a
17
- # correction is refused once that record changed (#646).
15
+ # findings, as AssessmentReport carries it for the completed record to keep, and the decisions on prior findings,
16
+ # which travel to completion as those do. It also carries the last completed record's revision, so a
17
+ # correction is refused once that record changed.
18
18
  class CorrectionBasis
19
19
  # The basis printed for a correction of findings, assessed from start: its base, its map's version, the digest of
20
20
  # the assessment the open record keeps, and what else of the assessment's report AssessmentReport carries in a
21
- # basis (D87); revision is the last completed record's.
21
+ # basis; revision is the last completed record's.
22
22
  #: (AuditStart, findings: Array[untyped], revision: String?, open_record: AuditRecord,
23
23
  #| ?prior: DecidedPriorFindings) -> CorrectionBasis
24
24
  def self.printed(start, findings:, revision:, open_record:, prior: DecidedPriorFindings::NONE)
@@ -51,7 +51,7 @@ module Principles
51
51
  #: () -> Array[Hash[String, untyped]]
52
52
  def findings = @fields.fetch("findings")
53
53
 
54
- # The decisions on prior findings it carries to completion, or none (D35).
54
+ # The decisions on prior findings it carries to completion, or none.
55
55
  #: () -> DecidedPriorFindings
56
56
  def prior_decided
57
57
  decided = @fields["prior_findings"]
@@ -64,14 +64,14 @@ module Principles
64
64
  RequestId.handing_back(principle_id: principle_id, phase: "correction", handed: @fields, parts: [before])
65
65
  end
66
66
 
67
- # Whether record is the open record this basis was printed with, its assessment unchanged since (D87).
67
+ # Whether record is the open record this basis was printed with, its assessment unchanged since.
68
68
  #: (AuditRecord?) -> bool
69
69
  def printed_with?(record)
70
70
  !record.nil? && !record.completed? && record.assessment_digest == @fields["assessment_report_sha256"]
71
71
  end
72
72
 
73
73
  # The last completed record's revision when the request was printed, which refuses a correction once that
74
- # record changed (#646).
74
+ # record changed.
75
75
  #: () -> LastCompletedRevision
76
76
  def printed_after = LastCompletedRevision.new(@fields["last_completed_revision"])
77
77
  end
@@ -5,8 +5,7 @@ module Principles
5
5
  # The domain logic, and the mediation of persistence. models/CLAUDE.md owns the boundary.
6
6
  module Models
7
7
  # A line an answer gives that a record keeps under field, with field_since, the date it was first given, beside
8
- # it: the same line keeps its date, a new line is dated afresh by the audit that records it, and null drops it
9
- # (D52).
8
+ # it: the same line keeps its date, a new line is dated afresh by the audit that records it, and null drops it.
10
9
  class DatedLine
11
10
  # line is what the answer gave, nil for none; field is the name the record keeps it under.
12
11
  #: (untyped, field: String) -> void
@@ -8,7 +8,7 @@ require_relative "recorded_finding"
8
8
  module Principles
9
9
  # The domain logic, and the mediation of persistence. models/CLAUDE.md owns the boundary.
10
10
  module Models
11
- # What the next full audit decided about each prior finding (D35), once this tool has checked the decisions:
11
+ # What the next full audit decided about each prior finding, once this tool has checked the decisions:
12
12
  # the findings that still hold, as the record keeps them; the ones closed, with their reasons; and, for each
13
13
  # new finding that raises a prior one again, when that one was first raised. The correction's basis carries
14
14
  # these fields, so an audit with findings completes with the same decisions.
@@ -50,14 +50,14 @@ module Principles
50
50
  @fields.fetch("closed")
51
51
  end
52
52
 
53
- # The ids of the prior findings decided resolved; a withdrawn one was never a gap (#714).
53
+ # The ids of the prior findings decided resolved; a withdrawn one was never a gap.
54
54
  #: () -> Array[String]
55
55
  def resolved_ids = closed.select { |each| each["decision"] == "resolved" }.map { |each| each.fetch("finding_id") }
56
56
 
57
57
  # What the decisions changed of the findings kept, each list by the name the completed result gives it after
58
- # prior_findings_: each pointer a decision dropped with null, with the pointer it had (#374); each waits_on it
59
- # dropped, with null or by accepting it, with the line and since it had (D52); each kept evidence item it gave a
60
- # new place (D70); and each problem it restated (D82), each as it was and is now. A correction basis printed
58
+ # prior_findings_: each pointer a decision dropped with null, with the pointer it had; each waits_on it
59
+ # dropped, with null or by accepting it, with the line and since it had; each kept evidence item it gave a
60
+ # new place; and each problem it restated, each as it was and is now. A correction basis printed
61
61
  # before a list was built carries none of it.
62
62
  #: () -> Hash[String, Array[Hash[String, untyped]]]
63
63
  def changed
@@ -72,7 +72,7 @@ module Principles
72
72
  inherited.key?(id) ? { "first_raised_at" => inherited.fetch(id) } : {}
73
73
  end
74
74
 
75
- # These decisions with each kept finding filed under its members' ids after moves (D28).
75
+ # These decisions with each kept finding filed under its members' ids after moves.
76
76
  #: (MemberMoves) -> DecidedPriorFindings
77
77
  def moved(moves)
78
78
  DecidedPriorFindings.new(@fields.merge("kept" => moves.findings(kept)))
@@ -10,9 +10,9 @@ module Principles
10
10
  # The domain: maps, audits and command steps, with every rule a schema cannot express.
11
11
  # models/CLAUDE.md owns the boundary.
12
12
  module Models
13
- # The changes a correction declares it made to the map after the audit began: the members it moved (D28),
13
+ # The changes a correction declares it made to the map after the audit began: the members it moved,
14
14
  # and the members whose role or check a fix changed, which each fixed disposition lists in
15
- # changed_map_entries (D40), and the members fixed dispositions removed. This tool checks them against the
15
+ # changed_map_entries, and the members fixed dispositions removed. This tool checks them against the
16
16
  # map at the base commit, which may also hold
17
17
  # members added since, needing no declaration, as a fix maps a member a finding said was missing (T69); whether a
18
18
  # change fixes its finding is the agent's judgement.
@@ -75,7 +75,7 @@ module Principles
75
75
 
76
76
  # Each claimed member's role and check, as was and now, where they differ between the base map with the
77
77
  # declared moves applied, which check compares, and current. The block gives [base, current], and is
78
- # called only when a fix claims an entry, so nothing else reads the base map (#462).
78
+ # called only when a fix claims an entry, so nothing else reads the base map.
79
79
  #: () { () -> [Principle, Principle] } -> Array[Hash[String, untyped]]
80
80
  def entry_changes(&)
81
81
  return [] if @entries.empty?
@@ -85,8 +85,8 @@ module Principles
85
85
  @entries.map { |id| changed_fields(id, moved.member(id), current.member(id)) }
86
86
  end
87
87
 
88
- # The map file, when the correction moved a member in it, even under its own id (#1100), a fix changed a
89
- # member's role or check in it, or added/removed members in it, so the agent commits it too (T69, #1178).
88
+ # The map file, when the correction moved a member in it, even under its own id, a fix changed a
89
+ # member's role or check in it, or added/removed members in it, so the agent commits it too.
90
90
  #: (String, ?added: Array[String]) -> Array[String]
91
91
  def files_to_commit(map_file, added: [])
92
92
  empty? && added.empty? ? [] : [map_file]