fix(core): add type guards for unknown frontmatter values in URIConstructionService#2412
Merged
fix(core): add type guards for unknown frontmatter values in URIConstructionService#2412
Conversation
…ructionService frontmatter is typed as Record<string, unknown>, but extractUID and resolveOntologyURL were passing unknown values where string was expected. This broke tsc since PR #2376 and blocked all auto-releases.
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
URIConstructionService.tsthat broke CI on main since PR fix: replace console.* with ILogger in 3 core services (#2370) #2376frontmatterisRecord<string, unknown>, but values were used asstringwithout type guardstypeofchecks instead ofas stringassertions for runtime safetyRoot Cause
PR #2376 replaced
console.*withILogger— the TypeScript errors in this file went unnoticed because unit tests pass (they don't runtsc), butbuildandtypecheckCI jobs fail.Impact: All 14+ commits after PR #2376 had failing CI → Auto Release skipped every time → no releases since
v15.0.1.Changes
typeof isDefinedBy !== "string"guard before passing toextractWikiLink()uid || nullwithtypeof uid === "string" ? uid : nullfor correct narrowingTest plan
tsc --noEmit --skipLibCheckpasses (0 errors)