principles 0.1.1 → 0.1.3
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 +30 -0
- data/lib/principles/command_line.rb +6 -3
- data/lib/principles/controllers/command.rb +3 -2
- data/lib/principles/controllers/inventory.rb +9 -1
- data/lib/principles/controllers/member_acknowledgement.rb +21 -11
- data/lib/principles/controllers/running_tool.rb +6 -4
- data/lib/principles/data/command-steps.json +2 -2
- data/lib/principles/data/repository.rb +5 -0
- data/lib/principles/data/running_version.rb +1 -1
- data/lib/principles/data/schemas/assessment-answer.schema.json +3 -6
- data/lib/principles/data/schemas/audit-record.schema.json +2 -1
- data/lib/principles/data/schemas/correction-answer.schema.json +11 -6
- data/lib/principles/data/schemas/deciding-answer.schema.json +5 -1
- data/lib/principles/list_principles_options.rb +28 -0
- data/lib/principles/models/acknowledgement.rb +10 -0
- data/lib/principles/models/acknowledgement_placeholders.rb +43 -18
- data/lib/principles/models/answer_fields.rb +21 -2
- data/lib/principles/models/disposition.rb +6 -5
- data/lib/principles/models/disposition_placeholders.rb +15 -7
- data/lib/principles/models/finding_decision.rb +2 -1
- data/lib/principles/models/finding_write_ups.rb +9 -3
- data/lib/principles/models/named_placeholder.rb +17 -7
- data/lib/principles/models/open_findings_decision.rb +3 -2
- data/lib/principles/models/project_history.rb +9 -0
- data/lib/principles/models/record_format.rb +5 -3
- data/lib/principles/models/recorded_finding.rb +2 -2
- data/lib/principles/models/still_holds_restatement.rb +1 -1
- data/lib/principles/models/template_placeholders.rb +10 -9
- data/lib/principles/models/write_up_pointer.rb +12 -4
- data/lib/principles/version.rb +2 -2
- data/lib/principles/views/acknowledgement_result.rb +23 -16
- data/lib/principles/views/answer_in_a_file.rb +1 -1
- data/lib/principles/views/assessment_request.rb +7 -3
- data/lib/principles/views/correction_request.rb +2 -2
- data/lib/principles/views/invocation.rb +4 -3
- data/lib/principles/views/principle_read_result.rb +5 -0
- data/lib/principles/views/prompts/answer-any-judgement-request/fill-the-answer-in-a-file.md +1 -1
- data/lib/principles/views/prompts/assess-every-member/ask-whether-each-rule-is-enforced.md +2 -0
- data/lib/principles/views/prompts/assess-every-member/decide-each-prior-finding.md +1 -1
- data/lib/principles/views/prompts/dispose-of-each-finding/confirm-each-deferral-written-up-nowhere.md +1 -1
- data/lib/principles/views/prompts/dispose-of-each-finding/fix-or-record-each-finding.md +5 -4
- data/lib/principles/views/prompts/dispose-of-each-finding/retain-assessment-and-correction.md +1 -1
- data/lib/principles/views/prompts/learn-what-a-command-does/list-open-findings.md +8 -8
- data/lib/principles/views/prompts/learn-what-a-command-does/list-principles.md +2 -0
- data/lib/principles/views/prompts/learn-what-a-command-does/show-answer-check.md +3 -3
- data/lib/principles/views/prompts/learn-what-a-command-does/show-open-correction.md +1 -1
- data/lib/principles/views/prompts/learn-what-a-command-does/submit-answer.md +1 -1
- data/lib/principles/views/prompts/run-a-first-audit-in-the-background/follow-the-brief.md +1 -1
- metadata +3 -1
|
@@ -4,15 +4,16 @@
|
|
|
4
4
|
module Principles
|
|
5
5
|
# The domain logic, and the mediation of persistence. models/CLAUDE.md owns the boundary.
|
|
6
6
|
module Models
|
|
7
|
-
# A placeholder a template prints naming the id of the slot it fills, a member's or a finding's,
|
|
8
|
-
# are alike and a file-edit tool's one-match replace fills one. Its text for any id, or
|
|
9
|
-
#
|
|
7
|
+
# A placeholder a template prints naming the id of the slot it fills, a member's or a finding's, or the slot's
|
|
8
|
+
# position, so no two slots are alike and a file-edit tool's one-match replace fills one. Its text for any id, or
|
|
9
|
+
# the text it printed before, sent in any slot, is left as printed: a plain text, or an earlier NamedPlaceholder
|
|
10
|
+
# with its own earlier text, so an answer filled from any release's template is read alike.
|
|
10
11
|
class NamedPlaceholder
|
|
11
12
|
# The slot in slotted that each slot's id fills.
|
|
12
13
|
SLOT = "%<id>s" #: String
|
|
13
14
|
|
|
14
|
-
# slotted is the text with SLOT where the id goes; before is the text it printed before
|
|
15
|
-
#: (String, before: String) -> void
|
|
15
|
+
# slotted is the text with SLOT where the id goes; before is the text it printed before, plain or named.
|
|
16
|
+
#: (String, before: String | NamedPlaceholder) -> void
|
|
16
17
|
def initialize(slotted, before:)
|
|
17
18
|
@slotted = slotted
|
|
18
19
|
@before = before
|
|
@@ -24,9 +25,18 @@ module Principles
|
|
|
24
25
|
#: String
|
|
25
26
|
attr_reader :slotted
|
|
26
27
|
|
|
27
|
-
# Whether text is this placeholder, for any id or as it was printed before
|
|
28
|
+
# Whether text is this placeholder, for any id or as it was printed before.
|
|
28
29
|
#: (untyped) -> bool
|
|
29
|
-
def left?(text) =
|
|
30
|
+
def left?(text) = (text.is_a?(String) && @pattern.match?(text)) || earlier?(text)
|
|
31
|
+
|
|
32
|
+
private
|
|
33
|
+
|
|
34
|
+
# Whether text is the placeholder as it was printed before.
|
|
35
|
+
#: (untyped) -> bool
|
|
36
|
+
def earlier?(text)
|
|
37
|
+
earlier = @before
|
|
38
|
+
earlier.is_a?(NamedPlaceholder) ? earlier.left?(text) : text == earlier
|
|
39
|
+
end
|
|
30
40
|
end
|
|
31
41
|
end
|
|
32
42
|
end
|
|
@@ -110,13 +110,14 @@ module Principles
|
|
|
110
110
|
"Give each finding one decision.")
|
|
111
111
|
end
|
|
112
112
|
|
|
113
|
-
# The decision at index, its new recorded_at, when it gives one, located and committed.
|
|
113
|
+
# The decision at index, its new recorded_at, when it gives one, located and committed, or checked as a link.
|
|
114
114
|
#: (Hash[String, untyped], Integer, AnswerFields) -> FindingDecision
|
|
115
115
|
def decision_at(decision, index, fields)
|
|
116
116
|
place = AnswerPlace.new("/decisions/#{index}", "Finding #{decision["finding_id"]}")
|
|
117
117
|
reference = decision["recorded_at"]
|
|
118
118
|
pointer = fields.write_up_pointer(reference, place.child("recorded_at")) if reference
|
|
119
|
-
|
|
119
|
+
file = pointer&.file
|
|
120
|
+
@history.refuse_uncommitted_write_up(file) if file
|
|
120
121
|
FindingDecision.new(decision, place, principle_id: @principle_id, recorded_at: pointer)
|
|
121
122
|
end
|
|
122
123
|
end
|
|
@@ -49,6 +49,15 @@ module Principles
|
|
|
49
49
|
#: (String) -> bool
|
|
50
50
|
def tracks?(path) = !@repository.inside? || @repository.untracked_including_ignored(through_links([path])).empty?
|
|
51
51
|
|
|
52
|
+
# The project's tmp/ folder, by its full path, when it is there and git ignores it, so an answer saved in it is
|
|
53
|
+
# never committed; nil otherwise, outside git too. Asked once for the command.
|
|
54
|
+
#: () -> String?
|
|
55
|
+
def ignored_tmp_folder
|
|
56
|
+
return @ignored_tmp_folder if defined?(@ignored_tmp_folder)
|
|
57
|
+
|
|
58
|
+
@ignored_tmp_folder = ("#{@files.root}/tmp" if @files.folder?("tmp") && @repository.ignores?("tmp/")) #: String?
|
|
59
|
+
end
|
|
60
|
+
|
|
52
61
|
# Whether the project is in git, so it has a history at all.
|
|
53
62
|
#: () -> bool
|
|
54
63
|
def inside_git? = @repository.inside?
|
|
@@ -20,10 +20,12 @@ module Principles
|
|
|
20
20
|
# rewrite, add the next format here, set by hand to the release that commit ships in, and name the field in
|
|
21
21
|
# FIELD_FORMATS, so only a record carrying it moves up.
|
|
22
22
|
# Add its row to prompts/docs/AUDIT_RECORD_FORMAT_HISTORY.md too.
|
|
23
|
-
FIRST_RELEASES = { 1 => "0.0.4", 2 => "0.0.8", 3 => "0.1.0" }.freeze #: Hash[Integer, String]
|
|
23
|
+
FIRST_RELEASES = { 1 => "0.0.4", 2 => "0.0.8", 3 => "0.1.0", 4 => "0.1.2" }.freeze #: Hash[Integer, String]
|
|
24
24
|
# The format each later field needs, by its path of property names: the open record's correction, which
|
|
25
|
-
# show-open-correction prints again,
|
|
26
|
-
|
|
25
|
+
# show-open-correction prints again, a finding's changes since its audit, which the next full audit shows, and a
|
|
26
|
+
# write-up at a URL, which an older copy's schema refuses as broken for its missing path.
|
|
27
|
+
FIELD_FORMATS = { "correction" => 2, "findings.changed_since_audit" => 3,
|
|
28
|
+
"findings.recorded_at.url" => 4 }.freeze #: Hash[String, Integer]
|
|
27
29
|
# The newest format this copy writes and rewrites without losing a field; formats count up from 1.
|
|
28
30
|
NEWEST = FIRST_RELEASES.size #: Integer
|
|
29
31
|
FIELDS = %w[format format_first_release].freeze
|
|
@@ -58,9 +58,9 @@ module Principles
|
|
|
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, unless that is at a url.
|
|
62
62
|
#: () -> Array[String]
|
|
63
|
-
def cited_paths = [*evidence&.map { it.fetch("path") }, recorded_at&.
|
|
63
|
+
def cited_paths = [*evidence&.map { it.fetch("path") }, recorded_at&.file].compact.uniq
|
|
64
64
|
|
|
65
65
|
# The commit whose record an audit cited for an earlier first_raised_at, when one did.
|
|
66
66
|
#: () -> String?
|
|
@@ -41,7 +41,7 @@ module Principles
|
|
|
41
41
|
problem if @decision.key?("problem")
|
|
42
42
|
return unless @decision["recorded_at"]
|
|
43
43
|
|
|
44
|
-
AnswerFields.new(locate).
|
|
44
|
+
AnswerFields.new(locate).write_up_pointer(@decision["recorded_at"], @place.child("recorded_at"))
|
|
45
45
|
end
|
|
46
46
|
|
|
47
47
|
private
|
|
@@ -16,20 +16,21 @@ module Principles
|
|
|
16
16
|
|
|
17
17
|
# placeholders is the text printed in each field, by field name, or for a field that takes pointers, one pointer
|
|
18
18
|
# whose fields hold that text, so the template shows their shape; empty_lists names the fields a template
|
|
19
|
-
# may instead start as an empty list, which is not given either; also_printed, the other
|
|
20
|
-
# may print in a field, refused alike. A NamedPlaceholder in either prints with its
|
|
21
|
-
# with the id of the entry it prints in, and is left as printed for any id.
|
|
22
|
-
#: (Hash[String, untyped], ?empty_lists: Array[String], ?also_printed: Hash[String, untyped])
|
|
19
|
+
# may instead start as an empty list, which is not given either; also_printed, the other texts a template
|
|
20
|
+
# may print in a field, each by a name saying when, refused alike. A NamedPlaceholder in either prints with its
|
|
21
|
+
# slot, which the view fills with the id of the entry it prints in, and is left as printed for any id.
|
|
22
|
+
#: (Hash[String, untyped], ?empty_lists: Array[String], ?also_printed: Hash[String, Hash[Symbol, untyped]])
|
|
23
|
+
#| -> void
|
|
23
24
|
def initialize(placeholders, empty_lists: [], also_printed: {})
|
|
24
25
|
@placeholders = placeholders.freeze #: Hash[String, untyped]
|
|
25
26
|
@empty_lists = empty_lists.freeze #: Array[String]
|
|
26
|
-
@also_printed = also_printed.freeze #: Hash[String, untyped]
|
|
27
|
+
@also_printed = also_printed.freeze #: Hash[String, Hash[Symbol, untyped]]
|
|
27
28
|
freeze
|
|
28
29
|
end
|
|
29
30
|
|
|
30
|
-
# The text printed in each field, with field's other text in place of its own.
|
|
31
|
-
#: (String) -> Hash[String, untyped]
|
|
32
|
-
def with_other_text_in(field) = to_h.merge(field => shown(@also_printed.fetch(field)))
|
|
31
|
+
# The text printed in each field, with field's other text named name in place of its own.
|
|
32
|
+
#: (String, Symbol) -> Hash[String, untyped]
|
|
33
|
+
def with_other_text_in(field, name) = to_h.merge(field => shown(@also_printed.fetch(field).fetch(name)))
|
|
33
34
|
|
|
34
35
|
# Each placeholder printed in its own field naming its entry's id; a field's other text is printed only by
|
|
35
36
|
# some of its requests, so another template leaving it is not read as this one's.
|
|
@@ -73,7 +74,7 @@ module Principles
|
|
|
73
74
|
# Whether value is a text the template prints in field.
|
|
74
75
|
#: (String, untyped) -> bool
|
|
75
76
|
def printed?(field, value)
|
|
76
|
-
[@placeholders[field],
|
|
77
|
+
[@placeholders[field], *@also_printed.fetch(field, {}).values].compact.any? do |printed|
|
|
77
78
|
printed.is_a?(NamedPlaceholder) ? printed.left?(value) : printed == value
|
|
78
79
|
end
|
|
79
80
|
end
|
|
@@ -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
|
# Where a finding is written up, as its record's recorded_at keeps it: a path, with a heading or a starting_at
|
|
10
|
-
# inside it. It holds that place as the Locator the hash it was
|
|
11
|
-
# and order, since the record's bytes and each digest over them
|
|
12
|
-
# those hashes hold the same keys and values, in any order.
|
|
10
|
+
# inside it, or a url outside the project, such as an issue's. It holds that place as the Locator the hash it was
|
|
11
|
+
# read from gives, which keeps its keys, nulls and order, since the record's bytes and each digest over them
|
|
12
|
+
# depend on it; two pointers are the same when those hashes hold the same keys and values, in any order.
|
|
13
13
|
class WriteUpPointer
|
|
14
14
|
#: (Hash[String, untyped]) -> void
|
|
15
15
|
def initialize(fields)
|
|
@@ -17,7 +17,15 @@ module Principles
|
|
|
17
17
|
freeze
|
|
18
18
|
end
|
|
19
19
|
|
|
20
|
-
# The
|
|
20
|
+
# The link to a write-up outside the project, which this tool never reads, or nil for one in a file here.
|
|
21
|
+
#: () -> String?
|
|
22
|
+
def url = @locator.to_h["url"]
|
|
23
|
+
|
|
24
|
+
# The project file it points into, which an audit commits and its record cites, or nil at a url.
|
|
25
|
+
#: () -> String?
|
|
26
|
+
def file = url ? nil : path
|
|
27
|
+
|
|
28
|
+
# The file the write-up is in, for a pointer with no url.
|
|
21
29
|
#: () -> String
|
|
22
30
|
def path = @locator.path
|
|
23
31
|
|
data/lib/principles/version.rb
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
|
|
4
4
|
module Principles
|
|
5
5
|
# The next production release, as major.minor.patch. A production build is versioned with this alone.
|
|
6
|
-
RELEASE = "0.1.
|
|
6
|
+
RELEASE = "0.1.3"
|
|
7
7
|
# The version a built gem prints. `rake build[production]` stamps RELEASE here, in the copy of lib/ it
|
|
8
8
|
# packages, and `rake build[development]` stamps RELEASE.g<short sha>. A checkout leaves it nil, and
|
|
9
9
|
# Data::RunningVersion reads the commit this tool runs from instead.
|
|
10
|
-
BUILT_VERSION = "0.1.
|
|
10
|
+
BUILT_VERSION = "0.1.3" #: String?
|
|
11
11
|
end
|
|
@@ -11,7 +11,7 @@ module Principles
|
|
|
11
11
|
module Views
|
|
12
12
|
# A one-member audit's request and its result.
|
|
13
13
|
class AcknowledgementResult
|
|
14
|
-
# Where a placeholder names the
|
|
14
|
+
# Where a placeholder names the entry it prints in, by its position in the template's members, 1 the first.
|
|
15
15
|
SLOT = "%<id>s" #: String
|
|
16
16
|
|
|
17
17
|
#: (Invocation) -> void
|
|
@@ -43,7 +43,7 @@ module Principles
|
|
|
43
43
|
def answer_to_fill(request_id:, asked:)
|
|
44
44
|
member_id = asked.fetch(:change).member_id
|
|
45
45
|
{ "request_id" => request_id, "basis" => { "member_ids" => [member_id] },
|
|
46
|
-
"members" => { member_id => named(asked.fetch(:placeholders),
|
|
46
|
+
"members" => { member_id => named(asked.fetch(:placeholders), 1) } }
|
|
47
47
|
end
|
|
48
48
|
|
|
49
49
|
# The request for several members' acknowledgements in one answer: each of members holds a member's
|
|
@@ -66,7 +66,7 @@ module Principles
|
|
|
66
66
|
#: (request_id: String, members: Array[Hash[Symbol, untyped]]) -> Hash[String, untyped]
|
|
67
67
|
def several_to_fill(request_id:, members:)
|
|
68
68
|
{ "request_id" => request_id, "basis" => { "member_ids" => members.map { it.fetch(:change).member_id } },
|
|
69
|
-
"members" => members.to_h { named_entry(
|
|
69
|
+
"members" => members.each_with_index.to_h { |asked, index| named_entry(asked, index + 1) } }
|
|
70
70
|
end
|
|
71
71
|
|
|
72
72
|
# The request for the members several principles map in one answer: under context.principles, each
|
|
@@ -91,28 +91,35 @@ module Principles
|
|
|
91
91
|
# print the same field.
|
|
92
92
|
#: (request_id: String, principles: Hash[String, Array[Hash[Symbol, untyped]]]) -> Hash[String, untyped]
|
|
93
93
|
def across_to_fill(request_id:, principles:)
|
|
94
|
-
entries = principles
|
|
95
|
-
id = asked.fetch(:change).member_id
|
|
96
|
-
by_member[id] = named(asked.fetch(:placeholders), id).merge(by_member.fetch(id, {}))
|
|
97
|
-
end
|
|
94
|
+
entries = across_entries(principles)
|
|
98
95
|
{ "request_id" => request_id, "basis" => { "principle_ids" => principles.keys, "member_ids" => entries.keys },
|
|
99
96
|
"members" => entries }
|
|
100
97
|
end
|
|
101
98
|
|
|
102
99
|
private
|
|
103
100
|
|
|
104
|
-
#
|
|
105
|
-
#
|
|
106
|
-
#: (Hash[String, untyped]
|
|
107
|
-
def
|
|
101
|
+
# One entry per member the principles' requests ask about, by its id, with every field any principle's template
|
|
102
|
+
# prints for it, the first principle's text where two print the same field, its placeholders naming its position.
|
|
103
|
+
#: (Hash[String, Array[Hash[Symbol, untyped]]]) -> Hash[String, Hash[String, untyped]]
|
|
104
|
+
def across_entries(principles)
|
|
105
|
+
ids = across_member_ids(principles)
|
|
106
|
+
principles.values.flatten.each_with_object({}) do |asked, by_member|
|
|
107
|
+
id = asked.fetch(:change).member_id
|
|
108
|
+
by_member[id] = named(asked.fetch(:placeholders), ids.index(id).to_i + 1).merge(by_member.fetch(id, {}))
|
|
109
|
+
end
|
|
110
|
+
end
|
|
108
111
|
|
|
109
|
-
#
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
112
|
+
# placeholders with each one's SLOT naming the entry's position, as its entry in the template prints them; any
|
|
113
|
+
# other text, a percent sign included, as it is.
|
|
114
|
+
#: (Hash[String, untyped], Integer) -> Hash[String, untyped]
|
|
115
|
+
def named(placeholders, position)
|
|
116
|
+
placeholders.transform_values { it.is_a?(String) ? it.gsub(SLOT, position.to_s) : it }
|
|
114
117
|
end
|
|
115
118
|
|
|
119
|
+
# The template's entry for the member asked asks about, by its id, its placeholders naming its position.
|
|
120
|
+
#: (Hash[Symbol, untyped], Integer) -> [String, Hash[String, untyped]]
|
|
121
|
+
def named_entry(asked, position) = [asked.fetch(:change).member_id, named(asked.fetch(:placeholders), position)]
|
|
122
|
+
|
|
116
123
|
# How to fill the answer to request_id, acknowledging member_ids of principle_ids: saved bare from
|
|
117
124
|
# start-audit --as template to a file the agent edits.
|
|
118
125
|
#: (Array[String], Array[String], request_id: String) -> String
|
|
@@ -9,7 +9,7 @@ require_relative "shell_word"
|
|
|
9
9
|
module Principles
|
|
10
10
|
# What this tool prints, from plain values a controller hands it. views/CLAUDE.md owns the boundary.
|
|
11
11
|
module Views
|
|
12
|
-
# How to fill an answer this tool prints bare: save it to a file
|
|
12
|
+
# How to fill an answer this tool prints bare: save it to a file kept out of git, named in full, fill it
|
|
13
13
|
# there with the agent's own file-edit tool, and submit that file, with the three characters JSON escapes.
|
|
14
14
|
# Filling a template in a shell heredoc took a script, since prose full of quotes needed escaping for the shell
|
|
15
15
|
# and for JSON.
|
|
@@ -25,7 +25,8 @@ module Principles
|
|
|
25
25
|
OPEN_FINDINGS_ELSEWHERE = "Where an entry names `open_finding_ids`" #: String
|
|
26
26
|
|
|
27
27
|
# The question every member's assessment answers, which a completed record digests with the description:
|
|
28
|
-
# the whole question, what observed means too, however much of it a request prints
|
|
28
|
+
# the whole question, what observed means too, however much of it a request prints, but not whether each rule
|
|
29
|
+
# is enforced, which only the set's assessment answers.
|
|
29
30
|
#: () -> String
|
|
30
31
|
def self.question = question_paragraphs.join(" ")
|
|
31
32
|
|
|
@@ -146,11 +147,14 @@ module Principles
|
|
|
146
147
|
carried_forward_instruction, mapped_elsewhere_instruction, AssessmentAnswerGuide.new(@members).instruction]
|
|
147
148
|
end
|
|
148
149
|
|
|
149
|
-
# The question, defining observed only when a member is judged afresh, whose delivery it guides
|
|
150
|
+
# The question, defining observed only when a member is judged afresh, whose delivery it guides, then whether
|
|
151
|
+
# each rule is enforced, which the set's assessment answers afresh at every audit. A record digests the question
|
|
152
|
+
# without it, so asking it still carries forward each member's last assessment, which never answered it.
|
|
150
153
|
#: () -> Instruction
|
|
151
154
|
def question
|
|
152
155
|
assess, observed = AssessmentRequest.question_paragraphs
|
|
153
|
-
|
|
156
|
+
enforced = Prompts.text("assess-every-member/ask-whether-each-rule-is-enforced")
|
|
157
|
+
Instruction.new("question", [[assess, true], [observed, @members.judged_afresh?], [enforced, true]])
|
|
154
158
|
end
|
|
155
159
|
|
|
156
160
|
# Why each member with judge_because is judged afresh, explaining only the values the members carry, so the
|
|
@@ -55,7 +55,7 @@ module Principles
|
|
|
55
55
|
{ "finding_id" => finding["id"], "action" => named.fetch("action"),
|
|
56
56
|
"reason" => named.fetch("reason"), "changed_members" => [], "removed_members" => [],
|
|
57
57
|
"evidence" => [],
|
|
58
|
-
"reassessment" =>
|
|
58
|
+
"reassessment" => nil, "recorded_at" => nil, "waits_on" => nil }
|
|
59
59
|
end)
|
|
60
60
|
end
|
|
61
61
|
|
|
@@ -76,7 +76,7 @@ module Principles
|
|
|
76
76
|
assessment_id = acceptable.fetch("request_id")
|
|
77
77
|
file = invocation.answer_file(request_id)
|
|
78
78
|
save = "Once this answer is submitted with the last line's command, save the correction's answer it leads " \
|
|
79
|
-
"to in a file
|
|
79
|
+
"to in a file kept out of git, at this full path, the same from every shell, from this command's " \
|
|
80
80
|
"output: #{alone(assessment_id, answer_file, invocation)} > #{ShellWord.new(file)}\nFill only its " \
|
|
81
81
|
"dispositions, and submit it: #{invocation.submit_answer(request_id, file:)}"
|
|
82
82
|
acceptable.merge("correction_recovery" => recovery(invocation),
|
|
@@ -16,7 +16,8 @@ module Principles
|
|
|
16
16
|
attr_reader :project
|
|
17
17
|
|
|
18
18
|
# named says whether each command names the project; without_project leaves it out. temp_directory is the
|
|
19
|
-
#
|
|
19
|
+
# folder a printed next step saves an answer in: the project's ignored tmp/ when it has one, else the temporary
|
|
20
|
+
# folder the running tool was given.
|
|
20
21
|
#: (executable: String, project: String, temp_directory: String, ?named: bool) -> void
|
|
21
22
|
def initialize(executable:, project:, temp_directory:, named: true)
|
|
22
23
|
@executable = executable
|
|
@@ -59,8 +60,8 @@ module Principles
|
|
|
59
60
|
in_project("submit-answer", request_id, options: ["--file", file])
|
|
60
61
|
end
|
|
61
62
|
|
|
62
|
-
# The file to save the answer name names in, a request id or a principle id, by its full path in
|
|
63
|
-
#
|
|
63
|
+
# The file to save the answer name names in, a request id or a principle id, by its full path in temp_directory,
|
|
64
|
+
# so every shell that runs the printed commands names the same file: a sandboxed and an unsandboxed one
|
|
64
65
|
# read $TMPDIR as different folders.
|
|
65
66
|
#: (String) -> String
|
|
66
67
|
def answer_file(name) = "#{@temp_directory.chomp("/")}/principles-#{name}-answer.json"
|
|
@@ -44,6 +44,11 @@ module Principles
|
|
|
44
44
|
{ "principles" => entries, "next_action" => listed_next_action(entries, waiting, one_to_audit).join("\n") }
|
|
45
45
|
end
|
|
46
46
|
|
|
47
|
+
# list-principles --lines: each mapped principle's id on a line of its own, for a shell loop; nothing when none
|
|
48
|
+
# is mapped.
|
|
49
|
+
#: (Array[String]) -> Lines
|
|
50
|
+
def ids(ids) = Lines.new(stdout: ids.map { "#{it}\n" }.join, stderr: "", status: 0)
|
|
51
|
+
|
|
47
52
|
# Each of list-principles' entries with its principle's open findings, a line each, for --open-findings. open
|
|
48
53
|
# maps each principle id to its findings' plain fields, as list-open-findings --lines takes them.
|
|
49
54
|
#: (Array[Hash[String, untyped]], Hash[String, Array[Hash[String, untyped]]]) -> Array[Hash[String, untyped]]
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Save the answer alone in a file
|
|
1
|
+
Save the answer alone in a file kept out of git, at this full path, the same from every shell: %{save}
|
|
2
2
|
|
|
3
3
|
Fill %{what} with your own file-edit tool, not a shell heredoc; JSON escapes only a double quote, a backslash and a line
|
|
4
4
|
break, as \", \\ and \n, never an apostrophe.
|
|
@@ -4,7 +4,7 @@ carries its `problem` as that audit stated it, its members under their ids now,
|
|
|
4
4
|
member is `current`, `changed` or `removed` since that audit. Read its write-up where `recorded_at` points when
|
|
5
5
|
there is one. A finding marked `text_not_kept` has no statement; judge it from its members.
|
|
6
6
|
|
|
7
|
-
Decide `still_holds` to keep it. Give `recorded_at` to point at a new write-up, and `problem`, one line, when the
|
|
7
|
+
Decide `still_holds` to keep it. Give `recorded_at` to point at a new write-up, as `{"url": "https://..."}` when it is outside the project, and `problem`, one line, when the
|
|
8
8
|
finding is marked `text_not_kept` or to restate its problem when a term in it was renamed or a fact it names moved,
|
|
9
9
|
since a different problem is a new finding; the record keeps its `first_raised_at`, so leave that field out unless an
|
|
10
10
|
earlier record held the same finding; to claim that, read this field whole.
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
Deferred with recorded_at null: %{finding_ids}. That is allowed when there is nowhere to point; the record then
|
|
2
2
|
keeps no pointer, so list-open-findings prints no write-up. If one is written up in a project file, point its
|
|
3
|
-
recorded_at there and check again; if it is written up outside the project, such as in an issue,
|
|
3
|
+
recorded_at there and check again; if it is written up outside the project, such as in an issue, set its recorded_at to {"url": ...} with the link.
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
Address each finding with an authorised edit, or record it as deferred, accepted or disagreed. The
|
|
2
2
|
template leaves each `action` as a placeholder: set it to fixed, deferred, accepted or disagreed for each finding. A
|
|
3
|
-
fixed finding needs an actual change to its members, evidence and a reassessment. Replace
|
|
4
|
-
template gives
|
|
5
|
-
sample into the field it illustrates, `waits_on` included; either one sent
|
|
3
|
+
fixed finding needs an actual change to its members, evidence and a reassessment. Replace the placeholder the
|
|
4
|
+
template gives each `reason` with your own words, write a `reassessment` only on a fix, where it prints null,
|
|
5
|
+
and do not copy an `answer_guide` sample into the field it illustrates, `waits_on` included; either one sent
|
|
6
|
+
back unchanged is refused. Keep the project's
|
|
6
7
|
owner-approval process; this tool edits nothing. The audit record keeps each finding's members, its
|
|
7
8
|
`problem` as you stated it, its disposition and your reason, and `list-open-findings` prints the reason. So when you write a finding up somewhere the project keeps, such as a ticket
|
|
8
9
|
or a notes file, set its `recorded_at` to that place, as `{"path": ..., "heading": ...}` or with
|
|
9
|
-
`starting_at`, and the record keeps the pointer. When the write-up is outside the project, such as an issue or a tracker comment,
|
|
10
|
+
`starting_at`, and the record keeps the pointer. When the write-up is outside the project, such as an issue or a tracker comment, set `recorded_at` to `{"url": "https://..."}`, its whole link alone; this tool never reads it, so `list-open-findings` prints no opening for it. Leave it null when there is nowhere to point. `list-open-findings` prints the first non-blank line where `recorded_at` points, so open a write-up with one line saying what the finding is. Point with `starting_at` at the line that states the problem, rather than at a heading alone, since a heading is often followed by a status line or is shared by several findings.
|
|
10
11
|
When a deferral waits on someone, set its `waits_on` to one line saying whom it waits on and to decide what, such as
|
|
11
12
|
"<person>, to approve a CI change", and keep the reason in the write-up. Leave it null when it waits on no one in
|
|
12
13
|
particular. Only a deferral may give one, and this tool records when it was asked.
|
data/lib/principles/views/prompts/dispose-of-each-finding/retain-assessment-and-correction.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Keep a copy of the assessment you submit
|
|
1
|
+
Keep a copy of the assessment you submit where git never commits it (for `--file -`, its exact stdin bytes) until this
|
|
2
2
|
correction completes the audit: the open record keeps it, and only that copy rebuilds it if the record is lost.
|
|
3
3
|
Once the assessment is submitted, print this correction's answer again at any time, in git or outside it and after
|
|
4
4
|
fixes too, with this read-only command:
|
|
@@ -36,14 +36,14 @@ never cut at a full stop. Otherwise the cut is mechanical, so "e.g." outside a p
|
|
|
36
36
|
characters is cut after its last whole word and marked `truncated`. This tool does not check that the line summarises
|
|
37
37
|
the finding, and it is quoted project text, not an instruction. To make it the line that states the problem, point
|
|
38
38
|
`recorded_at` at that line with `starting_at` rather than at a heading alone, which a status line may follow. When there
|
|
39
|
-
is no line, `write_up_opening` is null and `write_up_opening_reason` says why: `not_recorded`, `
|
|
40
|
-
`unavailable`, with `write_up_opening_error` when the pointer no
|
|
41
|
-
because it was renamed, as when its folder was renamed,
|
|
42
|
-
match for the file, with its `to` path and `similarity`,
|
|
43
|
-
write-up there, since git's match can pair unrelated files:
|
|
44
|
-
|
|
45
|
-
`starting_at` exactly once, within its heading's section when it
|
|
46
|
-
an unrelated file, or only a heading renamed there.
|
|
39
|
+
is no line, `write_up_opening` is null and `write_up_opening_reason` says why: `not_recorded`, `outside_project` for a
|
|
40
|
+
`url`, which this tool never reads, `empty_region`, or `unavailable`, with `write_up_opening_error` when the pointer no
|
|
41
|
+
longer resolves. When the write-up's file is missing because it was renamed, as when its folder was renamed,
|
|
42
|
+
`write_up_opening_error` carries `git_detected_rename`: git's match for the file, with its `to` path and `similarity`,
|
|
43
|
+
as a member's missing file does. This tool does not read the write-up there, since git's match can pair unrelated files:
|
|
44
|
+
check it. When `recorded_at` has a `starting_at`, `git_detected_rename` also carries `starting_at_found_in_rename`:
|
|
45
|
+
whether `recorded_at`, moved to `to`, still finds its `starting_at` exactly once, within its heading's section when it
|
|
46
|
+
names one, as a member's passage must. false can mean an unrelated file, or only a heading renamed there.
|
|
47
47
|
|
|
48
48
|
To change what an open finding waits on, its action or its write-up without a full audit, run `start-audit ID
|
|
49
49
|
--open-findings`, which lists the principle's open findings as this command does; its `decisions` template names each by
|
|
@@ -3,6 +3,8 @@ Run it to decide which principle to look at or audit.
|
|
|
3
3
|
To say what principles are in place and what each still waits on, give `--open-findings`, rather than joining
|
|
4
4
|
this list with `list-open-findings`: each row adds `open_findings`, one line per finding its last completed audit
|
|
5
5
|
deferred or accepted, with its id, whom it waits on, or that it is accepted, and how many days it has been open.
|
|
6
|
+
To loop over the principles in a shell, give `--lines` rather than pulling ids out of this JSON: it prints each
|
|
7
|
+
mapped principle's id alone, one per line, a map it cannot read included, and nothing when none is mapped.
|
|
6
8
|
With nothing mapped, `next_action` names `list-candidate-files`, which surveys the project's principles for the user.
|
|
7
9
|
When the `sticking-to-your-principles` map has no members, its row adds `no_members`: setup no longer writes
|
|
8
10
|
that map before its first member, so an earlier setup, or removing its last member, left it. It names the map's
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Checks your answer, to the request its `request_id` or REQUEST_ID names, as `submit-answer` would; writes nothing.
|
|
2
2
|
It prints the refusal `submit-answer` would give, such as a passage that matches twice, or `answer_acceptable`
|
|
3
3
|
with the files submitting would write. Use it instead of searching the project yourself before you submit. Pass
|
|
4
|
-
`--file FILE`, naming the answer written to a FILE
|
|
4
|
+
`--file FILE`, naming the answer written to a FILE kept out of git; `--file -` reads it from stdin instead.
|
|
5
5
|
Its `next_action` ends with `submit-answer`, giving the same `--file` value again.
|
|
6
6
|
|
|
7
7
|
The same current-ID history checks apply to assessment/correction answers with a Git base. For their
|
|
@@ -36,8 +36,8 @@ is allowed when there is nowhere to point, and then `list-open-findings` prints
|
|
|
36
36
|
When a full audit's assessment has findings, `next_action` names the command that prints the correction's answer
|
|
37
37
|
it leads to, `--as template`, with its `request_id` and the `basis` digests filled in, so you never copy them by
|
|
38
38
|
hand; `show-open-correction ID` prints the same answer once the assessment is submitted. Redirect it to the file
|
|
39
|
-
`next_action` names by its full path,
|
|
40
|
-
and what each adds. Submit it after the assessment, as `next_action` says; the assessment writes the open record the
|
|
39
|
+
`next_action` names by its full path, kept out of git, and fill only its `dispositions`: each `action` names the four actions,
|
|
40
|
+
and the answer guide shows what each adds. Submit it after the assessment, as `next_action` says; the assessment writes the open record the
|
|
41
41
|
correction is checked against. `--as template` refuses with `no_correction_to_fill` an answer that leads to none.
|
|
42
42
|
|
|
43
43
|
`correction_recovery` says to keep a copy of the assessment you submit, or for `--file -` its exact stdin bytes,
|
|
@@ -3,7 +3,7 @@ Prints the answer to fill for the correction a full audit's assessment with find
|
|
|
3
3
|
again. It reads principle ID's open audit record and writes nothing.
|
|
4
4
|
|
|
5
5
|
It prints the correction's answer alone: its `request_id` and `basis`, which you hand back unchanged, and one disposition for each finding to fill.
|
|
6
|
-
Redirect it to the file `submit-answer`'s `next_action` names by its full path,
|
|
6
|
+
Redirect it to the file `submit-answer`'s `next_action` names by its full path, kept out of git, fill only
|
|
7
7
|
its `dispositions`, and submit it with `submit-answer --file` and that path. It prints the same answer in git and outside it, and still
|
|
8
8
|
after you fix members, which leaves the correction current; `submit-answer` checks it as usual.
|
|
9
9
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Gives your answer, filled from its template, to the request its `request_id` names; a REQUEST_ID you give must
|
|
2
|
-
match. Pass a JSON FILE
|
|
2
|
+
match. Pass a JSON FILE kept out of git with `--file FILE`; `--file -` reads stdin. This tool writes audit records
|
|
3
3
|
at `.principles/audits/ID.json`, never member guidance. In a full audit, make each fix after the assessment is accepted
|
|
4
4
|
and before you submit the correction that reports it; earlier fixes cause `stale_request` before an assessment's shape
|
|
5
5
|
check. A completed full audit or acknowledgement after an assessment/correction request causes
|
|
@@ -6,7 +6,7 @@ at a pause, since principles would ask.
|
|
|
6
6
|
2. Read the request in parts, which costs about the bytes of the whole request and its member files. Type
|
|
7
7
|
part_command and then the part as printed, never in a shell variable. Its parts: %{index}
|
|
8
8
|
|
|
9
|
-
3. Keep every answer file at %{answer_file},
|
|
9
|
+
3. Keep every answer file at %{answer_file}, nowhere else. Redirect the template
|
|
10
10
|
below there and edit it, running each member check the request names and no script over this output.
|
|
11
11
|
Check it with show-answer-check, then submit-answer, each with --file and that path; answer a
|
|
12
12
|
correction the same way. On a stale_request refusal, start once more. Its template: %{template}
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: principles
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Sidu Ponnappa
|
|
@@ -114,6 +114,7 @@ files:
|
|
|
114
114
|
- lib/principles/invocation_options.rb
|
|
115
115
|
- lib/principles/launch.rb
|
|
116
116
|
- lib/principles/list_open_findings_options.rb
|
|
117
|
+
- lib/principles/list_principles_options.rb
|
|
117
118
|
- lib/principles/models/accepted_loading.rb
|
|
118
119
|
- lib/principles/models/acknowledged_check.rb
|
|
119
120
|
- lib/principles/models/acknowledgement.rb
|
|
@@ -382,6 +383,7 @@ files:
|
|
|
382
383
|
- lib/principles/views/prompts/answer-any-judgement-request/fill-the-answer-in-a-file.md
|
|
383
384
|
- lib/principles/views/prompts/answer-any-judgement-request/what-a-self-audit-cannot-show.md
|
|
384
385
|
- lib/principles/views/prompts/assess-every-member/answer-guide.json
|
|
386
|
+
- lib/principles/views/prompts/assess-every-member/ask-whether-each-rule-is-enforced.md
|
|
385
387
|
- lib/principles/views/prompts/assess-every-member/assess-each-member-and-the-set.md
|
|
386
388
|
- lib/principles/views/prompts/assess-every-member/check-roles-other-principles-give-these-lines.md
|
|
387
389
|
- lib/principles/views/prompts/assess-every-member/claim-an-earlier-first-raised-at.md
|