principles 0.0.6 → 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 (338) 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 +58 -41
  9. data/lib/principles/command_line.rb +37 -14
  10. data/lib/principles/command_routes.rb +21 -7
  11. data/lib/principles/controllers/acknowledgement.rb +50 -118
  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 +52 -21
  15. data/lib/principles/controllers/answer_phase.rb +20 -3
  16. data/lib/principles/controllers/assessment.rb +41 -28
  17. data/lib/principles/controllers/audit.rb +59 -15
  18. data/lib/principles/controllers/audit_completion.rb +25 -12
  19. data/lib/principles/controllers/command.rb +13 -12
  20. data/lib/principles/controllers/correction.rb +26 -11
  21. data/lib/principles/controllers/first_audit_brief.rb +40 -0
  22. data/lib/principles/controllers/full_audit_request.rb +47 -83
  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 +148 -0
  27. data/lib/principles/controllers/member_entries.rb +4 -4
  28. data/lib/principles/controllers/member_problems_report.rb +84 -30
  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 +67 -12
  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 -20
  57. data/lib/principles/data/schemas/acknowledgements-answer.schema.json +95 -0
  58. data/lib/principles/data/schemas/assessment-answer.schema.json +55 -20
  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 +14 -62
  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 +7 -6
  68. data/lib/principles/launch.rb +49 -0
  69. data/lib/principles/list_open_findings_options.rb +23 -0
  70. data/lib/principles/models/accepted_loading.rb +2 -2
  71. data/lib/principles/models/acknowledged_check.rb +106 -0
  72. data/lib/principles/models/acknowledgement.rb +51 -53
  73. data/lib/principles/models/acknowledgement_left_as_printed.rb +18 -5
  74. data/lib/principles/models/acknowledgement_refusal.rb +25 -10
  75. data/lib/principles/models/acknowledgements.rb +115 -0
  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 +12 -3
  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 +14 -15
  88. data/lib/principles/models/audit.rb +46 -34
  89. data/lib/principles/models/audit_record.rb +58 -27
  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 +19 -10
  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 +80 -0
  133. data/lib/principles/models/listed_members.rb +47 -0
  134. data/lib/principles/models/loaded_files.rb +4 -5
  135. data/lib/principles/models/loading_decision.rb +19 -10
  136. data/lib/principles/models/loading_facts.rb +1 -1
  137. data/lib/principles/models/loads_to_check.rb +1 -2
  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 +17 -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 +21 -18
  150. data/lib/principles/models/member_repair_moves.rb +15 -9
  151. data/lib/principles/models/member_sighting.rb +12 -15
  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 +42 -9
  181. data/lib/principles/models/project.rb +29 -20
  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 +42 -36
  196. data/lib/principles/models/request_id.rb +19 -7
  197. data/lib/principles/models/runs_from.rb +7 -2
  198. data/lib/principles/models/sent_answer.rb +38 -16
  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 +15 -7
  217. data/lib/principles/prose_list.rb +1 -1
  218. data/lib/principles/session_start_options.rb +3 -3
  219. data/lib/principles/start_audit_options.rb +54 -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 +137 -17
  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 +68 -38
  227. data/lib/principles/views/assessment_request.rb +43 -21
  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 +100 -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 +51 -39
  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 +49 -33
  237. data/lib/principles/views/diff_since_last_audit.rb +8 -6
  238. data/lib/principles/views/findings_result.rb +33 -1
  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 +32 -9
  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 +11 -7
  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 +61 -0
  256. data/lib/principles/views/members_a_commit_changed.rb +15 -11
  257. data/lib/principles/views/members_with_no_baseline.rb +10 -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 +24 -12
  261. data/lib/principles/views/open_findings_elsewhere_result.rb +5 -2
  262. data/lib/principles/views/open_findings_line.rb +26 -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 +70 -45
  275. data/lib/principles/views/problem_result.rb +75 -43
  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/report-the-exit-status-its-own-listing-gives.md +3 -0
  279. data/lib/principles/views/prompts/acknowledge-a-change/resolve-them-in-a-full-audit.md +1 -0
  280. data/lib/principles/views/prompts/acknowledge-a-change/say-whether-each-change-keeps-its-meaning.md +8 -0
  281. data/lib/principles/views/prompts/acknowledge-a-change/say-whether-the-change-keeps-the-meaning.md +3 -3
  282. data/lib/principles/views/prompts/assess-every-member/confirm-each-write-up-pointer-the-answer-drops.md +2 -0
  283. data/lib/principles/views/prompts/assess-every-member/decide-each-member-loading.md +2 -1
  284. data/lib/principles/views/prompts/assess-every-member/have-a-changed-check-reviewed-before-running-it.md +1 -1
  285. data/lib/principles/views/prompts/assess-every-member/have-a-new-check-reviewed-before-running-it.md +1 -1
  286. data/lib/principles/views/prompts/assess-every-member/judge-a-carried-assessment-citing-a-decided-finding.md +3 -0
  287. data/lib/principles/views/prompts/assess-every-member/judge-a-submitted-carried-assessment-citing-a-decided-finding.md +5 -0
  288. data/lib/principles/views/prompts/assess-every-member/judge-the-keeping-under-the-release-since-the-last-audit.md +1 -1
  289. data/lib/principles/views/prompts/assess-every-member/keep-the-printed-review-basis-or-replace-it.md +1 -0
  290. data/lib/principles/views/prompts/assess-every-member/name-the-commit-that-made-the-check.md +1 -0
  291. data/lib/principles/views/prompts/assess-every-member/read-a-trimmed-instruction-whole.md +1 -1
  292. data/lib/principles/views/prompts/assess-every-member/read-the-request-in-parts.md +1 -0
  293. data/lib/principles/views/prompts/assess-every-member/run-the-check-then-report-it.md +2 -2
  294. data/lib/principles/views/prompts/assess-every-member/run-the-reviewed-check-and-say-what-its-review-rested-on.md +5 -3
  295. data/lib/principles/views/prompts/assess-every-member/why-each-member-is-judged-again.md +3 -2
  296. data/lib/principles/views/prompts/dispose-of-each-finding/answer-guide.json +1 -1
  297. data/lib/principles/views/prompts/dispose-of-each-finding/confirm-each-deferral-written-up-nowhere.md +2 -0
  298. data/lib/principles/views/prompts/dispose-of-each-finding/retain-assessment-and-correction.md +4 -4
  299. data/lib/principles/views/prompts/find-a-principle-to-map/where-the-inventory-looks.md +2 -2
  300. data/lib/principles/views/prompts/learn-what-a-command-does/every-command-and-how-they-chain.md +1 -2
  301. data/lib/principles/views/prompts/learn-what-a-command-does/list-candidate-files.md +4 -3
  302. data/lib/principles/views/prompts/learn-what-a-command-does/list-member-problems.md +16 -16
  303. data/lib/principles/views/prompts/learn-what-a-command-does/list-open-findings.md +65 -61
  304. data/lib/principles/views/prompts/learn-what-a-command-does/report-after-commit.md +14 -0
  305. data/lib/principles/views/prompts/learn-what-a-command-does/report-at-session-start.md +26 -0
  306. data/lib/principles/views/prompts/learn-what-a-command-does/show-answer-check.md +22 -20
  307. data/lib/principles/views/prompts/learn-what-a-command-does/show-first-audit-brief.md +19 -0
  308. data/lib/principles/views/prompts/learn-what-a-command-does/show-hook-setup.md +13 -0
  309. data/lib/principles/views/prompts/learn-what-a-command-does/show-meta-principle-passage.md +3 -1
  310. data/lib/principles/views/prompts/learn-what-a-command-does/show-open-correction.md +12 -0
  311. data/lib/principles/views/prompts/learn-what-a-command-does/start-audit.md +27 -28
  312. data/lib/principles/views/prompts/learn-what-a-command-does/submit-answer.md +39 -38
  313. data/lib/principles/views/prompts/report-the-completed-audit/commit-only-what-the-audit-changed.md +2 -2
  314. data/lib/principles/views/prompts/run-a-first-audit-in-the-background/follow-the-brief.md +18 -0
  315. data/lib/principles/views/prompts/set-principles-up/offer-the-report-hooks.md +2 -0
  316. data/lib/principles/views/prompts/set-principles-up/wire-the-report-hooks-with-the-user.md +8 -0
  317. data/lib/principles/views/prompts/start-a-session/act-on-the-open-findings.md +3 -4
  318. data/lib/principles/views/prompts/start-a-session/every-loaded-line-costs-every-session.md +1 -0
  319. data/lib/principles/views/prompts/start-a-session/hand-the-first-audit-to-a-subagent.md +3 -0
  320. data/lib/principles/views/prompts/start-a-session/run-each-command-above.md +1 -0
  321. data/lib/principles/views/prompts/start-a-session/start-no-second-first-audit.md +2 -0
  322. data/lib/principles/views/prompts/start-a-session/start-with-the-principles-skill.md +1 -0
  323. data/lib/principles/views/prompts.rb +1 -1
  324. data/lib/principles/views/read_the_change.rb +36 -0
  325. data/lib/principles/views/record_waiting_on_an_upgrade.rb +2 -2
  326. data/lib/principles/views/repoint_result.rb +1 -1
  327. data/lib/principles/views/report_hooks_offer.rb +25 -0
  328. data/lib/principles/views/request_part.rb +5 -5
  329. data/lib/principles/views/request_parts.rb +1 -1
  330. data/lib/principles/views/session_start_report.rb +46 -0
  331. data/lib/principles/views/shell_word.rb +1 -1
  332. data/lib/principles/views/trimmed_instructions_note.rb +30 -0
  333. data/lib/principles/views/visible_text.rb +1 -1
  334. data/lib/principles/views/workflow_diagram.rb +1 -1
  335. data/principles.gemspec +44 -0
  336. metadata +95 -14
  337. data/lib/principles/views/prompts/start-a-session/it-returns-after-each-clear-or-compaction-too.md +0 -1
  338. data/lib/principles/views/prompts/start-a-session/it-returns-at-each-session-start.md +0 -1
@@ -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
  # The judgements an answer leaves as its template printed them, each named with its pointer, which the answer
12
- # refuses in one refusal, so a copied template takes one repair (#991, #1010, #1040).
12
+ # refuses in one refusal, so a copied template takes one repair.
13
13
  class LeftAsPrinted
14
14
  # The problem with a judgement sent back as its placeholder.
15
15
  UNCHANGED = "is the template's placeholder, unchanged" #: String
@@ -22,7 +22,7 @@ module Principles
22
22
  end
23
23
 
24
24
  # Refuses the answer naming each judgement left as printed, then each of besides, problems its shape has
25
- # elsewhere, so one refusal names every repair (#1106); one at or under a pointer named is left out, since
25
+ # elsewhere, so one refusal names every repair; one at or under a pointer named is left out, since
26
26
  # writing the judgement repairs it. Nothing when none is left as printed, so the shape's own refusal names them.
27
27
  #: (?besides: Array[Hash[String, String]]) -> void
28
28
  def refuse(besides: [])
@@ -0,0 +1,113 @@
1
+ # typed: strict
2
+ # frozen_string_literal: true
3
+
4
+ module Principles
5
+ # The domain logic, which loads and saves itself through data/. models/CLAUDE.md owns the boundary.
6
+ module Models
7
+ # Where two versions of a member's lines differ: each run of lines one side changed, in order, as a line diff finds
8
+ # them by their longest common subsequence. The lines both sides share from the start and from the end are never
9
+ # part of a run, so the first run starts at the same line on both sides.
10
+ class LineDiff
11
+ # One run of changed lines: the 0-based, end-exclusive range each side's changed lines take, empty on a side
12
+ # that only the other side's lines were added to.
13
+ Hunk = Struct.new(:at_baseline, :now)
14
+
15
+ # The longest run of lines two sides hold in the same order, as the index on each side of each of its lines.
16
+ class CommonLines
17
+ #: (Array[String], Array[String]) -> void
18
+ def initialize(one, other)
19
+ @one = one
20
+ @other = other
21
+ freeze
22
+ end
23
+
24
+ #: () -> Array[[Integer, Integer]]
25
+ def pairs
26
+ longest = table
27
+ at = [0, 0] #: [Integer, Integer]
28
+ found = [] #: Array[[Integer, Integer]]
29
+ while at[0] < @one.length && at[1] < @other.length
30
+ found << at if @one[at[0]] == @other[at[1]]
31
+ at = next_from(longest, *at)
32
+ end
33
+ found
34
+ end
35
+
36
+ private
37
+
38
+ # The length of the longest common run from each pair of indices to both ends.
39
+ #: () -> Array[Array[Integer]]
40
+ def table
41
+ longest = Array.new(@one.length + 1) { Array.new(@other.length + 1, 0) }
42
+ (@one.length - 1).downto(0) do |one_at|
43
+ row = longest.fetch(one_at)
44
+ (@other.length - 1).downto(0) { |other_at| row[other_at] = length_at(longest, one_at, other_at) }
45
+ end
46
+ longest
47
+ end
48
+
49
+ #: (Array[Array[Integer]], Integer, Integer) -> Integer
50
+ def length_at(longest, one_at, other_at)
51
+ return cell(longest, one_at + 1, other_at + 1) + 1 if @one[one_at] == @other[other_at]
52
+
53
+ [cell(longest, one_at + 1, other_at), cell(longest, one_at, other_at + 1)].max.to_i
54
+ end
55
+
56
+ # The indices after one_at and other_at along the longest common run.
57
+ #: (Array[Array[Integer]], Integer, Integer) -> [Integer, Integer]
58
+ def next_from(longest, one_at, other_at)
59
+ return [one_at + 1, other_at + 1] if @one[one_at] == @other[other_at]
60
+
61
+ skip_one = cell(longest, one_at + 1, other_at) >= cell(longest, one_at, other_at + 1)
62
+ skip_one ? [one_at + 1, other_at] : [one_at, other_at + 1]
63
+ end
64
+
65
+ #: (Array[Array[Integer]], Integer, Integer) -> Integer
66
+ def cell(longest, one_at, other_at) = longest.fetch(one_at).fetch(other_at)
67
+ end
68
+
69
+ #: (Array[String], Array[String]) -> void
70
+ def initialize(at_baseline, now)
71
+ @at_baseline = at_baseline
72
+ @now = now
73
+ freeze
74
+ end
75
+
76
+ # Each run of changed lines, in order; none when the sides read the same.
77
+ #: () -> Array[Hunk]
78
+ def hunks
79
+ from = [0, 0] #: [Integer, Integer]
80
+ (matched_pairs + [[@at_baseline.length, @now.length]]).each_with_object([]) do |(one, other), found|
81
+ found << Hunk.new(from[0]...one, from[1]...other) if [one, other] != from
82
+ from = [one + 1, other + 1]
83
+ end
84
+ end
85
+
86
+ private
87
+
88
+ # The index on each side of each line both sides keep, in order: those they share from the start and the end,
89
+ # and between them the longest common run.
90
+ #: () -> Array[[Integer, Integer]]
91
+ def matched_pairs
92
+ head = common_length(@at_baseline, @now)
93
+ tail = common_length(@at_baseline.drop(head).reverse, @now.drop(head).reverse)
94
+ (0...head).map { [it, it] } + matched_between(head, tail) +
95
+ tail.downto(1).map { [@at_baseline.length - it, @now.length - it] }
96
+ end
97
+
98
+ # The longest common run of the lines after the head lines and before the tail lines both sides share.
99
+ #: (Integer, Integer) -> Array[[Integer, Integer]]
100
+ def matched_between(head, tail)
101
+ one = @at_baseline[head...(@at_baseline.length - tail)].to_a
102
+ other = @now[head...(@now.length - tail)].to_a
103
+ CommonLines.new(one, other).pairs.map { |one_at, other_at| [one_at + head, other_at + head] }
104
+ end
105
+
106
+ # How many lines two sides share from their start.
107
+ #: (Array[String], Array[String]) -> Integer
108
+ def common_length(one, other)
109
+ one.zip(other).take_while { |line, other_line| line == other_line && !other_line.nil? }.length
110
+ end
111
+ end
112
+ end
113
+ end
@@ -38,7 +38,7 @@ module Principles
38
38
  end
39
39
 
40
40
  # Whether this span surely holds all of other's text: it holds other's lines and is a whole file, which holds
41
- # every line's text, where a passage may start or end partway through a line (#756).
41
+ # every line's text, where a passage may start or end partway through a line.
42
42
  #: (LineSpan) -> bool
43
43
  def holds_all_text_of?(other)
44
44
  @whole_file && holds?(other)
@@ -0,0 +1,80 @@
1
+ # typed: strict
2
+ # frozen_string_literal: true
3
+
4
+ require "shellwords"
5
+ require_relative "listed_members"
6
+ require_relative "problem_report"
7
+
8
+ module Principles
9
+ # The domain logic, and the mediation of persistence. models/CLAUDE.md owns the boundary.
10
+ module Models
11
+ # A member's check that is this tool's own list-member-problems --short, which exits 3 while it lists the member
12
+ # itself, until the acknowledgement of its edit is committed. Only a check whose words
13
+ # map exactly to that command's is one: any other check passes on exit 0 alone.
14
+ class ListMemberProblemsCheck
15
+ COMMAND = "list-member-problems"
16
+ SHORT = "--short"
17
+ # Characters a shell reads as more than one command's words, or as a redirection or substitution, which leave
18
+ # what ran no longer this command alone.
19
+ SHELL_CONTROL = /[;&|<>()`$]/
20
+ # The words that may run this tool before its executable, which is any path to `principles`.
21
+ RUNNERS = [[], ["ruby"], %w[bundle exec]].freeze #: Array[Array[String]]
22
+
23
+ # The check command reads as, or nil when its words do not map exactly to list-member-problems --short with at
24
+ # most one principle id, run as this tool by any path to it, with no word of shell control.
25
+ #: (String) -> ListMemberProblemsCheck?
26
+ def self.of(command)
27
+ ids = principle_ids(words_after_the_command(command))
28
+ new(ids.first) if ids
29
+ end
30
+
31
+ # The words after the command name, or nil unless command runs this tool alone.
32
+ #: (String) -> Array[String]?
33
+ def self.words_after_the_command(command)
34
+ words = Shellwords.split(command)
35
+ at = words.index(COMMAND)
36
+ words.drop(at + 1) if at && words.none? { SHELL_CONTROL.match?(it) } && this_tool?(words.take(at))
37
+ rescue ArgumentError
38
+ nil
39
+ end
40
+
41
+ # The principle ids the words after the command name give, at most one, or nil unless they are --short once and
42
+ # that id.
43
+ #: (Array[String]?) -> Array[String]?
44
+ def self.principle_ids(after)
45
+ return unless after
46
+
47
+ ids = after - [SHORT]
48
+ ids if after.count(SHORT) == 1 && ids.length <= 1 && ids.none? { it.start_with?("-") }
49
+ end
50
+
51
+ # Whether words run this tool: its executable last, after nothing or a runner.
52
+ #: (Array[String]) -> bool
53
+ def self.this_tool?(words)
54
+ *runner, executable = words
55
+ executable&.split("/")&.last == "principles" && RUNNERS.include?(runner)
56
+ end
57
+ private_class_method :words_after_the_command, :principle_ids, :this_tool?
58
+
59
+ # The principle whose map the check reads, or nil for every map.
60
+ #: String?
61
+ attr_reader :principle_id
62
+
63
+ #: (String?) -> void
64
+ def initialize(principle_id)
65
+ @principle_id = principle_id
66
+ freeze
67
+ end
68
+
69
+ # What the check lists in project now, read through the report the command prints from, over the same scope:
70
+ # each member, as its principle id and member id, and by principle the count of members no audit has assessed,
71
+ # beside the members acknowledging names, each as its principle id and member id.
72
+ #: (Project, principle_id: String, acknowledging: Array[[String, String]]) -> ListedMembers
73
+ def listed(project, principle_id:, acknowledging:)
74
+ report = ProblemReport.for(project, @principle_id)
75
+ ListedMembers.new(listed: report.checked.fetch("members").map { it.values_at("principle", "id") },
76
+ principle_id:, acknowledging:, never_assessed: report.never_assessed)
77
+ end
78
+ end
79
+ end
80
+ end
@@ -0,0 +1,47 @@
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 members a member's own list-member-problems check lists now, beside those one answer acknowledges: the check
8
+ # exits 3 until that answer's record is committed, and lists none then only if it acknowledges every one.
9
+ class ListedMembers
10
+ # listed is each member the check lists, as its principle id and member id; acknowledging is each member the
11
+ # answer acknowledges, the same way, across every principle it answers for; never_assessed counts, by
12
+ # principle, the members no audit has assessed, which the check counts and no acknowledgement clears.
13
+ #: (listed: Array[[String, String]], principle_id: String, acknowledging: Array[[String, String]],
14
+ #| ?never_assessed: Hash[String, Integer]) -> void
15
+ def initialize(listed:, principle_id:, acknowledging:, never_assessed: {})
16
+ @listed = listed
17
+ @principle_id = principle_id
18
+ @acknowledging = acknowledging
19
+ @never_assessed = never_assessed
20
+ freeze
21
+ end
22
+
23
+ # Whether ids, as an answer reports them, are the ids of the members listed, each once, in any order.
24
+ #: (untyped) -> bool
25
+ def reported?(ids) = ids.is_a?(Array) ? ids.sort == @listed.map(&:last).sort : false
26
+
27
+ # The members listed that the answer does not acknowledge, which the check would still list: each by its id,
28
+ # with its principle when that is another, since an id is unique only within its map; then each principle's
29
+ # members no audit has assessed, by count.
30
+ #: () -> Array[String]
31
+ def unacknowledged
32
+ listed = (@listed - @acknowledging).map do |principle, id|
33
+ principle == @principle_id ? id : "#{id} of #{principle}"
34
+ end
35
+ listed + @never_assessed.map { |principle, count| never_assessed(principle, count) }
36
+ end
37
+
38
+ private
39
+
40
+ # count members of principle no audit has assessed, as a refusal names them.
41
+ #: (String, Integer) -> String
42
+ def never_assessed(principle, count)
43
+ "#{count} member#{"s" unless count == 1} of #{principle} no audit has assessed"
44
+ end
45
+ end
46
+ end
47
+ end
@@ -6,11 +6,10 @@ require_relative "member_loads"
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
- # The files a principle's members load, each once however many of its members it holds, since every member's
10
- # loads gives its whole file's size and summing members counts a shared file once per member (second alpha
11
- # user on #481, #483). Only session start loads its files together, so only those are totalled; a file that
12
- # loads on files, on invocation or on delegation loads apart from the rest. A file that cannot be read has no
13
- # size and is not totalled.
9
+ # The files a principle's members load, each once however many of its members it holds, since every member's loads
10
+ # gives its whole file's size and summing members counts a shared file once per member. Only session start loads
11
+ # its files together, so only those are totalled; a file that loads on files, on invocation or on delegation loads
12
+ # apart from the rest. A file that cannot be read has no size and is not totalled.
14
13
  class LoadedFiles
15
14
  # The files members load, each read whole once, as files hold it.
16
15
  #: (Data::ProjectFiles, PrincipleMembers, hooks: HookCommands) -> LoadedFiles
@@ -9,10 +9,10 @@ module Principles
9
9
  # The domain logic, and the mediation of persistence. models/CLAUDE.md owns the boundary.
10
10
  module Models
11
11
  # One decision in an assessment's loading_decisions on a member the audit listed to check against the
12
- # activation (#355). Whether the member should load as it does is the agent's judgement; this tool checks the
12
+ # activation. Whether the member should load as it does is the agent's judgement; this tool checks the
13
13
  # decision's shape.
14
14
  class LoadingDecision
15
- # The reason start-audit --as template prints in each decision, which left as printed is not given (#994).
15
+ # The reason start-audit --as template prints in each decision, which left as printed is not given.
16
16
  PLACEHOLDERS = TemplatePlaceholders.new(
17
17
  { "reason" => "One line saying why the member loads as it does" }
18
18
  ) #: TemplatePlaceholders
@@ -30,20 +30,29 @@ module Principles
30
30
  #: () -> String
31
31
  def member_id = @decision["member_id"].to_s
32
32
 
33
- # What the record keeps of this decision once checked: its reason and the loads it accepted, from its
34
- # member's row in the listing.
33
+ # What the record keeps of this decision: its reason, or for kept the last accepted reason, and the loads it
34
+ # accepted, from its member's row in the listing; refused unless the decision is one the record can keep.
35
35
  #: (Hash[String, untyped]) -> Hash[String, untyped]
36
- def kept(row) = { "reason" => @decision["reason"], "loads" => row.fetch("loads") }
36
+ def kept(row)
37
+ check(row)
38
+ reason = @decision["decision"] == "kept" ? row.dig("last_accepted", "reason") : @decision["reason"]
39
+ { "reason" => reason, "loads" => row.fetch("loads") }
40
+ end
41
+
42
+ private
37
43
 
38
- # Refuses the decision unless it is accepted with a one-line reason.
39
- #: () -> void
40
- def check
44
+ # Refuses the decision unless it is accepted with a one-line reason, or kept on a member row whose loading
45
+ # the last audit accepted and is unchanged since, so its reason still holds.
46
+ #: (Hash[String, untyped]) -> void
47
+ def check(row)
41
48
  return if @decision["decision"] == "accepted" && AnswerText.new(@decision["reason"]).written?
49
+ return if @decision["decision"] == "kept" && row.dig("last_accepted", "since_accepted") == "unchanged"
42
50
 
43
51
  raise Error.new("invalid_loading_decision",
44
52
  "loading_decisions[#{@index}] for #{@decision["member_id"]} needs decision accepted with a " \
45
- "reason",
46
- "Give decision accepted with a one-line reason why the member loads as it does, or, if the " \
53
+ "reason, or kept where its last_accepted.since_accepted is unchanged",
54
+ "Give decision accepted with a one-line reason why the member loads as it does, or kept to " \
55
+ "repeat the last accepted reason while since_accepted is unchanged, or, if the " \
47
56
  "activation is what is wrong, change it with change-activation and run start-audit again, " \
48
57
  "as the request's loads_to_check_instruction says; a finding decision is not built yet.")
49
58
  end
@@ -8,7 +8,7 @@ module Principles
8
8
  module Models
9
9
  # What a member's loads say about when it loads and what, at any depth, without the file's or the member's size.
10
10
  # A file's size moves with every edit elsewhere in a shared file, so a judgement weighed on a member's loading
11
- # compares these facts, not the sizes (second alpha user on 5bedec4, #515).
11
+ # compares these facts, not the sizes.
12
12
  class LoadingFacts
13
13
  # loads is a member's loads as MemberLoads#to_h gives them, or as a record keeps them.
14
14
  #: (Hash[String, untyped]) -> void
@@ -11,7 +11,7 @@ module Principles
11
11
  # The domain logic, and the mediation of persistence. models/CLAUDE.md owns the boundary.
12
12
  module Models
13
13
  # The members a full audit lists for the agent to weigh against the principle's activation, each with the
14
- # facts that put it there (#355 slice 3, brief 2026-11-09-1322). It lists by fact and compares no globs, so
14
+ # facts that put it there. It lists by fact and compares no globs, so
15
15
  # whether a member loads outside the activation is the agent's judgement.
16
16
  class LoadsToCheck
17
17
  # activation is the map's, or nil when none is declared; loads is each member's MemberLoads by id; accepted
@@ -46,7 +46,6 @@ module Principles
46
46
  expected = listed_by_id
47
47
  raise incomplete(expected.keys) unless given.map(&:member_id).sort == expected.keys.sort
48
48
 
49
- given.each(&:check)
50
49
  given.to_h { |decision| [decision.member_id, decision.kept(expected.fetch(decision.member_id))] }
51
50
  end
52
51
 
@@ -7,7 +7,7 @@ module Principles
7
7
  # The domain logic, which loads and saves itself through data/. models/CLAUDE.md owns the boundary.
8
8
  module Models
9
9
  # The text a locator found now: its file, the lines it spans and the hash of what it says. A Locator says where
10
- # to look; this is what was found there, as Project#locate finds it (#909).
10
+ # to look; this is what was found there, as Project#locate finds it.
11
11
  class LocatedText
12
12
  # The text found, from what Project#locate gives.
13
13
  #: (Hash[String, untyped]) -> LocatedText
@@ -63,7 +63,7 @@ module Principles
63
63
 
64
64
  # Whether principles is set up: the meta-principle's map names a keeping place, a member of any kind. That says
65
65
  # a place is named, not that the principle is held, which its audit finds. A map this version cannot read, in a
66
- # newer format, unparseable or invalid, counts, since it may well have members, so no read refuses over it (D75).
66
+ # newer format, unparseable or invalid, counts, since it may well have members, so no read refuses over it.
67
67
  #: () -> bool
68
68
  def set_up?
69
69
  return false unless mapped?(MetaPrinciple::ID)
@@ -144,7 +144,7 @@ module Principles
144
144
  @files.relative(id)
145
145
  end
146
146
 
147
- # The file map id was kept in under the folder's earlier name, relative to the project (#536).
147
+ # The file map id was kept in under the folder's earlier name, relative to the project.
148
148
  #: (String) -> String
149
149
  def earlier_file(id)
150
150
  @files.earlier_relative(id)
@@ -3,6 +3,8 @@
3
3
 
4
4
  require_relative "../error"
5
5
  require_relative "locator"
6
+ require_relative "meta_principle"
7
+ require_relative "report_hooks"
6
8
 
7
9
  module Principles
8
10
  # The domain logic, which loads and saves itself through data/. models/CLAUDE.md owns the boundary.
@@ -36,7 +38,7 @@ module Principles
36
38
 
37
39
  # fields is copied and frozen, so no caller changes a member through the hash it was built from or handed;
38
40
  # the copy is shallow, so its strings are the caller's. Principle builds its members from strings it has
39
- # copied and frozen, so a member in a map shares nothing (#654).
41
+ # copied and frozen, so a member in a map shares nothing.
40
42
  #: (Hash[String, untyped]) -> void
41
43
  def initialize(fields)
42
44
  @fields = fields.dup.freeze #: Hash[String, untyped]
@@ -87,19 +89,29 @@ module Principles
87
89
  end
88
90
 
89
91
  # Whether it is its whole file, which no locator but its path narrows, so it holds all the text of every
90
- # line it spans (#756).
92
+ # line it spans.
91
93
  #: () -> bool
92
94
  def whole_file?
93
95
  (LOCATORS - ["path"]).none? { |locator| @fields.key?(locator) }
94
96
  end
95
97
 
98
+ # Whether its change since a commit reads as the history of its own lines: it is part of its file, and paths,
99
+ # its file's path then and now, are one path.
100
+ #: (Array[String]) -> bool
101
+ def traced_by_lines?(paths) = !whole_file? && paths.one?
102
+
103
+ # The lines its change since a commit reads by: lines_now, the first_line and last_line it spans now, when
104
+ # traced_by_lines? says so over paths; else nil, and the change reads as its file's diff.
105
+ #: (Array[String], Hash[String, Integer]) -> Hash[String, Integer]?
106
+ def traced_lines(paths, lines_now) = (lines_now if traced_by_lines?(paths))
107
+
96
108
  # What the member does for its principle, as the map states it.
97
109
  #: () -> String?
98
110
  def role
99
111
  @fields["role"]
100
112
  end
101
113
 
102
- # The command that enforces the member, which an audit asks the agent to run (D30); nil when it has none.
114
+ # The command that enforces the member, which an audit asks the agent to run; nil when it has none.
103
115
  #: () -> String?
104
116
  def check
105
117
  @fields["check"]
@@ -108,7 +120,7 @@ module Principles
108
120
  # Each invisible formatting or direction-changing character, or line separator, the member's check
109
121
  # holds, in order, as its code point, its name when HIDDEN_CHARACTER_NAMES has it, and its position
110
122
  # counted in characters from 1; none when it has no check. This tool prints such characters escaped, and
111
- # naming them helps a reviewer who scans the command quickly (#258, #260).
123
+ # naming them helps a reviewer who scans the command quickly.
112
124
  #: () -> Array[String]
113
125
  def check_hidden_characters
114
126
  check.to_s.each_char.with_index(1).filter_map do |character, position|
@@ -131,6 +143,21 @@ module Principles
131
143
  #: () -> Locator
132
144
  def locator = Locator.new(reference)
133
145
 
146
+ # Which part of principles an upgrade can change this member is: "hook", the plugin's file at the path
147
+ # MetaPrinciple names, or a hooks or settings file whose hooks run the session-start command, whole or a part
148
+ # whose own text, which the block gives only then, runs it too; "skill", the plugin's file at the path
149
+ # MetaPrinciple names; or "passage", a section under the heading setup maps; nil for any other member.
150
+ #: (HookCommands) { () -> String } -> String?
151
+ def package_part(hooks, &)
152
+ return "passage" if @fields["section"] == MetaPrinciple::PASSAGE_HEADING
153
+
154
+ start = ReportHooks::SESSION_START.command
155
+ return ("hook" if hooks.passage_runs?(path, start, &)) unless whole_file?
156
+ return "hook" if path == MetaPrinciple::HOOK_PATH || hooks.runs?(path, start)
157
+
158
+ "skill" if path == MetaPrinciple::SKILL_PATH
159
+ end
160
+
134
161
  # This member, still known by key once it has moved. The key is stored only while it differs from the
135
162
  # member's id, so a member moved back to where it began has the bytes it had.
136
163
  #: (String) -> Member
@@ -7,6 +7,7 @@ require_relative "answer_fields"
7
7
  require_relative "answer_place"
8
8
  require_relative "carried_assessments"
9
9
  require_relative "principle_members"
10
+ require_relative "answered_time"
10
11
  require_relative "member_sighting"
11
12
  require_relative "misspelt_member_id"
12
13
  require_relative "record_judged_against"
@@ -19,17 +20,17 @@ module Principles
19
20
  module Models
20
21
  # The member_assessments of an assessment answer: one for each mapped member, each with an assessment, a delivery,
21
22
  # an observation when delivery is observed, evidence that resolves, and the result of the member's check when it
22
- # has one (D30).
23
+ # has one.
23
24
  class MemberAssessments
24
25
  # What a record entry keeps for a member carried forward, until completion puts back its last assessment.
25
26
  CARRIED = { "carried_forward" => true }.freeze #: Hash[String, untyped]
26
27
 
27
28
  # The text a fresh member's template prints in its assessment, which an answer may not send back unchanged, as a
28
- # correction may not send back its own (#991).
29
+ # correction may not send back its own.
29
30
  PLACEHOLDER = "Your assessment, including its context cost" #: String
30
31
 
31
32
  # The text the template printed alone gives a sighting's fields beside delivery, each left as printed when the
32
- # delivery gives none (#1010).
33
+ # delivery gives none.
33
34
  SIGHTING = TemplatePlaceholders.new(
34
35
  { "observation" => "Only with delivery observed: what you saw the member do, where, and what you did not see",
35
36
  "observed_at" => "Only for a sighting before this audit: when, in UTC, or a dated record's date " \
@@ -39,8 +40,8 @@ module Principles
39
40
  # assessments is the answer's member_assessments; members are the mapped members, with each checked one's
40
41
  # check; fields checks each field and locates each piece of evidence; judged_against is the principle's record
41
42
  # as it stands, which says which members' last assessments may be carried forward, marked {"member_id",
42
- # "carried_forward": true} (D49), and which command it ran for each member's check (D63); answered_at is when
43
- # the answer came, which no sighting it reports is after (#699).
43
+ # "carried_forward": true}, and which command it ran for each member's check; answered_at is when
44
+ # the answer came, which no sighting it reports is after.
44
45
  #: (untyped, PrincipleMembers, fields: AnswerFields, answered_at: String, ?judged_against: RecordJudgedAgainst?)
45
46
  #| -> void
46
47
  def initialize(assessments, members, fields:, answered_at:, judged_against: nil)
@@ -72,7 +73,7 @@ module Principles
72
73
  end
73
74
 
74
75
  # Each member's assessment by id, as its record entry keeps it: what the agent said, and the hash of each piece
75
- # of evidence it cited, which the block locates, so the next audit can say whether that evidence changed (D49).
76
+ # of evidence it cited, which the block locates, so the next audit can say whether that evidence changed.
76
77
  #: () { (Locator) -> Hash[String, untyped] } -> Hash[String, Hash[String, untyped]]
77
78
  def kept(&locate)
78
79
  @assessments.to_h do |assessment|
@@ -88,12 +89,20 @@ module Principles
88
89
 
89
90
  private
90
91
 
91
- # assessments without the sighting fields each leaves as printed, which it does not give (#1010).
92
+ # assessments without the sighting fields each leaves as printed, which it does not give, each
93
+ # observed_at given with an offset read in audited_at's form.
92
94
  #: (untyped) -> untyped
93
95
  def given(assessments)
94
96
  return assessments unless assessments.is_a?(Array)
95
97
 
96
- assessments.map { |assessment| assessment.is_a?(Hash) ? SIGHTING.given(assessment) : assessment }
98
+ assessments.map { |assessment| assessment.is_a?(Hash) ? in_utc(SIGHTING.given(assessment)) : assessment }
99
+ end
100
+
101
+ #: (Hash[String, untyped]) -> Hash[String, untyped]
102
+ def in_utc(assessment)
103
+ return assessment unless assessment.key?("observed_at")
104
+
105
+ assessment.merge("observed_at" => AnsweredTime.new(assessment["observed_at"]).in_audited_at_form)
97
106
  end
98
107
 
99
108
  # Refuses answered, the ids the assessments name, unless they are the mapped ids, each once, hinting at any
@@ -9,7 +9,7 @@ module Principles
9
9
  module Models
10
10
  # A member of another principle's map whose text shares a line with one located member: its principle, id,
11
11
  # role there and lines, and how its lines stand to the located member's: the same lines, all of them, within
12
- # them, or none of these, for a partial overlap (#383, #442, #610, #718). These are lines, not text, so what an
12
+ # them, or none of these, for a partial overlap. These are lines, not text, so what an
13
13
  # edit reaches is left to the agent.
14
14
  class MemberElsewhere
15
15
  # member is the other map's member, whose id and role are printed; span is its lines now.
@@ -24,7 +24,7 @@ module Principles
24
24
  end
25
25
 
26
26
  # Whether the agent should check the text where the lines meet before deciding which edit reaches which
27
- # member: one holds the other's lines, and the one holding them is not a whole file (#756).
27
+ # member: one holds the other's lines, and the one holding them is not a whole file.
28
28
  #: () -> bool
29
29
  def text_check_needed? = @text_check_needed
30
30
 
@@ -32,12 +32,12 @@ module Principles
32
32
  #: String
33
33
  attr_reader :principle_id
34
34
 
35
- # The findings among left_open, its principle's open findings, that name it (#772).
35
+ # The findings among left_open, its principle's open findings, that name it.
36
36
  #: (Array[OpenFinding]) -> Array[OpenFinding]
37
37
  def open_among(left_open) = left_open.select { |finding| finding.on?(@member.key) }
38
38
 
39
39
  # Its entry, naming by id the findings among left_open that name it, which the request lists once, so the same
40
- # problem is not raised again in another principle's audit (#772, D62); as to_h when none do.
40
+ # problem is not raised again in another principle's audit; as to_h when none do.
41
41
  #: (Array[OpenFinding]) -> Hash[String, untyped]
42
42
  def naming(left_open)
43
43
  on_it = open_among(left_open)
@@ -16,12 +16,12 @@ module Principles
16
16
  # a member names; passage anchors then narrow it the same way in every type.
17
17
  class MemberFile
18
18
  # The refusals, raised here and by the file types, that say a member's reference finds nothing in a file's
19
- # text, rather than that the reference itself is wrong. Add a new one here when it raises one (#457).
19
+ # text, rather than that the reference itself is wrong. Add a new one here when it raises one.
20
20
  PLACEMENT_REFUSALS = %w[section_not_found ambiguous_heading passage_not_found ambiguous_passage
21
21
  passage_end_not_found section_needs_markdown query_needs_frontmatter field_not_found
22
22
  unsupported_frontmatter duplicate_frontmatter_key].freeze
23
23
  # The placement refusals of a quote the text does not hold, which a pointer that is not a member may also
24
- # repair by pointing at other text (#742).
24
+ # repair by pointing at other text.
25
25
  QUOTE_NOT_FOUND = %w[passage_not_found passage_end_not_found].freeze #: Array[String]
26
26
  # The placement refusals that mean a member's place in its file is gone: its heading, passage anchor or
27
27
  # frontmatter field no longer matches, so it is lost there, not changed and not unreadable.
@@ -78,7 +78,7 @@ module Principles
78
78
  found
79
79
  end
80
80
 
81
- # The lines of the region locator names, as the agent reads them (D33).
81
+ # The lines of the region locator names, as the agent reads them.
82
82
  #: (Locator) -> Array[String]
83
83
  def lines_of(locator)
84
84
  located = locate(locator)
@@ -86,7 +86,7 @@ module Principles
86
86
  end
87
87
 
88
88
  # The opening of the region locator names, after the heading line itself when it names a heading, as
89
- # WriteUpOpening finds it; nil when there is none. This tool does not judge what it says (#300).
89
+ # WriteUpOpening finds it; nil when there is none. This tool does not judge what it says.
90
90
  #: (Locator) -> Hash[String, untyped]?
91
91
  def write_up_opening(locator)
92
92
  located = locate(locator)
@@ -11,7 +11,7 @@ module Principles
11
11
  module Models
12
12
  # The facts beside each member's own text that its assessment was judged on: its map entry, which holds its path,
13
13
  # locator, role and check, and when it loads, without the sizes an edit elsewhere in its file moves. A full audit
14
- # keeps a digest of each with the assessment, and carries the assessment forward only while both match (D49).
14
+ # keeps a digest of each with the assessment, and carries the assessment forward only while both match.
15
15
  class MemberGrounds
16
16
  # members are the map's members; loads is each member's MemberLoads by id.
17
17
  #: (PrincipleMembers, Hash[String, MemberLoads]) -> void
@@ -7,7 +7,7 @@ module Principles
7
7
  # The domain logic, which loads and saves itself through data/. models/CLAUDE.md owns the boundary.
8
8
  module Models
9
9
  # The member hashes an audit record holds, read from a record a later copy wrote that this copy's schema refuses,
10
- # for list-member-problems to compare its members with, read-only (#1066). Only those fields are read, each entry
10
+ # for list-member-problems to compare its members with, read-only. Only those fields are read, each entry
11
11
  # kept only when its hash is text, so nothing else of a shape this copy does not know travels; a member left out
12
12
  # is compared with the commit that mapped it instead.
13
13
  class MemberHashesAsWritten