featureparity 0.0.38 → 0.0.40

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: 2a92e0896218a93cbad1f24f42c2354ed86b58e2bbbd4dc3a68c9f43e7804642
4
- data.tar.gz: a19eb9b79bbe79229d66ccabcd2193df3c808d536b0df3cb81f26be822b11568
3
+ metadata.gz: 9dd6a510da7bd07c87ce3c58eaa05dcd3facc6c46f3faa912f4f10680e5880de
4
+ data.tar.gz: 5785e9baf74b9eb8721dca68c1e86b44e6ab69ead5ff596145816c81db8dc85b
5
5
  SHA512:
6
- metadata.gz: 4ea52af325a0b3a848c6527cd99aad3a547428e792c93b682c75a1a86e856e94dd5f384038748415099f5ff0c0395d7f327941fa610b07684fb16d79aabc6b7b
7
- data.tar.gz: 663ec3b222bf6326205a58caf16a33a8bf42026caffb5638ba2d5406bf780170485c650ccbb115bb08f0a1c1f5bfa02d76fbc8b970795f1043243e89fec37279
6
+ metadata.gz: 0b690ed24b1913f26f8a58c3610ef4e16e158f28919c1b8b0548eefef0254fe6bd58d41f2d86fa2a014e7f22a5020eb12eed60ee85e9cbb0c5c71861efb37429
7
+ data.tar.gz: 62eb7f052c5bf00cfd4d1c39c9f6b8dbae3d6e7db84c2348b8aff8c51cc0301f439f7a52c69b2a0488006c9ebe7a66779a08bdcd1e1e12709cd25010b013ae65
@@ -154,7 +154,7 @@ module Fp
154
154
  'duplicate_of' => issues.find { |i| i['type'] == 'duplicate' }&.dig('duplicate_of'),
155
155
  'conflicts' => (analysis && analysis['conflicts']) || [],
156
156
  'suggestions' => (analysis && analysis['suggestions']) || [],
157
- 'warrants_requirement' => analysis && analysis['warrants_requirement'],
157
+ 'warrants_requirement' => warrants_requirement(analysis),
158
158
  'error' => error
159
159
  }
160
160
  end
@@ -238,6 +238,19 @@ module Fp
238
238
  # The analyzer's yes/no on whether the concept deserves to be a requirement at all.
239
239
  # A "no" carries its reason so a human can decide to withdraw it — the CLI only
240
240
  # reports it; nothing is withdrawn or proposed on the strength of the judgment.
241
+ # The server's `legitimacy` is the judgment; `--json` keeps reporting it under
242
+ # `warrants_requirement` as { judgment, confidence, reason }.
243
+ def warrants_requirement(analysis)
244
+ legitimacy = analysis && analysis['legitimacy']
245
+ return nil unless legitimacy.is_a?(Hash) && [true, false].include?(legitimacy['passes'])
246
+
247
+ {
248
+ 'judgment' => legitimacy['passes'],
249
+ 'confidence' => legitimacy['confidence'],
250
+ 'reason' => Array(legitimacy['reasons']).first
251
+ }
252
+ end
253
+
241
254
  def warrants_line(warrants)
242
255
  return nil unless warrants.is_a?(Hash) && [true, false].include?(warrants['judgment'])
243
256
 
@@ -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
 
@@ -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
@@ -135,6 +135,9 @@ module Fp
135
135
  else
136
136
  surfaces.each { |s| puts " - #{s}" }
137
137
  end
138
+ if req['pending_change_kind'] == 'modification' && Parity.under_review?(req)
139
+ puts ' (Surfaces may change — a proposal is awaiting review)'
140
+ end
138
141
  puts
139
142
 
140
143
  # 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,41 @@ 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
+ # Build a brief summary of skip reasons for the error message when nothing is drafted.
932
+ def skipped_summary(skipped)
933
+ return '' if skipped.empty?
934
+
935
+ by_reason = skipped.group_by { |row| row['reason'] }
936
+ parts = by_reason.map do |reason, rows|
937
+ "#{rows.size} #{SKIP_REASONS[reason] || reason}"
938
+ end
939
+ "#{skipped.size} skipped (#{parts.join(', ')}). "
940
+ end
941
+
894
942
  def print_skipped_requirements(skipped)
895
943
  return if skipped.empty?
896
944
 
897
945
  puts
898
946
  puts "Skipped (#{skipped.size}):"
899
- skipped.each { |row| puts " - #{row['slug']}: #{SKIP_REASONS[row['reason']] || row['reason']}" }
947
+ skipped.each do |row|
948
+ reason = SKIP_REASONS[row['reason']] || row['reason']
949
+ # Show the parent slug when a child was skipped because its parent was
950
+ if row['reason'] == 'parent_skipped' && row['parent_slug']
951
+ reason = "#{reason} (#{row['parent_slug']})"
952
+ end
953
+ puts " - #{row['slug']}: #{reason}"
954
+ end
900
955
  end
901
956
 
902
957
  def print_gap_list(gaps, new_key)
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.38'
4
+ VERSION = '0.0.40'
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.38
4
+ version: 0.0.40
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-18 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