Skip to content

LSP: analysis snapshot shared by every provider (specs/lsp/analysis.t27) #12215

Closed

Description

@gHashTag

One immutable analysis result per document version, built once and read by every provider. No provider parses on its own. This is the layer that wraps the compiler passes the language server needs (parse, analyze, typecheck, lint, outline). Part of the LSP epic, Refs #12209 (wave 0, foundation). Only .t27: no code in any other language, not even scratch probes or a loader; see skill only-t27.

If the compiler passes do not return source spans (line and column) for tokens, nodes and diagnostics, that is a compiler gap: file it on #5980 with a minimal .t27 repro and park the dependent part of this issue. Do not re-implement a parser here.

Prior art:

Boundary

  • specs/lsp/analysis.t27

User Scenarios

  • Given a document at version 7, when a snapshot is built, then it holds the token list with spans, the syntax tree with spans, the use list, the outline, and the parse, type and lint diagnostics, all tagged (uri, 7).
  • Given the same text analysed twice, when the snapshots are compared, then they are equal, and the diagnostics match what t27c check reports for that text.
  • Given a snapshot for version 7 and a store now at version 8, when a provider asks whether it is current, then the answer is stale.
  • Given a cancellation arrives while a snapshot is being built, when the next checkpoint is reached, then the build stops and returns cancelled without a partial snapshot.

Requirements

  • FR-001: The module MUST define Snapshot with uri, version, tokens, syntax tree, use list, outline, and a typed diagnostics list (code, severity, range, source, message, optional related information, optional rule id).
  • FR-002: The module MUST build a snapshot from document text alone, without reading the file system, and MUST be deterministic.
  • FR-003: The module MUST expose is_current(snapshot, version) and cancellation checkpoints between passes.
  • FR-004: Every diagnostic MUST carry the same code and message as the corresponding compiler pass, so that t27c check output and published diagnostics cannot disagree; the test compares them on 5 specs from specs/ with known errors.
  • FR-005: Providers MUST receive the snapshot as an argument; the module MUST NOT export a parse function other than the one that builds a snapshot.

Success Criteria

  • At least 15 tests in specs/lsp/analysis.t27 pass, run on the lab with t27c test-report (exit 0), including one spec with a syntax error, one with a type error and one with a lint finding.
  • Building the snapshot for the largest spec under specs/lsp/ takes under 200 ms on the lab; the measurement and its command are pasted in the issue.
  • git diff --name-only master lists only specs/lsp/analysis.t27 (0 files in other languages).

Activity

  1. added
    enhancementNew feature or request
    area/specs.t27 spec files and conformance
    P1Queen takes before unlabelled work (priority.t27 HIGH)
    on Oct 25, 2026
  2. gHashTag commented on Nov 17, 2026

    @gHashTag
    CollaboratorAuthor

    Spec created for this issue (typecheck OK, tests pass).

  3. gHashTag commented on Nov 17, 2026

    @gHashTag
    CollaboratorAuthor

    Spec exists and passes typecheck + tests. M9 milestone complete.

  4. gHashTag commented on Nov 18, 2026

    @gHashTag
    CollaboratorAuthor

    Reopened: closed as spec-only. A .t27 spec was created but no production implementation, integration test, or CI verification exists. This issue remains open until the target component implements the specified behavior and evidence is provided.

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

    P1Queen takes before unlabelled work (priority.t27 HIGH)area/specs.t27 spec files and conformanceenhancementNew feature or requestspec

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions