Introduce structured FBC types: MajorMinor and Date#29
Conversation
|
🤖 Finished Review · ✅ Success · Started 8:08 PM UTC · Completed 8:23 PM UTC |
Review — ApprovePR: Introduce structured FBC types: MajorMinor and Date SummaryThis PR replaces plain string fields in FBC output types with structured CorrectnessType safety and nil-dereference safety are sound. In Error aggregation works correctly.
Sorting migrated correctly. The Schema and serializationJSON output format is preserved. YAML output works via JSON round-tripping. Since
Test coverageTests are comprehensive and well-structured:
DesignThe architectural separation is clean: PLCC validators enforce data quality policy (content requirements like date contiguity, tier rules), while the FBC type layer enforces structural schema invariants (version format, date format). These are genuinely independent concerns — a product can pass PLCC validation but have an unparseable timestamp format in a formula cell, and vice versa. The No issues foundNo correctness, security, or style issues were identified that require changes.
Previous runReviewFindingsHigh
Medium
Low
Previous run (2)ReviewFindingsHigh
Medium
Low
Labels: PR introduces new structured types and changes exported API surface, qualifying as an enhancement. |
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>
5497c67 to
0056b34
Compare
|
🤖 Finished Review · ✅ Success · Started 8:55 PM UTC · Completed 9:09 PM UTC |
|
(rebased on main) |
|
/fs-review |
|
🤖 Finished Review · ✅ Success · Started 5:24 PM UTC · Completed 5:29 PM UTC |
Superseded by updated review
There was a problem hiding this comment.
This PR adds a second filtering layer during FBC conversion:
- PLCC validation
- FBC conversion + type enforcement (new)
now step 2) may fail.
This is causing the current tests with the reference PLCC data on the --split value to fail as with PR 27 we relaxed the filters on OCP versions MAJOR.MINOR for older operators and we are now failing during FBC conversion.
I would say this is a real failure: i.e., we want to enforce syntax here and the PLCC filters should enforce and catch this (this is syntax based). Otherwise we have to adapt the tests and expect this failure to happen (so that we are sure FBC catches it).
We have to drop the panic() before merging.
We may also consider using direct Date types instead of pointers.
| Name string `json:"name"` | ||
| StartDate string `json:"startDate"` | ||
| EndDate string `json:"endDate"` | ||
| StartDate *Date `json:"startDate,omitempty"` |
There was a problem hiding this comment.
We are enforcing types now in FBC.
Why don't we drop the pointer here and the "omitempty" as well?
We don't really have to disambiguate date "0" and no date and we are going to enforce we have dates for the phases. We are going to enforce the type, using a Date type here would be more straightforward.
| validPackages := make([]*Package, 0, len(products)) | ||
| for _, product := range products { | ||
| pkg := newPackage(product) | ||
| pkg, err := newPackage(product) |
There was a problem hiding this comment.
Previously, the newPackage could not fail.
Now we are introducing FBC side checking enforcing types.
This is an error that should be reported as an error.
In this function, the FBC filters were mutating ones only, so there was only the need to log the mutation.
Now we are enforcing filters and we can error, we must report back errors.
|
|
||
| // MajorMinor represents a version string in MAJOR.MINOR format. | ||
| type MajorMinor struct { | ||
| Major uint64 |
There was a problem hiding this comment.
nit: why uint64 and not just uint?
| return nil, fmt.Errorf("invalid version %q; expected <major>.<minor>", s) | ||
| } | ||
| if len(matches) != 3 { | ||
| panic("programmer error: expected 2 submatches") |
There was a problem hiding this comment.
This is a library, should not panic!
Summary
MajorMinorandDatetypes that enforce format invariants at construction timeVersion.NameandPlatform.VersionsuseMajorMinor(regex-validated, no leading zeros);Phase.StartDate/EndDateuse*Date(nil = no date)errors.Join) instead of silently passing through malformed data; empty and "N/A" timestamps translate to nilTest plan
make testpassesGenerated with Claude Code