fix(eol): classify unknown-metadata components as UNKNOWN#30
Merged
Conversation
eol-api now always returns a metadata object per component. Unknown/
unresolvable packages return a partial object with only a reason
({ unknownReason }) instead of the historical null. deriveComponentStatus
only treated falsy metadata as UNKNOWN, so the new truthy { unknownReason }
object fell through to the isEol/eolAt logic and was silently classified
as OK ("Not EOL").
Detect the unknown reason before the isEol/eolAt logic and widen the type
surface to model the new shape:
- add UNKNOWN_REASONS / UnknownReason / UnknownComponentMetadata and the
ComponentMetadata union to src/types/eol-scan.ts, plus an isUnknownReason
guard; EolScanComponent.metadata becomes ComponentMetadata | null
(| null kept so legacy null records still resolve to UNKNOWN)
- deriveComponentStatus takes ComponentMetadata | null and returns UNKNOWN
for null or any present unknownReason, narrowing to the known metadata
shape for the existing EOL/EOL_UPCOMING/OK logic
- export UNKNOWN_REASONS and isUnknownReason from the package root
- cover the four reasons, an unrecognized reason, null, and isUnknownReason
eduardoRoth
approved these changes
Jul 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
deriveComponentStatussilently classifying unknown/unresolvable packages asOK("Not EOL") after eol-api changed the componentmetadatashape.Changes
src/types/eol-scan.ts— addUNKNOWN_REASONS,UnknownReason,UnknownComponentMetadata, theComponentMetadataunion, and anisUnknownReasonguard. WidenEolScanComponent.metadatatoComponentMetadata | null(keep| nullso legacy null records still resolve toUNKNOWN).src/eol/utils.ts— widenderiveComponentStatustoComponentMetadata | null; detect a presentunknownReasonbefore theisEol/eolAtlogic and returnUNKNOWN. Add a private type guard that narrows the known branch back toEolScanComponentMetadataso the existing EOL/EOL_UPCOMING/OK logic typechecks unchanged.src/index.ts— export the runtime valuesUNKNOWN_REASONSandisUnknownReason.src/eol/utils.test.ts— add tests for each of the four reasons →UNKNOWN, an unrecognized-but-present reason →UNKNOWN,null→UNKNOWN, the existing EOL/EOL_UPCOMING/OK cases, and a fullisUnknownReasonsuite.Testing
npm run build— passnpm run type-check(tsc --noEmit) — passnpm test— 200/200 pass (eol-scan.tsat 100% coverage)npm run format:check— clean;npm run lint(oxlint) — only pre-existing warnings inspdx-to-cdx.ts, none from this changeScreenshots
n/a
Risks & Rollback
UNKNOWNinstead ofOK— this is the fix.EolScanComponent.metadatais now a union. TS consumers that dereference known fields directly offmetadata(e.g.metadata.isEolafter only a null check) must narrow first — viaderiveComponentStatus,isUnknownReason, or an'unknownReason' in metadatacheck. Consumers routing UNKNOWN detection throughderiveComponentStatusare unaffected. Warrants a minor/major version bump.Checklist