featureparity 0.0.29 → 0.0.31

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: 5cef61c9093573a494f9d27b203554e51dfc2f0a6d60ae43e666564c8e2b1740
4
- data.tar.gz: 7162500244354be8c93a78499e479ac30a7df2d25ab4f818ce3451a6819ce960
3
+ metadata.gz: 2f0f78517e010302b866caf565d5327e7c98929a82230ecf98da1bac55d51d9f
4
+ data.tar.gz: 956d1c46e86711b37653f387044709d76e0a4e83161ca3f49f12d555ce1309e2
5
5
  SHA512:
6
- metadata.gz: a4733078f1af140723dadb54a0ed5e3ba5c80b771a48ba9f8364c6dcfb088cb9e3c39c79fac27b0fd5083e2339e47b8b6fb76fe5c54fde772f68fdbc2a005e7d
7
- data.tar.gz: 21330096e2f61cf6100dc54708c25818647f88581e0d0ef073bc84b2ec532556582012d899a663a0e96ce9e757ff6f5ae0ec51338be797bc19363f40e97d86af
6
+ metadata.gz: 8c6252c44e1a635cb54b9044dd9b3f9037e405811913f100dedbcac598dfebb57432842856481b1dc943989b44c84350a9559433c110d9ab31d19b266389b967
7
+ data.tar.gz: c28eb89f74bc8e205e855df172621aac1f79dca7c2f30a3232c8072fd1a6acf4a9cf1898efb581699732b885f9ac872fa7ccf7aa83471d80fd2c47eebaaaa306
data/lib/fp/client.rb CHANGED
@@ -318,12 +318,16 @@ module Fp
318
318
  # only do that by fetching the test files from GitHub, which fails silently on a
319
319
  # private repo, so resolved results are always sent when we have them.
320
320
  def ingest_ci_results(project_id, ci_url:, surface:, junit_xml:, pr_url: nil, results: nil,
321
- test_revisions: nil, unmarked_failures: nil, orphan_markers: nil, sha: nil)
321
+ test_revisions: nil, unmarked_failures: nil, orphan_markers: nil, sha: nil,
322
+ local: false)
322
323
  body = {
323
324
  ci_url: ci_url,
324
325
  surface: surface,
325
326
  junit_xml: junit_xml
326
327
  }
328
+ # A run on someone's machine rather than in CI (`fp ci-report --local`): there may be
329
+ # no run URL to record, and the server only accepts that when told so.
330
+ body[:local] = true if local
327
331
  # Only send pr_url when set, so a merged-branch run stays a plain ingest.
328
332
  body[:pr_url] = pr_url if pr_url && !pr_url.empty?
329
333
  # The checkout commit, so the receipt (or a PR run's branch verdict) links the
@@ -148,6 +148,7 @@ module Fp
148
148
  'status' => requirement['status'],
149
149
  'action' => action,
150
150
  'verdict' => analysis && analysis['verdict'],
151
+ 'verdict_reasons' => (analysis && analysis['verdict_reasons']) || [],
151
152
  'failed_checks' => analysis ? failed_legitimacy_checks(analysis) : [],
152
153
  'issues' => issues,
153
154
  'duplicate_of' => issues.find { |i| i['type'] == 'duplicate' }&.dig('duplicate_of'),
@@ -202,12 +203,14 @@ module Fp
202
203
  puts " issues: #{entry['issues'].map { |i| i['type'] }.join(', ')}" unless entry['issues'].empty?
203
204
  warrants = warrants_line(entry['warrants_requirement'])
204
205
  puts " #{warrants}" if warrants && entry['warrants_requirement']['judgment'] == false
206
+ print_verdict_reasons(entry, indent: ' ')
205
207
  puts " error: #{entry['error']}" if entry['error']
206
208
  end
207
209
 
208
210
  def print_detail(entry)
209
211
  puts "#{entry['slug']} — #{entry['title']}"
210
212
  puts " verdict: #{entry['verdict'] || '(none)'} suggested: #{ACTIONS[entry['action']]}"
213
+ print_verdict_reasons(entry, indent: ' ')
211
214
  puts " superseded by: #{entry['duplicate_of']}" if entry['duplicate_of']
212
215
  warrants = warrants_line(entry['warrants_requirement'])
213
216
  puts " #{warrants}" if warrants
@@ -220,6 +223,18 @@ module Fp
220
223
  puts " error: #{entry['error']}" if entry['error']
221
224
  end
222
225
 
226
+ # Why the verdict is what it is (Fizzy #1896). The server decides the verdict as a
227
+ # gate — an issue means needs work, a weakness means acceptable — and sends the
228
+ # reasons; the CLI only prints them, so an agent reading "acceptable" knows what
229
+ # to fix before it asks a human to look.
230
+ def print_verdict_reasons(entry, indent:)
231
+ reasons = entry['verdict_reasons'] || []
232
+ return if reasons.empty? || entry['verdict'].nil? || entry['verdict'] == 'good'
233
+
234
+ puts "#{indent}why #{entry['verdict'].tr('_', ' ')}:"
235
+ reasons.each { |reason| puts "#{indent} - #{reason}" }
236
+ end
237
+
223
238
  # The analyzer's yes/no on whether the concept deserves to be a requirement at all.
224
239
  # A "no" carries its reason so a human can decide to withdraw it — the CLI only
225
240
  # reports it; nothing is withdrawn or proposed on the strength of the judgment.
@@ -49,6 +49,12 @@ module Fp
49
49
  # of `passing`, and no merged evidence is demoted. Run it without --pr on pushes to
50
50
  # the default branch to record the real `passing`, superseding any pr_passing a prior
51
51
  # PR run left behind.
52
+ #
53
+ # --local is for when there is no CI to run the suite — a team out of CI minutes, or
54
+ # one without a pipeline yet (Fizzy #1837). A person runs the suite on their own
55
+ # machine and reports it the same way CI would; --ci-url becomes optional. The verdict
56
+ # is stamped on HEAD, so the working tree has to be clean: a result from edits nobody
57
+ # committed would be recorded against a commit that never ran them.
52
58
  class CiReport < Base
53
59
  help_summary 'CI only: ingest real pass/fail results (writes passing/failing evidence)'
54
60
  help_usage 'fp ci-report --junit <file>... --project <slug> --surface <surface> --ci-url URL [--pr URL]'
@@ -62,10 +68,13 @@ module Fp
62
68
  help_flag :repo, 'Repository the tests live in (org/repo)'
63
69
  help_flag :sha, 'Checkout commit SHA'
64
70
  help_flag :allow_empty, 'Do not error when a report resolves no fp:<slug> markers'
71
+ help_flag :local, 'No CI available: report a suite a person ran locally at a clean, committed HEAD (--ci-url optional)'
65
72
  help_example 'fp ci-report --junit junit.xml --project stowzilla --surface api --ci-url "$CI_RUN_URL"'
66
73
  help_example 'fp ci-report --junit web.xml --surface web --base-dir frontend --pr "$PR_URL"'
74
+ help_example 'fp ci-report --local --junit junit.xml --surface api'
67
75
  help_note "This is CI's command, not an agent's: only it writes passing/failing. Run it on both\n" \
68
- 'green and red builds (if: always()) so failures show on the matrix.'
76
+ "green and red builds (if: always()) so failures show on the matrix.\n" \
77
+ 'Out of CI minutes? A person can run the suite and report it with --local; agents report with fp report.'
69
78
 
70
79
  KNOWN_FLAGS = {
71
80
  project: :string,
@@ -77,7 +86,8 @@ module Fp
77
86
  base_dir: :string,
78
87
  repo: :string,
79
88
  sha: :string,
80
- allow_empty: :boolean
89
+ allow_empty: :boolean,
90
+ local: :boolean
81
91
  }.freeze
82
92
 
83
93
  def run(args)
@@ -88,7 +98,7 @@ module Fp
88
98
 
89
99
  require_project!(opts)
90
100
  require_flag(opts, :surface)
91
- require_flag(opts, :ci_url)
101
+ require_flag(opts, :ci_url) unless opts[:local]
92
102
 
93
103
  if junit_paths.empty?
94
104
  output.error('--junit <path> is required (may be given more than once).')
@@ -103,6 +113,7 @@ module Fp
103
113
 
104
114
  project_id = resolve_project_id(opts[:project])
105
115
  known = known_slugs(project_id)
116
+ require_clean_tree!(opts) if opts[:local]
106
117
  commit_sha = resolve_commit_sha(opts)
107
118
  repo = opts[:repo] || presence(ENV['GITHUB_REPOSITORY'])
108
119
 
@@ -147,6 +158,7 @@ module Fp
147
158
  junit_xml: resolved_reports.first[:xml],
148
159
  pr_url: opts[:pr],
149
160
  sha: commit_sha,
161
+ local: opts[:local],
150
162
  results: combined_results,
151
163
  test_revisions: combined_revisions,
152
164
  unmarked_failures: totals[:unmarked_failures],
@@ -359,6 +371,23 @@ module Fp
359
371
  exit 1
360
372
  end
361
373
 
374
+ # A local run is recorded against HEAD, so HEAD has to be what ran. Untracked files
375
+ # are ignored: the report itself is usually one.
376
+ def require_clean_tree!(opts)
377
+ root = Fp::JUnit.repo_root_for(opts[:base_dir] || Dir.pwd)
378
+ stdout, _stderr, status = Open3.capture3('git', 'status', '--porcelain', '--untracked-files=no',
379
+ chdir: root || Dir.pwd)
380
+ unless status.success?
381
+ output.error('--local needs a git checkout: the results are recorded against the commit that ran them.')
382
+ exit 1
383
+ end
384
+ return if stdout.strip.empty?
385
+
386
+ output.error('--local refuses a working tree with uncommitted changes: the results would be ' \
387
+ 'recorded against a commit that never ran them. Commit (and push) first, then re-run the suite.')
388
+ exit 1
389
+ end
390
+
362
391
  def resolve_commit_sha(opts)
363
392
  explicit = presence(opts[:sha])
364
393
  return explicit if explicit
@@ -403,6 +432,7 @@ module Fp
403
432
 
404
433
  output.success(data) do
405
434
  mode = opts[:pr] ? " (PR mode — passing tests recorded as pr_passing)" : ''
435
+ mode += ' (local run, no CI)' if opts[:local]
406
436
  puts "Ingested CI results for surface '#{opts[:surface]}'#{mode}:"
407
437
  totals[:reports].each do |report|
408
438
  report[:results].each do |r|
@@ -503,6 +503,9 @@ module Fp
503
503
 
504
504
  analysis = feedback[:analysis]
505
505
  puts "Quality feedback: #{analysis['verdict'] || 'no verdict'}"
506
+ # The server decides the verdict as a gate and says what decided it (Fizzy
507
+ # #1896); an agent reading "acceptable" learns what to fix without asking.
508
+ Array(analysis['verdict_reasons']).each { |reason| puts " why: #{reason}" }
506
509
  Array(analysis['issues']).each do |issue|
507
510
  puts " - #{issue['type'].to_s.tr('_', ' ')}"
508
511
  end
@@ -23,6 +23,7 @@ module Fp
23
23
  help_flag :parent, "Set the parent requirement's slug"
24
24
  help_flag :no_parent, 'Propose un-nesting the requirement back to the top level (clears --parent)'
25
25
  help_flag :slug, 'Proposed new slug (evidence follows; markers still need updating)'
26
+ help_flag :tags, 'Proposed new tags, in order (comma-separated; replaces the current list, "" clears it)'
26
27
  help_flag :reason, 'What prompted this change, in words (recorded on the change)'
27
28
  help_flag :removal, 'Propose deleting the requirement instead of changing it'
28
29
  help_flag :withdraw, 'Take back the open proposal you authored, restoring the requirement as it was'
@@ -31,6 +32,7 @@ module Fp
31
32
  help_flag :source_context, 'Free-form note about what prompted this proposal'
32
33
  help_flag :source_ref, 'A place in the repo that prompted it, e.g. app/models/order.rb:42 (repeatable)'
33
34
  help_example 'fp propose-change print_qr --project stowzilla --acceptance "QR scans after 24h at -20C" --reason "Cold-chain rollout"'
35
+ help_example 'fp propose-change summon_can_be_undone --tags rules,units --reason "Rulebook check reads the first tag"'
34
36
  help_example 'fp propose-change print_qr --removal --reason "Superseded by print_container_label"'
35
37
  help_note "Applies the change and drops the requirement to draft for a human to review. --reason and\n" \
36
38
  "--source-* record what prompted the proposal in its history; the requirement's own origin is unchanged."
@@ -38,6 +40,7 @@ module Fp
38
40
  KNOWN_FLAGS = {
39
41
  project: :string, name: :string, why: :string, acceptance: :string,
40
42
  required: :string, required_types: :string, category: :string, parent: :string, slug: :string,
43
+ tags: :string,
41
44
  no_parent: :boolean,
42
45
  reason: :string, source_type: :string, source_url: :string, source_context: :string,
43
46
  removal: :boolean, withdraw: :boolean
@@ -80,7 +83,7 @@ module Fp
80
83
 
81
84
  if !removal && params.keys.none? { |k| proposed_field?(k) }
82
85
  output.error('Nothing to propose. Pass at least one of --name/--slug/--why/--acceptance/' \
83
- '--required/--required-types/--category/--parent/--no-parent, or --removal to ' \
86
+ '--required/--required-types/--category/--tags/--parent/--no-parent, or --removal to ' \
84
87
  'propose deletion.')
85
88
  exit 1
86
89
  end
@@ -175,6 +178,11 @@ module Fp
175
178
  exit 1
176
179
  end
177
180
 
181
+ if opts[:tags] == true
182
+ output.error('--tags needs a value, e.g. --tags rules,units (or --tags "" to clear them).')
183
+ exit 1
184
+ end
185
+
178
186
  return unless opts[:withdraw] && opts[:removal]
179
187
 
180
188
  output.error('--withdraw cancels an open proposal; it cannot be combined with --removal.')
@@ -214,6 +222,7 @@ module Fp
214
222
  if opts[:required_types]
215
223
  params[:required_test_types] = opts[:required_types].split(',').map { |t| t.strip.downcase }.reject(&:empty?)
216
224
  end
225
+ params[:tags] = opts[:tags].split(',').map(&:strip).reject(&:empty?) unless opts[:tags].nil?
217
226
  params[:parent_id] = resolve_parent_id(project_id, opts[:parent]) if opts[:parent]
218
227
  # --no-parent un-nests a child back to top level: an empty parent_id. The server
219
228
  # treats "" as "no parent" and diffs it against the current parent (Fizzy #1492).
@@ -230,7 +239,7 @@ module Fp
230
239
  end
231
240
 
232
241
  def proposed_field?(key)
233
- %i[title why acceptance category slug required_surfaces required_test_types parent_id].include?(key)
242
+ %i[title why acceptance category slug tags required_surfaces required_test_types parent_id].include?(key)
234
243
  end
235
244
 
236
245
  def resolve_parent_id(project_id, parent_slug)
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.29'
4
+ VERSION = '0.0.31'
5
5
  end
@@ -447,6 +447,7 @@ fp propose-change print_container_qr --project stowzilla \
447
447
  | `--acceptance` | No | Proposed acceptance criteria |
448
448
  | `--required` | No | Proposed surfaces (comma-separated; agents cannot remove existing ones) |
449
449
  | `--category` | No | Proposed category |
450
+ | `--tags` | No | Proposed tags, in order (comma-separated). Replaces the whole list; `--tags ""` clears it. A reject restores the old list in its old order |
450
451
  | `--parent` | No | Proposed parent requirement, by slug |
451
452
  | `--slug` | No | Proposed new key; evidence follows it, but existing `fp:<slug>` markers must be updated |
452
453
  | `--reason` | No | Why the change is needed |
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.29
4
+ version: 0.0.31
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-03 00:00:00.000000000 Z
11
+ date: 2026-11-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: net-http