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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +383 -0
- data/LICENSE +202 -0
- data/NOTICE +4 -0
- data/README.md +111 -0
- data/exe/principles +20 -0
- data/lib/principles/after_commit_hook_options.rb +2 -2
- data/lib/principles/cli.rb +50 -42
- data/lib/principles/command_line.rb +22 -16
- data/lib/principles/command_routes.rb +20 -6
- data/lib/principles/controllers/acknowledgement.rb +29 -74
- data/lib/principles/controllers/acknowledgements.rb +154 -0
- data/lib/principles/controllers/after_commit_report.rb +44 -0
- data/lib/principles/controllers/answer.rb +48 -18
- data/lib/principles/controllers/answer_phase.rb +20 -3
- data/lib/principles/controllers/assessment.rb +32 -11
- data/lib/principles/controllers/audit.rb +43 -19
- data/lib/principles/controllers/audit_completion.rb +21 -12
- data/lib/principles/controllers/command.rb +13 -12
- data/lib/principles/controllers/correction.rb +15 -7
- data/lib/principles/controllers/first_audit_brief.rb +40 -0
- data/lib/principles/controllers/full_audit_request.rb +41 -82
- data/lib/principles/controllers/hook_setup.rb +49 -0
- data/lib/principles/controllers/inventory.rb +10 -8
- data/lib/principles/controllers/mapping.rb +2 -2
- data/lib/principles/controllers/member_acknowledgement.rb +32 -21
- data/lib/principles/controllers/member_entries.rb +4 -4
- data/lib/principles/controllers/member_problems_report.rb +62 -16
- data/lib/principles/controllers/members_a_commit_changed.rb +3 -3
- data/lib/principles/controllers/members_to_assess.rb +23 -20
- data/lib/principles/controllers/meta_principle_setup.rb +5 -6
- data/lib/principles/controllers/open_correction.rb +42 -0
- data/lib/principles/controllers/parts_to_read.rb +117 -0
- data/lib/principles/controllers/repoint.rb +1 -1
- data/lib/principles/controllers/running_tool.rb +56 -6
- data/lib/principles/controllers/session_start_report.rb +62 -0
- data/lib/principles/controllers/survey.rb +2 -2
- data/lib/principles/data/audit_files.rb +7 -7
- data/lib/principles/data/bounded_file.rb +1 -1
- data/lib/principles/data/candidate_files_found.rb +6 -3
- data/lib/principles/data/command-steps.json +61 -6
- data/lib/principles/data/expected_type.rb +3 -3
- data/lib/principles/data/first_parent_log.rb +1 -1
- data/lib/principles/data/head_reflog.rb +74 -0
- data/lib/principles/data/hook_input.rb +59 -0
- data/lib/principles/data/ignored_by_git.rb +2 -2
- data/lib/principles/data/known_fields.rb +1 -1
- data/lib/principles/data/linked_path.rb +1 -1
- data/lib/principles/data/map_files.rb +2 -2
- data/lib/principles/data/principles_on_path.rb +83 -0
- data/lib/principles/data/principles_subfolder.rb +1 -1
- data/lib/principles/data/project_files.rb +10 -3
- data/lib/principles/data/repository.rb +14 -7
- data/lib/principles/data/running_version.rb +10 -8
- data/lib/principles/data/schema_check.rb +5 -5
- data/lib/principles/data/schemas/acknowledgement-answer.schema.json +86 -21
- data/lib/principles/data/schemas/acknowledgements-answer.schema.json +9 -2
- data/lib/principles/data/schemas/assessment-answer.schema.json +43 -22
- data/lib/principles/data/schemas/audit-record.schema.json +29 -20
- data/lib/principles/data/schemas/command-steps.schema.json +1 -1
- data/lib/principles/data/schemas/correction-answer-guide.schema.json +1 -1
- data/lib/principles/data/schemas/correction-answer.schema.json +9 -9
- data/lib/principles/data/schemas/member-map.schema.json +3 -3
- data/lib/principles/data/schemas/repointing-answer.schema.json +1 -1
- data/lib/principles/error.rb +4 -4
- data/lib/principles/failure_refusal.rb +57 -0
- data/lib/principles/invocation_options.rb +4 -4
- data/lib/principles/launch.rb +49 -0
- data/lib/principles/list_open_findings_options.rb +1 -1
- data/lib/principles/models/accepted_loading.rb +2 -2
- data/lib/principles/models/acknowledged_check.rb +23 -11
- data/lib/principles/models/acknowledgement.rb +34 -18
- data/lib/principles/models/acknowledgement_left_as_printed.rb +7 -15
- data/lib/principles/models/acknowledgement_refusal.rb +25 -10
- data/lib/principles/models/acknowledgements.rb +45 -29
- data/lib/principles/models/acknowledgements_across.rb +68 -0
- data/lib/principles/models/activation.rb +2 -2
- data/lib/principles/models/after_commit_input.rb +115 -0
- data/lib/principles/models/agent_loads.rb +1 -1
- data/lib/principles/models/answer_fields.rb +2 -2
- data/lib/principles/models/answer_place.rb +3 -3
- data/lib/principles/models/answer_text.rb +2 -2
- data/lib/principles/models/answered_time.rb +4 -4
- data/lib/principles/models/assessment_answer.rb +10 -10
- data/lib/principles/models/assessment_basis.rb +2 -2
- data/lib/principles/models/assessment_left_as_printed.rb +1 -1
- data/lib/principles/models/assessment_report.rb +6 -7
- data/lib/principles/models/audit.rb +33 -34
- data/lib/principles/models/audit_record.rb +54 -28
- data/lib/principles/models/audit_records.rb +13 -13
- data/lib/principles/models/audit_start.rb +3 -3
- data/lib/principles/models/audited_member_lines.rb +1 -1
- data/lib/principles/models/candidate_files.rb +18 -10
- data/lib/principles/models/candidate_inventory.rb +6 -6
- data/lib/principles/models/candidate_outline.rb +9 -9
- data/lib/principles/models/carried_assessments.rb +18 -3
- data/lib/principles/models/carried_member.rb +5 -5
- data/lib/principles/models/changed_regions.rb +92 -0
- data/lib/principles/models/check_result_guide.rb +50 -0
- data/lib/principles/models/check_since_last_audit.rb +5 -4
- data/lib/principles/models/cited_files.rb +4 -4
- data/lib/principles/models/command_steps.rb +3 -3
- data/lib/principles/models/commits_brought_in.rb +1 -1
- data/lib/principles/models/commits_since_base.rb +1 -1
- data/lib/principles/models/correction_answer.rb +2 -2
- data/lib/principles/models/correction_basis.rb +7 -7
- data/lib/principles/models/dated_line.rb +1 -2
- data/lib/principles/models/decided_prior_findings.rb +6 -6
- data/lib/principles/models/declared_map_changes.rb +5 -5
- data/lib/principles/models/disposition.rb +21 -21
- data/lib/principles/models/entry_file.rb +1 -1
- data/lib/principles/models/entry_files.rb +1 -1
- data/lib/principles/models/evidence_item.rb +1 -1
- data/lib/principles/models/evidence_lines_since.rb +2 -2
- data/lib/principles/models/evidence_replacements.rb +3 -3
- data/lib/principles/models/finding_write_ups.rb +12 -5
- data/lib/principles/models/findings_left_open.rb +4 -4
- data/lib/principles/models/first_full_audit.rb +32 -0
- data/lib/principles/models/first_raised_claim.rb +1 -1
- data/lib/principles/models/fix_only_fields.rb +1 -1
- data/lib/principles/models/head_moves.rb +66 -0
- data/lib/principles/models/hook_commands.rb +49 -4
- data/lib/principles/models/ignored_candidates.rb +1 -1
- data/lib/principles/models/instruction_named.rb +2 -3
- data/lib/principles/models/json_digest.rb +2 -2
- data/lib/principles/models/json_path_query.rb +1 -1
- data/lib/principles/models/kept_prior_finding.rb +9 -9
- data/lib/principles/models/last_completed_revision.rb +4 -5
- data/lib/principles/models/left_as_printed.rb +2 -2
- data/lib/principles/models/line_diff.rb +113 -0
- data/lib/principles/models/line_span.rb +1 -1
- data/lib/principles/models/list_member_problems_check.rb +4 -4
- data/lib/principles/models/listed_members.rb +7 -9
- data/lib/principles/models/loaded_files.rb +4 -5
- data/lib/principles/models/loading_decision.rb +3 -3
- data/lib/principles/models/loading_facts.rb +1 -1
- data/lib/principles/models/loads_to_check.rb +1 -1
- data/lib/principles/models/located_text.rb +1 -1
- data/lib/principles/models/mapped_principles.rb +2 -2
- data/lib/principles/models/member.rb +31 -4
- data/lib/principles/models/member_assessments.rb +8 -8
- data/lib/principles/models/member_elsewhere.rb +4 -4
- data/lib/principles/models/member_file.rb +4 -4
- data/lib/principles/models/member_grounds.rb +1 -1
- data/lib/principles/models/member_hashes_as_written.rb +1 -1
- data/lib/principles/models/member_lines.rb +29 -61
- data/lib/principles/models/member_loads.rb +2 -2
- data/lib/principles/models/member_moves.rb +1 -1
- data/lib/principles/models/member_problems.rb +14 -15
- data/lib/principles/models/member_repair_moves.rb +15 -9
- data/lib/principles/models/member_sighting.rb +10 -10
- data/lib/principles/models/member_snapshots.rb +1 -1
- data/lib/principles/models/member_state.rb +1 -1
- data/lib/principles/models/members_across_principles.rb +77 -0
- data/lib/principles/models/members_elsewhere.rb +2 -2
- data/lib/principles/models/members_sharing_lines.rb +7 -7
- data/lib/principles/models/meta_principle.rb +11 -4
- data/lib/principles/models/missing_files.rb +3 -3
- data/lib/principles/models/new_findings.rb +4 -4
- data/lib/principles/models/open_correction.rb +57 -0
- data/lib/principles/models/open_finding.rb +36 -31
- data/lib/principles/models/open_findings_elsewhere.rb +2 -2
- data/lib/principles/models/other_principles.rb +2 -2
- data/lib/principles/models/other_templates_placeholders.rb +17 -16
- data/lib/principles/models/outline_budget.rb +7 -7
- data/lib/principles/models/outline_group.rb +1 -1
- data/lib/principles/models/outline_section.rb +2 -2
- data/lib/principles/models/part_named.rb +41 -0
- data/lib/principles/models/placement.rb +2 -2
- data/lib/principles/models/principle.rb +13 -13
- data/lib/principles/models/principle_history.rb +8 -8
- data/lib/principles/models/principle_members.rb +14 -7
- data/lib/principles/models/principles_folder_move.rb +1 -1
- data/lib/principles/models/principles_on_path.rb +29 -0
- data/lib/principles/models/principles_package.rb +3 -3
- data/lib/principles/models/prior_decision_fields.rb +8 -8
- data/lib/principles/models/prior_finding_decision.rb +8 -8
- data/lib/principles/models/prior_finding_outcomes.rb +1 -1
- data/lib/principles/models/prior_findings.rb +5 -5
- data/lib/principles/models/problem_report.rb +26 -8
- data/lib/principles/models/project.rb +27 -19
- data/lib/principles/models/project_history.rb +18 -12
- data/lib/principles/models/quoted_change.rb +8 -8
- data/lib/principles/models/recent_decision.rb +3 -3
- data/lib/principles/models/record_format.rb +16 -10
- data/lib/principles/models/record_judged_against.rb +4 -4
- data/lib/principles/models/recorded_entry.rb +17 -8
- data/lib/principles/models/recorded_finding.rb +9 -9
- data/lib/principles/models/recorded_findings.rb +2 -2
- data/lib/principles/models/recorded_hashes.rb +2 -2
- data/lib/principles/models/recorded_members.rb +13 -13
- data/lib/principles/models/refusal_before_shape.rb +2 -2
- data/lib/principles/models/repoint.rb +3 -3
- data/lib/principles/models/report_hooks.rb +69 -0
- data/lib/principles/models/reported_check.rb +34 -31
- data/lib/principles/models/request_id.rb +18 -6
- data/lib/principles/models/runs_from.rb +7 -2
- data/lib/principles/models/sent_answer.rb +14 -12
- data/lib/principles/models/sent_prior_decisions.rb +1 -1
- data/lib/principles/models/session_start_input.rb +37 -0
- data/lib/principles/models/shape_problems_beside.rb +1 -1
- data/lib/principles/models/skill_loads.rb +1 -1
- data/lib/principles/models/stale_request.rb +59 -0
- data/lib/principles/models/still_holds_restatement.rb +6 -6
- data/lib/principles/models/submitted_answer.rb +1 -1
- data/lib/principles/models/template_placeholders.rb +6 -6
- data/lib/principles/models/text_within.rb +1 -1
- data/lib/principles/models/tracked_paths.rb +38 -0
- data/lib/principles/models/unchecked_members.rb +2 -2
- data/lib/principles/models/uncommitted_files.rb +1 -1
- data/lib/principles/models/uncommitted_outside_the_map.rb +2 -2
- data/lib/principles/models/waits_on.rb +1 -1
- data/lib/principles/models/write_up_opening.rb +5 -5
- data/lib/principles/models/write_up_pointer.rb +3 -3
- data/lib/principles/models/write_up_repoint.rb +2 -3
- data/lib/principles/positional_arguments.rb +13 -6
- data/lib/principles/prose_list.rb +1 -1
- data/lib/principles/session_start_options.rb +1 -1
- data/lib/principles/start_audit_options.rb +46 -12
- data/lib/principles/supported_ruby.rb +24 -7
- data/lib/principles/version.rb +2 -2
- data/lib/principles/views/acknowledged_since_last_audit.rb +2 -2
- data/lib/principles/views/acknowledgement_result.rb +97 -11
- data/lib/principles/views/activation_in_hand.rb +1 -1
- data/lib/principles/views/answered_request.rb +6 -2
- data/lib/principles/views/assessed_members.rb +50 -41
- data/lib/principles/views/assessment_request.rb +39 -36
- data/lib/principles/views/audit_changes.rb +4 -4
- data/lib/principles/views/audit_commit.rb +5 -4
- data/lib/principles/views/audit_result.rb +92 -53
- data/lib/principles/views/candidate_files_result.rb +7 -6
- data/lib/principles/views/check_notes.rb +29 -6
- data/lib/principles/views/check_result_template.rb +45 -34
- data/lib/principles/views/completed_audit_next_step.rb +44 -0
- data/lib/principles/views/context_parts.rb +112 -0
- data/lib/principles/views/correction_request.rb +44 -25
- data/lib/principles/views/diff_since_last_audit.rb +8 -6
- data/lib/principles/views/findings_result.rb +17 -6
- data/lib/principles/views/first_audit_brief.rb +51 -0
- data/lib/principles/views/first_audit_line.rb +45 -0
- data/lib/principles/views/help.rb +4 -4
- data/lib/principles/views/hook_setup_result.rb +91 -0
- data/lib/principles/views/instruction.rb +3 -3
- data/lib/principles/views/invocation.rb +14 -6
- data/lib/principles/views/json_with_entries_on_lines.rb +6 -35
- data/lib/principles/views/landed_since_base.rb +1 -1
- data/lib/principles/views/line_history_since_last_audit.rb +35 -0
- data/lib/principles/views/lines_shared_with_member.rb +6 -6
- data/lib/principles/views/loads_to_check_result.rb +8 -5
- data/lib/principles/views/map_added_to.rb +3 -3
- data/lib/principles/views/map_result.rb +9 -9
- data/lib/principles/views/member_change_since_baseline.rb +44 -23
- data/lib/principles/views/member_lines_beside_text.rb +43 -0
- data/lib/principles/views/member_repairs.rb +3 -2
- data/lib/principles/views/member_row.rb +2 -2
- data/lib/principles/views/members_a_commit_changed.rb +13 -10
- data/lib/principles/views/members_with_no_baseline.rb +3 -3
- data/lib/principles/views/meta_principle_passage.rb +1 -1
- data/lib/principles/views/meta_principle_result.rb +12 -5
- data/lib/principles/views/one_member_check_result_template.rb +7 -7
- data/lib/principles/views/open_findings_elsewhere_result.rb +5 -2
- data/lib/principles/views/open_findings_line.rb +25 -36
- data/lib/principles/views/other_principles_unjudged_result.rb +6 -3
- data/lib/principles/views/outside_the_map_result.rb +5 -2
- data/lib/principles/views/package_since_last_audit_result.rb +29 -6
- data/lib/principles/views/parts_index_result.rb +60 -0
- data/lib/principles/views/principle_read_result.rb +5 -6
- data/lib/principles/views/principle_with_changed_members.rb +1 -1
- data/lib/principles/views/principles_with_no_completed_audit.rb +1 -2
- data/lib/principles/views/printed_json.rb +51 -0
- data/lib/principles/views/printed_principle.rb +1 -1
- data/lib/principles/views/prior_finding_decisions_result.rb +4 -4
- data/lib/principles/views/prior_findings_result.rb +17 -14
- data/lib/principles/views/problem_lines.rb +39 -17
- data/lib/principles/views/problem_result.rb +40 -37
- data/lib/principles/views/prompts/acknowledge-a-change/judge-each-member-once-for-every-principle.md +2 -0
- data/lib/principles/views/prompts/acknowledge-a-change/read-the-deferred-findings-it-keeps.md +1 -0
- data/lib/principles/views/prompts/acknowledge-a-change/resolve-them-in-a-full-audit.md +1 -0
- data/lib/principles/views/prompts/acknowledge-a-change/say-whether-the-change-keeps-the-meaning.md +3 -3
- data/lib/principles/views/prompts/assess-every-member/confirm-each-write-up-pointer-the-answer-drops.md +2 -0
- data/lib/principles/views/prompts/assess-every-member/have-a-changed-check-reviewed-before-running-it.md +1 -1
- data/lib/principles/views/prompts/assess-every-member/have-a-new-check-reviewed-before-running-it.md +1 -1
- data/lib/principles/views/prompts/assess-every-member/judge-a-carried-assessment-citing-a-decided-finding.md +3 -0
- data/lib/principles/views/prompts/assess-every-member/judge-a-submitted-carried-assessment-citing-a-decided-finding.md +5 -0
- data/lib/principles/views/prompts/assess-every-member/judge-the-keeping-under-the-release-since-the-last-audit.md +1 -1
- data/lib/principles/views/prompts/assess-every-member/keep-the-printed-review-basis-or-replace-it.md +1 -0
- data/lib/principles/views/prompts/assess-every-member/name-the-commit-that-made-the-check.md +1 -0
- data/lib/principles/views/prompts/assess-every-member/read-a-trimmed-instruction-whole.md +1 -1
- data/lib/principles/views/prompts/assess-every-member/read-the-request-in-parts.md +1 -0
- data/lib/principles/views/prompts/assess-every-member/why-each-member-is-judged-again.md +3 -2
- data/lib/principles/views/prompts/dispose-of-each-finding/answer-guide.json +1 -1
- data/lib/principles/views/prompts/dispose-of-each-finding/confirm-each-deferral-written-up-nowhere.md +2 -0
- data/lib/principles/views/prompts/dispose-of-each-finding/retain-assessment-and-correction.md +4 -4
- data/lib/principles/views/prompts/find-a-principle-to-map/where-the-inventory-looks.md +2 -2
- data/lib/principles/views/prompts/learn-what-a-command-does/list-candidate-files.md +4 -3
- data/lib/principles/views/prompts/learn-what-a-command-does/list-member-problems.md +6 -6
- data/lib/principles/views/prompts/learn-what-a-command-does/list-open-findings.md +11 -11
- data/lib/principles/views/prompts/learn-what-a-command-does/report-after-commit.md +14 -0
- data/lib/principles/views/prompts/learn-what-a-command-does/report-at-session-start.md +26 -0
- data/lib/principles/views/prompts/learn-what-a-command-does/show-answer-check.md +20 -18
- data/lib/principles/views/prompts/learn-what-a-command-does/show-first-audit-brief.md +19 -0
- data/lib/principles/views/prompts/learn-what-a-command-does/show-hook-setup.md +13 -0
- data/lib/principles/views/prompts/learn-what-a-command-does/show-meta-principle-passage.md +3 -1
- data/lib/principles/views/prompts/learn-what-a-command-does/show-open-correction.md +12 -0
- data/lib/principles/views/prompts/learn-what-a-command-does/start-audit.md +21 -22
- data/lib/principles/views/prompts/learn-what-a-command-does/submit-answer.md +5 -4
- data/lib/principles/views/prompts/report-the-completed-audit/commit-only-what-the-audit-changed.md +2 -2
- data/lib/principles/views/prompts/run-a-first-audit-in-the-background/follow-the-brief.md +18 -0
- data/lib/principles/views/prompts/set-principles-up/offer-the-report-hooks.md +2 -0
- data/lib/principles/views/prompts/set-principles-up/wire-the-report-hooks-with-the-user.md +8 -0
- data/lib/principles/views/prompts/start-a-session/act-on-the-open-findings.md +3 -4
- data/lib/principles/views/prompts/start-a-session/every-loaded-line-costs-every-session.md +1 -1
- data/lib/principles/views/prompts/start-a-session/hand-the-first-audit-to-a-subagent.md +3 -0
- data/lib/principles/views/prompts/start-a-session/run-each-command-above.md +1 -0
- data/lib/principles/views/prompts/start-a-session/start-no-second-first-audit.md +2 -0
- data/lib/principles/views/prompts.rb +1 -1
- data/lib/principles/views/read_the_change.rb +36 -0
- data/lib/principles/views/record_waiting_on_an_upgrade.rb +2 -2
- data/lib/principles/views/repoint_result.rb +1 -1
- data/lib/principles/views/report_hooks_offer.rb +25 -0
- data/lib/principles/views/request_part.rb +5 -5
- data/lib/principles/views/request_parts.rb +1 -1
- data/lib/principles/views/session_start_report.rb +46 -0
- data/lib/principles/views/shell_word.rb +1 -1
- data/lib/principles/views/trimmed_instructions_note.rb +30 -0
- data/lib/principles/views/visible_text.rb +1 -1
- data/lib/principles/views/workflow_diagram.rb +1 -1
- data/principles.gemspec +44 -0
- metadata +83 -14
- data/lib/principles/views/prompts/start-a-session/it-returns-after-each-clear-or-compaction-too.md +0 -1
- data/lib/principles/views/prompts/start-a-session/it-returns-at-each-session-start.md +0 -1
|
@@ -11,6 +11,7 @@ require_relative "member_file"
|
|
|
11
11
|
require_relative "commits_brought_in"
|
|
12
12
|
require_relative "uncommitted_files"
|
|
13
13
|
require_relative "captured_head"
|
|
14
|
+
require_relative "tracked_paths"
|
|
14
15
|
|
|
15
16
|
module Principles
|
|
16
17
|
# The domain logic, and the mediation of persistence. models/CLAUDE.md owns the boundary.
|
|
@@ -19,7 +20,7 @@ module Principles
|
|
|
19
20
|
# is based on, each member as that commit holds it, and what changed since. Outside git there is no
|
|
20
21
|
# history, and an audit has no base commit. A path that is a symbolic link, or lies below one, is read at
|
|
21
22
|
# each commit in the file its links lead to, and whether it is committed, and which commits touched it, cover
|
|
22
|
-
# every link on the way, since git holds a link as its target's name
|
|
23
|
+
# every link on the way, since git holds a link as its target's name. uncommitted_outside alone asks by
|
|
23
24
|
# the paths given: start-audit asks it only once base_commit found every file they lead to committed.
|
|
24
25
|
class ProjectHistory
|
|
25
26
|
# This tool's folder as git names a folder, now and under its earlier name.
|
|
@@ -31,15 +32,20 @@ module Principles
|
|
|
31
32
|
@repository = repository
|
|
32
33
|
@files = files
|
|
33
34
|
@head = CapturedHead.new(repository) #: CapturedHead
|
|
35
|
+
@tracked_paths = nil #: TrackedPaths?
|
|
34
36
|
end
|
|
35
37
|
|
|
38
|
+
# Every path git tracks, as git spells it, read once for the command; none outside git.
|
|
39
|
+
#: () -> TrackedPaths
|
|
40
|
+
def tracked_paths = @tracked_paths ||= TrackedPaths.new(@repository.tracked_files)
|
|
41
|
+
|
|
36
42
|
# Which of paths, and of the links and files they lead through, git does not track, which an audit refuses as
|
|
37
|
-
# members until committed
|
|
43
|
+
# members until committed. nil outside git, where nothing is checked.
|
|
38
44
|
#: (Array[String]) -> Array[String]?
|
|
39
45
|
def untracked(paths) = (@repository.untracked(through_links(paths)) if @repository.inside?)
|
|
40
46
|
|
|
41
47
|
# Whether git tracks path and every file its links lead to, so a fresh clone finds its text; an ignored file is
|
|
42
|
-
# not tracked either
|
|
48
|
+
# not tracked either. True outside git, where nothing is checked.
|
|
43
49
|
#: (String) -> bool
|
|
44
50
|
def tracks?(path) = !@repository.inside? || @repository.not_tracked(through_links([path])).empty?
|
|
45
51
|
|
|
@@ -48,7 +54,7 @@ module Principles
|
|
|
48
54
|
def inside_git? = @repository.inside?
|
|
49
55
|
|
|
50
56
|
# The full sha of the commit revision names, which a survey of the commits after it starts from. Refuses outside
|
|
51
|
-
# git, where there are no commits, and a revision git resolves to no commit
|
|
57
|
+
# git, where there are no commits, and a revision git resolves to no commit.
|
|
52
58
|
#: (String) -> String
|
|
53
59
|
def commit_named(revision)
|
|
54
60
|
unless @repository.inside?
|
|
@@ -62,12 +68,12 @@ module Principles
|
|
|
62
68
|
.including("revision" => revision)
|
|
63
69
|
end
|
|
64
70
|
|
|
65
|
-
# Each file the commits after commit, a full sha, changed up to HEAD that the project still holds
|
|
71
|
+
# Each file the commits after commit, a full sha, changed up to HEAD that the project still holds.
|
|
66
72
|
#: (String) -> Array[String]
|
|
67
73
|
def changed_after(commit) = @repository.changed_since(commit).select { |path| @files.file?(path) }
|
|
68
74
|
|
|
69
75
|
# The project's files, other than paths, that differ from HEAD or are untracked, ignored ones aside; nil
|
|
70
|
-
# outside git or when there are none. A check and an answer's evidence read them as they are now
|
|
76
|
+
# outside git or when there are none. A check and an answer's evidence read them as they are now.
|
|
71
77
|
#: (Array[String]) -> Array[String]?
|
|
72
78
|
def uncommitted_outside(paths)
|
|
73
79
|
return unless @repository.inside?
|
|
@@ -77,7 +83,7 @@ module Principles
|
|
|
77
83
|
end
|
|
78
84
|
|
|
79
85
|
# Refuses a write-up's path while it, or a file its links lead to, differs from HEAD: the record is committed
|
|
80
|
-
# pointing at it, so a fresh clone would find nothing there
|
|
86
|
+
# pointing at it, so a fresh clone would find nothing there. Nothing outside git.
|
|
81
87
|
#: (String) -> void
|
|
82
88
|
def refuse_uncommitted_write_up(path)
|
|
83
89
|
UncommittedFiles.new(uncommitted([path])).refuse_write_up(path) if @repository.inside?
|
|
@@ -100,7 +106,7 @@ module Principles
|
|
|
100
106
|
end
|
|
101
107
|
|
|
102
108
|
# The lines of the member at locator in its file at commit, or nil when commit lacks the file or the
|
|
103
|
-
# locator finds nothing in its text there, as after a move; any other refusal still refuses
|
|
109
|
+
# locator finds nothing in its text there, as after a move; any other refusal still refuses.
|
|
104
110
|
#: (String, Locator) -> Array[String]?
|
|
105
111
|
def lines_at(commit, locator)
|
|
106
112
|
path = locator.path
|
|
@@ -130,7 +136,7 @@ module Principles
|
|
|
130
136
|
# The rename git detects for path, a file absent from the working tree, as {"to", "similarity",
|
|
131
137
|
# "deleted_in"}: the last commit that touched path, or nil while the move is not yet committed. It is
|
|
132
138
|
# git's similarity match, which can pair a deleted file with an unrelated similar one, so the agent checks
|
|
133
|
-
# it
|
|
139
|
+
# it. nil outside git, for a file that exists, or when git detects none.
|
|
134
140
|
#: (String) -> Hash[String, untyped]?
|
|
135
141
|
def rename_of(path)
|
|
136
142
|
return unless @repository.inside? && @repository.absent?(path)
|
|
@@ -160,12 +166,12 @@ module Principles
|
|
|
160
166
|
end
|
|
161
167
|
|
|
162
168
|
# Which of paths name a file in the project now, so a file deleted since an audit cited it is not committed as a
|
|
163
|
-
# deletion
|
|
169
|
+
# deletion.
|
|
164
170
|
#: (Array[String]) -> Array[String]
|
|
165
171
|
def existing(paths) = paths.select { |path| @files.file?(path) }
|
|
166
172
|
|
|
167
173
|
# The commit HEAD named when this history first asked, kept for the rest of the command, so a commit landing
|
|
168
|
-
# while it runs leaves no read at one commit and the next at another
|
|
174
|
+
# while it runs leaves no read at one commit and the next at another; nil outside git. A history serves
|
|
169
175
|
# one command at most, so the next command sees the new commit.
|
|
170
176
|
#: () -> String?
|
|
171
177
|
def head = @head.commit
|
|
@@ -187,7 +193,7 @@ module Principles
|
|
|
187
193
|
@repository.commits_touching(through_links(paths), since: since, up_to: head || "HEAD")
|
|
188
194
|
end
|
|
189
195
|
|
|
190
|
-
# The commits after commit, up to HEAD, that one move of HEAD brought in, whatever they changed
|
|
196
|
+
# The commits after commit, up to HEAD, that one move of HEAD brought in, whatever they changed.
|
|
191
197
|
#: (String) -> CommitsBroughtIn
|
|
192
198
|
def commits_brought_in(commit)
|
|
193
199
|
CommitsBroughtIn.new(@repository.commits_since(commit, []).map { |each| each.fetch("commit") })
|
|
@@ -7,8 +7,8 @@ require_relative "member_lines"
|
|
|
7
7
|
module Principles
|
|
8
8
|
# The domain logic, and the mediation of persistence. models/CLAUDE.md owns the boundary.
|
|
9
9
|
module Models
|
|
10
|
-
# A one-member audit's change as its answer quotes it
|
|
11
|
-
# each a whole line of its side or a fragment long enough to show the edit that only its side reads
|
|
10
|
+
# A one-member audit's change as its answer quotes it: a line of the member before the change and one after,
|
|
11
|
+
# each a whole line of its side or a fragment long enough to show the edit that only its side reads.
|
|
12
12
|
class QuotedChange
|
|
13
13
|
# One side of the change a quote is checked against: the member's lines then, and when they read.
|
|
14
14
|
class SideOfTheChange
|
|
@@ -33,10 +33,10 @@ module Principles
|
|
|
33
33
|
def first_line_absent_from(other) = @lines.find { |line| !other.whole_line?(line) } || ""
|
|
34
34
|
end
|
|
35
35
|
|
|
36
|
-
# The fewest characters a quoted fragment of a line may have, so it shows which edit was read
|
|
36
|
+
# The fewest characters a quoted fragment of a line may have, so it shows which edit was read.
|
|
37
37
|
FRAGMENT_LENGTH = 30
|
|
38
38
|
|
|
39
|
-
# The longest changed line the hint gives whole, beyond which it gives the span the edit changed
|
|
39
|
+
# The longest changed line the hint gives whole, beyond which it gives the span the edit changed.
|
|
40
40
|
LONG_LINE = 200
|
|
41
41
|
|
|
42
42
|
# lines holds the member's lines at its baseline commit and at HEAD; member_id names it in a refusal.
|
|
@@ -48,9 +48,9 @@ module Principles
|
|
|
48
48
|
freeze
|
|
49
49
|
end
|
|
50
50
|
|
|
51
|
-
# The first line on each side the other lacks, which the request hints the quotes from
|
|
51
|
+
# The first line on each side the other lacks, which the request hints the quotes from; of a pair with a
|
|
52
52
|
# line over LONG_LINE characters, the span each side's edit changed, so a small edit is found without comparing
|
|
53
|
-
# two long lines by eye, and the request does not carry them again
|
|
53
|
+
# two long lines by eye, and the request does not carry them again.
|
|
54
54
|
#: () -> Hash[String, String]
|
|
55
55
|
def first_changed_lines
|
|
56
56
|
old_line = @then.first_line_absent_from(@now)
|
|
@@ -83,7 +83,7 @@ module Principles
|
|
|
83
83
|
end
|
|
84
84
|
|
|
85
85
|
# The start of the word at index in line, when it starts within FRAGMENT_LENGTH before it; else index, so a
|
|
86
|
-
# span of a line without spaces keeps its context
|
|
86
|
+
# span of a line without spaces keeps its context.
|
|
87
87
|
#: (String, Integer) -> Integer
|
|
88
88
|
def word_start(line, index)
|
|
89
89
|
return index if index.zero?
|
|
@@ -113,7 +113,7 @@ module Principles
|
|
|
113
113
|
def common_length(one, other) = one.each_char.zip(other.each_char).take_while { |a, b| a == b }.length
|
|
114
114
|
|
|
115
115
|
# A quote is a whole line, or a fragment long enough to show the edit, that only this side reads; or "" when
|
|
116
|
-
# this side has no line the other lacks, as before a pure insertion
|
|
116
|
+
# this side has no line the other lacks, as before a pure insertion.
|
|
117
117
|
#: (String, SideOfTheChange, SideOfTheChange) -> void
|
|
118
118
|
def quoted(line, side, other)
|
|
119
119
|
return if line == side.first_line_absent_from(other)
|
|
@@ -11,10 +11,10 @@ module Principles
|
|
|
11
11
|
module Models
|
|
12
12
|
# The recent decision under a principle an assessment answer judges against its members' own words: either why
|
|
13
13
|
# none can be checked, or how one held up with pointers to where it is recorded. The record keeps none of it,
|
|
14
|
-
# but a completed audit asks to commit the files its evidence cites
|
|
14
|
+
# but a completed audit asks to commit the files its evidence cites.
|
|
15
15
|
class RecentDecision
|
|
16
16
|
# The placeholder start-audit --as template prints in each field of both forms, so the agent fills one form
|
|
17
|
-
# and leaves the other as printed, which is not giving it
|
|
17
|
+
# and leaves the other as printed, which is not giving it.
|
|
18
18
|
PLACEHOLDERS = TemplatePlaceholders.new(
|
|
19
19
|
{
|
|
20
20
|
"unavailable_reason" => "Why no recent decision under this principle can be checked. Leave as printed " \
|
|
@@ -35,7 +35,7 @@ module Principles
|
|
|
35
35
|
end
|
|
36
36
|
|
|
37
37
|
# Whether the decision as sent gives fields and leaves every one as the template printed it, so gives neither
|
|
38
|
-
# form
|
|
38
|
+
# form.
|
|
39
39
|
#: () -> bool
|
|
40
40
|
def left_as_printed? = @sent_any && @decision.empty?
|
|
41
41
|
|
|
@@ -9,17 +9,21 @@ module Principles
|
|
|
9
9
|
module Models
|
|
10
10
|
# An audit record's format: the number a copy compares with the newest it writes and rewrites without losing a
|
|
11
11
|
# field, and the first release that wrote it, which a copy that does not know the format names as the update to
|
|
12
|
-
# make
|
|
12
|
+
# make. A record without a format is older than format 1. An open record outside git keeps the last
|
|
13
13
|
# completed one whole, so that one's format counts too.
|
|
14
14
|
class RecordFormat
|
|
15
15
|
# The refusal of a record a later copy wrote at a format this copy cannot rewrite or read, which a read across
|
|
16
|
-
# principles, or one comparing members, catches by its kind rather than its code
|
|
16
|
+
# principles, or one comparing members, catches by its kind rather than its code.
|
|
17
17
|
class NewerFormatError < Error; end
|
|
18
18
|
|
|
19
|
-
#
|
|
20
|
-
# hand to the release that commit ships in
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
# The release that first wrote each format. In the commit that adds a field an older copy would drop on a
|
|
20
|
+
# rewrite, add the next format here, set by hand to the release that commit ships in, and name the field in
|
|
21
|
+
# FIELD_FORMATS, so only a record carrying it moves up.
|
|
22
|
+
FIRST_RELEASES = { 1 => "0.0.4", 2 => "0.0.8" }.freeze #: Hash[Integer, String]
|
|
23
|
+
# The format each later field needs: the open record's correction, which show-open-correction prints again.
|
|
24
|
+
FIELD_FORMATS = { "correction" => 2 }.freeze #: Hash[String, Integer]
|
|
25
|
+
# The newest format this copy writes and rewrites without losing a field; formats count up from 1.
|
|
26
|
+
NEWEST = FIRST_RELEASES.size #: Integer
|
|
23
27
|
FIELDS = %w[format format_first_release].freeze
|
|
24
28
|
|
|
25
29
|
#: (untyped) -> RecordFormat?
|
|
@@ -34,10 +38,12 @@ module Principles
|
|
|
34
38
|
freeze
|
|
35
39
|
end
|
|
36
40
|
|
|
37
|
-
# The record's fields as this copy writes them,
|
|
41
|
+
# The record's fields as this copy writes them, ahead of the rest the oldest format that holds them all and that
|
|
42
|
+
# format's first release, worked out again on each write.
|
|
38
43
|
#: () -> Hash[String, untyped]
|
|
39
44
|
def stamped
|
|
40
|
-
|
|
45
|
+
format = FIELD_FORMATS.filter_map { |field, needs| needs if @fields.key?(field) }.max || 1
|
|
46
|
+
{ "format" => format, "format_first_release" => FIRST_RELEASES.fetch(format), **@fields.except(*FIELDS) }
|
|
41
47
|
end
|
|
42
48
|
|
|
43
49
|
# Refuses a record whose format, or its kept last completed record's, is above NEWEST, before this copy, at
|
|
@@ -52,7 +58,7 @@ module Principles
|
|
|
52
58
|
end
|
|
53
59
|
|
|
54
60
|
# Refuses a record this copy's schema refused, when a later copy wrote it, so it is not reported as invalid.
|
|
55
|
-
# A read holds no version, so the repair names both ways to update
|
|
61
|
+
# A read holds no version, so the repair names both ways to update.
|
|
56
62
|
#: (String) -> void
|
|
57
63
|
def refuse_unreadable(file)
|
|
58
64
|
return unless newer?
|
|
@@ -73,7 +79,7 @@ module Principles
|
|
|
73
79
|
#: () -> String
|
|
74
80
|
def first_release = newest_held.last
|
|
75
81
|
|
|
76
|
-
# How to update to read the record, whatever copy runs: what a read without the running version says
|
|
82
|
+
# How to update to read the record, whatever copy runs: what a read without the running version says.
|
|
77
83
|
#: () -> String
|
|
78
84
|
def update_either_way
|
|
79
85
|
"Update the principles plugin or gem to #{first_release} or later, or a checkout or archive of principles " \
|
|
@@ -9,8 +9,8 @@ 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 principle's audit record as it stands when an assessment answer is judged against it, each part read from
|
|
12
|
-
# that one record: the members whose loads the answer must decide
|
|
13
|
-
# forward
|
|
12
|
+
# that one record: the members whose loads the answer must decide, the assessments it may carry
|
|
13
|
+
# forward, and the command it ran for each member's check.
|
|
14
14
|
class RecordJudgedAgainst
|
|
15
15
|
# record is the principle's stored record, open or completed, nil when it has none.
|
|
16
16
|
#: (loads: LoadsToCheck, carried: CarriedAssessments, record: AuditRecord?) -> void
|
|
@@ -34,9 +34,9 @@ module Principles
|
|
|
34
34
|
#: (String) -> String?
|
|
35
35
|
def check_run_for(key) = @record&.check_run_for(key)
|
|
36
36
|
|
|
37
|
-
# The line saying what the review of that run rested on, and since when, as
|
|
37
|
+
# The line saying what the review of that run rested on, and since when, as an answer keeping it carries it.
|
|
38
38
|
#: (String) -> Hash[String, untyped]
|
|
39
|
-
def check_review_for(key) = @record&.
|
|
39
|
+
def check_review_for(key) = @record&.check_review_carried_for(key) || {}
|
|
40
40
|
end
|
|
41
41
|
end
|
|
42
42
|
end
|
|
@@ -7,7 +7,7 @@ module Principles
|
|
|
7
7
|
# The domain logic, and the mediation of persistence. models/CLAUDE.md owns the boundary.
|
|
8
8
|
module Models
|
|
9
9
|
# One member's entry in a completed audit record, filed under the id the member had then: its hash, any
|
|
10
|
-
# acknowledgements since
|
|
10
|
+
# acknowledgements since, and the assessment that audit kept for it, with what it was judged on.
|
|
11
11
|
class RecordedEntry
|
|
12
12
|
#: (String, Hash[String, untyped]) -> void
|
|
13
13
|
def initialize(filed_id, entry)
|
|
@@ -18,7 +18,7 @@ module Principles
|
|
|
18
18
|
|
|
19
19
|
# The key the record knows the member by: the key kept beside its entry when it differs from the id it was
|
|
20
20
|
# filed under, else that id. The one owner of that rule, which MemberHashesAsWritten reads a newer record by
|
|
21
|
-
# too
|
|
21
|
+
# too.
|
|
22
22
|
#: () -> String
|
|
23
23
|
def key = @entry["key"] || @filed_id
|
|
24
24
|
|
|
@@ -26,13 +26,22 @@ module Principles
|
|
|
26
26
|
#: () -> Hash[String, untyped]?
|
|
27
27
|
def assessment = @entry["assessment"]
|
|
28
28
|
|
|
29
|
-
# The path of each file the kept assessment cites as evidence; none when it kept none
|
|
29
|
+
# The path of each file the kept assessment cites as evidence; none when it kept none.
|
|
30
30
|
#: () -> Array[String]
|
|
31
31
|
def cited_paths = (assessment&.fetch("evidence", nil) || []).map { it.fetch("path") }
|
|
32
32
|
|
|
33
|
+
# Each of finding_ids the kept assessment's text names as a whole word, in its assessment or observation; none
|
|
34
|
+
# when it kept none. Ids repeat across records, so naming one says only that the text may cite it.
|
|
35
|
+
#: (Array[String]) -> Array[String]
|
|
36
|
+
def naming(finding_ids)
|
|
37
|
+
kept = assessment or return []
|
|
38
|
+
text = kept.values_at("assessment", "observation").compact.join("\n")
|
|
39
|
+
finding_ids.select { text.match?(/(?<![[:alnum:]_])#{Regexp.escape(it)}(?![[:alnum:]_])/) }
|
|
40
|
+
end
|
|
41
|
+
|
|
33
42
|
# The kept assessment as the next full audit shows it carried forward, an observed delivery's sighting dated
|
|
34
|
-
# beside it
|
|
35
|
-
# item's hash then
|
|
43
|
+
# beside it, with whether any evidence it cited changed since, which the block says from each evidence
|
|
44
|
+
# item's hash then.
|
|
36
45
|
#: () { (Locator, String) -> bool } -> Hash[String, untyped]
|
|
37
46
|
def carried_forward(&changed)
|
|
38
47
|
kept = assessment || {}
|
|
@@ -42,7 +51,7 @@ module Principles
|
|
|
42
51
|
end
|
|
43
52
|
|
|
44
53
|
# When the sighting the kept assessment observed was, if observation repeats its observation word for word:
|
|
45
|
-
# its observed_at, or for a record from before sightings were dated, its assessed_at
|
|
54
|
+
# its observed_at, or for a record from before sightings were dated, its assessed_at. Nil otherwise.
|
|
46
55
|
#: (String) -> String?
|
|
47
56
|
def repeated_sighting(observation)
|
|
48
57
|
kept = assessment or return nil
|
|
@@ -55,7 +64,7 @@ module Principles
|
|
|
55
64
|
|
|
56
65
|
# Why the member, now id with its text hashing to sha256 and judged on grounds, must be judged again, or nil
|
|
57
66
|
# when its kept assessment still describes it: the same text the audit judged, under the same id, map entry
|
|
58
|
-
# and loads
|
|
67
|
+
# and loads. An acknowledged edit is judged again, unless it was undone.
|
|
59
68
|
#: (id: String, sha256: String?, grounds: Hash[String, String]) -> String?
|
|
60
69
|
def judge_because(id:, sha256:, grounds:)
|
|
61
70
|
return "changed_during_last_audit" if @entry["changed_during_last_audit"]
|
|
@@ -71,7 +80,7 @@ module Principles
|
|
|
71
80
|
private
|
|
72
81
|
|
|
73
82
|
# When kept's observed delivery was seen, as shown beside it: its observed_at, or for a record from before
|
|
74
|
-
# sightings were dated, its assessed_at, saying so. Empty for a delivery not observed
|
|
83
|
+
# sightings were dated, its assessed_at, saying so. Empty for a delivery not observed.
|
|
75
84
|
#: (Hash[String, untyped]) -> Hash[String, untyped]
|
|
76
85
|
def sighting(kept)
|
|
77
86
|
return {} unless kept["delivery"] == "observed"
|
|
@@ -7,7 +7,7 @@ module Principles
|
|
|
7
7
|
# The domain logic, and the mediation of persistence. models/CLAUDE.md owns the boundary.
|
|
8
8
|
module Models
|
|
9
9
|
# One finding as an audit record holds it: its id, what the audit did about it and where it is written up.
|
|
10
|
-
# AuditRecord reads its findings only through this value
|
|
10
|
+
# AuditRecord reads its findings only through this value.
|
|
11
11
|
class RecordedFinding
|
|
12
12
|
# What a finding an assessment raised carries to its record, through the correction's basis: the one list of
|
|
13
13
|
# those fields, so the basis and the record cannot carry different ones.
|
|
@@ -34,7 +34,7 @@ module Principles
|
|
|
34
34
|
#: () -> String?
|
|
35
35
|
def action = @fields["action"]
|
|
36
36
|
|
|
37
|
-
# Why its audit left it unfixed, or nil when it was fixed or its record predates keeping the reason
|
|
37
|
+
# Why its audit left it unfixed, or nil when it was fixed or its record predates keeping the reason.
|
|
38
38
|
#: () -> String?
|
|
39
39
|
def reason = @fields["reason"]
|
|
40
40
|
|
|
@@ -49,24 +49,24 @@ module Principles
|
|
|
49
49
|
#: () -> String?
|
|
50
50
|
def first_raised_at = @fields["first_raised_at"]
|
|
51
51
|
|
|
52
|
-
# The locators of the evidence it was raised with, or nil when its record keeps none
|
|
52
|
+
# The locators of the evidence it was raised with, or nil when its record keeps none.
|
|
53
53
|
#: () -> Array[Hash[String, untyped]]?
|
|
54
54
|
def evidence = @fields["evidence"]
|
|
55
55
|
|
|
56
56
|
# Whether its record keeps the evidence it was raised with; one written before this tool kept evidence, or kept
|
|
57
|
-
# by a still_holds decision that gave none, keeps none
|
|
57
|
+
# by a still_holds decision that gave none, keeps none.
|
|
58
58
|
#: () -> bool
|
|
59
59
|
def evidence_kept? = !evidence.nil?
|
|
60
60
|
|
|
61
|
-
# The path of each file it points at: its evidence and its write-up
|
|
61
|
+
# The path of each file it points at: its evidence and its write-up.
|
|
62
62
|
#: () -> Array[String]
|
|
63
63
|
def cited_paths = [*evidence&.map { it.fetch("path") }, recorded_at&.path].compact.uniq
|
|
64
64
|
|
|
65
|
-
# The commit whose record an audit cited for an earlier first_raised_at, when one did
|
|
65
|
+
# The commit whose record an audit cited for an earlier first_raised_at, when one did.
|
|
66
66
|
#: () -> String?
|
|
67
67
|
def raised_in = @fields["raised_in"]
|
|
68
68
|
|
|
69
|
-
# The one line saying whom it waits on and to decide what, when its deferral says
|
|
69
|
+
# The one line saying whom it waits on and to decide what, when its deferral says.
|
|
70
70
|
#: () -> String?
|
|
71
71
|
def waits_on = @fields["waits_on"]
|
|
72
72
|
|
|
@@ -74,7 +74,7 @@ module Principles
|
|
|
74
74
|
#: () -> String?
|
|
75
75
|
def waits_on_since = @fields["waits_on_since"]
|
|
76
76
|
|
|
77
|
-
# Whether its audit left it open, deferred or accepted, for the next full audit to decide
|
|
77
|
+
# Whether its audit left it open, deferred or accepted, for the next full audit to decide.
|
|
78
78
|
#: () -> bool
|
|
79
79
|
def open? = %w[deferred accepted].include?(action)
|
|
80
80
|
|
|
@@ -83,7 +83,7 @@ module Principles
|
|
|
83
83
|
def fixed? = action == "fixed"
|
|
84
84
|
|
|
85
85
|
# This finding pointed at recorded_at, the move from where it pointed appended to its repointed with when and
|
|
86
|
-
# why
|
|
86
|
+
# why, or itself when it already points there, so an identical retry writes nothing.
|
|
87
87
|
#: (WriteUpPointer, at: String, reason: String) -> RecordedFinding
|
|
88
88
|
def moved_to(pointer, at:, reason:)
|
|
89
89
|
return self if recorded_at == pointer
|
|
@@ -38,7 +38,7 @@ module Principles
|
|
|
38
38
|
#: () -> Array[String]
|
|
39
39
|
def fixed_ids = @findings.select(&:fixed?).map(&:id)
|
|
40
40
|
|
|
41
|
-
# These findings with each one a repoint names moved by it, dated at
|
|
41
|
+
# These findings with each one a repoint names moved by it, dated at; the last repoint naming one wins.
|
|
42
42
|
#: (Array[WriteUpRepoint], at: String) -> RecordedFindings
|
|
43
43
|
def repointed(repoints, at:)
|
|
44
44
|
by_finding = repoints.to_h { |repoint| [repoint.finding_id, repoint] }
|
|
@@ -50,7 +50,7 @@ module Principles
|
|
|
50
50
|
members: @members)
|
|
51
51
|
end
|
|
52
52
|
|
|
53
|
-
# The path of each file they point at: their evidence and write-ups
|
|
53
|
+
# The path of each file they point at: their evidence and write-ups.
|
|
54
54
|
#: () -> Array[String]
|
|
55
55
|
def cited_paths = @findings.flat_map(&:cited_paths).uniq
|
|
56
56
|
end
|
|
@@ -5,8 +5,8 @@ module Principles
|
|
|
5
5
|
# The domain logic, which loads and saves itself through data/. models/CLAUDE.md owns the boundary.
|
|
6
6
|
module Models
|
|
7
7
|
# The member hashes a principle's audit record holds, by key, which its members now are compared with, and
|
|
8
|
-
# whether a later copy wrote that record, so its audits wait on an upgrade and the comparison is read-only
|
|
9
|
-
#
|
|
8
|
+
# whether a later copy wrote that record, so its audits wait on an upgrade and the comparison is read-only.
|
|
9
|
+
# A principle with no record holds none.
|
|
10
10
|
class RecordedHashes
|
|
11
11
|
#: (Hash[String, String], ?waiting: bool) -> void
|
|
12
12
|
def initialize(by_key, waiting: false)
|
|
@@ -10,8 +10,8 @@ module Principles
|
|
|
10
10
|
# The domain logic, and the mediation of persistence. models/CLAUDE.md owns the boundary.
|
|
11
11
|
module Models
|
|
12
12
|
# The members an audit record assessed: each filed under the id it had then, with its key beside it when the
|
|
13
|
-
# two differ, holding its hash then, the result reported for its check
|
|
14
|
-
# and the acknowledgements made for it since
|
|
13
|
+
# two differ, holding its hash then, the result reported for its check, its accepted loading decision
|
|
14
|
+
# and the acknowledgements made for it since. Callers reach them through AuditRecord#members.
|
|
15
15
|
class RecordedMembers
|
|
16
16
|
#: (Hash[String, untyped]) -> void
|
|
17
17
|
def initialize(entries)
|
|
@@ -24,7 +24,7 @@ module Principles
|
|
|
24
24
|
def to_h = @entries
|
|
25
25
|
|
|
26
26
|
# The entries without when each assessment was made, or when a sighting it gave no date for was dated, which a
|
|
27
|
-
# record made again from the same answer dates anew
|
|
27
|
+
# record made again from the same answer dates anew.
|
|
28
28
|
#: () -> Hash[String, untyped]
|
|
29
29
|
def undated
|
|
30
30
|
@entries.transform_values do |entry|
|
|
@@ -33,7 +33,7 @@ module Principles
|
|
|
33
33
|
end
|
|
34
34
|
end
|
|
35
35
|
|
|
36
|
-
# The path of each file an assessment kept here cites as evidence, carried forward or made now
|
|
36
|
+
# The path of each file an assessment kept here cites as evidence, carried forward or made now.
|
|
37
37
|
#: () -> Array[String]
|
|
38
38
|
def cited_paths
|
|
39
39
|
@entries.flat_map { |id, entry| RecordedEntry.new(id, entry).cited_paths }.uniq
|
|
@@ -60,7 +60,7 @@ module Principles
|
|
|
60
60
|
end
|
|
61
61
|
|
|
62
62
|
# The check the record's audit was given an exit status for, for the member known by key: nil when the
|
|
63
|
-
# member had no check then, or its check was reported as not run, so no audit has run it
|
|
63
|
+
# member had no check then, or its check was reported as not run, so no audit has run it.
|
|
64
64
|
#: (String) -> String?
|
|
65
65
|
def check_run_for(key)
|
|
66
66
|
result = entry_for(key)&.fetch("check_result", nil) or return nil
|
|
@@ -70,7 +70,7 @@ module Principles
|
|
|
70
70
|
# How check, the map's check now for the member known by key, stands to the one the record's audit ran:
|
|
71
71
|
# :unchanged when it ran this same command, or none for a member that has none; :removed when it ran one the
|
|
72
72
|
# member no longer has; :changed when it ran another; :not_run when it was told this one could not be run; :new
|
|
73
|
-
# when it reported none
|
|
73
|
+
# when it reported none. The one owner of that comparison, which a full audit's template and a
|
|
74
74
|
# one-member audit both ask.
|
|
75
75
|
#: (String, String?) -> Symbol
|
|
76
76
|
def check_since(key, check)
|
|
@@ -83,7 +83,7 @@ module Principles
|
|
|
83
83
|
end
|
|
84
84
|
|
|
85
85
|
# What the review of that run rested on, for the member known by key, as the record keeps it: its review_basis
|
|
86
|
-
# and any review_basis_since, or nothing when the record ran no check for it or kept no line
|
|
86
|
+
# and any review_basis_since, or nothing when the record ran no check for it or kept no line.
|
|
87
87
|
#: (String) -> Hash[String, untyped]
|
|
88
88
|
def check_review_as_kept(key)
|
|
89
89
|
return {} unless check_run_for(key)
|
|
@@ -91,7 +91,7 @@ module Principles
|
|
|
91
91
|
entry_for(key)&.fetch("check_result")&.slice("review_basis", "review_basis_since") || {}
|
|
92
92
|
end
|
|
93
93
|
|
|
94
|
-
# Each member's accepted loading decision, by its id now, found by the key it keeps through moves
|
|
94
|
+
# Each member's accepted loading decision, by its id now, found by the key it keeps through moves.
|
|
95
95
|
#: (PrincipleMembers) -> Hash[String, AcceptedLoading]
|
|
96
96
|
def loading_accepted(members)
|
|
97
97
|
members.to_h do |member|
|
|
@@ -100,14 +100,14 @@ module Principles
|
|
|
100
100
|
end.compact
|
|
101
101
|
end
|
|
102
102
|
|
|
103
|
-
# The acknowledgements made for the member known by key since the record's audit, oldest first
|
|
103
|
+
# The acknowledgements made for the member known by key since the record's audit, oldest first.
|
|
104
104
|
#: (String) -> Array[Hash[String, untyped]]
|
|
105
105
|
def acknowledgements_for(key)
|
|
106
106
|
entry_for(key)&.fetch("acknowledgements", nil) || []
|
|
107
107
|
end
|
|
108
108
|
|
|
109
109
|
# The member acknowledged most recently and when, as [id, acknowledged_at], or nil when none was since the
|
|
110
|
-
# record's audit
|
|
110
|
+
# record's audit. The times compare as text, which orders them only because every writer gives UTC in
|
|
111
111
|
# ISO 8601.
|
|
112
112
|
#: () -> [String, String]?
|
|
113
113
|
def latest_acknowledgement
|
|
@@ -116,8 +116,8 @@ module Principles
|
|
|
116
116
|
end.max_by(&:last)
|
|
117
117
|
end
|
|
118
118
|
|
|
119
|
-
# These entries with the member known by key moved to change's to_sha256, and change kept beside it
|
|
120
|
-
# check_result, when given, in place of the result it kept
|
|
119
|
+
# These entries with the member known by key moved to change's to_sha256, and change kept beside it, with
|
|
120
|
+
# check_result, when given, in place of the result it kept.
|
|
121
121
|
#: (String, Hash[String, untyped], ?check_result: Hash[String, untyped]?) -> RecordedMembers
|
|
122
122
|
def acknowledged(key, change, check_result: nil)
|
|
123
123
|
RecordedMembers.new(@entries.to_h do |id, entry|
|
|
@@ -143,7 +143,7 @@ module Principles
|
|
|
143
143
|
end
|
|
144
144
|
|
|
145
145
|
# These entries with each assessment an answer carried forward, marked {"carried_forward": true}, replaced by
|
|
146
|
-
# the one last kept for the same member, so the record keeps it with its first date
|
|
146
|
+
# the one last kept for the same member, so the record keeps it with its first date.
|
|
147
147
|
#: (RecordedMembers?) -> RecordedMembers
|
|
148
148
|
def carrying(last)
|
|
149
149
|
RecordedMembers.new(@entries.to_h do |id, entry|
|
|
@@ -5,13 +5,13 @@ 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 refusal an answer meets before its shape is checked, for a mistake the shape would refuse without naming, such
|
|
8
|
-
# as a placeholder left in a field of another type
|
|
8
|
+
# as a placeholder left in a field of another type. A phase lists its own, in order, and
|
|
9
9
|
# SentAnswer reads each, so a new one is declared here once.
|
|
10
10
|
# @interface
|
|
11
11
|
module RefusalBeforeShape
|
|
12
12
|
# Refuses answer, as sent from source, when it makes this mistake; nothing otherwise. shape_problems are the
|
|
13
13
|
# problems its shape check finds, as Data::SchemaCheck#problems gives them, which a refusal may name beside its
|
|
14
|
-
# own, so one refusal names every repair
|
|
14
|
+
# own, so one refusal names every repair. Sorbet takes an abstract method only with a forwarding super
|
|
15
15
|
# for its body, which RuboCop would otherwise call useless.
|
|
16
16
|
# @abstract
|
|
17
17
|
#: (untyped, String, Array[Hash[String, String]]) -> void
|
|
@@ -14,7 +14,7 @@ require_relative "write_up_repoint"
|
|
|
14
14
|
module Principles
|
|
15
15
|
# The domain logic, and the mediation of persistence. models/CLAUDE.md owns the boundary.
|
|
16
16
|
module Models
|
|
17
|
-
# A repoint of a principle's open findings' write-ups without a full audit
|
|
17
|
+
# A repoint of a principle's open findings' write-ups without a full audit: the agent, having checked
|
|
18
18
|
# where a write-up moved to, gives each finding it names a new recorded_at, and the last completed record keeps
|
|
19
19
|
# it, with where it pointed before, when and why. Judging that the new place holds the write-up is the agent's.
|
|
20
20
|
class Repoint
|
|
@@ -70,7 +70,7 @@ module Principles
|
|
|
70
70
|
def unchanged_ids(repointed) = completed.open_ids - moved_ids(repointed)
|
|
71
71
|
|
|
72
72
|
# Refuses unless the principle's record is a completed audit's: an open record outside git keeps the completed
|
|
73
|
-
# one, whose findings its correction will decide, and with none there is nothing to repoint
|
|
73
|
+
# one, whose findings its correction will decide, and with none there is nothing to repoint.
|
|
74
74
|
#: () -> AuditRecord
|
|
75
75
|
def completed
|
|
76
76
|
record = @record
|
|
@@ -90,7 +90,7 @@ module Principles
|
|
|
90
90
|
private
|
|
91
91
|
|
|
92
92
|
# Refuses ids, the findings an answer's repoints name, when one is not open in the completed record or two
|
|
93
|
-
# name one finding, since either would otherwise read as a success
|
|
93
|
+
# name one finding, since either would otherwise read as a success.
|
|
94
94
|
#: (Array[String]) -> void
|
|
95
95
|
def each_open_once(ids)
|
|
96
96
|
open = completed.open_ids
|