featureparity 0.0.39 → 0.0.41

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: 728f32133b314a959c3d44742058516e90dba1f82b0ae211809d43d86c84f026
4
- data.tar.gz: d6c083a465b825cbaa0b62a7b19ba99cd083b86565df914376eb45a61d071bd4
3
+ metadata.gz: 604df9b10892e95ecb76e71ee9afaf72f2465aebee4dc40d48e3657e6219ee02
4
+ data.tar.gz: 67a7b63205f476536a6ca59999103209503d10bba27b8a11b166d686c3997770
5
5
  SHA512:
6
- metadata.gz: dedc368d3d9e755cf44b5c7dfbe513cfead1b21a16e47e14052199c500ec8bf3dd3d9942c37a9c5d14faccf6a518e01c241e7b6dfe098ce18bc75b4f49f02954
7
- data.tar.gz: 522329e058ec8cf7a12c7df1bab98e4588b70c635bbd27dbc60cd31c4224ebb99f956377e4f48e8e1986fd4a186cfdb2fd881238fc779dc05aa4a645717997a7
6
+ metadata.gz: f40525810581b7ce517d5676840671fed3fc8d93d6fc2b622af80972b64d645c5077e6b7b9144d372dbf9d6b77e31bfc9547ccb9f42bcbf8938408a46397914d
7
+ data.tar.gz: fb318ed5fbfbdd95137db59f85204ee7ed7ac79329d5879be45a5627fc2799d9479d39fe44d6484e44c8e179a4ebfa37d987304ac002378d5fb33f2fcbfc448c
@@ -91,7 +91,7 @@ module Fp
91
91
  return entry(requirement, 'in_review', nil)
92
92
  end
93
93
 
94
- progress("#{slug} ...") if sweeping
94
+ announce("#{slug} ...") if sweeping
95
95
  analysis = cached_analysis(requirement)
96
96
 
97
97
  if analysis.nil? || opts[:force] || opts[:conflicts] && analysis['conflicts'].nil?
@@ -100,13 +100,13 @@ module Fp
100
100
  result = client.analyze_requirement(requirement['id'], force: opts[:force],
101
101
  include_conflicts: opts[:conflicts])
102
102
  unless result[:ok]
103
- # Without access (or without the analyzer) every call would fail the same way.
104
103
  if [401, 402, 403, 503].include?(result[:status])
105
104
  output.error(result[:error], status: result[:status])
106
105
  exit 1
107
106
  end
108
107
  return entry(requirement, 'error', nil, error: result[:error])
109
108
  end
109
+ confirm_access
110
110
  analysis = result[:data]['analysis']
111
111
  end
112
112
 
@@ -260,6 +260,20 @@ module Fp
260
260
  line
261
261
  end
262
262
 
263
+ def announce(message)
264
+ return progress(message) if @access_confirmed
265
+
266
+ (@held_progress ||= []) << message
267
+ end
268
+
269
+ def confirm_access
270
+ return if @access_confirmed
271
+
272
+ @access_confirmed = true
273
+ Array(@held_progress).each { |message| progress(message) }
274
+ @held_progress = nil
275
+ end
276
+
263
277
  def progress(message)
264
278
  warn message unless output.json?
265
279
  end
@@ -330,7 +330,7 @@ module Fp
330
330
  pending.map { |p| [p['slug'], p['kind'], truncate(p['title'].to_s, 48)] }
331
331
  )
332
332
  puts 'These still count toward the gate — proposing a change is not a way out of it.'
333
- puts "Their evidence is suspect until the change is reviewed: fp history <slug>#{project_scope(project_slug)}"
333
+ puts "Review the proposal: fp history <slug>#{project_scope(project_slug)}"
334
334
  puts
335
335
  end
336
336
 
@@ -196,6 +196,9 @@ module Fp
196
196
  elsif update[:update_available]
197
197
  "#{update[:latest_version]} — newer than this one. Run `#{update[:update_command]}` " \
198
198
  "(or `#{UpdateCheck::GEM_COMMAND}`)."
199
+ elsif update[:check_stale]
200
+ "#{update[:latest_version]} — older than this one (#{Fp::VERSION}), so the version check " \
201
+ "looks stale. #{UpdateCheck::CHANGELOG_URL} lists the newest release."
199
202
  else
200
203
  "#{update[:latest_version]} (up to date)"
201
204
  end
@@ -109,14 +109,14 @@ module Fp
109
109
  rows = []
110
110
 
111
111
  parents.each do |r|
112
- surfaces = (r['required_surfaces'] || []).join(', ')
112
+ surfaces = Parity.surface_labels(r).join(', ')
113
113
  category = r['category'] || '-'
114
114
  tags = (r['tags'] || []).join(', ')
115
115
  rows << [r['slug'], truncate(r['title'], 40), category, tags.empty? ? '-' : tags, surfaces.empty? ? '-' : surfaces, status_cell(r)]
116
116
 
117
117
  # Add children indented
118
118
  (children_by_parent[r['id']] || []).each do |child|
119
- child_surfaces = (child['required_surfaces'] || []).join(', ')
119
+ child_surfaces = Parity.surface_labels(child).join(', ')
120
120
  child_category = child['category'] || '-'
121
121
  child_tags = (child['tags'] || []).join(', ')
122
122
  rows << [" └ #{child['slug']}", truncate(child['title'], 36), child_category, child_tags.empty? ? '-' : child_tags, child_surfaces.empty? ? '-' : child_surfaces, status_cell(child)]
@@ -125,7 +125,7 @@ module Fp
125
125
 
126
126
  # Show orphans at top level
127
127
  orphans.each do |r|
128
- surfaces = (r['required_surfaces'] || []).join(', ')
128
+ surfaces = Parity.surface_labels(r).join(', ')
129
129
  category = r['category'] || '-'
130
130
  tags = (r['tags'] || []).join(', ')
131
131
  rows << [r['slug'], truncate(r['title'], 40), category, tags.empty? ? '-' : tags, surfaces.empty? ? '-' : surfaces, status_cell(r)]
@@ -273,8 +273,10 @@ module Fp
273
273
  'so nothing can cover them.'
274
274
  end
275
275
  # Gaps are counted on approved requirements. A project that is all drafts has
276
- # none of those, which is not the same as having nothing left to test.
277
- if filter_desc.empty? && (report['summary'] || {})['requirements'].to_i.zero?
276
+ # none of those, which is not the same as having nothing left to test. Show the
277
+ # hint whether or not a surface filter is in force (Fizzy #2076): a surface
278
+ # from .featureparity.yml is still "inside a repo with no approved requirements".
279
+ if (report['summary'] || {})['requirements'].to_i.zero?
278
280
  puts 'No requirement has been approved yet, so there is nothing to measure. ' \
279
281
  'Drafts with no test: fp list --status draft --gaps, or fp coverage.'
280
282
  end
@@ -128,13 +128,18 @@ module Fp
128
128
  puts "Parent: #{parent_slug || req['parent_id'] || '(none)'}"
129
129
  puts
130
130
 
131
- surfaces = req['required_surfaces'] || []
131
+ surfaces = Parity.surface_labels(req)
132
132
  puts 'Required Surfaces:'
133
133
  if surfaces.empty?
134
134
  puts ' (none)'
135
135
  else
136
136
  surfaces.each { |s| puts " - #{s}" }
137
137
  end
138
+ if Array(req['proposed_surfaces']).any?
139
+ puts ' (A proposed surface is not required until a human approves the proposal)'
140
+ elsif req['pending_change_kind'] == 'modification' && Parity.under_review?(req)
141
+ puts ' (Surfaces may change — a proposal is awaiting review)'
142
+ end
138
143
  puts
139
144
 
140
145
  # Required test types: the kinds of test that must each cover this requirement on
@@ -237,6 +237,24 @@ module Fp
237
237
  if source_surface && !opts[:evaluate]
238
238
  drafted, gaps, skipped = draft_requirements_from_surface(project_id, opts[:project], surface, candidates,
239
239
  opts[:from], key)
240
+
241
+ # If nothing was drafted (all skipped or errored), delete the surface and fail.
242
+ # The 0.0.36 changelog and the skill both promise "creates nothing when it has
243
+ # nothing to carry over" (Fizzy #2076).
244
+ if drafted.empty?
245
+ delete_result = client.delete_surface(project_id, surface['id'])
246
+ unless delete_result[:ok]
247
+ warn "Warning: could not clean up surface '#{key}': #{delete_result[:error]}"
248
+ end
249
+
250
+ output.error(
251
+ "No requirement on '#{opts[:from]}' could be drafted for '#{key}'. " \
252
+ "Nothing was created. #{skipped_summary(skipped)}" \
253
+ "To add the surface without drafting any requirements: " \
254
+ "fp surfaces add #{key} --project #{opts[:project]}"
255
+ )
256
+ exit 1
257
+ end
240
258
  end
241
259
 
242
260
  response_data = result[:data].merge('drafted' => drafted, 'gaps' => gaps)
@@ -551,7 +569,7 @@ module Fp
551
569
  return unless drafted.any?
552
570
 
553
571
  puts
554
- puts '⚠️ These are now DRAFTS awaiting human review.'
572
+ puts '⚠️ These are now proposals awaiting human review.'
555
573
  puts ' A human must approve each change in the web app before the surface is measured.'
556
574
  end
557
575
 
@@ -798,10 +816,28 @@ module Fp
798
816
  # Runs before the surface is created: a project without AI access is told once and
799
817
  # the command exits 1 with nothing made, as `fp analyze` does.
800
818
  def evaluate_requirements_for_surface!(candidates, source_key, new_surface_key)
801
- candidates.map do |req|
819
+ # Check AI access first, before printing any progress (Fizzy #2076). The first
820
+ # candidate's check surfaces any account-level block (402) so the error appears
821
+ # alone, not after a "Evaluating..." line that looked like it was about to work.
822
+ # Reuse the result for the first candidate so we don't double-call the API.
823
+ precheck_result = nil
824
+ if candidates.any?
825
+ precheck_result = client.evaluate_surface_applicability(candidates.first['id'], new_surface_key, source_key)
826
+ if !precheck_result[:ok] && EVALUATION_BLOCKED.include?(precheck_result[:status])
827
+ output.error(
828
+ "#{precheck_result[:error]} Nothing was created. Without --evaluate, " \
829
+ "fp surfaces add #{new_surface_key} --from #{source_key} drafts every requirement on '#{source_key}' for review.",
830
+ status: precheck_result[:status]
831
+ )
832
+ exit 1
833
+ end
834
+ end
835
+
836
+ candidates.each_with_index.map do |req, index|
802
837
  progress("Evaluating #{req['slug']} ...")
803
838
 
804
- eval_result = client.evaluate_surface_applicability(req['id'], new_surface_key, source_key)
839
+ # Reuse the precheck result for the first candidate
840
+ eval_result = index.zero? && precheck_result ? precheck_result : client.evaluate_surface_applicability(req['id'], new_surface_key, source_key)
805
841
 
806
842
  if eval_result[:ok]
807
843
  evaluation = eval_result[:data]['evaluation'] || {}
@@ -881,22 +917,48 @@ module Fp
881
917
  puts "Drafted #{drafted.size} requirement(s) from '#{source_key}' to include '#{new_key}':"
882
918
  drafted.each { |req| puts " - #{req['slug']}: #{truncate(req['title'], 50)}" }
883
919
  puts
884
- puts '⚠️ These are now DRAFTS awaiting human review.'
920
+ puts '⚠️ These are now proposals awaiting human review.'
885
921
  puts ' A human must approve each change in the web app before the surface is measured.'
886
922
  end
887
923
 
888
924
  SKIP_REASONS = {
889
925
  'has_pending_change' => 'already has a change awaiting review',
890
926
  'already_includes_surface' => 'already names this surface',
891
- 'archived' => 'archived'
927
+ 'archived' => 'archived',
928
+ 'parent_skipped' => 'parent was skipped'
892
929
  }.freeze
893
930
 
931
+ SKIP_COUNTS = {
932
+ 'has_pending_change' => ['already has a change awaiting review', 'already have a change awaiting review'],
933
+ 'already_includes_surface' => ['already names this surface', 'already name this surface'],
934
+ 'archived' => %w[archived archived],
935
+ 'parent_skipped' => ['whose parent was skipped', 'whose parent was skipped']
936
+ }.freeze
937
+
938
+ def skipped_summary(skipped)
939
+ return '' if skipped.empty?
940
+
941
+ by_reason = skipped.group_by { |row| row['reason'] }
942
+ parts = by_reason.map do |reason, rows|
943
+ one, many = SKIP_COUNTS[reason] || [reason, reason]
944
+ "#{rows.size} #{rows.size == 1 ? one : many}"
945
+ end
946
+ "#{skipped.size} skipped (#{parts.join(', ')}). "
947
+ end
948
+
894
949
  def print_skipped_requirements(skipped)
895
950
  return if skipped.empty?
896
951
 
897
952
  puts
898
953
  puts "Skipped (#{skipped.size}):"
899
- skipped.each { |row| puts " - #{row['slug']}: #{SKIP_REASONS[row['reason']] || row['reason']}" }
954
+ skipped.each do |row|
955
+ reason = SKIP_REASONS[row['reason']] || row['reason']
956
+ # Show the parent slug when a child was skipped because its parent was
957
+ if row['reason'] == 'parent_skipped' && row['parent_slug']
958
+ reason = "#{reason} (#{row['parent_slug']})"
959
+ end
960
+ puts " - #{row['slug']}: #{reason}"
961
+ end
900
962
  end
901
963
 
902
964
  def print_gap_list(gaps, new_key)
@@ -37,10 +37,10 @@ module Fp
37
37
  attr_writer :installer
38
38
 
39
39
  def installer
40
- @installer ||= lambda do
40
+ @installer ||= lambda do |version|
41
41
  out, status = Open3.capture2e(
42
42
  Gem.ruby, '-e', 'require "rubygems/gem_runner"; Gem::GemRunner.new.run(ARGV)',
43
- 'install', 'featureparity'
43
+ 'install', 'featureparity', '--version', version
44
44
  )
45
45
  [out, status.success?]
46
46
  end
@@ -59,7 +59,7 @@ module Fp
59
59
  end
60
60
 
61
61
  unless status[:update_available]
62
- return output.success(status.merge(updated: false)) { puts "fp #{Fp::VERSION} is the latest version." }
62
+ return output.success(status.merge(updated: false)) { puts current_line(status) }
63
63
  end
64
64
 
65
65
  if opts[:check]
@@ -74,9 +74,16 @@ module Fp
74
74
 
75
75
  private
76
76
 
77
+ def current_line(status)
78
+ return "fp #{Fp::VERSION} is the latest version." unless status[:check_stale]
79
+
80
+ "fp #{Fp::VERSION} is newer than the latest version the API reports (#{status[:latest_version]}), " \
81
+ 'so there is nothing to install. The version check looks stale.'
82
+ end
83
+
77
84
  def install(status)
78
85
  puts "Installing fp #{status[:latest_version]} (you have #{Fp::VERSION})..." unless output.json?
79
- log, ok = self.class.installer.call
86
+ log, ok = self.class.installer.call(status[:latest_version])
80
87
 
81
88
  unless ok
82
89
  output.error("The update failed. Run `#{UpdateCheck::GEM_COMMAND}` to see why.\n#{log.to_s.lines.last(5).join}".strip)
@@ -85,7 +92,7 @@ module Fp
85
92
 
86
93
  payload = status.merge(updated: true, next_steps: AFTER_UPDATE.map(&:first), changelog_url: UpdateCheck::CHANGELOG_URL)
87
94
  output.success(payload) do
88
- puts "✓ fp is updated. `fp version` shows what's installed."
95
+ puts "✓ fp #{status[:latest_version]} is installed."
89
96
  puts "What changed: #{UpdateCheck::CHANGELOG_URL}"
90
97
  puts
91
98
  puts 'Next, in each repo that uses fp:'
data/lib/fp/parity.rb CHANGED
@@ -80,6 +80,13 @@ module Fp
80
80
  # What a status column prints for a requirement: its status, except that one awaiting
81
81
  # review is called that, and a proposal against it is named either way.
82
82
  # active | draft | draft (removal proposed) | awaiting review (modification proposed)
83
+ def self.surface_labels(requirement)
84
+ proposed = Array(requirement['proposed_surfaces'])
85
+ Array(requirement['required_surfaces']).map do |surface|
86
+ proposed.include?(surface) ? "#{surface} (proposed)" : surface
87
+ end
88
+ end
89
+
83
90
  def self.status_label(requirement)
84
91
  status = under_review?(requirement) ? UNDER_REVIEW_LABEL : requirement['status'].to_s
85
92
  kind = requirement['pending_change_kind'].to_s
@@ -61,6 +61,7 @@ module Fp
61
61
  current_version: Fp::VERSION,
62
62
  latest_version: latest,
63
63
  update_available: latest ? newer?(latest) : false,
64
+ check_stale: latest ? newer?(Fp::VERSION, latest) : false,
64
65
  update_command: UPDATE_COMMAND
65
66
  }
66
67
  end
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.39'
4
+ VERSION = '0.0.41'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: featureparity
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.39
4
+ version: 0.0.41
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stowzilla
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-11-23 00:00:00.000000000 Z
11
+ date: 2026-11-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: net-http