Skip to content

Linter diagnostics on library-defined model properties are dropped #12558

Open

Description

Bug

A linter diagnostic targeting a property declared in a library model is silently dropped when that model is used by a project operation. This is not the template-instantiation case in #11861: neither the property nor its type comes from a user-supplied template argument.

Minimal shape:

// lib.tsp
model SharedQuery {
  @query
  top?: int32;
}

// main.tsp
@route("/items")
@get
op list(...SharedQuery): string[];

A rule that reports on SharedQuery.top (for example, one checking query parameters on collection GETs) produces no diagnostic. The target's source is in the library, so the linter filters it out instead of surfacing it at the operation's use site.

Related: #1997. Concrete Azure repro: Azure/typespec-azure#6066.

Activity

  1. github-actions commented on Nov 12, 2026

    @github-actions
    Contributor

    🎯 Issue Triage

    Linter diagnostics targeting properties declared in library models are discarded even when a project operation directly uses those properties. This creates a blind spot for rules that should report actionable diagnostics at the project use site.

    Category: Bug

    Area: compiler:core

    🔗 [Playground Reproduction]((typespec.io/redacted)

    📋 Reproduction code
    // lib.tsp
    model SharedQuery {
      @query
      top?: int32;
    }
    
    // main.tsp
    @route("/items")
    @get
    op list(...SharedQuery): string[];
    🔍 Analysis

    The affected component is the compiler's linter diagnostic pipeline. The likely cause is project/library filtering based only on the diagnostic target's declaration source: SharedQuery.top is classified as library-owned, so the diagnostic is dropped without relocating or associating it with the project operation that spreads the model.

    This is related to #1997's broader request to show library diagnostics at their use site. #11861 has similar symptoms but a distinct template-instantiation path; this report covers direct use of a non-template library model. The playground preserves the reported source shape, but reproducing the source-context filtering requires placing SharedQuery in an actual library package.

    📝 Suggested next steps

    Generated by Agentic Triage

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcompiler:coreIssues for @typespec/compiler

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions