Add post-filter FBC invariant validators#30
Conversation
Replace plain string fields in the FBC output types with structured types that enforce format invariants at construction time: - Version.Name: string → MajorMinor (uint64 Major/Minor, regex-validated) - Phase.StartDate/EndDate: string → *Date (wraps time.Time, YYYY-MM-DD) - Platform.Versions: []string → []MajorMinor Translation functions (translatePhase, translateVersion, newPackage) now return errors instead of silently passing through malformed data. Errors are collected with errors.Join (no fail-fast) and surfaced as validation failures. Empty timestamps and "N/A" translate to nil *Date (not an error). This enforces the FBC lifecycle contract — the schema that downstream consumers depend on — which is separate from the PLCC validation policy that governs data quality in the upstream source. PLCC validators check whether product lifecycle data meets content policy (tier requirements, date contiguity, release cadence, etc.); the FBC type layer ensures the output schema is well-formed by construction regardless of which PLCC validators are enabled. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Reject packages where: - no versions exist - any version has no phases - any phase has nil start or end date - phases within a version are not contiguous (endDate+1 != next startDate) These run after mutation filters and cannot be disabled. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
🤖 Finished Review · ✅ Success · Started 8:53 PM UTC · Completed 9:06 PM UTC |
ReviewFindingsHigh
Medium
Low
Labels: PR modifies FBC package types and validators; documentation is stale |
| // Version represents an operator version with its lifecycle phases and platform compatibility. | ||
| type Version struct { | ||
| Name string `json:"name"` | ||
| Name MajorMinor `json:"name"` |
There was a problem hiding this comment.
[medium] breaking-api
Exported struct field types changed (Version.Name, Phase.StartDate/EndDate, Platform.Versions) from string types to structured types. Breaking Go API change; JSON wire format preserved. Pre-v1 module.
Suggested fix: Document the Go API breaking changes in the PR description or a changelog.
| for _, v := range product.Versions { | ||
| pkg.Versions = append(pkg.Versions, translateVersion(v)) | ||
| fv, err := translateVersion(v) | ||
| if err != nil { |
There was a problem hiding this comment.
[low] edge-case
newPackage uses all-or-nothing semantics for version translation. If any version fails, all successfully-translated versions are discarded. Consistent with existing PLCC validation patterns.
Summary
EqualandNextDaymethods to theDatetype for contiguity checkingThis PR is stacked on top of #29 (the structured FBC types commit). The relevant commit to review is the second one.
Test plan
make test)Generated with Claude Code