@guanlin4924/devflow-pi 0.1.54 → 0.1.55
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.
package/package.json
CHANGED
|
@@ -92,10 +92,16 @@ module RequirementCoverage
|
|
|
92
92
|
end
|
|
93
93
|
end
|
|
94
94
|
|
|
95
|
+
disposition_ids = {}
|
|
95
96
|
disposition_by_id = {}
|
|
96
97
|
Array(coverage["units"]).each do |entry|
|
|
98
|
+
unless entry.is_a?(Hash)
|
|
99
|
+
add(errors, "COVERAGE_UNIT_SCHEMA_INVALID", "coverage unit must be a mapping")
|
|
100
|
+
next
|
|
101
|
+
end
|
|
97
102
|
unit_id = entry["unit_id"].to_s
|
|
98
|
-
duplicate(errors,
|
|
103
|
+
duplicate(errors, disposition_ids, unit_id, "DUPLICATE_COVERAGE")
|
|
104
|
+
disposition_by_id[unit_id] ||= entry
|
|
99
105
|
add(errors, "UNIT_REF_NOT_FOUND", "coverage references an unknown unit", unit_id: unit_id) unless unit_by_id.key?(unit_id)
|
|
100
106
|
disposition = entry["disposition"]
|
|
101
107
|
unless disposition.is_a?(Hash) && %w[active deferred out_of_scope merged].include?(disposition["kind"].to_s)
|
|
@@ -138,17 +144,29 @@ module RequirementCoverage
|
|
|
138
144
|
add(errors, "SOURCE_UNITS_SCHEMA_INVALID", "source_units schema_version must be 1") unless source["schema_version"].to_i == 1
|
|
139
145
|
add(errors, "SOURCE_UNITS_NOT_CORE_GENERATED", "source_units must be produced by Core") unless source["produced_by"].to_s == "core.source_unitizer/v1"
|
|
140
146
|
add(errors, "SOURCE_UNITS_SCHEMA_INVALID", "source_document_fingerprint is required") if source["source_document_fingerprint"].to_s.empty?
|
|
141
|
-
|
|
147
|
+
unless source["units"].is_a?(Array)
|
|
148
|
+
add(errors, "SOURCE_UNITS_SCHEMA_INVALID", "units must be an array")
|
|
149
|
+
return
|
|
150
|
+
end
|
|
142
151
|
Array(source["units"]).each do |unit|
|
|
152
|
+
unless unit.is_a?(Hash)
|
|
153
|
+
add(errors, "SOURCE_UNIT_SCHEMA_INVALID", "source unit must be a mapping")
|
|
154
|
+
next
|
|
155
|
+
end
|
|
143
156
|
add(errors, "UNIT_SCHEMA_INVALID", "stable_unit_id is required") if unit["stable_unit_id"].to_s.empty?
|
|
144
157
|
add(errors, "SOURCE_UNIT_REUSED_STALE", "unit source fingerprint mismatch", unit_id: unit["stable_unit_id"]) unless unit["source_document_fingerprint"].to_s == source["source_document_fingerprint"].to_s
|
|
145
158
|
add(errors, "EXCERPT_MODIFIED", "excerpt fingerprint mismatch", unit_id: unit["stable_unit_id"]) if unit["excerpt_fingerprint"] && sha(unit["excerpt"]) != unit["excerpt_fingerprint"].to_s
|
|
159
|
+
unless unit["required_assertions"].is_a?(Array) && unit["required_assertions"].all? { |assertion| assertion.is_a?(Hash) }
|
|
160
|
+
add(errors, "SOURCE_UNIT_SCHEMA_INVALID", "required_assertions must be an array of mappings", unit_id: unit["stable_unit_id"])
|
|
161
|
+
end
|
|
146
162
|
end
|
|
147
163
|
end
|
|
148
164
|
|
|
149
165
|
def validate_coverage(coverage, errors)
|
|
150
166
|
add(errors, "COVERAGE_SCHEMA_INVALID", "coverage schema_version must be 1") unless coverage["schema_version"].to_i == 1
|
|
151
167
|
%w[claims units].each { |key| add(errors, "COVERAGE_SCHEMA_INVALID", "#{key} must be an array") unless coverage[key].is_a?(Array) }
|
|
168
|
+
Array(coverage["claims"]).each { |claim| add(errors, "CLAIM_SCHEMA_INVALID", "claim must be a mapping") unless claim.is_a?(Hash) }
|
|
169
|
+
Array(coverage["units"]).each { |unit| add(errors, "COVERAGE_UNIT_SCHEMA_INVALID", "coverage unit must be a mapping") unless unit.is_a?(Hash) }
|
|
152
170
|
end
|
|
153
171
|
|
|
154
172
|
def compare(assertion, inherited)
|
package/src/constants.ts
CHANGED