principles 0.1.1 → 0.1.2
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 +18 -0
- data/lib/principles/command_line.rb +6 -3
- data/lib/principles/controllers/inventory.rb +9 -1
- data/lib/principles/data/command-steps.json +2 -2
- 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/answer_fields.rb +21 -2
- data/lib/principles/models/disposition.rb +5 -4
- data/lib/principles/models/finding_decision.rb +2 -1
- data/lib/principles/models/finding_write_ups.rb +9 -3
- data/lib/principles/models/open_findings_decision.rb +3 -2
- 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/write_up_pointer.rb +12 -4
- data/lib/principles/version.rb +2 -2
- data/lib/principles/views/assessment_request.rb +7 -3
- data/lib/principles/views/correction_request.rb +1 -1
- data/lib/principles/views/first_audit_brief.rb +1 -0
- data/lib/principles/views/principle_read_result.rb +5 -0
- 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/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/run-a-first-audit-in-the-background/follow-the-brief.md +1 -1
- metadata +3 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 77b4ab64d6dcd922dde0d13b50a4ee3c0ad0d8bb843e127ff0108afdb1f91360
|
|
4
|
+
data.tar.gz: fc5b3d6a60b22ebcc1909f464c343cf57c7b3e807a490d301989741b804611f4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2dc4f9e61ef5d6e5f5bcbfcd3ac999b76671ee6f949428ecbfe8855e966efe248510926c703b96dc7deb6eedb776e9990f981479629b52b0380bc0ced5fec2e5
|
|
7
|
+
data.tar.gz: b57331bd5e94ceb6ea22787c41b3a611efc12e8c9c97a76b3d6ca9c40abc9573194e9bf6888813f4b9ad3fdd1972cd6f92e525b1ee0a47b9447423c1102c24ac
|
data/CHANGELOG.md
CHANGED
|
@@ -13,6 +13,24 @@ The agent's mechanics are the means, never the lead: do not open with "An agent
|
|
|
13
13
|
|
|
14
14
|
## Unreleased
|
|
15
15
|
|
|
16
|
+
## [0.1.2] - 2026-11-24
|
|
17
|
+
|
|
18
|
+
### Added
|
|
19
|
+
|
|
20
|
+
- **A full audit now asks whether each rule its principle states is enforced, and whether each enforced rule is written down.** `principles start-audit ID` asks the agent to judge from the members' roles and text whether a check, hook or CI step enforces each rule, and to raise either gap as a finding, where a map holding only statements often went unremarked. It adds about 180 bytes to each full audit's request, and members judged at the last audit still carry their assessments forward.
|
|
21
|
+
|
|
22
|
+
- **Looping over the mapped principles takes no script.** `principles list-principles --lines` prints each principle's id alone, one per line, ready for a shell loop, where an agent pulled the ids out of the JSON listing with a script of its own.
|
|
23
|
+
|
|
24
|
+
### Changed
|
|
25
|
+
|
|
26
|
+
- **A release needs its publisher only to type the RubyGems one-time code.** `bundle exec rake release:prepare` does everything slow: the gate, the tag, the public copy, and the gem built and checked. Then `bundle exec rake release:publish OTP=<code>` uploads the gem the moment the code arrives. After that it pushes, publishes the plugin through a merged pull request and commits the next patch, where nine closing commands were once run by hand. A stopped step resumes on a rerun, and a refused or expired code uploads nothing. **Breaking:** `RELEASE=1 bundle exec rake release` no longer publishes; `bundle exec rake release` is the dry run.
|
|
27
|
+
|
|
28
|
+
### Fixed
|
|
29
|
+
|
|
30
|
+
- **A finding written up in an issue is pointed at by its link, with no stub file in the project.** A deferral's `recorded_at` in `principles submit-answer`, from a correction, a full audit's kept finding or `start-audit ID --open-findings`, now takes `{"url": "https://..."}`, where a link was refused. A link that is not a whole https one is refused with how to give one. `principles list-open-findings` reads nothing at the link, and never reports it lost. A record holding a link can be read only by this release or later: an older copy refuses it as newer, so leave it as it is.
|
|
31
|
+
- **A deferred, accepted or disagreed finding is no longer refused for a reassessment its template invited.** The correction's answer, as `principles show-open-correction` prints it, now leaves each `reassessment` null, which only a fix replaces, where it printed a sentence that any other action had to send back word for word.
|
|
32
|
+
- **A first audit run in the background knows where its answer file may not go, even in a worktree inside the repository's own folders.** The brief that `principles show-first-audit-brief ID` prints now names the project's root as the place no answer file may go, where it said only "never in the project".
|
|
33
|
+
|
|
16
34
|
## [0.1.1] - 2026-11-24
|
|
17
35
|
|
|
18
36
|
### Changed
|
|
@@ -6,6 +6,7 @@ require_relative "invocation_options"
|
|
|
6
6
|
require_relative "after_commit_hook_options"
|
|
7
7
|
require_relative "session_start_options"
|
|
8
8
|
require_relative "list_open_findings_options"
|
|
9
|
+
require_relative "list_principles_options"
|
|
9
10
|
require_relative "start_audit_options"
|
|
10
11
|
require_relative "models/command_steps"
|
|
11
12
|
require_relative "prose_list"
|
|
@@ -160,13 +161,15 @@ module Principles
|
|
|
160
161
|
end
|
|
161
162
|
|
|
162
163
|
# Options checked together, each set owning what is wrong with it as given: --session-start, the
|
|
163
|
-
# after-commit hook's pair on the command it runs, the audit start-audit begins and the
|
|
164
|
-
# list-open-findings
|
|
164
|
+
# after-commit hook's pair on the command it runs, the audit start-audit begins and the forms
|
|
165
|
+
# list-open-findings and list-principles print; the first fault is refused.
|
|
165
166
|
#: (String) -> void
|
|
166
167
|
def check_combined_options(name)
|
|
167
168
|
hook = (AfterCommitHookOptions.new(@options) if name == AfterCommitHookOptions::COMMAND)
|
|
169
|
+
principles = (ListPrinciplesOptions.new(@options) if name == ListPrinciplesOptions::COMMAND)
|
|
168
170
|
start_audit = StartAuditOptions.new(@options, several_ids: several_ids?(name))
|
|
169
|
-
sets = [SessionStartOptions.new(@options), hook, start_audit, ListOpenFindingsOptions.new(@options)
|
|
171
|
+
sets = [SessionStartOptions.new(@options), hook, start_audit, ListOpenFindingsOptions.new(@options),
|
|
172
|
+
principles].compact
|
|
170
173
|
fault = sets.filter_map(&:fault).first or return
|
|
171
174
|
raise UsageRefusal.new(fault, help_repair(name))
|
|
172
175
|
end
|
|
@@ -17,7 +17,7 @@ module Principles
|
|
|
17
17
|
def call(command, id, options)
|
|
18
18
|
naming_the_executable do
|
|
19
19
|
case command
|
|
20
|
-
when "list-principles" then
|
|
20
|
+
when "list-principles" then listed(options)
|
|
21
21
|
when "show-principle" then members(required_id(id)).merge("wrote" => [])
|
|
22
22
|
else unknown(command)
|
|
23
23
|
end
|
|
@@ -98,6 +98,14 @@ module Principles
|
|
|
98
98
|
Views::PrincipleReadResult.new(invocation)
|
|
99
99
|
end
|
|
100
100
|
|
|
101
|
+
# list-principles as options ask: each id on a line with --lines, else the rows as JSON.
|
|
102
|
+
#: (Hash[String, untyped]) -> untyped
|
|
103
|
+
def listed(options)
|
|
104
|
+
return read_result.ids(@principles.ids) if options["lines"]
|
|
105
|
+
|
|
106
|
+
listing(open_findings: options["open_findings"]).merge("wrote" => [])
|
|
107
|
+
end
|
|
108
|
+
|
|
101
109
|
# Its next_action offers an audit while one principle's audits do not wait on an upgrade; a map listed with its
|
|
102
110
|
# refusal counts, since repairing it leaves it to audit. With open_findings, each row lists its open findings.
|
|
103
111
|
#: (open_findings: bool?) -> untyped
|
|
@@ -60,12 +60,12 @@
|
|
|
60
60
|
]
|
|
61
61
|
},
|
|
62
62
|
{
|
|
63
|
-
"name": "list-principles", "usage": "list-principles [--open-findings]", "group": "read", "options": ["open-findings"],
|
|
63
|
+
"name": "list-principles", "usage": "list-principles [--open-findings | --lines]", "group": "read", "options": ["open-findings", "lines"],
|
|
64
64
|
"summary": "Every mapped principle and whether its members are current.",
|
|
65
65
|
"help": "learn-what-a-command-does/list-principles",
|
|
66
66
|
"steps": [
|
|
67
67
|
{ "id": "count-members-by-freshness", "actor": "cli",
|
|
68
|
-
"does": "Reads every map and the audit record of each, and counts its members as current, changed, unassessed, locator_lost or unavailable. With --open-findings, adds each principle's open findings, one line each, saying whom it waits on, or that it is accepted, and how many days it has been open.",
|
|
68
|
+
"does": "Reads every map and the audit record of each, and counts its members as current, changed, unassessed, locator_lost or unavailable. With --open-findings, adds each principle's open findings, one line each, saying whom it waits on, or that it is accepted, and how many days it has been open. With --lines, prints each principle's id alone, one per line, and reads no map.",
|
|
69
69
|
"refuses_like": ["read-map", "read-audit"] }
|
|
70
70
|
]
|
|
71
71
|
},
|
|
@@ -12,7 +12,7 @@ module Principles
|
|
|
12
12
|
class RunningVersion
|
|
13
13
|
# git archive writes the short sha of the commit it archives here, since .gitattributes marks this file
|
|
14
14
|
# export-subst; a checkout keeps the placeholder as written.
|
|
15
|
-
ARCHIVED_COMMIT = "
|
|
15
|
+
ARCHIVED_COMMIT = "f91461e6" #: String
|
|
16
16
|
|
|
17
17
|
#: (?String, release: String, ?built: String?, ?archived_commit: String) -> void
|
|
18
18
|
def initialize(checkout = File.expand_path("../../..", __dir__), release:, built: nil,
|
|
@@ -253,18 +253,15 @@
|
|
|
253
253
|
},
|
|
254
254
|
"recorded_at": {
|
|
255
255
|
"x-type-refusal-advice": {
|
|
256
|
-
"keys": [
|
|
257
|
-
|
|
258
|
-
"starting_at"
|
|
259
|
-
],
|
|
260
|
-
"says": "plus starting_at (or heading) when the file holds more than this finding"
|
|
256
|
+
"keys": ["path", "url", "heading", "starting_at", "ending_at", "query"],
|
|
257
|
+
"says": "with path, plus starting_at (or heading) when the file holds more than this finding, or with url alone, a whole https link, for a write-up outside the project such as an issue"
|
|
261
258
|
},
|
|
262
259
|
"type": ["object", "null", "string"],
|
|
263
260
|
"description": "On a still_holds decision, a new pointer to the write-up, or null for none. A string is the template's placeholder, left as printed.",
|
|
264
|
-
"required": ["path"],
|
|
265
261
|
"additionalProperties": false,
|
|
266
262
|
"properties": {
|
|
267
263
|
"path": { "type": "string" },
|
|
264
|
+
"url": { "type": "string" },
|
|
268
265
|
"heading": { "type": "string" },
|
|
269
266
|
"starting_at": { "type": "string" },
|
|
270
267
|
"ending_at": { "type": "string" },
|
|
@@ -268,9 +268,10 @@
|
|
|
268
268
|
"waits_on_since": { "type": "string", "minLength": 1, "description": "When an earlier audit asked waits_on, carried since. Absent means this record's audited_at; only principles writes it." },
|
|
269
269
|
"recorded_at": {
|
|
270
270
|
"type": "object",
|
|
271
|
-
"
|
|
271
|
+
"description": "A file in the project, by path and optionally a place inside it, or a write-up outside the project by url alone.",
|
|
272
272
|
"properties": {
|
|
273
273
|
"path": { "type": "string", "minLength": 1 },
|
|
274
|
+
"url": { "type": "string", "minLength": 1 },
|
|
274
275
|
"heading": { "type": "string" },
|
|
275
276
|
"starting_at": { "type": "string" },
|
|
276
277
|
"ending_at": { "type": "string" },
|
|
@@ -181,23 +181,27 @@
|
|
|
181
181
|
"recorded_at": {
|
|
182
182
|
"x-type-refusal-advice": {
|
|
183
183
|
"keys": [
|
|
184
|
+
"path",
|
|
185
|
+
"url",
|
|
184
186
|
"heading",
|
|
185
|
-
"starting_at"
|
|
187
|
+
"starting_at",
|
|
188
|
+
"ending_at",
|
|
189
|
+
"query"
|
|
186
190
|
],
|
|
187
|
-
"says": "plus starting_at (or heading) when the file holds more than this finding"
|
|
191
|
+
"says": "with path, plus starting_at (or heading) when the file holds more than this finding, or with url alone, a whole https link, for a write-up outside the project such as an issue"
|
|
188
192
|
},
|
|
189
193
|
"type": [
|
|
190
194
|
"object",
|
|
191
195
|
"null"
|
|
192
196
|
],
|
|
193
|
-
"required": [
|
|
194
|
-
"path"
|
|
195
|
-
],
|
|
196
197
|
"additionalProperties": false,
|
|
197
198
|
"properties": {
|
|
198
199
|
"path": {
|
|
199
200
|
"type": "string"
|
|
200
201
|
},
|
|
202
|
+
"url": {
|
|
203
|
+
"type": "string"
|
|
204
|
+
},
|
|
201
205
|
"heading": {
|
|
202
206
|
"type": "string"
|
|
203
207
|
},
|
|
@@ -231,7 +235,8 @@
|
|
|
231
235
|
}
|
|
232
236
|
},
|
|
233
237
|
"reassessment": {
|
|
234
|
-
"type": "string"
|
|
238
|
+
"type": ["string", "null"],
|
|
239
|
+
"description": "How a fix's changed members now carry the principle: the template prints null, which any other action keeps or omits, and Models::Disposition refuses on a fix."
|
|
235
240
|
},
|
|
236
241
|
"waits_on": {
|
|
237
242
|
"type": ["string", "null"],
|
|
@@ -31,11 +31,15 @@
|
|
|
31
31
|
"action": { "type": "string" },
|
|
32
32
|
"waits_on": { "type": ["string", "null"] },
|
|
33
33
|
"recorded_at": {
|
|
34
|
+
"x-type-refusal-advice": {
|
|
35
|
+
"keys": ["path", "url", "heading", "starting_at", "ending_at", "query"],
|
|
36
|
+
"says": "with path, plus starting_at (or heading) when the file holds more than this finding, or with url alone, a whole https link, for a write-up outside the project such as an issue"
|
|
37
|
+
},
|
|
34
38
|
"type": ["object", "null"],
|
|
35
|
-
"required": ["path"],
|
|
36
39
|
"additionalProperties": false,
|
|
37
40
|
"properties": {
|
|
38
41
|
"path": { "type": "string" },
|
|
42
|
+
"url": { "type": "string" },
|
|
39
43
|
"heading": { "type": "string" },
|
|
40
44
|
"starting_at": { "type": "string" },
|
|
41
45
|
"ending_at": { "type": "string" },
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# typed: strict
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
require_relative "invocation_options"
|
|
5
|
+
|
|
6
|
+
module Principles
|
|
7
|
+
# The options choosing what list-principles prints, --lines or --open-findings, and what is wrong with them as
|
|
8
|
+
# given, which CommandLine refuses as a usage error.
|
|
9
|
+
class ListPrinciplesOptions
|
|
10
|
+
COMMAND = "list-principles"
|
|
11
|
+
|
|
12
|
+
#: (InvocationOptions) -> void
|
|
13
|
+
def initialize(options)
|
|
14
|
+
@lines = !options.value("lines").nil? #: bool
|
|
15
|
+
@open_findings = !options.value("open_findings").nil? #: bool
|
|
16
|
+
freeze
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
# What is wrong with the options as given, or nil when they fit: --lines prints ids alone, so it would drop the
|
|
20
|
+
# open findings asked for without a word.
|
|
21
|
+
#: () -> String?
|
|
22
|
+
def fault
|
|
23
|
+
return unless @lines && @open_findings
|
|
24
|
+
|
|
25
|
+
"--lines prints only each principle's id, so it shows no open findings; give one of --lines and --open-findings"
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -13,6 +13,12 @@ module Principles
|
|
|
13
13
|
# The checks every answer's fields share: a field is a nonempty string or an array, and each piece of
|
|
14
14
|
# evidence names a path that the caller's block locates in the project.
|
|
15
15
|
class AnswerFields
|
|
16
|
+
# A whole https link: a host, then anything but whitespace.
|
|
17
|
+
LINK = %r{\Ahttps://[^\s/?#]+\S*\z}
|
|
18
|
+
LINK_REPAIR = "Give recorded_at as {\"url\": \"https://...\"}, the whole link to where it is written up, " \
|
|
19
|
+
"such as an issue, with no other field; or as {\"path\": ..., \"heading\": ...} for a file in " \
|
|
20
|
+
"the project."
|
|
21
|
+
|
|
16
22
|
#: (^(Locator) -> void) -> void
|
|
17
23
|
def initialize(locate)
|
|
18
24
|
@locate = locate
|
|
@@ -56,12 +62,25 @@ module Principles
|
|
|
56
62
|
end
|
|
57
63
|
end
|
|
58
64
|
|
|
59
|
-
# Where a finding is written up, located at its place in the answer, as the value its record keeps
|
|
65
|
+
# Where a finding is written up, located at its place in the answer, as the value its record keeps: a place in a
|
|
66
|
+
# project file, or a link outside the project, which is checked as a link and read nowhere.
|
|
60
67
|
#: (untyped, AnswerPlace) -> WriteUpPointer
|
|
61
68
|
def write_up_pointer(reference, place)
|
|
62
|
-
pointer(reference, place)
|
|
69
|
+
reference.key?("url") ? link(reference, place.child("url")) : pointer(reference, place)
|
|
63
70
|
WriteUpPointer.new(reference)
|
|
64
71
|
end
|
|
72
|
+
|
|
73
|
+
private
|
|
74
|
+
|
|
75
|
+
# A write-up's url: a whole https link with a host and no space, given alone.
|
|
76
|
+
#: (Hash[String, untyped], AnswerPlace) -> void
|
|
77
|
+
def link(reference, place)
|
|
78
|
+
url = reference["url"]
|
|
79
|
+
return if reference.size == 1 && url.is_a?(String) && url.match?(LINK)
|
|
80
|
+
|
|
81
|
+
raise place.refusal(Error.new("invalid_answer", "recorded_at's url must be a whole https link, given alone",
|
|
82
|
+
LINK_REPAIR))
|
|
83
|
+
end
|
|
65
84
|
end
|
|
66
85
|
end
|
|
67
86
|
end
|
|
@@ -51,9 +51,9 @@ module Principles
|
|
|
51
51
|
#: () -> Array[String]
|
|
52
52
|
def changed_members = @disposition.fetch("changed_members", [])
|
|
53
53
|
|
|
54
|
-
# The file where the finding is written up, if anywhere.
|
|
54
|
+
# The project file where the finding is written up, if anywhere; none for a write-up at a url.
|
|
55
55
|
#: () -> String?
|
|
56
|
-
def recorded_path = recorded_at&.
|
|
56
|
+
def recorded_path = recorded_at&.file
|
|
57
57
|
|
|
58
58
|
# What the audit record keeps of this disposition beside its finding: the action, and why a finding left
|
|
59
59
|
# unfixed was left so, which a fix's reassessment answers instead; where the finding is written up and
|
|
@@ -154,12 +154,13 @@ module Principles
|
|
|
154
154
|
left_reassessment: DispositionPlaceholders::TEXT_FIELDS.fetch("reassessment").placeholder)
|
|
155
155
|
end
|
|
156
156
|
|
|
157
|
-
# Each piece of evidence, and where the finding is written up,
|
|
157
|
+
# Each piece of evidence located in the project, and where the finding is written up, there or at a link.
|
|
158
158
|
#: () -> void
|
|
159
159
|
def locate_pointers
|
|
160
160
|
fix_fields.check_removal_evidence if fixed?
|
|
161
161
|
@fields.evidence(fix_fields.list("evidence"), @place.child("evidence"))
|
|
162
|
-
|
|
162
|
+
recorded_at = @disposition["recorded_at"]
|
|
163
|
+
@fields.write_up_pointer(recorded_at, @place.child("recorded_at")) if recorded_at
|
|
163
164
|
end
|
|
164
165
|
|
|
165
166
|
# A deferral must say where it is written up, or null, so an answer reused from before recorded_at existed
|
|
@@ -25,7 +25,8 @@ module Principles
|
|
|
25
25
|
"waits_on" => "One line, on a deferred finding only: whom it now waits on and to decide what. Or null, " \
|
|
26
26
|
"even on a deferred finding, to drop it.",
|
|
27
27
|
"action" => "deferred or accepted, as when the owner rules; its reason becomes the finding's own.",
|
|
28
|
-
"recorded_at" => "Where its write-up is now, in a committed file: {\"path\": ..., \"heading\": ...}
|
|
28
|
+
"recorded_at" => "Where its write-up is now, in a committed file: {\"path\": ..., \"heading\": ...}; outside " \
|
|
29
|
+
"the project, such as an issue: {\"url\": \"https://...\"}; or null.",
|
|
29
30
|
"reason" => "One line saying why, required with any change. A field left out keeps its value; " \
|
|
30
31
|
"decision_fields may be kept or deleted."
|
|
31
32
|
}.freeze #: Hash[String, String]
|
|
@@ -62,8 +62,14 @@ module Principles
|
|
|
62
62
|
|
|
63
63
|
# pointer's write_up_opening, or null with the reason: not_recorded, empty_region, or unavailable with the
|
|
64
64
|
# refusal, so one pointer that no longer resolves never refuses the whole list.
|
|
65
|
+
# A url's is null as outside_project, since this tool reads nothing outside the project.
|
|
65
66
|
#: (WriteUpPointer?) -> Hash[String, untyped]
|
|
66
|
-
def opening_fields(pointer)
|
|
67
|
+
def opening_fields(pointer)
|
|
68
|
+
return none("not_recorded") unless pointer
|
|
69
|
+
return none("outside_project") if pointer.url
|
|
70
|
+
|
|
71
|
+
opening_found(pointer)
|
|
72
|
+
end
|
|
67
73
|
|
|
68
74
|
# The write_up_opening pointer leads to, or null with why: empty_region, or unavailable with the refusal.
|
|
69
75
|
#: (WriteUpPointer) -> Hash[String, untyped]
|
|
@@ -74,10 +80,10 @@ module Principles
|
|
|
74
80
|
none("unavailable").merge("write_up_opening_error" => unavailable(e.payload, pointer))
|
|
75
81
|
end
|
|
76
82
|
|
|
77
|
-
# Whether a recorded pointer no longer resolves in the project's file now.
|
|
83
|
+
# Whether a recorded pointer no longer resolves in the project's file now; a url names no file here to lose.
|
|
78
84
|
#: (WriteUpPointer?) -> bool
|
|
79
85
|
def unresolved?(pointer)
|
|
80
|
-
return false
|
|
86
|
+
return false if pointer.nil? || pointer.url
|
|
81
87
|
|
|
82
88
|
pointer.opening_in(@project)
|
|
83
89
|
false
|
|
@@ -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
|
|
@@ -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
|
|
@@ -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.2"
|
|
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.2" #: String?
|
|
11
11
|
end
|
|
@@ -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
|
|
|
@@ -27,6 +27,7 @@ module Principles
|
|
|
27
27
|
{ "principle" => id,
|
|
28
28
|
"brief" => Prompts.text("run-a-first-audit-in-the-background/follow-the-brief",
|
|
29
29
|
id: id, answer_file: ShellWord.new(@invocation.answer_file(id)).to_s,
|
|
30
|
+
project_root: @invocation.project,
|
|
30
31
|
index: @invocation.in_project("start-audit", id, options: ["--part", "index"]),
|
|
31
32
|
template: @invocation.in_project("start-audit", id, options: ["--as", "template"])),
|
|
32
33
|
"wrote" => [] }
|
|
@@ -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]]
|
|
@@ -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.
|
|
@@ -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
|
|
@@ -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}, never
|
|
9
|
+
3. Keep every answer file at %{answer_file}, never under %{project_root}. 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.2
|
|
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
|