png_conform 0.1.3 → 0.1.5
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/.rubocop_todo.yml +101 -80
- data/CONTRIBUTING.md +22 -0
- data/Gemfile +4 -0
- data/README.adoc +7 -0
- data/Rakefile +8 -1
- data/TODO.structured-diagnostics/00-overview.md +98 -0
- data/TODO.structured-diagnostics/01-shared-contract.md +36 -0
- data/TODO.structured-diagnostics/02-requirement-catalog.md +37 -0
- data/TODO.structured-diagnostics/03a-png-apng-emitters.md +45 -0
- data/TODO.structured-diagnostics/03b-mng-jng-emitters.md +34 -0
- data/TODO.structured-diagnostics/03c-format-aware-orchestration.md +38 -0
- data/TODO.structured-diagnostics/04-report-migration.md +40 -0
- data/TODO.structured-diagnostics/05-corpus-goldens.md +42 -0
- data/TODO.structured-diagnostics/90-progress.md +22 -0
- data/benchmarks/lib/benchmark_runner.rb +1 -1
- data/benchmarks/lib/metrics_collector.rb +3 -3
- data/benchmarks/lib/report_generator.rb +8 -9
- data/config/diagnostics.yml +2906 -0
- data/docs/ARCHITECTURE.adoc +13 -4
- data/docs/CLI_OPTIONS.adoc +126 -0
- data/lib/png_conform/analyzers/comparison_analyzer.rb +5 -5
- data/lib/png_conform/analyzers/optimization_analyzer.rb +6 -6
- data/lib/png_conform/bindata/chunk_structure.rb +8 -1
- data/lib/png_conform/cli.rb +0 -7
- data/lib/png_conform/commands/check_command.rb +3 -2
- data/lib/png_conform/diagnostics/builder.rb +52 -0
- data/lib/png_conform/diagnostics/catalog.rb +242 -0
- data/lib/png_conform/diagnostics/golden_generator.rb +92 -0
- data/lib/png_conform/diagnostics/location.rb +45 -0
- data/lib/png_conform/models/chunk_info.rb +1 -1
- data/lib/png_conform/models/file_analysis.rb +2 -0
- data/lib/png_conform/models/validation_error.rb +96 -1
- data/lib/png_conform/models/validation_result.rb +20 -2
- data/lib/png_conform/readers/chunk_framing.rb +79 -0
- data/lib/png_conform/readers/format_dispatch.rb +49 -0
- data/lib/png_conform/readers/full_load_reader.rb +51 -1
- data/lib/png_conform/readers/streaming_reader.rb +25 -5
- data/lib/png_conform/reporters/summary_reporter.rb +1 -1
- data/lib/png_conform/reporters/verbose_reporter.rb +3 -1
- data/lib/png_conform/services/chunk_processor.rb +11 -11
- data/lib/png_conform/services/file_signature.rb +2 -2
- data/lib/png_conform/services/profile_manager.rb +77 -28
- data/lib/png_conform/services/result_builder.rb +9 -14
- data/lib/png_conform/services/validation_orchestrator.rb +175 -49
- data/lib/png_conform/services/zlib_validator.rb +2 -2
- data/lib/png_conform/validators/ancillary/bkgd_validator.rb +12 -12
- data/lib/png_conform/validators/ancillary/chrm_validator.rb +10 -10
- data/lib/png_conform/validators/ancillary/cicp_validator.rb +15 -9
- data/lib/png_conform/validators/ancillary/gama_validator.rb +10 -10
- data/lib/png_conform/validators/ancillary/hist_validator.rb +17 -17
- data/lib/png_conform/validators/ancillary/iccp_validator.rb +27 -27
- data/lib/png_conform/validators/ancillary/idot_validator.rb +5 -5
- data/lib/png_conform/validators/ancillary/itxt_validator.rb +24 -24
- data/lib/png_conform/validators/ancillary/mdcv_validator.rb +15 -7
- data/lib/png_conform/validators/ancillary/offs_validator.rb +10 -10
- data/lib/png_conform/validators/ancillary/pcal_validator.rb +28 -28
- data/lib/png_conform/validators/ancillary/phys_validator.rb +8 -8
- data/lib/png_conform/validators/ancillary/sbit_validator.rb +13 -13
- data/lib/png_conform/validators/ancillary/scal_validator.rb +13 -13
- data/lib/png_conform/validators/ancillary/splt_validator.rb +21 -21
- data/lib/png_conform/validators/ancillary/srgb_validator.rb +9 -9
- data/lib/png_conform/validators/ancillary/ster_validator.rb +9 -9
- data/lib/png_conform/validators/ancillary/text_validator.rb +12 -12
- data/lib/png_conform/validators/ancillary/time_validator.rb +11 -11
- data/lib/png_conform/validators/ancillary/trns_validator.rb +15 -15
- data/lib/png_conform/validators/ancillary/ztxt_validator.rb +16 -16
- data/lib/png_conform/validators/apng/actl_validator.rb +5 -5
- data/lib/png_conform/validators/apng/fctl_validator.rb +13 -11
- data/lib/png_conform/validators/apng/fdat_validator.rb +9 -9
- data/lib/png_conform/validators/base_validator.rb +72 -39
- data/lib/png_conform/validators/critical/idat_validator.rb +7 -4
- data/lib/png_conform/validators/critical/iend_validator.rb +8 -5
- data/lib/png_conform/validators/critical/ihdr_validator.rb +18 -18
- data/lib/png_conform/validators/critical/plte_validator.rb +10 -10
- data/lib/png_conform/validators/jng/jdat_validator.rb +5 -5
- data/lib/png_conform/validators/jng/jhdr_validator.rb +10 -10
- data/lib/png_conform/validators/jng/jsep_validator.rb +7 -7
- data/lib/png_conform/validators/mng/back_validator.rb +7 -13
- data/lib/png_conform/validators/mng/clip_validator.rb +5 -7
- data/lib/png_conform/validators/mng/clon_validator.rb +4 -6
- data/lib/png_conform/validators/mng/defi_validator.rb +9 -15
- data/lib/png_conform/validators/mng/dhdr_validator.rb +11 -17
- data/lib/png_conform/validators/mng/disc_validator.rb +5 -7
- data/lib/png_conform/validators/mng/endl_validator.rb +8 -10
- data/lib/png_conform/validators/mng/fram_validator.rb +5 -7
- data/lib/png_conform/validators/mng/loop_validator.rb +5 -9
- data/lib/png_conform/validators/mng/mend_validator.rb +3 -3
- data/lib/png_conform/validators/mng/mhdr_validator.rb +4 -4
- data/lib/png_conform/validators/mng/move_validator.rb +5 -7
- data/lib/png_conform/validators/mng/save_validator.rb +4 -4
- data/lib/png_conform/validators/mng/seek_validator.rb +5 -5
- data/lib/png_conform/validators/mng/show_validator.rb +4 -6
- data/lib/png_conform/validators/mng/term_validator.rb +8 -14
- data/lib/png_conform/version.rb +1 -1
- data/lib/png_conform.rb +44 -0
- data/script/generate_mng_jng_fixtures +90 -0
- data/script/regenerate_diagnostic_goldens +9 -0
- metadata +37 -5
- data/png_conform.gemspec +0 -44
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c3185c558227f8e781d2939e2c5ab3d938e23b2e316b7a4e6dc331e3833a808b
|
|
4
|
+
data.tar.gz: a34d66c41bed7ef373ee86fd6e492aaee2203c0655884e0f5bfffe8a644e5d3d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 67ffbca8b2bf76865aae2cf41596e85a3fb3a566b30ae27df8d229f66849a598c5c28bf84e1f36cee4a79d9c7a9eac6adad3ab548a7be669bcc1058709277881
|
|
7
|
+
data.tar.gz: aee8b3f744dc6f8f6e4fa7cf64077d4174e23fc0a789361f36229a2dc25ecf292eb4fe4662fce7c3b08931d0467c46786a104c91d250a66e34862e67391410f9
|
data/.rubocop_todo.yml
CHANGED
|
@@ -1,92 +1,63 @@
|
|
|
1
1
|
# This configuration was generated by
|
|
2
2
|
# `rubocop --auto-gen-config`
|
|
3
|
-
# on 2026-
|
|
3
|
+
# on 2026-04-04 06:26:35 UTC using RuboCop version 1.86.0.
|
|
4
4
|
# The point is for the user to remove these configuration records
|
|
5
5
|
# one by one as the offenses are removed from the code base.
|
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
|
7
7
|
# versions of RuboCop, may require this file to be generated again.
|
|
8
8
|
|
|
9
|
-
# Offense count: 6
|
|
10
|
-
# This cop supports safe autocorrection (--autocorrect).
|
|
11
|
-
# Configuration parameters: EnforcedStyle, IndentationWidth.
|
|
12
|
-
# SupportedStyles: with_first_argument, with_fixed_indentation
|
|
13
|
-
Layout/ArgumentAlignment:
|
|
14
|
-
Exclude:
|
|
15
|
-
- 'lib/png_conform/commands/check_command.rb'
|
|
16
|
-
- 'lib/png_conform/services/chunk_processor.rb'
|
|
17
|
-
- 'lib/png_conform/services/profile_manager.rb'
|
|
18
|
-
- 'lib/png_conform/services/validator_pool.rb'
|
|
19
|
-
|
|
20
|
-
# Offense count: 4
|
|
21
|
-
# This cop supports safe autocorrection (--autocorrect).
|
|
22
|
-
# Configuration parameters: EnforcedStyleAlignWith.
|
|
23
|
-
# SupportedStylesAlignWith: either, start_of_block, start_of_line
|
|
24
|
-
Layout/BlockAlignment:
|
|
25
|
-
Exclude:
|
|
26
|
-
- 'lib/png_conform/analyzers/comparison_analyzer.rb'
|
|
27
|
-
- 'lib/png_conform/analyzers/optimization_analyzer.rb'
|
|
28
|
-
- 'lib/png_conform/services/file_signature.rb'
|
|
29
|
-
- 'lib/png_conform/services/lru_cache.rb'
|
|
30
|
-
|
|
31
|
-
# Offense count: 4
|
|
32
|
-
# This cop supports safe autocorrection (--autocorrect).
|
|
33
|
-
Layout/BlockEndNewline:
|
|
34
|
-
Exclude:
|
|
35
|
-
- 'lib/png_conform/analyzers/comparison_analyzer.rb'
|
|
36
|
-
- 'lib/png_conform/analyzers/optimization_analyzer.rb'
|
|
37
|
-
- 'lib/png_conform/services/file_signature.rb'
|
|
38
|
-
- 'lib/png_conform/services/lru_cache.rb'
|
|
39
|
-
|
|
40
9
|
# Offense count: 1
|
|
41
10
|
# This cop supports safe autocorrection (--autocorrect).
|
|
42
|
-
|
|
11
|
+
Gemspec/RequireMFA:
|
|
43
12
|
Exclude:
|
|
44
|
-
- '
|
|
13
|
+
- 'png_conform.gemspec'
|
|
45
14
|
|
|
46
15
|
# Offense count: 1
|
|
47
16
|
# This cop supports safe autocorrection (--autocorrect).
|
|
48
|
-
# Configuration parameters:
|
|
49
|
-
|
|
50
|
-
Layout/EndAlignment:
|
|
17
|
+
# Configuration parameters: AllowForAlignment, AllowBeforeTrailingComments, ForceEqualSignAlignment.
|
|
18
|
+
Layout/ExtraSpacing:
|
|
51
19
|
Exclude:
|
|
52
|
-
- '
|
|
20
|
+
- 'spec/png_conform/validators/ancillary/bkgd_validator_spec.rb'
|
|
53
21
|
|
|
54
|
-
# Offense count:
|
|
22
|
+
# Offense count: 1
|
|
55
23
|
# This cop supports safe autocorrection (--autocorrect).
|
|
56
|
-
# Configuration parameters:
|
|
57
|
-
#
|
|
58
|
-
|
|
59
|
-
# SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit
|
|
60
|
-
Layout/HashAlignment:
|
|
24
|
+
# Configuration parameters: EnforcedStyle.
|
|
25
|
+
# SupportedStyles: normal, indented_internal_methods
|
|
26
|
+
Layout/IndentationConsistency:
|
|
61
27
|
Exclude:
|
|
62
|
-
- '
|
|
28
|
+
- 'png_conform.gemspec'
|
|
63
29
|
|
|
64
|
-
# Offense count:
|
|
30
|
+
# Offense count: 6
|
|
65
31
|
# This cop supports safe autocorrection (--autocorrect).
|
|
66
|
-
# Configuration parameters:
|
|
67
|
-
|
|
32
|
+
# Configuration parameters: EnforcedStyle, IndentationWidth.
|
|
33
|
+
# SupportedStyles: aligned, indented
|
|
34
|
+
Layout/LineEndStringConcatenationIndentation:
|
|
68
35
|
Exclude:
|
|
69
|
-
- 'lib/png_conform/analyzers/comparison_analyzer.rb'
|
|
70
36
|
- 'lib/png_conform/analyzers/optimization_analyzer.rb'
|
|
71
|
-
- 'lib/png_conform/services/file_signature.rb'
|
|
72
|
-
- 'lib/png_conform/services/lru_cache.rb'
|
|
73
|
-
- 'lib/png_conform/services/validation_cache.rb'
|
|
74
37
|
|
|
75
|
-
# Offense count:
|
|
38
|
+
# Offense count: 263
|
|
76
39
|
# This cop supports safe autocorrection (--autocorrect).
|
|
77
|
-
# Configuration parameters: Max, AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes,
|
|
40
|
+
# Configuration parameters: Max, AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, AllowRBSInlineAnnotation, AllowCopDirectives, AllowedPatterns, SplitStrings.
|
|
78
41
|
# URISchemes: http, https
|
|
79
42
|
Layout/LineLength:
|
|
80
43
|
Enabled: false
|
|
81
44
|
|
|
82
|
-
# Offense count:
|
|
45
|
+
# Offense count: 1
|
|
83
46
|
# This cop supports safe autocorrection (--autocorrect).
|
|
84
47
|
# Configuration parameters: AllowInHeredoc.
|
|
85
48
|
Layout/TrailingWhitespace:
|
|
86
49
|
Exclude:
|
|
87
|
-
- '
|
|
88
|
-
|
|
89
|
-
|
|
50
|
+
- 'spec/png_conform/validators/ancillary/bkgd_validator_spec.rb'
|
|
51
|
+
|
|
52
|
+
# Offense count: 14
|
|
53
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
54
|
+
Lint/AmbiguousOperatorPrecedence:
|
|
55
|
+
Exclude:
|
|
56
|
+
- 'benchmarks/lib/benchmark_runner.rb'
|
|
57
|
+
- 'benchmarks/lib/report_generator.rb'
|
|
58
|
+
- 'lib/png_conform/services/result_builder.rb'
|
|
59
|
+
- 'lib/png_conform/services/zlib_validator.rb'
|
|
60
|
+
- 'lib/png_conform/validators/critical/ihdr_validator.rb'
|
|
90
61
|
|
|
91
62
|
# Offense count: 1
|
|
92
63
|
Lint/BinaryOperatorWithIdenticalOperands:
|
|
@@ -102,6 +73,12 @@ Lint/DuplicateBranch:
|
|
|
102
73
|
- 'lib/png_conform/validators/ancillary/sbit_validator.rb'
|
|
103
74
|
- 'spec/pngsuite/helpers/semantic_validator.rb'
|
|
104
75
|
|
|
76
|
+
# Offense count: 1
|
|
77
|
+
# Configuration parameters: AllowComments, AllowEmptyLambdas.
|
|
78
|
+
Lint/EmptyBlock:
|
|
79
|
+
Exclude:
|
|
80
|
+
- 'spec/png_conform/validators/ancillary/bkgd_validator_spec.rb'
|
|
81
|
+
|
|
105
82
|
# Offense count: 4
|
|
106
83
|
# Configuration parameters: AllowedParentClasses.
|
|
107
84
|
Lint/MissingSuper:
|
|
@@ -142,6 +119,13 @@ Metrics/ParameterLists:
|
|
|
142
119
|
Metrics/PerceivedComplexity:
|
|
143
120
|
Enabled: false
|
|
144
121
|
|
|
122
|
+
# Offense count: 132
|
|
123
|
+
# Configuration parameters: Mode, AllowedMethods, AllowedPatterns, AllowBangMethods, WaywardPredicates.
|
|
124
|
+
# AllowedMethods: call
|
|
125
|
+
# WaywardPredicates: infinite?, nonzero?
|
|
126
|
+
Naming/PredicateMethod:
|
|
127
|
+
Enabled: false
|
|
128
|
+
|
|
145
129
|
# Offense count: 1
|
|
146
130
|
# Configuration parameters: EnforcedStyle, CheckMethodNames, CheckSymbols, AllowedIdentifiers, AllowedPatterns.
|
|
147
131
|
# SupportedStyles: snake_case, normalcase, non_integer
|
|
@@ -156,6 +140,13 @@ Performance/CollectionLiteralInLoop:
|
|
|
156
140
|
Exclude:
|
|
157
141
|
- 'examples/advanced_usage.rb'
|
|
158
142
|
|
|
143
|
+
# Offense count: 4
|
|
144
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
145
|
+
Performance/MapCompact:
|
|
146
|
+
Exclude:
|
|
147
|
+
- 'benchmarks/lib/metrics_collector.rb'
|
|
148
|
+
- 'lib/png_conform/services/file_signature.rb'
|
|
149
|
+
|
|
159
150
|
# Offense count: 70
|
|
160
151
|
# Configuration parameters: Prefixes, AllowedPatterns.
|
|
161
152
|
# Prefixes: when, with, without
|
|
@@ -187,51 +178,81 @@ RSpec/MultipleMemoizedHelpers:
|
|
|
187
178
|
Max: 6
|
|
188
179
|
|
|
189
180
|
# Offense count: 2
|
|
190
|
-
#
|
|
181
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
182
|
+
RSpec/Output:
|
|
183
|
+
Exclude:
|
|
184
|
+
- 'spec/png_conform/validators/ancillary/bkgd_validator_spec.rb'
|
|
185
|
+
|
|
186
|
+
# Offense count: 2
|
|
187
|
+
# Configuration parameters: CustomTransform, IgnoreMethods, IgnoreMetadata, InflectorPath, EnforcedInflector.
|
|
188
|
+
# SupportedInflectors: default, active_support
|
|
191
189
|
RSpec/SpecFilePathFormat:
|
|
192
190
|
Exclude:
|
|
193
191
|
- 'spec/png_conform/bindata/chunk_structure_spec.rb'
|
|
194
192
|
- 'spec/png_conform/bindata/png_file_spec.rb'
|
|
195
193
|
|
|
196
|
-
# Offense count:
|
|
194
|
+
# Offense count: 44
|
|
197
195
|
# Configuration parameters: IgnoreNameless, IgnoreSymbolicNames.
|
|
198
196
|
RSpec/VerifiedDoubles:
|
|
199
197
|
Enabled: false
|
|
200
198
|
|
|
201
|
-
# Offense count:
|
|
202
|
-
# This cop supports
|
|
203
|
-
|
|
204
|
-
# SupportedStyles: line_count_based, semantic, braces_for_chaining, always_braces
|
|
205
|
-
# ProceduralMethods: benchmark, bm, bmbm, create, each_with_object, measure, new, realtime, tap, with_object
|
|
206
|
-
# FunctionalMethods: let, let!, subject, watch
|
|
207
|
-
# AllowedMethods: lambda, proc, it
|
|
208
|
-
Style/BlockDelimiters:
|
|
199
|
+
# Offense count: 2
|
|
200
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
201
|
+
Style/BitwisePredicate:
|
|
209
202
|
Exclude:
|
|
210
|
-
- 'lib/png_conform/
|
|
211
|
-
- 'lib/png_conform/
|
|
212
|
-
- 'lib/png_conform/services/file_signature.rb'
|
|
213
|
-
- 'lib/png_conform/services/lru_cache.rb'
|
|
203
|
+
- 'lib/png_conform/bindata/chunk_structure.rb'
|
|
204
|
+
- 'lib/png_conform/services/chunk_processor.rb'
|
|
214
205
|
|
|
215
|
-
# Offense count:
|
|
206
|
+
# Offense count: 2
|
|
207
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
208
|
+
Style/ComparableBetween:
|
|
209
|
+
Exclude:
|
|
210
|
+
- 'lib/png_conform/validators/ancillary/trns_validator.rb'
|
|
211
|
+
- 'lib/png_conform/validators/base_validator.rb'
|
|
212
|
+
|
|
213
|
+
# Offense count: 1
|
|
214
|
+
Style/FileOpen:
|
|
215
|
+
Exclude:
|
|
216
|
+
- 'lib/png_conform/container.rb'
|
|
217
|
+
|
|
218
|
+
# Offense count: 36
|
|
216
219
|
# This cop supports safe autocorrection (--autocorrect).
|
|
217
220
|
# Configuration parameters: MaxUnannotatedPlaceholdersAllowed, Mode, AllowedMethods, AllowedPatterns.
|
|
218
221
|
# SupportedStyles: annotated, template, unannotated
|
|
219
222
|
Style/FormatStringToken:
|
|
220
223
|
EnforcedStyle: unannotated
|
|
221
224
|
|
|
222
|
-
# Offense count:
|
|
223
|
-
|
|
225
|
+
# Offense count: 4
|
|
226
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
227
|
+
Style/MapToSet:
|
|
224
228
|
Exclude:
|
|
225
|
-
- 'lib/png_conform/
|
|
229
|
+
- 'lib/png_conform/analyzers/comparison_analyzer.rb'
|
|
226
230
|
|
|
227
231
|
# Offense count: 1
|
|
232
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
233
|
+
Style/RedundantFormat:
|
|
234
|
+
Exclude:
|
|
235
|
+
- 'benchmarks/lib/report_generator.rb'
|
|
236
|
+
|
|
237
|
+
# Offense count: 2
|
|
238
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
239
|
+
# Configuration parameters: AllowedMethods, AllowedPatterns.
|
|
240
|
+
Style/ReturnNilInPredicateMethodDefinition:
|
|
241
|
+
Exclude:
|
|
242
|
+
- 'lib/png_conform/analyzers/comparison_analyzer.rb'
|
|
243
|
+
- 'spec/pngsuite/helpers/pngcheck_parser.rb'
|
|
244
|
+
|
|
245
|
+
# Offense count: 2
|
|
228
246
|
# This cop supports safe autocorrection (--autocorrect).
|
|
229
|
-
|
|
247
|
+
# Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
|
|
248
|
+
# SupportedStyles: single_quotes, double_quotes
|
|
249
|
+
Style/StringLiterals:
|
|
230
250
|
Exclude:
|
|
231
|
-
- '
|
|
251
|
+
- 'png_conform.gemspec'
|
|
232
252
|
|
|
233
253
|
# Offense count: 2
|
|
234
254
|
# This cop supports safe autocorrection (--autocorrect).
|
|
235
|
-
Style/
|
|
255
|
+
Style/SuperArguments:
|
|
236
256
|
Exclude:
|
|
237
|
-
- 'lib/png_conform/
|
|
257
|
+
- 'lib/png_conform/models/chunk_info.rb'
|
|
258
|
+
- 'lib/png_conform/models/validation_result.rb'
|
data/CONTRIBUTING.md
CHANGED
|
@@ -147,6 +147,28 @@ bundle exec rspec spec/path/to/spec_file.rb
|
|
|
147
147
|
COVERAGE=true bundle exec rake spec
|
|
148
148
|
```
|
|
149
149
|
|
|
150
|
+
### Diagnostics Goldens
|
|
151
|
+
|
|
152
|
+
Every fixture under `spec/fixtures` has one structured diagnostics golden
|
|
153
|
+
under `spec/fixtures/diagnostics/`. CI fails if a golden drifts.
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
# Targeted check: corpus spec only
|
|
157
|
+
bundle exec rspec spec/structured_diagnostics/corpus_spec.rb
|
|
158
|
+
|
|
159
|
+
# Full-corpus verification (non-mutating; also part of the default rake task)
|
|
160
|
+
bundle exec rake diagnostics:check
|
|
161
|
+
|
|
162
|
+
# Controlled regeneration (writes files)
|
|
163
|
+
script/regenerate_diagnostic_goldens --write
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
Regenerate only when a rule, report or schema change is intended. After
|
|
167
|
+
`--write`, review the complete `git diff spec/fixtures/diagnostics` and
|
|
168
|
+
confirm every change is explained by your change, then rerun
|
|
169
|
+
`bundle exec rake diagnostics:check` and commit the goldens in their own
|
|
170
|
+
reviewable commit. Never edit a golden by hand.
|
|
171
|
+
|
|
150
172
|
### Writing Tests
|
|
151
173
|
|
|
152
174
|
Follow these principles:
|
data/Gemfile
CHANGED
|
@@ -3,6 +3,10 @@
|
|
|
3
3
|
source "https://rubygems.org"
|
|
4
4
|
|
|
5
5
|
# Specify your gem's dependencies in png_conform.gemspec
|
|
6
|
+
|
|
7
|
+
# LensCore main until v1 is released; replace with the
|
|
8
|
+
# released constraint at freeze.
|
|
9
|
+
gem "lens_core", github: "claricle/lens_core", branch: "main"
|
|
6
10
|
gemspec
|
|
7
11
|
|
|
8
12
|
gem "openssl", "~> 3.0"
|
data/README.adoc
CHANGED
|
@@ -328,6 +328,13 @@ $ png_conform check --format json image.png
|
|
|
328
328
|
}
|
|
329
329
|
----
|
|
330
330
|
====
|
|
331
|
+
.Structured diagnostics
|
|
332
|
+
Every JSON and YAML report carries `schema_version` and a `diagnostics` array
|
|
333
|
+
(identity, severity, kind, citation, location, message, context) from the shared
|
|
334
|
+
`lens_core` contract. The legacy `errors` array is kept as a compatibility alias
|
|
335
|
+
for one transition. See `docs/CLI_OPTIONS.adoc` (Structured diagnostics) for the
|
|
336
|
+
full schema, a worked example and the migration notes.
|
|
337
|
+
|
|
331
338
|
.YAML with errors
|
|
332
339
|
[example]
|
|
333
340
|
====
|
data/Rakefile
CHANGED
|
@@ -7,4 +7,11 @@ require "rubocop/rake_task"
|
|
|
7
7
|
RSpec::Core::RakeTask.new(:spec)
|
|
8
8
|
RuboCop::RakeTask.new
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
namespace :diagnostics do
|
|
11
|
+
desc "Verify checked-in diagnostics goldens without writing files"
|
|
12
|
+
task :check do
|
|
13
|
+
ruby "script/regenerate_diagnostic_goldens", "--check"
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
task default: %i[spec rubocop diagnostics:check]
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# Issue #9 — Lens-family structured diagnostics
|
|
2
|
+
|
|
3
|
+
Planning baseline: `origin/main` at `653abae0d16d9533a37a5d5eca40896d3b307993`.
|
|
4
|
+
|
|
5
|
+
Public requirements and related work: [`png_conform#9`](https://github.com/claricle/png_conform/issues/9), [`svg_conform#100`](https://github.com/claricle/svg_conform/issues/100), [`claricle/lens_core`](https://github.com/claricle/lens_core), and [`emf#37`](https://github.com/claricle/emf/issues/37).
|
|
6
|
+
|
|
7
|
+
## Plan navigation
|
|
8
|
+
|
|
9
|
+
- [01 — Adopt the shared contract behind a PNG adapter](01-shared-contract.md)
|
|
10
|
+
- [02 — Catalog every rule and citation](02-requirement-catalog.md)
|
|
11
|
+
- [03a — Convert PNG, APNG, and service emitters](03a-png-apng-emitters.md)
|
|
12
|
+
- [03b — Convert MNG and JNG emitters](03b-mng-jng-emitters.md)
|
|
13
|
+
- [03c — Make orchestration format-aware](03c-format-aware-orchestration.md)
|
|
14
|
+
- [04 — Unify Ruby, JSON, YAML, and text reports](04-report-migration.md)
|
|
15
|
+
- [05 — Pin corpus JSON and the release gate](05-corpus-goldens.md)
|
|
16
|
+
- [Progress and handoff](90-progress.md)
|
|
17
|
+
|
|
18
|
+
## Problem
|
|
19
|
+
|
|
20
|
+
`png_conform` currently carries diagnostics through several incompatible representations. Validators add hashes to `ValidationContext`; `ResultBuilder#add_context_messages` then forwards only each message into `ValidationResult`; and `FileAnalysis#to_h` emits a small legacy subset. That path loses chunk offsets and error types before JSON/YAML reporting, while human reporters format the reduced model independently.
|
|
21
|
+
|
|
22
|
+
Issue #9 asks for the lens-family diagnostic contract: stable identity/kind, severity, a format-native location, spec or profile citation, and machine and human renderings derived from one model. The change must cover every in-scope conformance failure and pin the resulting JSON for the fixture corpus.
|
|
23
|
+
|
|
24
|
+
The shared schema is not yet a landed dependency. `svg_conform` issue #100 is responsible for defining it in the new zero-dependency `claricle/lens_core` gem (`LensCore`), while the EMF conformance work in issue #37 is on an unmerged feature branch. Existing SVG API and CLI reports also differ and lose fields in adaptation, so neither current SVG shape should be copied as the canonical contract.
|
|
25
|
+
|
|
26
|
+
## Scope
|
|
27
|
+
|
|
28
|
+
- Consume `LensCore` from the `claricle/lens_core` git branch published by `claricle/svg_conform#100`, then move to its released dependency when v1 freezes. Do not vendor the contract.
|
|
29
|
+
- Keep a PNG adapter around the shared model so byte offset, chunk type/index, field name, expected value, and actual value can be represented without forcing SVG line/column semantics.
|
|
30
|
+
- Give every active or documented direct-use conformance emitter a stable requirement ID, kind, default severity, and authoritative specification/profile citation; classify reachability before including non-registry source files.
|
|
31
|
+
- Carry the same diagnostic object through validation context, result building, the Ruby API, JSON/YAML, and text reporters without dropping fields.
|
|
32
|
+
- Map all 47 registered format validators—28 PNG/APNG and 19 MNG/JNG—plus shared `BaseValidator` behavior and other proven active/public emitters. Cite ISO/IEC 15948 for PNG plus the MNG 1.0 and JNG specification sections for MNG/JNG findings.
|
|
33
|
+
- Make the active reader/orchestrator path format-aware: recognize PNG, MNG, and JNG signatures, apply each format's own top-level header/data/terminator rules, and prove complete valid and invalid files without cross-format false findings.
|
|
34
|
+
- Pin deterministic structured JSON for all 180 existing PNG fixtures and a small, licensed MNG/JNG fixture set, with a reviewable, check-only regeneration workflow.
|
|
35
|
+
- Document the public Ruby and CLI schemas, compatibility behavior, location semantics, and golden update procedure.
|
|
36
|
+
|
|
37
|
+
## Exclusions
|
|
38
|
+
|
|
39
|
+
- Defining, copying, or vendoring a competing family-wide contract inside this repository.
|
|
40
|
+
- Implementing SVG, EMF, or PostScript conformance behavior in this repository.
|
|
41
|
+
- Converting CLI invocation, missing-file, dependency, or unexpected process failures into conformance findings; those remain operational errors unless the shared contract explicitly says otherwise.
|
|
42
|
+
- Changing rule semantics beyond correcting the active path's PNG-only format dispatch and top-level PNG/MNG/JNG sequence checks; auto-remediation behavior, profile policy, and pngcheck-compatible exit status otherwise remain unchanged.
|
|
43
|
+
- Wiring or migrating dormant code merely because it contains emitter-like methods. Card 02 classifies `lib/png_conform/pipelines/`, `Services::ZlibValidator`, `Validators::StreamingIdatValidator`, and the legacy private emitter helpers in `ValidationService`; sources with no registry, require/call, or documented direct-use public contract stay out of the migration.
|
|
44
|
+
|
|
45
|
+
## Intended end state
|
|
46
|
+
|
|
47
|
+
- A single immutable diagnostic value is created at the rule boundary and survives unchanged to all report formats.
|
|
48
|
+
- Its serialized shape matches the landed, versioned lens-family contract and includes stable requirement identity, kind, severity, message, structured citation, and an extensible location containing PNG-native context.
|
|
49
|
+
- Human output is rendered from that value; it does not reconstruct meaning from message text.
|
|
50
|
+
- Public report shapes add the canonical diagnostics while compatibility aliases preserve the legacy Ruby/JSON surface for one documented transition.
|
|
51
|
+
- A catalog completeness check covers every active emitter, and corpus goldens make schema, ordering, optional-field, filename, and timestamp changes review-visible.
|
|
52
|
+
|
|
53
|
+
## Cross-repository prerequisites
|
|
54
|
+
|
|
55
|
+
1. **Blocking contract prerequisite — `svg_conform#100`:** a reviewed commit must publish the zero-dependency `claricle/lens_core` gem on a consumable git branch, including field names, primitive/optional value rules, deterministic ordering, human-rendering boundary, extensible location/citation representation, and schema version. The png_conform dependency remains pinned to that branch until the LensCore v1 contract freezes; a released v1 is not required to begin this issue.
|
|
56
|
+
2. **Non-blocking family-parity check — `emf#37`:** recheck the EMF integration once it consumes LensCore and demonstrate the same common fields and serialization rules. EMF's current feature branch is useful evidence, but it neither defines nor supplies PNG's runtime contract.
|
|
57
|
+
3. PNG implementation may inventory all format rules and citations while the LensCore branch is pending, but cards 01, 03a–03c, 04, and 05 cannot be accepted against an assumed schema.
|
|
58
|
+
|
|
59
|
+
## Ordering and parallelism
|
|
60
|
+
|
|
61
|
+
1. Start card 02’s complete PNG/APNG/MNG/JNG inventory immediately.
|
|
62
|
+
2. Complete card 01 after `svg_conform#100` satisfies the blocking prerequisite.
|
|
63
|
+
3. Cards 03a and 03b depend on cards 01 and 02, and may run in parallel by validator family.
|
|
64
|
+
4. Card 03c follows the shared diagnostic APIs and both emitter conversions; it owns the reader/orchestrator format dispatch and full-file PNG/MNG/JNG integration proofs.
|
|
65
|
+
5. Card 04 follows cards 03a–03c so additive compatibility assertions exercise the final cross-format objects.
|
|
66
|
+
6. Card 05 may source and license the small MNG/JNG fixture set early, but golden generation follows card 04; perform its single reviewed regeneration only after the schema, format dispatch, and rendering policy are frozen.
|
|
67
|
+
|
|
68
|
+
## Effort
|
|
69
|
+
|
|
70
|
+
| Card | Work | Estimate |
|
|
71
|
+
| --- | --- | ---: |
|
|
72
|
+
| 01 | Shared contract and PNG adapter | 1–2 engineer-days |
|
|
73
|
+
| 02 | Requirement catalog and citation inventory | 1–2 engineer-days |
|
|
74
|
+
| 03a | PNG/APNG and service emitters | 2–3 engineer-days |
|
|
75
|
+
| 03b | MNG/JNG emitters | 1.5–2.5 engineer-days |
|
|
76
|
+
| 03c | Format-aware readers, orchestration, and full-file integration | 1.5–2.5 engineer-days |
|
|
77
|
+
| 04 | Ruby API and report migration | 1.5–2.5 engineer-days |
|
|
78
|
+
| 05 | Licensed cross-format corpus, goldens, documentation, and release gate | 1.5–3 engineer-days |
|
|
79
|
+
|
|
80
|
+
The required PNG/APNG/MNG/JNG scope totals **10–17.5 engineer-days**. The total excludes the external wait for the LensCore branch and assumes authoritative specification text and suitable redistributable MNG/JNG samples are available to the implementer.
|
|
81
|
+
|
|
82
|
+
## Project decisions
|
|
83
|
+
|
|
84
|
+
1. `claricle/lens_core` is the sole shared-contract source. png_conform consumes its git branch until v1 freezes and never vendors a local copy.
|
|
85
|
+
2. PNG, APNG, MNG, and JNG are all required. All 47 registered format validators are mapped, the active validation path dispatches their distinct signatures and top-level rules, and the golden corpus gains a small licensed MNG/JNG set alongside the 180 PNG fixtures.
|
|
86
|
+
3. Public report changes are additive. Compatibility aliases preserve the legacy surface for one documented transition; this issue does not perform a breaking replacement.
|
|
87
|
+
|
|
88
|
+
## Planning evidence
|
|
89
|
+
|
|
90
|
+
- `lib/png_conform/validators/base_validator.rb` creates context hashes with message/severity/chunk/offset.
|
|
91
|
+
- `lib/png_conform/services/result_builder.rb` drops all fields except message when building results.
|
|
92
|
+
- `lib/png_conform/models/validation_error.rb` lacks canonical requirement, citation, and location values.
|
|
93
|
+
- `lib/png_conform/models/file_analysis.rb` defines the current machine representation; `lib/png_conform/reporters/json_reporter.rb` serializes it directly.
|
|
94
|
+
- `ChunkRegistry::VALIDATOR_PATHS` has 47 registered format validators: 28 PNG/APNG and 19 MNG/JNG. `BaseValidator` is shared infrastructure outside that count; `StreamingIdatValidator` is not registered.
|
|
95
|
+
- `lib/png_conform/services/profile_manager.rb` is loaded by the public library and directly exposes profile validation. `validate_chunk_against_profile` emits unknown-profile and prohibited-chunk errors plus undefined-chunk warnings; `validate_file_against_profile` emits prohibited-present and missing-required errors. Those existing semantics must enter the canonical model while their public result keys remain available during the compatibility transition.
|
|
96
|
+
- `ValidationOrchestrator` currently accepts only the PNG signature and unconditionally requires `IHDR`, `IEND`, and `IDAT`. `StreamingReader` likewise recognizes only the PNG signature and stops only at `IEND`; format-specific BinData models establish MNG's `MHDR`/`MEND` envelope and JNG's `JHDR`/`JDAT`/`IEND` envelope.
|
|
97
|
+
- The source tree has 317 candidate diagnostic-emission call sites before reachability filtering, 47 validator specs plus base-validator and registry specs (49 files total), 180 PNG fixtures, no MNG/JNG fixtures, and no diagnostic JSON goldens.
|
|
98
|
+
- `FileAnalysis#to_h` currently emits `severity` and `message` for each error plus optional `chunk_type`, `expected`, and `actual`; `chunk_offset` and `error_type` exist as Ruby readers but are not current JSON keys.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# 01 — Adopt the shared contract behind a PNG adapter
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
|
|
5
|
+
Bind `png_conform` to the zero-dependency `claricle/lens_core` gem defined by `svg_conform#100` without copying SVG-only coordinates or coupling validators to package internals. Preserve the existing `ValidationError` entry points as additive compatibility aliases while making the shared diagnostic the source of truth.
|
|
6
|
+
|
|
7
|
+
## Work
|
|
8
|
+
|
|
9
|
+
- Declare the `lens_core` runtime dependency in `png_conform.gemspec` and pin `claricle/lens_core` to the reviewed integration branch through `Gemfile`/`Gemfile.lock` until v1 freezes. Replace the git source with the released v1 constraint at freeze; do not publish png_conform while its installable dependency is unavailable.
|
|
10
|
+
- Require LensCore directly from the dependency. Do not create a vendored or locally reimplemented shared-contract module.
|
|
11
|
+
- Add `lib/png_conform/diagnostics/location.rb` for PNG-native location data: byte offset plus optional chunk type, chunk index, and field. Its shared projection must use only the extension/context mechanism defined upstream.
|
|
12
|
+
- Add `lib/png_conform/diagnostics/citation.rb` only if the upstream contract delegates citation construction to consumers; otherwise wrap the upstream value without changing its keys.
|
|
13
|
+
- Refactor `PngConform::Models::ValidationError` to own/delegate to the shared immutable diagnostic while retaining documented severity predicates, factories, legacy readers, and `#to_s` behavior as compatibility aliases for one documented transition.
|
|
14
|
+
- Add `spec/png_conform/diagnostics/shared_contract_spec.rb` to pin schema version, primitive types, optional-field policy, location projection, stable serialization, and human rendering. Extend `spec/png_conform/models/validation_error_spec.rb` for legacy compatibility.
|
|
15
|
+
|
|
16
|
+
## Dependencies
|
|
17
|
+
|
|
18
|
+
- Blocking: `svg_conform#100` publishes the versioned LensCore schema and a consumable `claricle/lens_core` git branch.
|
|
19
|
+
- Non-blocking parity evidence: once EMF #37 consumes LensCore, its contract tests serialize the same common fields. PNG-specific location context may differ.
|
|
20
|
+
|
|
21
|
+
## Done when
|
|
22
|
+
|
|
23
|
+
- The dependency points to one reviewed LensCore branch revision, and no second family schema or vendored copy is defined locally.
|
|
24
|
+
- A PNG diagnostic round-trips stable requirement identity, kind, severity, message, citation, and byte/chunk location using JSON-safe primitives.
|
|
25
|
+
- The same object produces machine and human representations, and changing a structured field changes both applicable representations without message parsing.
|
|
26
|
+
- Existing documented `ValidationError` readers and predicates remain available as compatibility aliases for the documented transition.
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
bundle exec rspec spec/png_conform/diagnostics/shared_contract_spec.rb \
|
|
30
|
+
spec/png_conform/models/validation_error_spec.rb
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Status
|
|
34
|
+
|
|
35
|
+
State: done
|
|
36
|
+
PR: https://github.com/claricle/png_conform/pull/14
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# 02 — Catalog every rule and citation
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
|
|
5
|
+
Replace message text as the implicit rule identity with a complete, reviewable registry across PNG, APNG, MNG, and JNG. This card can begin while the upstream schema is pending.
|
|
6
|
+
|
|
7
|
+
## Work
|
|
8
|
+
|
|
9
|
+
- Add `config/diagnostics.yml`, keyed by stable requirement ID, with format, kind, default severity, specification/profile name and version, and exact section/clause citation. Keep messages/templates in the catalog only if the shared contract standardizes them there.
|
|
10
|
+
- Add `lib/png_conform/diagnostics/catalog.rb` to load and validate the registry, reject duplicate/unknown IDs, and return typed data for diagnostic construction.
|
|
11
|
+
- Inventory the 47 validators registered in `ChunkRegistry::VALIDATOR_PATHS`—28 PNG/APNG and 19 MNG/JNG—then separately inventory shared findings from `lib/png_conform/validators/base_validator.rb`, direct findings in `lib/png_conform/services/validation_orchestrator.rb` and `chunk_processor.rb`, and the public profile findings from `ProfileManager.validate_chunk_against_profile` and `ProfileManager.validate_file_against_profile` in `lib/png_conform/services/profile_manager.rb`. Inventory any other emitter only when it is proven active or covered by a documented direct-use public contract. Include active informational diagnostics in the one-model migration even though they are not failures.
|
|
12
|
+
- Trace registry membership, `require` edges, call sites, public documentation, and focused direct-use tests for non-registry sources. Record an explicit include/exclude rationale for `lib/png_conform/pipelines/`, `Services::ZlibValidator`, `Validators::StreamingIdatValidator`, and the legacy private emitter helpers in `ValidationService`. Do not wire dormant classes into production or catalog unreachable helper methods just to expand coverage; a non-registry source enters scope only when a direct-use public contract is documented and tested.
|
|
13
|
+
- Assign citations from ISO/IEC 15948 (including the applicable edition), the APNG specification, and the MNG 1.0 and JNG specifications. Profile-only policy findings cite the profile ID/version rather than inventing a normative PNG clause.
|
|
14
|
+
- Add `spec/png_conform/diagnostics/catalog_spec.rb` to prove schema validity, unique IDs, known severities/kinds/formats, citation presence, and complete coverage of the explicit emitter inventory. The inventory must fail when a new emitter lacks a catalog ID.
|
|
15
|
+
- Document non-conformance informational messages separately; do not give success/progress messages fictitious normative citations.
|
|
16
|
+
|
|
17
|
+
## Dependencies
|
|
18
|
+
|
|
19
|
+
- Access to the authoritative editions used for clause-level review.
|
|
20
|
+
- The final serializer keys wait on card 01, but stable IDs and source citations do not.
|
|
21
|
+
|
|
22
|
+
## Done when
|
|
23
|
+
|
|
24
|
+
- Every active error, warning, and conformance-information path across all 47 registered validators, shared `BaseValidator` behavior, and other proven active/public emitters has one stable catalog ID and an authoritative spec/profile citation appropriate to its format.
|
|
25
|
+
- The catalog distinguishes `ProfileManager.validate_chunk_against_profile` findings for an unknown profile, a prohibited chunk, and a chunk undefined by a profile from `validate_file_against_profile` findings for a prohibited-present chunk and a missing required chunk, with the applicable profile ID/version as the policy citation.
|
|
26
|
+
- Common helper findings remain distinguishable by violated requirement rather than collapsing to one generic length/range/CRC ID.
|
|
27
|
+
- Duplicate IDs, missing citations, unknown metadata values, and uncataloged emitters fail a focused completeness spec.
|
|
28
|
+
- The inventory records a source-backed reachability/public-contract classification for `lib/png_conform/pipelines/`, `Services::ZlibValidator`, `Validators::StreamingIdatValidator`, and the legacy `ValidationService` helper emitters so card 03a has explicit inclusion decisions and no speculative migration work.
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
bundle exec rspec spec/png_conform/diagnostics/catalog_spec.rb
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Status
|
|
35
|
+
|
|
36
|
+
State: done
|
|
37
|
+
PR: https://github.com/claricle/png_conform/pull/13
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# 03a — Convert PNG, APNG, and service emitters
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
|
|
5
|
+
Create the canonical diagnostic once at each active PNG/APNG rule boundary and carry it without metadata loss through the validation pipeline.
|
|
6
|
+
|
|
7
|
+
## Work
|
|
8
|
+
|
|
9
|
+
- Change `ValidationContext` in `lib/png_conform/validators/base_validator.rb` to collect diagnostic values instead of ad hoc hashes. Require a catalog ID at every conformance-diagnostic boundary, explicitly including informational findings; pass dynamic message data, PNG location, and expected/actual context separately.
|
|
10
|
+
- Update the 28 registered non-MNG/JNG validators under `lib/png_conform/validators/critical/`, `ancillary/`, and `apng/` to emit the cataloged requirements from card 02. Convert shared `BaseValidator` behavior separately; it is infrastructure, not a 29th registered validator.
|
|
11
|
+
- Convert the direct active unknown-critical findings in `lib/png_conform/services/chunk_processor.rb`, plus any other non-registry emitter that card 02 proves has a documented, tested direct-use public contract. Card 03c exclusively owns `ValidationOrchestrator` signature, missing-chunk, and top-level ordering findings so format dispatch is changed and tested as one unit.
|
|
12
|
+
- Migrate the active profile-policy emitter in `lib/png_conform/services/profile_manager.rb` without changing its split responsibilities. `validate_chunk_against_profile` must construct canonical diagnostics for an unknown profile, a prohibited chunk, and a chunk undefined by the profile; `validate_file_against_profile` must construct them for prohibited-present and missing-required chunks. Preserve the former method's existing `status`/`message` keys and the latter's `valid`/`errors`/`warnings` keys as compatibility projections for the documented transition; no profile finding may remain string-only internally.
|
|
13
|
+
- Keep `Services::ZlibValidator`, `Validators::StreamingIdatValidator`, and the legacy private emitter helpers in `ValidationService` out of the migration under the current source evidence: the first two have no require/call path, the streaming validator is absent from the registry, and the helper emitters are unused. Do not make them reachable as part of this issue. If card 02 finds an existing documented direct-use contract, add that source to the explicit active inventory and add a focused spec before converting it.
|
|
14
|
+
- Refactor `ResultBuilder#add_context_messages` in `lib/png_conform/services/result_builder.rb` to append each diagnostic intact. Remove severity-specific reconstruction that currently retains only `e[:message]`.
|
|
15
|
+
- Follow card 02’s reachability finding for `lib/png_conform/pipelines/`: adapt an emitter only if an existing public/reachable path is proven; otherwise record the directory as outside the active issue path. Do not create a second diagnostic pipeline by making dormant code reachable.
|
|
16
|
+
- Extend existing validator and profile-manager specs to assert IDs, citations, severity, and applicable absolute byte/chunk locations in addition to message text. In `spec/png_conform/services/profile_manager_spec.rb`, add structured assertions for unknown-profile, prohibited-chunk, and undefined-chunk results from `validate_chunk_against_profile`, plus prohibited-present and missing-required results from `validate_file_against_profile`; keep the existing success examples as preservation checks. Card 03c owns orchestrator and full-file integration assertions.
|
|
17
|
+
- Together with card 03b, make `spec/png_conform/diagnostics/emitter_coverage_spec.rb` enumerate all 47 registered validators so the agreed inventory is explicit and regression-visible.
|
|
18
|
+
|
|
19
|
+
## Dependencies
|
|
20
|
+
|
|
21
|
+
- Cards 01 and 02.
|
|
22
|
+
- Card 03b runs in parallel after the shared context/catalog APIs are merged; both emitter cards feed card 03c and are required before card 04.
|
|
23
|
+
|
|
24
|
+
## Done when
|
|
25
|
+
|
|
26
|
+
- All active PNG/APNG and shared-service errors, warnings, and conformance-information messages across the 28 registered non-MNG/JNG validators originate as canonical diagnostics with catalog IDs and citations.
|
|
27
|
+
- `ValidationContext` to `ResultBuilder` preserves diagnostic identity, location, expected/actual context, and severity exactly.
|
|
28
|
+
- CRC, unknown-critical, registered compressed-payload, and representative critical/ancillary/APNG failures each have focused structured assertions; card 03c separately proves signature and top-level sequence findings.
|
|
29
|
+
- `ProfileManager.validate_chunk_against_profile` has structured assertions for unknown-profile and prohibited-chunk errors plus an undefined-chunk warning; `ProfileManager.validate_file_against_profile` has structured prohibited-present and missing-required-chunk assertions. Every case proves stable ID, policy citation, severity, message, and the applicable profile/chunk context while preserving current compatibility keys.
|
|
30
|
+
- Dormant non-registry classes and unused `ValidationService` helper emitters are neither wired into production nor counted as migrated unless their pre-existing direct-use public contract is documented and covered by a focused spec.
|
|
31
|
+
- No active PNG/APNG conformance emitter bypasses the cataloged diagnostic constructor.
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
bundle exec rspec spec/png_conform/diagnostics/emitter_coverage_spec.rb \
|
|
35
|
+
spec/png_conform/validators/base_validator_spec.rb \
|
|
36
|
+
spec/png_conform/validators/critical \
|
|
37
|
+
spec/png_conform/validators/ancillary \
|
|
38
|
+
spec/png_conform/validators/apng \
|
|
39
|
+
spec/png_conform/services/profile_manager_spec.rb
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Status
|
|
43
|
+
|
|
44
|
+
State: done
|
|
45
|
+
PR: https://github.com/claricle/png_conform/pull/17
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# 03b — Convert MNG and JNG emitters
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
|
|
5
|
+
Apply the same contract to the other file formats that `png_conform` publicly advertises, using their own normative specifications rather than mislabeling their requirements as ISO/IEC 15948 rules.
|
|
6
|
+
|
|
7
|
+
## Work
|
|
8
|
+
|
|
9
|
+
- Update all 19 validators under `lib/png_conform/validators/mng/` and `lib/png_conform/validators/jng/` to require the stable IDs cataloged in card 02.
|
|
10
|
+
- Preserve MNG/JNG byte offsets, chunk type/index, field context, expected/actual values, severity, and format in the shared location/context projection.
|
|
11
|
+
- Extend the existing MNG/JNG validator specs with structured identity and citation assertions for representative length, field, sequence, and required-chunk failures.
|
|
12
|
+
- Add MNG/JNG emitter coverage to `spec/png_conform/diagnostics/emitter_coverage_spec.rb` so future rules cannot silently return to message-only errors.
|
|
13
|
+
|
|
14
|
+
## Dependencies
|
|
15
|
+
|
|
16
|
+
- Cards 01 and 02.
|
|
17
|
+
- Card 03a shares the context/catalog APIs and emitter-coverage spec; coordinate those files while converting the two required format families. Card 03c consumes both emitter cards and owns end-to-end format dispatch.
|
|
18
|
+
|
|
19
|
+
## Done when
|
|
20
|
+
|
|
21
|
+
- Every active MNG/JNG conformance error, warning, and information message across all 19 validators uses a stable catalog ID and the applicable MNG 1.0 or JNG specification section.
|
|
22
|
+
- Representative MNG and JNG diagnostics preserve structured format, byte/chunk location, severity, and rule identity through `ValidationResult`.
|
|
23
|
+
- The emitter completeness spec covers the MNG/JNG validator directories and fails on an uncataloged finding.
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
bundle exec rspec spec/png_conform/diagnostics/emitter_coverage_spec.rb \
|
|
27
|
+
spec/png_conform/validators/mng \
|
|
28
|
+
spec/png_conform/validators/jng
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Status
|
|
32
|
+
|
|
33
|
+
State: done
|
|
34
|
+
PR: https://github.com/claricle/png_conform/pull/16
|