featureparity 0.0.37 → 0.0.38

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6d6fb30ab7c332dcae4d9e8596eedc79f39703a9e1b27b7bfbd350a8577fb04f
4
- data.tar.gz: 899c9e95e30f1a0bbf4ee0ad4ae51f2f220f3bf7fac4224c0a00abaf118c00ad
3
+ metadata.gz: 2a92e0896218a93cbad1f24f42c2354ed86b58e2bbbd4dc3a68c9f43e7804642
4
+ data.tar.gz: a19eb9b79bbe79229d66ccabcd2193df3c808d536b0df3cb81f26be822b11568
5
5
  SHA512:
6
- metadata.gz: 570b953fad5c9c12936f1903d9ebdbe04ce21c76a43a6230834471fe8bb7362a2ccc95d02927692a42a0692485d0a6216ceba746df4cc4950401d1c1f057a9b0
7
- data.tar.gz: e9caaa1068766f560d7615630ae575fb84ab39de61fa11979c29a5ab2c501f4d30b5e73bc64d269b8284ee3fb562aefb45218653c42d21297577500edd6548bf
6
+ metadata.gz: 4ea52af325a0b3a848c6527cd99aad3a547428e792c93b682c75a1a86e856e94dd5f384038748415099f5ff0c0395d7f327941fa610b07684fb16d79aabc6b7b
7
+ data.tar.gz: 663ec3b222bf6326205a58caf16a33a8bf42026caffb5638ba2d5406bf780170485c650ccbb115bb08f0a1c1f5bfa02d76fbc8b970795f1043243e89fec37279
@@ -25,7 +25,7 @@ module Fp
25
25
  help_usage 'fp coverage [--project <slug>] [--surface X] [--all]'
26
26
  help_flag :project, 'Project slug (falls back to .featureparity.yml)'
27
27
  help_flag :surface, 'Limit to one surface'
28
- help_flag :all, 'Also list the measured requirements (active, or under review) the gate checks'
28
+ help_flag :all, 'Also list the measured requirements (active, or awaiting review) the gate checks'
29
29
  help_example 'fp coverage', 'Drafts × surfaces, then the drafts with no evidence'
30
30
  help_example 'fp coverage --all --json'
31
31
  help_note "Drafts are not enforced: a human activates a draft before fp check gates on it.\n" \
@@ -91,13 +91,27 @@ module Fp
91
91
  by_surface = Array(row['cells']).to_h { |c| [c['surface'], c['state']] }
92
92
  cells = surfaces.map { |key| by_surface.key?(key) ? Parity.glyph(by_surface[key]) : Parity::NOT_REQUIRED }
93
93
  line = [row['slug']]
94
- line << row['status'] if show_status
94
+ line << Parity.status_label(row) if show_status
95
95
  line + cells
96
96
  end
97
97
  output.table(headers, table)
98
98
  puts Parity::LEGEND
99
99
  end
100
100
 
101
+ # A requirement awaiting review of a proposed change is stored as a draft but is
102
+ # measured by the gate, so it is not in the drafts table. Say so by name: "No draft
103
+ # requirements" beside an `fp show` that says draft read as a lost requirement
104
+ # (Fizzy #2043).
105
+ def self.print_awaiting_review(pending)
106
+ pending = Array(pending)
107
+ return if pending.empty?
108
+
109
+ puts
110
+ puts "#{pending.size} requirement(s) #{Parity::UNDER_REVIEW_LABEL} of a proposed change " \
111
+ 'are not drafts. The gate still measures them (fp matrix, or fp coverage --all):'
112
+ pending.each { |p| puts " #{p['slug']} — #{p['kind']} proposed" }
113
+ end
114
+
101
115
  def self.print_untested(untested)
102
116
  puts
103
117
  if untested.empty?
@@ -124,6 +138,7 @@ module Fp
124
138
  'untested' => untested
125
139
  }
126
140
  payload['measured'] = report['requirements'] || [] if all
141
+ payload['awaiting_review'] = report['pending_reviews'] || []
127
142
 
128
143
  output.success(payload) do
129
144
  scope = surface ? " (surface: #{surface})" : ''
@@ -144,6 +159,7 @@ module Fp
144
159
 
145
160
  self.class.print_drafts(output, drafts, surfaces)
146
161
  self.class.print_untested(untested) unless drafts.empty?
162
+ self.class.print_awaiting_review(report['pending_reviews']) unless all
147
163
  puts
148
164
  puts 'Drafts are reported, never gated. A human activates a draft before fp check enforces it.'
149
165
  end
@@ -11,7 +11,7 @@ module Fp
11
11
  help_flag :surface, 'Only requirements that name this surface'
12
12
  help_flag :category, 'Filter by category'
13
13
  help_flag :tag, 'Filter by a free-form tag'
14
- help_flag :status, 'Filter by status: active (default), draft, archived'
14
+ help_flag :status, 'Filter by status: active (default, with those awaiting review), draft, archived'
15
15
  help_flag :gaps, 'Show only requirements with an uncovered required surface (reads evidence)'
16
16
  help_example 'fp list --project acme'
17
17
  help_example 'fp list --project acme --status draft', 'Drafts are hidden by default'
@@ -59,9 +59,21 @@ module Fp
59
59
  requirements = result[:data]['requirements'] || []
60
60
  all = requirements
61
61
 
62
- # Filter by status (default: active only)
62
+ # A requirement awaiting review of a proposed change is stored as a draft, but it
63
+ # is still enforced by the gate and is nobody's unapproved draft. It is listed
64
+ # with the active requirements, under the same name fp show, fp matrix and fp
65
+ # coverage give it, and left out of --status draft (Fizzy #2043). Before, the
66
+ # default listing said "No requirements found (active)" and then named it in a
67
+ # footnote.
68
+ awaiting = all.select { |r| Parity.under_review?(r) }
63
69
  status_filter = opts[:status] || 'active'
64
- requirements = requirements.select { |r| r['status'] == status_filter }
70
+ requirements = requirements.select do |r|
71
+ if Parity.under_review?(r)
72
+ status_filter == 'active'
73
+ else
74
+ r['status'] == status_filter
75
+ end
76
+ end
65
77
 
66
78
  # Filter by surface if specified
67
79
  if opts[:surface]
@@ -70,12 +82,9 @@ module Fp
70
82
  end
71
83
  end
72
84
 
73
- # Requirements a proposed change knocked back to draft. The default `--status
74
- # active` filter hides them, which would make an active requirement appear to
75
- # vanish the moment an agent proposed a change to it — so they get named below
76
- # even when the filter excluded them. They still count toward the gate.
77
- awaiting = all.select { |r| r['pending_change_kind'].to_s != '' }
78
- hidden_awaiting = awaiting.reject { |r| requirements.include?(r) }
85
+ listed_awaiting = requirements.select { |r| Parity.under_review?(r) }
86
+ requirements = requirements.map { |r| r.merge('under_review' => Parity.under_review?(r)) }
87
+ awaiting = awaiting.map { |r| r.merge('under_review' => true) }
79
88
 
80
89
  output.success({ requirements: requirements, project: opts[:project],
81
90
  awaiting_review: awaiting }) do
@@ -125,26 +134,26 @@ module Fp
125
134
  output.table(headers, rows)
126
135
  end
127
136
 
128
- print_awaiting_review(hidden_awaiting)
137
+ print_awaiting_review(listed_awaiting, awaiting, status_filter)
129
138
  end
130
139
  end
131
140
 
132
- # "draft" alone doesn't distinguish "never approved" from "was approved, someone
133
- # proposed a change". The pointer on the requirement does, so use it.
134
141
  def status_cell(requirement)
135
- kind = requirement['pending_change_kind'].to_s
136
- return requirement['status'] if kind.empty?
137
-
138
- "#{requirement['status']} (#{kind} proposed)"
142
+ Parity.status_label(requirement)
139
143
  end
140
144
 
141
- def print_awaiting_review(hidden)
142
- return if hidden.empty?
143
-
144
- puts
145
- puts "#{hidden.size} requirement(s) not listed above are awaiting review of a proposed change:"
146
- hidden.each { |r| puts " #{r['slug']} — #{r['pending_change_kind']} proposed (fp history #{r['slug']})" }
147
- puts 'They are still enforced by the gate. A human must approve or reject the change.'
145
+ def print_awaiting_review(listed, awaiting, status_filter)
146
+ if listed.any?
147
+ puts
148
+ puts "#{listed.size} requirement(s) #{Parity::UNDER_REVIEW_LABEL} of a proposed change. " \
149
+ 'They are still enforced by the gate until a human approves or rejects the ' \
150
+ 'change: fp history <slug>'
151
+ elsif status_filter == 'draft' && awaiting.any?
152
+ # Say where they went, or a requirement someone proposed a change to looks lost.
153
+ puts
154
+ puts "#{awaiting.size} requirement(s) #{Parity::UNDER_REVIEW_LABEL} of a proposed change " \
155
+ 'are not drafts: they are listed with the active requirements (fp list).'
156
+ end
148
157
  end
149
158
 
150
159
  # Gaps: active requirements with at least one required surface that has no real
@@ -287,7 +296,7 @@ module Fp
287
296
 
288
297
  if gaps.any? { |gap| gap['under_review'] }
289
298
  puts
290
- puts "#{Parity::UNDER_REVIEW} #{Parity::UNDER_REVIEW_LEGEND} — check `fp history <slug>` before writing a test against wording that may be about to move."
299
+ puts "#{Parity::UNDER_REVIEW_LEGEND} — check `fp history <slug>` before writing a test against wording that may be about to move."
291
300
  end
292
301
 
293
302
  if drafts
@@ -96,7 +96,7 @@ module Fp
96
96
  def slug_cell(requirement, glyphs: true)
97
97
  return requirement['slug'] unless Parity.row_marker(requirement)
98
98
 
99
- glyphs ? "#{requirement['slug']} #{Parity::UNDER_REVIEW}" : "#{requirement['slug']} (under review)"
99
+ glyphs ? "#{requirement['slug']} #{Parity::UNDER_REVIEW}" : "#{requirement['slug']} (#{Parity::UNDER_REVIEW_LABEL})"
100
100
  end
101
101
 
102
102
  def render_table(report, project_slug, headers, rows)
@@ -116,7 +116,7 @@ module Fp
116
116
  puts counts.join(' ') unless counts.empty?
117
117
 
118
118
  unless pending.empty?
119
- puts "#{pending.size} awaiting review (#{Parity.pending_summary(pending)}) — fp history <slug>"
119
+ puts "#{pending.size} #{Parity::UNDER_REVIEW_LABEL} (#{Parity.pending_summary(pending)}) — fp history <slug>"
120
120
  end
121
121
 
122
122
  # The matrix is a report, not a gate — but say which way the gate would go, so
@@ -118,7 +118,10 @@ module Fp
118
118
  puts "=" * req['title'].length
119
119
  puts
120
120
  puts "Slug: #{req['slug']}"
121
- puts "Status: #{req['status']}"
121
+ puts "Status: #{Parity.status_label(req)}"
122
+ if Parity.under_review?(req)
123
+ puts " Still enforced by the gate until a human decides: fp history #{req['slug']}"
124
+ end
122
125
  puts "Category: #{req['category'] || '(none)'}"
123
126
  tags = req['tags'] || []
124
127
  puts "Tags: #{tags.empty? ? '(none)' : tags.join(', ')}"
data/lib/fp/parity.rb CHANGED
@@ -38,6 +38,12 @@ module Fp
38
38
  # but the wording just moved under the tests".
39
39
  UNDER_REVIEW = '✎'
40
40
 
41
+ # The one name for that requirement, used by every command that shows a status
42
+ # (fp show, fp list, fp coverage, fp matrix, fp check). Its stored status is `draft`,
43
+ # but printing "draft" in one command and a pencil in another read as four different
44
+ # things (Fizzy #2043).
45
+ UNDER_REVIEW_LABEL = 'awaiting review'
46
+
41
47
  # Fallback for a state this gem version doesn't know about.
42
48
  UNKNOWN_GLYPH = '?'
43
49
 
@@ -58,6 +64,28 @@ module Fp
58
64
  UNDER_REVIEW if row['under_review'] || row[:under_review]
59
65
  end
60
66
 
67
+ # Is this requirement (a row from the requirements listing or the parity report)
68
+ # awaiting review of a proposed change — a draft an open proposal demoted from
69
+ # active, which the gate still measures? The server says so in `under_review`. An
70
+ # API that predates the field only gives the pointer, which can't tell a
71
+ # never-approved draft with a proposal from an approved one; read it as under review,
72
+ # the way the gate does when it can't tell.
73
+ def self.under_review?(requirement)
74
+ flag = requirement['under_review']
75
+ return flag ? true : false unless flag.nil?
76
+
77
+ requirement['status'] == 'draft' && !requirement['pending_change_kind'].to_s.empty?
78
+ end
79
+
80
+ # What a status column prints for a requirement: its status, except that one awaiting
81
+ # review is called that, and a proposal against it is named either way.
82
+ # active | draft | draft (removal proposed) | awaiting review (modification proposed)
83
+ def self.status_label(requirement)
84
+ status = under_review?(requirement) ? UNDER_REVIEW_LABEL : requirement['status'].to_s
85
+ kind = requirement['pending_change_kind'].to_s
86
+ kind.empty? ? status : "#{status} (#{kind} proposed)"
87
+ end
88
+
61
89
  # "2 modifications, 1 deletion" for a pending_reviews list.
62
90
  def self.pending_summary(pending_reviews)
63
91
  kinds = Array(pending_reviews).map { |p| p['kind'] || p[:kind] }
data/lib/fp/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Fp
4
- VERSION = '0.0.37'
4
+ VERSION = '0.0.38'
5
5
  end
@@ -762,7 +762,7 @@ fp matrix --project acme --surface api
762
762
 
763
763
  A slug suffixed with `✎` has a proposed change awaiting review — it is still measured by
764
764
  the gate, and its evidence is `suspect` until someone reviews the change. `--csv` writes
765
- `<slug> (under review)` instead of the glyph.
765
+ `<slug> (awaiting review)` instead of the glyph.
766
766
 
767
767
  `--status draft --gaps` lists *drafts* with a required surface lacking real evidence
768
768
  (missing, stubbed, or failing). Plain `--gaps` reads the gate, which never measures a
@@ -780,7 +780,7 @@ human activates anything.
780
780
  ```bash
781
781
  fp coverage # drafts × surfaces, then the drafts with no evidence
782
782
  fp coverage --surface api
783
- fp coverage --all # also the measured (active / under review) rows
783
+ fp coverage --all # also the measured (active / awaiting review) rows
784
784
  fp coverage --json # drafts, untested, and with --all, measured
785
785
  ```
786
786
 
@@ -842,7 +842,8 @@ the test broke.
842
842
  **Requirements awaiting review still count.** `fp propose-change` demotes a requirement to
843
843
  `draft`, but the gate keeps measuring it — otherwise proposing a change would be a way to
844
844
  turn a red gate green. Coverage is still demanded; only evidence freshness relaxes, because
845
- proposing marks the evidence `suspect`. `fp check` lists them separately from violations:
845
+ proposing marks the evidence `suspect` (a test that was already `failing` or `stub` stays
846
+ that way and keeps violating). `fp check` lists them separately from violations:
846
847
 
847
848
  ```
848
849
  1 requirement(s) awaiting review of a proposed change (1 modification):
@@ -851,8 +852,17 @@ proposing marks the evidence `suspect`. `fp check` lists them separately from vi
851
852
  These still count toward the gate — proposing a change is not a way out of it.
852
853
  ```
853
854
 
854
- `fp matrix` marks the same rows with `✎`, and `fp list` names them even when the default
855
- `--status active` filter would otherwise hide them.
855
+ Every command calls such a requirement **awaiting review**. `fp matrix` and `fp list
856
+ --gaps` mark its row with `✎`, `fp show` prints `Status: awaiting review (modification
857
+ proposed)`, `fp list` shows it with that status among the active requirements (it is left
858
+ out of `--status draft`), and `fp coverage` names it under the drafts table, since the
859
+ gate measures it and it is not a draft. A never-approved draft that someone proposed a
860
+ change to stays `draft (modification proposed)`. In `--json` the stored `status` is still
861
+ `draft`; read `under_review`.
862
+
863
+ Surfaces are listed in the showroom's order everywhere (`fp matrix` and `fp coverage`
864
+ columns, `fp surfaces`): the ones the team placed first, then the rest alphabetically by
865
+ name. Change it with `fp surfaces edit <key> --showroom-position N`.
856
866
 
857
867
  **Preview mode (`--junit`).** Without it, `fp check` sees only what has been recorded —
858
868
  on a pull request, that's the default branch's state, not what the branch changed. With
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: featureparity
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.37
4
+ version: 0.0.38
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stowzilla