Detect references to removed versioned types - #11925
Open
Sylvester Kaczmarek (sylvesterkaczmarek) wants to merge 1 commit into
Open
Detect references to removed versioned types#11925Sylvester Kaczmarek (sylvesterkaczmarek) wants to merge 1 commit into
Sylvester Kaczmarek (sylvesterkaczmarek) wants to merge 1 commit into
Conversation
|
Azure Pipelines: Successfully started running 1 pipeline(s). 1 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Copilot started reviewing on behalf of
Sylvester Kaczmarek (sylvesterkaczmarek)
September 10, 2026 11:01
View session
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The change is narrowly scoped, adds a targeted regression test, and includes the required .chronus fix entry.
Pull request overview
This PR fixes a gap in @typespec/versioning reference validation by reporting a diagnostic when a referencing type remains available across a version boundary where the referenced type is removed, preventing dangling $refs in versioned outputs.
Changes:
- Extend
validateAvailabilityForRefto emitincompatible-versioned-reference(doesNotExist) at the referenced-type removal boundary when the referrer remains available. - Add a regression test covering the “target removed while referrer remains available” scenario.
- Add a
.chronusfixentry for@typespec/versioning.
File summaries
| File | Description |
|---|---|
| packages/versioning/src/validate.ts | Adds a new diagnostic branch to catch references to types removed while the source remains available. |
| packages/versioning/test/incompatible-versioning.test.ts | Adds a regression test asserting the new diagnostic message for the removed-target case. |
| .chronus/changes/fix-removed-reference-validation-2026-09-10.md | Adds a changelog entry documenting the fix in @typespec/versioning. |
Review details
- Files reviewed: 3/3 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Sylvester Kaczmarek (sylvesterkaczmarek)
force-pushed
the
fix/11807-removed-reference
branch
from
September 12, 2026 17:11
47cfee8 to
97a14e3
Compare
Copilot started reviewing on behalf of
Sylvester Kaczmarek (sylvesterkaczmarek)
September 12, 2026 17:12
View session
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Validation still has unresolved cases for re-added and non-present targets.
Get a fresh assessment by requesting another Copilot review.
Review details
Suppressed comments (1)
packages/versioning/src/validate.ts:853
- This only handles
targetVal === Availability.Removed, but cross-namespace dependency maps are translated at the source keys intranslateAvailability; a source version can jump from a target version before the removal directly to one after it, so the translated value isAvailability.Unavailableand no key is everRemoved. If the source is alreadyAvailableat that key, the existingAddedcheck also does not fire, leaving the dangling reference undiagnosed. Please cover both non-present states and emit only at the first transition after the target removal.
sourceVal === Availability.Available &&
targetVal === Availability.Removed &&
findAvailabilityAfterVersion(key, Availability.Removed, sourceAvail) === undefined
- Files reviewed: 3/3 changed files
- Comments generated: 1
- Review effort level: Lite
Comment on lines
+850
to
+854
| if ( | ||
| sourceVal === Availability.Available && | ||
| targetVal === Availability.Removed && | ||
| findAvailabilityAfterVersion(key, Availability.Removed, sourceAvail) === undefined | ||
| ) { |
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.
Fixes #11807.
Report a dangling versioned reference when the target is removed while the source remains available. The check fires at the target removal boundary and preserves the existing removed-before diagnostic when the source is removed later.
Tests: