principles 0.0.7 → 0.0.9
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 +409 -0
- data/LICENSE +202 -0
- data/NOTICE +4 -0
- data/README.md +145 -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 +46 -20
- 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 +25 -13
- 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 +64 -9
- 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 +21 -7
- data/lib/principles/data/running_version.rb +11 -9
- 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 +5 -5
- 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 +10 -6
- 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 +45 -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 +31 -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 +28 -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 +89 -73
- 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 +16 -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 +37 -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 +14 -14
- data/lib/principles/views/prompts/learn-what-a-command-does/list-principles.md +3 -0
- 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 +1 -5
- 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 +84 -18
- data/lib/principles/views/prompts/start-a-session/every-loaded-line-costs-every-session.md +0 -1
- 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
- data/lib/principles/views/prompts/start-a-session/raise-them-at-the-next-pause.md +0 -1
- data/lib/principles/views/prompts/start-a-session/raise-them-before-the-first-task.md +0 -1
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
3
|
"$id": "correction-answer.schema.json",
|
|
4
4
|
"title": "Correction answer",
|
|
5
|
-
"description": "What an agent answers an audit's correction request with: the request's id and basis, one disposition per finding, any members its fixes moved
|
|
5
|
+
"description": "What an agent answers an audit's correction request with: the request's id and basis, one disposition per finding, any members its fixes moved, and in each fix any members whose role or check it changed. Fields this tool does not read are refused, to catch a misspelt field. The rules across fields, such as one disposition per finding, stay in Models::CorrectionAnswer and Models::DeclaredMapChanges.",
|
|
6
6
|
"type": "object",
|
|
7
7
|
"additionalProperties": false,
|
|
8
8
|
"required": [
|
|
@@ -64,11 +64,11 @@
|
|
|
64
64
|
},
|
|
65
65
|
"problem": {
|
|
66
66
|
"type": "string",
|
|
67
|
-
"description": "The finding's problem as the assessment stated it, carried so the completed record keeps it
|
|
67
|
+
"description": "The finding's problem as the assessment stated it, carried so the completed record keeps it."
|
|
68
68
|
},
|
|
69
69
|
"evidence": {
|
|
70
70
|
"type": "array",
|
|
71
|
-
"description": "The evidence the assessment raised the finding with, carried so the completed record keeps it
|
|
71
|
+
"description": "The evidence the assessment raised the finding with, carried so the completed record keeps it. Absent from a basis printed before it was kept.",
|
|
72
72
|
"items": {
|
|
73
73
|
"type": "object",
|
|
74
74
|
"required": [
|
|
@@ -100,16 +100,16 @@
|
|
|
100
100
|
"recent_decision_paths": {
|
|
101
101
|
"type": "array",
|
|
102
102
|
"items": { "type": "string" },
|
|
103
|
-
"description": "The paths the assessment's recent decision cites as evidence, which the record does not keep, carried so the completed audit asks to commit those that differ from HEAD
|
|
103
|
+
"description": "The paths the assessment's recent decision cites as evidence, which the record does not keep, carried so the completed audit asks to commit those that differ from HEAD. Copy it as the template gives it."
|
|
104
104
|
},
|
|
105
105
|
"assessment_report_sha256": {
|
|
106
106
|
"type": "string",
|
|
107
107
|
"pattern": "\\A[0-9a-f]{64}\\z",
|
|
108
|
-
"description": "A digest of the assessment the open audit record keeps, which the correction reads back from that record, so it is refused once the record changed or was discarded
|
|
108
|
+
"description": "A digest of the assessment the open audit record keeps, which the correction reads back from that record, so it is refused once the record changed or was discarded. Copy it as the template gives it."
|
|
109
109
|
},
|
|
110
110
|
"prior_findings": {
|
|
111
111
|
"type": "object",
|
|
112
|
-
"description": "The assessment's decisions on prior findings, carried so the completed record keeps the ones that still hold
|
|
112
|
+
"description": "The assessment's decisions on prior findings, carried so the completed record keeps the ones that still hold.",
|
|
113
113
|
"required": [
|
|
114
114
|
"kept",
|
|
115
115
|
"closed",
|
|
@@ -139,14 +139,14 @@
|
|
|
139
139
|
"action",
|
|
140
140
|
"reason"
|
|
141
141
|
],
|
|
142
|
-
"description": "changed_members, evidence and reassessment are a fix's; Models::Disposition refuses a fixed disposition missing one, and any other may omit them
|
|
142
|
+
"description": "changed_members, evidence and reassessment are a fix's; Models::Disposition refuses a fixed disposition missing one, and any other may omit them.",
|
|
143
143
|
"properties": {
|
|
144
144
|
"finding_id": {
|
|
145
145
|
"type": "string"
|
|
146
146
|
},
|
|
147
147
|
"action": {
|
|
148
148
|
"type": ["string", "null"],
|
|
149
|
-
"description": "fixed, deferred, accepted or disagreed, which the agent chooses: the template leaves it null, and Models::CorrectionAnswer refuses null or any other value with invalid_disposition
|
|
149
|
+
"description": "fixed, deferred, accepted or disagreed, which the agent chooses: the template leaves it null, and Models::CorrectionAnswer refuses null or any other value with invalid_disposition."
|
|
150
150
|
},
|
|
151
151
|
"reason": {
|
|
152
152
|
"type": "string"
|
|
@@ -235,7 +235,7 @@
|
|
|
235
235
|
},
|
|
236
236
|
"waits_on": {
|
|
237
237
|
"type": ["string", "null"],
|
|
238
|
-
"description": "On a deferral, one line saying whom it waits on and to decide what; null on any disposition. Models::CorrectionAnswer refuses a value on another action, or one not one line
|
|
238
|
+
"description": "On a deferral, one line saying whom it waits on and to decide what; null on any disposition. Models::CorrectionAnswer refuses a value on another action, or one not one line."
|
|
239
239
|
}
|
|
240
240
|
}
|
|
241
241
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
3
|
"$id": "member-map.schema.json",
|
|
4
4
|
"title": "Member map",
|
|
5
|
-
"description": "A principle's committed map, .principles/maps/ID.json: what the principle is, and each member that carries it. Fields this schema does not name are allowed, so an older version can read a map a newer one wrote
|
|
5
|
+
"description": "A principle's committed map, .principles/maps/ID.json: what the principle is, and each member that carries it. Fields this schema does not name are allowed, so an older version can read a map a newer one wrote.",
|
|
6
6
|
"type": "object",
|
|
7
7
|
"required": ["description", "members"],
|
|
8
8
|
"properties": {
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"description": { "type": "string", "minLength": 1 },
|
|
11
11
|
"activation": {
|
|
12
12
|
"type": "object",
|
|
13
|
-
"description": "When the principle's work is in hand, as the agent declared it with change-activation
|
|
13
|
+
"description": "When the principle's work is in hand, as the agent declared it with change-activation: when files matching one of its globs are read or changed, when its work is invoked, or always. change-activation writes files only with when files; a hand-edited map is not yet checked for that.",
|
|
14
14
|
"required": ["when"],
|
|
15
15
|
"additionalProperties": false,
|
|
16
16
|
"properties": {
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"ending_at": { "type": "string", "minLength": 1 },
|
|
32
32
|
"role": { "type": "string", "minLength": 1 },
|
|
33
33
|
"key": { "type": "string", "minLength": 1, "description": "What the member is known by across moves, which its audit record files its hash under. Absent, it is the member's id. move-member stores the old id here on a member's first move, and add-member gives a member a key of its own when its id is the key of a member that moved away." },
|
|
34
|
-
"check": { "type": "string", "minLength": 1, "description": "The command that enforces this member, which an audit asks the agent to run and report. This tool never runs it
|
|
34
|
+
"check": { "type": "string", "minLength": 1, "description": "The command that enforces this member, which an audit asks the agent to run and report. This tool never runs it." }
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
3
|
"$id": "repointing-answer.schema.json",
|
|
4
4
|
"title": "Repointing answer",
|
|
5
|
-
"description": "What an agent answers a repoint of a principle's open findings' write-ups with
|
|
5
|
+
"description": "What an agent answers a repoint of a principle's open findings' write-ups with: the request's id and basis, then for each finding a new recorded_at, or null to leave it, and a one-line reason. Fields this tool does not read are refused. Models::Repoint locates each new pointer.",
|
|
6
6
|
"type": "object",
|
|
7
7
|
"additionalProperties": false,
|
|
8
8
|
"required": ["request_id", "basis", "repoints"],
|
data/lib/principles/error.rb
CHANGED
|
@@ -10,7 +10,7 @@ module Principles
|
|
|
10
10
|
|
|
11
11
|
# A command a refusal's repair names for values it holds, such as a member id, left unquoted, since a model
|
|
12
12
|
# cannot quote: the controller prints it through Views::Invocation, the one owner of shell quoting, after its
|
|
13
|
-
# purpose and a colon, on a line of its own
|
|
13
|
+
# purpose and a colon, on a line of its own. options are flags with their values, quoted the same
|
|
14
14
|
# way; usage is this tool's own placeholder text, such as "--role ROLE", left for the agent to fill.
|
|
15
15
|
class RepairCommand
|
|
16
16
|
#: String
|
|
@@ -34,7 +34,7 @@ module Principles
|
|
|
34
34
|
#: Hash[String, untyped]
|
|
35
35
|
attr_reader :payload
|
|
36
36
|
|
|
37
|
-
# fields are the failing JSON pointers of a malformed file or answer, each with what is wrong there
|
|
37
|
+
# fields are the failing JSON pointers of a malformed file or answer, each with what is wrong there.
|
|
38
38
|
#: (String, String, String, ?String?, ?fields: Array[Hash[String, String]]?) -> void
|
|
39
39
|
def initialize(code, message, repair, path = nil, fields: nil)
|
|
40
40
|
super(message)
|
|
@@ -64,7 +64,7 @@ module Principles
|
|
|
64
64
|
end
|
|
65
65
|
|
|
66
66
|
# This refusal with each of its commands printed by the block, after its purpose, a line each after the repair's
|
|
67
|
-
# text
|
|
67
|
+
# text.
|
|
68
68
|
#: () { (RepairCommand) -> String } -> Error
|
|
69
69
|
def printing_commands(&)
|
|
70
70
|
return self if @commands.empty?
|
|
@@ -75,7 +75,7 @@ module Principles
|
|
|
75
75
|
|
|
76
76
|
# This refusal, when it names under did_you_mean the one mapped id an id it was given nearly matches, with its
|
|
77
77
|
# repair led by the command the block prints for that id; this tool never runs a command on the near miss
|
|
78
|
-
# itself
|
|
78
|
+
# itself. Otherwise this refusal as it is.
|
|
79
79
|
#: () { (String) -> String } -> Error
|
|
80
80
|
def rerun_with_near_miss(&)
|
|
81
81
|
mapped = payload["did_you_mean"] or return self
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# typed: strict
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
require "optparse"
|
|
5
|
+
require_relative "command_line"
|
|
6
|
+
|
|
7
|
+
module Principles
|
|
8
|
+
# The JSON object an agent reads for a failure that is not one of this tool's refusals: a usage error, a file the
|
|
9
|
+
# system would not read or write, or a file of the wrong shape, each with its code and repair.
|
|
10
|
+
class FailureRefusal
|
|
11
|
+
# The repair for a shape error raised from this tool's own code. Such an error cannot say which file was at
|
|
12
|
+
# fault, so the repair names every file a command reads, and blames none.
|
|
13
|
+
SHAPE_REPAIR = "A file this command read is not in the shape this tool writes: the map in " \
|
|
14
|
+
".principles/maps/ID.json, its audit record in .principles/audits/ID.json, or the answer given " \
|
|
15
|
+
"with --file. Compare it with git, or with the answer to fill its request printed, which " \
|
|
16
|
+
"show-open-correction ID prints for a correction."
|
|
17
|
+
|
|
18
|
+
# executable is the invocation a usage error's repair tells the agent to run --help with.
|
|
19
|
+
#: (StandardError, executable: String) -> void
|
|
20
|
+
def initialize(error, executable:)
|
|
21
|
+
@error = error
|
|
22
|
+
@executable = executable
|
|
23
|
+
freeze
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
# The exit status: 2 for a usage error, 1 for any other.
|
|
27
|
+
#: () -> Integer
|
|
28
|
+
def status = @error.is_a?(OptionParser::ParseError) ? 2 : 1
|
|
29
|
+
|
|
30
|
+
#: () -> Hash[Symbol, String]
|
|
31
|
+
def payload
|
|
32
|
+
case @error
|
|
33
|
+
when OptionParser::ParseError
|
|
34
|
+
failure(status: "usage_error", code: "invalid_invocation", repair: usage_repair)
|
|
35
|
+
when SystemCallError
|
|
36
|
+
failure(status: "refused", code: "filesystem_error",
|
|
37
|
+
repair: "Check the project path and file permissions, then retry.")
|
|
38
|
+
else
|
|
39
|
+
failure(status: "refused", code: "invalid_shape", repair: SHAPE_REPAIR)
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
private
|
|
44
|
+
|
|
45
|
+
# The repair a refused command line carries for the command it names, or the advice to see every command.
|
|
46
|
+
#: () -> String
|
|
47
|
+
def usage_repair
|
|
48
|
+
error = @error
|
|
49
|
+
error.is_a?(CommandLine::UsageRefusal) ? error.repair : "To see every command: #{@executable} --help"
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
#: (status: String, code: String, repair: String) -> Hash[Symbol, String]
|
|
53
|
+
def failure(status:, code:, repair:)
|
|
54
|
+
{ status: status, code: code, message: @error.message, repair: repair }
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
@@ -9,15 +9,15 @@ module Principles
|
|
|
9
9
|
class InvocationOptions
|
|
10
10
|
# The options that take a value; --help, -h and --version take none.
|
|
11
11
|
VALUE_OPTIONS = %w[project file description path section starting-at ending-at query role
|
|
12
|
-
check session-start commits-after hook-event as instruction].freeze #: Array[String]
|
|
13
|
-
# The options that take no value, as list-member-problems --short
|
|
14
|
-
FLAG_OPTIONS = %w[short lines when-invoked always write-ups confirm].freeze #: Array[String]
|
|
12
|
+
check session-start commits-after hook-event as instruction part].freeze #: Array[String]
|
|
13
|
+
# The options that take no value, as list-member-problems --short.
|
|
14
|
+
FLAG_OPTIONS = %w[short lines when-invoked always write-ups confirm open-findings].freeze #: Array[String]
|
|
15
15
|
# The options that may be given more than once, each value kept in order, as change-activation --when-files and
|
|
16
|
-
# start-audit --member
|
|
16
|
+
# start-audit --member.
|
|
17
17
|
LIST_OPTIONS = %w[when-files also member].freeze #: Array[String]
|
|
18
18
|
# The words that name an option taking the next word as its value.
|
|
19
19
|
VALUE_WORDS = (VALUE_OPTIONS + LIST_OPTIONS).map { |name| "--#{name}" }.freeze #: Array[String]
|
|
20
|
-
# Every word the parser reads as an option, which an option taking a value refuses as its value
|
|
20
|
+
# Every word the parser reads as an option, which an option taking a value refuses as its value.
|
|
21
21
|
WORDS = [*VALUE_WORDS, *FLAG_OPTIONS.map { |name| "--#{name}" }, "--help", "-h",
|
|
22
22
|
"--version"].freeze #: Array[String]
|
|
23
23
|
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# typed: strict
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
require_relative "version"
|
|
5
|
+
require_relative "data/running_version"
|
|
6
|
+
require_relative "data/principles_on_path"
|
|
7
|
+
require_relative "controllers/running_tool"
|
|
8
|
+
|
|
9
|
+
module Principles
|
|
10
|
+
# This process as its entry point launched it: the executable that entry point names itself by, the file it was
|
|
11
|
+
# launched as, PATH and the folder it started in, read here so that no layer reads them. It gives every controller
|
|
12
|
+
# the same RunningTool.
|
|
13
|
+
class Launch
|
|
14
|
+
#: (String) -> void
|
|
15
|
+
def initialize(executable)
|
|
16
|
+
@executable = executable
|
|
17
|
+
freeze
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
# This run of the tool: the executable it was invoked as, its version, and what PATH and its folder say of it,
|
|
21
|
+
# each read only when a command needs it.
|
|
22
|
+
#: () -> Controllers::RunningTool
|
|
23
|
+
def running_tool
|
|
24
|
+
Controllers::RunningTool.new(executable: @executable, version: -> { running_version },
|
|
25
|
+
other_on_path: ->(asking) { on_path.other(asking) },
|
|
26
|
+
launched_on_path: -> { on_path.own_first? },
|
|
27
|
+
cwd: started_in)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
private
|
|
31
|
+
|
|
32
|
+
# The folder this run was started in, by its real path, as a project's root is given, or nil when it is gone.
|
|
33
|
+
#: () -> String?
|
|
34
|
+
def started_in
|
|
35
|
+
File.realpath(Dir.pwd)
|
|
36
|
+
rescue SystemCallError
|
|
37
|
+
nil
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# The principles on PATH, against this run's own file: the plugin's bin or a RubyGems binstub when either
|
|
41
|
+
# launched it, else this tool's executable.
|
|
42
|
+
#: () -> Data::PrinciplesOnPath
|
|
43
|
+
def on_path = Data::PrinciplesOnPath.new(ENV.fetch("PATH", ""), own: File.expand_path($PROGRAM_NAME))
|
|
44
|
+
|
|
45
|
+
# The version of this tool that is running, as a build stamped it or a checkout's commit gives it.
|
|
46
|
+
#: () -> String
|
|
47
|
+
def running_version = Data::RunningVersion.new(release: RELEASE, built: BUILT_VERSION).to_s
|
|
48
|
+
end
|
|
49
|
+
end
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
require_relative "invocation_options"
|
|
5
5
|
|
|
6
6
|
module Principles
|
|
7
|
-
# The options choosing which form list-open-findings prints, --lines or --short
|
|
7
|
+
# The options choosing which form list-open-findings prints, --lines or --short, and what is wrong with them
|
|
8
8
|
# as given, which CommandLine refuses as a usage error.
|
|
9
9
|
class ListOpenFindingsOptions
|
|
10
10
|
#: (InvocationOptions) -> void
|
|
@@ -7,9 +7,9 @@ module Principles
|
|
|
7
7
|
# The domain logic, and the mediation of persistence. models/CLAUDE.md owns the boundary.
|
|
8
8
|
module Models
|
|
9
9
|
# The decision a completed audit accepted on a member's loading, kept in the member's record entry with the
|
|
10
|
-
# member's text hash, as the next full audit shows it beside the member's row
|
|
10
|
+
# member's text hash, as the next full audit shows it beside the member's row. It changed since when
|
|
11
11
|
# what it weighed changed: when the member loads, or the member's own text. A file's size alone moves with every
|
|
12
|
-
# edit elsewhere in a shared file, so it does not count
|
|
12
|
+
# edit elsewhere in a shared file, so it does not count.
|
|
13
13
|
class AcceptedLoading
|
|
14
14
|
# entry is the member's record entry, holding loading_accepted and sha256.
|
|
15
15
|
#: (Hash[String, untyped]) -> void
|
|
@@ -5,6 +5,7 @@ require_relative "../error"
|
|
|
5
5
|
require_relative "acknowledgement_refusal"
|
|
6
6
|
require_relative "answer_place"
|
|
7
7
|
require_relative "audit_record"
|
|
8
|
+
require_relative "check_result_guide"
|
|
8
9
|
require_relative "listed_members"
|
|
9
10
|
require_relative "../prose_list"
|
|
10
11
|
require_relative "member"
|
|
@@ -13,15 +14,15 @@ require_relative "reported_check"
|
|
|
13
14
|
module Principles
|
|
14
15
|
# The domain logic, and the mediation of persistence. models/CLAUDE.md owns the boundary.
|
|
15
16
|
module Models
|
|
16
|
-
# The run of its member's check that a one-member audit's answer reports
|
|
17
|
-
# the record ran, carrying the line its last review rested on
|
|
18
|
-
# check that failed or could not run is a full audit's to judge
|
|
17
|
+
# The run of its member's check that a one-member audit's answer reports: checked against the check
|
|
18
|
+
# the record ran, carrying the line its last review rested on, and accepted only once it passed, since a
|
|
19
|
+
# check that failed or could not run is a full audit's to judge.
|
|
19
20
|
class AcknowledgedCheck
|
|
20
21
|
# Where a one-member audit's answer gives its check_result, which a refusal of a field in it points into.
|
|
21
22
|
CHECK_RESULT = AnswerPlace.new("/check_result", "The acknowledgement") #: AnswerPlace
|
|
22
23
|
|
|
23
24
|
# record is the completed record the member is judged against. listed is what the member's check lists now,
|
|
24
|
-
# when it is this tool's own list-member-problems, which exits 3 while it lists the member
|
|
25
|
+
# when it is this tool's own list-member-problems, which exits 3 while it lists the member.
|
|
25
26
|
#: (member: Member, principle_id: String, record: AuditRecord, ?listed: ListedMembers?) -> void
|
|
26
27
|
def initialize(member:, principle_id:, record:, listed: nil)
|
|
27
28
|
@member = member
|
|
@@ -39,17 +40,18 @@ module Principles
|
|
|
39
40
|
refuse("it has no check, so its answer reports no check_result") if !check && answer.key?("check_result")
|
|
40
41
|
return unless check
|
|
41
42
|
|
|
42
|
-
sent = answer["check_result"]
|
|
43
|
+
sent = answer["check_result"] or missing
|
|
43
44
|
passed(ReportedCheck.new(AnswerPlace.new("", "The acknowledgement"), check,
|
|
44
|
-
ran: @record.check_run_for(@member.key), kept: @record.check_review_for(@member.key)
|
|
45
|
+
ran: @record.check_run_for(@member.key), kept: @record.check_review_for(@member.key),
|
|
46
|
+
guide: CheckResultGuide::ACKNOWLEDGEMENT)
|
|
45
47
|
.result(reported(sent, check)), sent)
|
|
46
48
|
end
|
|
47
49
|
|
|
48
50
|
private
|
|
49
51
|
|
|
50
52
|
# result, once its check exited 0, or 3 for this tool's own list-member-problems while it lists only members
|
|
51
|
-
# this answer acknowledges, which it lists no more once the record is committed
|
|
52
|
-
# exit status, since the answer's schema refuses not_run_reason
|
|
53
|
+
# this answer acknowledges, which it lists no more once the record is committed. It always gives an
|
|
54
|
+
# exit status, since the answer's schema refuses not_run_reason. sent is the check_result as given.
|
|
53
55
|
#: (Hash[String, untyped], Hash[String, untyped]) -> Hash[String, untyped]
|
|
54
56
|
def passed(result, sent)
|
|
55
57
|
status = result.fetch("exit_status")
|
|
@@ -61,7 +63,7 @@ module Principles
|
|
|
61
63
|
|
|
62
64
|
# Whether the member's check is this tool's own list-member-problems and lists only members this answer
|
|
63
65
|
# acknowledges, refusing a listed_members that is not what it lists now, and a listing of another member,
|
|
64
|
-
# which it would still list once the record is committed
|
|
66
|
+
# which it would still list once the record is committed.
|
|
65
67
|
#: (String, Hash[String, untyped]) -> bool
|
|
66
68
|
def lists_only_the_acknowledged?(command, sent)
|
|
67
69
|
listed = @listed or return false
|
|
@@ -73,7 +75,7 @@ module Principles
|
|
|
73
75
|
"answer does not acknowledge, so a full audit judges it")
|
|
74
76
|
end
|
|
75
77
|
|
|
76
|
-
# Refuses a listed_members that is not what the member's own list-member-problems check lists now
|
|
78
|
+
# Refuses a listed_members that is not what the member's own list-member-problems check lists now.
|
|
77
79
|
#: (String) -> bot
|
|
78
80
|
def misreported(command)
|
|
79
81
|
raise CHECK_RESULT.child("listed_members").refusal(
|
|
@@ -83,10 +85,20 @@ module Principles
|
|
|
83
85
|
)
|
|
84
86
|
end
|
|
85
87
|
|
|
86
|
-
# The check_result the answer reports, its command read as the request printed it when left out
|
|
88
|
+
# The check_result the answer reports, its command read as the request printed it when left out.
|
|
87
89
|
#: (untyped, String) -> untyped
|
|
88
90
|
def reported(sent, check) = sent.is_a?(Hash) ? { "command" => check, **sent.except("listed_members") } : sent
|
|
89
91
|
|
|
92
|
+
# Refuses an answer for a checked member that reports no check_result, naming the instruction and template slot
|
|
93
|
+
# its request prints, not the full audit's answer_guide, which it does not.
|
|
94
|
+
#: () -> bot
|
|
95
|
+
def missing
|
|
96
|
+
raise CHECK_RESULT.refusal(
|
|
97
|
+
Error.new("invalid_check_result", "the member has a check, so its acknowledgement needs a check_result",
|
|
98
|
+
CheckResultGuide::ACKNOWLEDGEMENT.missing)
|
|
99
|
+
)
|
|
100
|
+
end
|
|
101
|
+
|
|
90
102
|
#: (String) -> bot
|
|
91
103
|
def refuse(why) = AcknowledgementRefusal.new(@member, @principle_id).refuse(why)
|
|
92
104
|
end
|
|
@@ -5,6 +5,7 @@ require_relative "../error"
|
|
|
5
5
|
require_relative "acknowledged_check"
|
|
6
6
|
require_relative "acknowledgement_left_as_printed"
|
|
7
7
|
require_relative "acknowledgement_refusal"
|
|
8
|
+
require_relative "acknowledgements"
|
|
8
9
|
require_relative "request_id"
|
|
9
10
|
require_relative "audit_record"
|
|
10
11
|
require_relative "member"
|
|
@@ -17,15 +18,15 @@ require_relative "template_placeholders"
|
|
|
17
18
|
module Principles
|
|
18
19
|
# The domain logic, and the mediation of persistence. models/CLAUDE.md owns the boundary.
|
|
19
20
|
module Models
|
|
20
|
-
# A one-member audit
|
|
21
|
+
# A one-member audit: the agent says a committed change to one member keeps its meaning, quoting a line
|
|
21
22
|
# from before and after it, so the record's baseline for that member moves on and --short stops repeating it.
|
|
22
23
|
# Refused outside git, for a member no completed audit assessed, and for an unchanged or checked member.
|
|
23
24
|
class Acknowledgement
|
|
24
25
|
PHASE = "acknowledgement"
|
|
25
26
|
# The text the answer's template prints in each field the agent judges, which an answer may not send back, so
|
|
26
|
-
# a template returned as printed acknowledges nothing
|
|
27
|
-
# out reads as first_changed_lines
|
|
28
|
-
# inserted line usually adds a rule, for an agent that reads the template alone
|
|
27
|
+
# a template returned as printed acknowledges nothing. It prints no quotes, which an answer leaving them
|
|
28
|
+
# out reads as first_changed_lines. After a pure insertion, meaning_kept's says that an
|
|
29
|
+
# inserted line usually adds a rule, for an agent that reads the template alone.
|
|
29
30
|
PLACEHOLDERS = TemplatePlaceholders.new(
|
|
30
31
|
{ "meaning_kept" => "true only if the member still says the same thing",
|
|
31
32
|
"reason" => "Why, in one line of your own" },
|
|
@@ -33,9 +34,9 @@ module Principles
|
|
|
33
34
|
"a line, which usually adds a rule" }
|
|
34
35
|
) #: TemplatePlaceholders
|
|
35
36
|
# The text a checked member's template prints where its check's exit status goes, short since the request's
|
|
36
|
-
# context says how to run the check
|
|
37
|
+
# context says how to run the check.
|
|
37
38
|
EXIT_STATUS_PLACEHOLDER = ReportedCheck::EXIT_STATUS_PLACEHOLDER #: String
|
|
38
|
-
# The fields an answer may not send back as the template printed them, refused before its shape
|
|
39
|
+
# The fields an answer may not send back as the template printed them, refused before its shape.
|
|
39
40
|
LEFT_AS_PRINTED = AcknowledgementLeftAsPrinted.new(
|
|
40
41
|
PLACEHOLDERS, exit_status: EXIT_STATUS_PLACEHOLDER
|
|
41
42
|
) #: AcknowledgementLeftAsPrinted
|
|
@@ -58,16 +59,16 @@ module Principles
|
|
|
58
59
|
end
|
|
59
60
|
|
|
60
61
|
# The member's lines at its baseline and now, which the answer quotes; refused when the member cannot be found
|
|
61
|
-
# where its baseline was read, since there is no line there to quote
|
|
62
|
-
# where the map then placed it
|
|
62
|
+
# where its baseline was read, since there is no line there to quote; #baseline reads a moved member
|
|
63
|
+
# where the map then placed it.
|
|
63
64
|
#: (MemberLines?) -> MemberLines
|
|
64
65
|
def compared(lines)
|
|
65
66
|
lines or refuse("it cannot be found in its file at its baseline commit #{last_judged_commit}")
|
|
66
67
|
end
|
|
67
68
|
|
|
68
69
|
# The member's baseline: the oldest of placements, from the commit it was last judged at on, that holds the
|
|
69
|
-
# text the record vouches for, which is later than that commit when its full audit fixed it
|
|
70
|
-
# map then placed it when it has moved since
|
|
70
|
+
# text the record vouches for, which is later than that commit when its full audit fixed it, and as the
|
|
71
|
+
# map then placed it when it has moved since. Refused when none does, since that text is not the
|
|
71
72
|
# audited one.
|
|
72
73
|
#: (Enumerable[Placement]) -> Placement
|
|
73
74
|
def baseline(placements)
|
|
@@ -76,18 +77,18 @@ module Principles
|
|
|
76
77
|
refuse("its text does not match the audit record at #{last_judged_commit} or any later commit")
|
|
77
78
|
end
|
|
78
79
|
|
|
79
|
-
# Where the member was at baseline, when that is not where it is now, as after a move
|
|
80
|
+
# Where the member was at baseline, when that is not where it is now, as after a move.
|
|
80
81
|
#: (Placement) -> Hash[String, untyped]?
|
|
81
82
|
def moved_from(baseline)
|
|
82
83
|
baseline.reference unless baseline.reference == @member.reference
|
|
83
84
|
end
|
|
84
85
|
|
|
85
|
-
# The paths the change since baseline spans, which the baseline's placement owns
|
|
86
|
+
# The paths the change since baseline spans, which the baseline's placement owns.
|
|
86
87
|
#: (Placement) -> Array[String]
|
|
87
88
|
def paths_since(baseline) = baseline.paths_to(@member.path)
|
|
88
89
|
|
|
89
90
|
# The commit the member was last judged at, when baseline is later than it, as when the member's own full
|
|
90
|
-
# audit fixed it after its base
|
|
91
|
+
# audit fixed it after its base.
|
|
91
92
|
#: (Placement) -> String?
|
|
92
93
|
def audit_base(baseline)
|
|
93
94
|
judged = last_judged_commit
|
|
@@ -118,19 +119,34 @@ module Principles
|
|
|
118
119
|
end
|
|
119
120
|
|
|
120
121
|
# The ids of the deferred and the accepted findings the last audit left on this member, which the request
|
|
121
|
-
# and the acknowledgement name
|
|
122
|
-
# (D35 brief, finding 11).
|
|
122
|
+
# and the acknowledgement name, the accepted ones since an edit may bear on whether they still hold
|
|
123
123
|
#: () -> Hash[String, Array[String]]
|
|
124
124
|
def open_findings
|
|
125
125
|
{ "deferred_findings" => findings_on_member("deferred"), "accepted_findings" => findings_on_member("accepted") }
|
|
126
126
|
end
|
|
127
127
|
|
|
128
|
+
# Whether the last audit deferred a finding on this member, which acknowledging it leaves open for a full audit.
|
|
129
|
+
#: () -> bool
|
|
130
|
+
def keeps_deferred_findings? = findings_on_member("deferred").any?
|
|
131
|
+
|
|
132
|
+
# The answer's entry for its member, under members by the member's id as several members' entries are;
|
|
133
|
+
# refused when members leaves it out or holds another member.
|
|
134
|
+
#: (untyped) -> untyped
|
|
135
|
+
def entry_in(answer)
|
|
136
|
+
entries = answer.fetch("members")
|
|
137
|
+
refusal = Acknowledgements.unmatched(missing: [@member.id] - entries.keys, extra: entries.keys - [@member.id],
|
|
138
|
+
named_by: "basis.member_ids")
|
|
139
|
+
raise refusal if refusal
|
|
140
|
+
|
|
141
|
+
entries.fetch(@member.id)
|
|
142
|
+
end
|
|
143
|
+
|
|
128
144
|
# The record with this member's baseline moved to its text now, once the answer is checked against the
|
|
129
145
|
# member's lines at the baseline commit and now. The change keeps the check run the answer reported, which the
|
|
130
|
-
# member's check_result cannot show was this run when the last audit's passed with the same command
|
|
146
|
+
# member's check_result cannot show was this run when the last audit's passed with the same command.
|
|
131
147
|
# into is the record the change is made to: the one this member is judged against, unless another member's
|
|
132
148
|
# acknowledgement in the same answer has already changed it. listed is what the member's check lists now, when
|
|
133
|
-
# it is this tool's own list-member-problems
|
|
149
|
+
# it is this tool's own list-member-problems.
|
|
134
150
|
#: (untyped, MemberLines, at: String, ?into: AuditRecord?, ?listed: ListedMembers?) -> AuditRecord
|
|
135
151
|
def accepted(answer, lines, at:, into: nil, listed: nil)
|
|
136
152
|
checked(answer, lines)
|
|
@@ -161,7 +177,7 @@ module Principles
|
|
|
161
177
|
def quoted_change(lines) = QuotedChange.new(lines, member_id: @member.id)
|
|
162
178
|
|
|
163
179
|
# The ids of the findings the last audit left open on this member with action, found by key, so a member moved
|
|
164
|
-
# since keeps its findings
|
|
180
|
+
# since keeps its findings.
|
|
165
181
|
#: (String) -> Array[String]
|
|
166
182
|
def findings_on_member(action)
|
|
167
183
|
acknowledgeable.left_open.select { |finding| finding.action == action && finding.on?(@member.key) }.map(&:id)
|
|
@@ -10,9 +10,9 @@ module Principles
|
|
|
10
10
|
# The domain logic, and the mediation of persistence. models/CLAUDE.md owns the boundary.
|
|
11
11
|
module Models
|
|
12
12
|
# The fields a one-member audit's answer leaves as its template printed them, refused in one refusal before the
|
|
13
|
-
# answer's shape: its judgement's, meaning_kept and reason
|
|
14
|
-
# otherwise refused as text with a repair offering the not_run_reason this template refuses
|
|
15
|
-
# placeholders the template prints in each; Acknowledgement::LEFT_AS_PRINTED is the one
|
|
13
|
+
# answer's shape: its judgement's, meaning_kept and reason, and a checked member's exit_status, which was
|
|
14
|
+
# otherwise refused as text with a repair offering the not_run_reason this template refuses. It holds the
|
|
15
|
+
# placeholders the template prints in each; Acknowledgement::LEFT_AS_PRINTED is the one every acknowledgement uses.
|
|
16
16
|
class AcknowledgementLeftAsPrinted
|
|
17
17
|
include RefusalBeforeShape
|
|
18
18
|
|
|
@@ -20,20 +20,14 @@ module Principles
|
|
|
20
20
|
EXIT_STATUS = "check_result.exit_status" #: String
|
|
21
21
|
|
|
22
22
|
# judged holds the placeholders of the judgement's fields, exit_status the one printed where the status goes;
|
|
23
|
-
#
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
def initialize(judged, exit_status:, each_member: false)
|
|
23
|
+
# they are read in each entry of the answer's members, keyed by member id, for one member as for several.
|
|
24
|
+
#: (TemplatePlaceholders, exit_status: String) -> void
|
|
25
|
+
def initialize(judged, exit_status:)
|
|
27
26
|
@judged = judged
|
|
28
27
|
@exit_status = exit_status
|
|
29
|
-
@each_member = each_member
|
|
30
28
|
freeze
|
|
31
29
|
end
|
|
32
30
|
|
|
33
|
-
# The same fields, read in each entry of an answer to several members (#1169).
|
|
34
|
-
#: () -> AcknowledgementLeftAsPrinted
|
|
35
|
-
def in_each_member = AcknowledgementLeftAsPrinted.new(@judged, exit_status: @exit_status, each_member: true)
|
|
36
|
-
|
|
37
31
|
# @override
|
|
38
32
|
#: (untyped, String, Array[Hash[String, String]]) -> void
|
|
39
33
|
def refuse_in(answer, _source, shape_problems)
|
|
@@ -44,11 +38,9 @@ module Principles
|
|
|
44
38
|
|
|
45
39
|
private
|
|
46
40
|
|
|
47
|
-
# Each field left as printed
|
|
41
|
+
# Each field left as printed in each entry of the answer's members, by name, beside its pointer.
|
|
48
42
|
#: (Hash[String, untyped]) -> Hash[String, String]
|
|
49
43
|
def pointers_in(answer)
|
|
50
|
-
return left_in(answer).to_h { [it, "/#{it.tr(".", "/")}"] } unless @each_member
|
|
51
|
-
|
|
52
44
|
members = answer["members"]
|
|
53
45
|
return {} unless members.is_a?(Hash)
|
|
54
46
|
|