Skip to content

fix(validation): stop flagging every input as unknown after changing … - #400

Merged
eFAILution merged 1 commit into
eFAILution:betafrom
X-Guardian:fix/stale-unknown-input-diagnostics
Nov 17, 2026
Merged

eFAILution merged 1 commit into
eFAILution:betafrom
X-Guardian:fix/stale-unknown-input-diagnostics

Conversation

@X-Guardian

Copy link
Copy Markdown
Contributor

Summary

  • Changing a component's @ref by typing could leave every input flagged Unknown input '…' until the next edit. A validation pass started on a half-typed ref finished after the pass for the full ref and overwrote its results. The half-typed ref has no template, and the fetcher reported that as a component with no inputs.
  • Validation now discards a pass's findings if the document changed while it ran. The edit that changed the document has already scheduled a pass for the current text.
  • A ref with no template is now a not-found fetch failure, not a component with no inputs. Validation, completion and hover no longer cache a failed fetch.
  • Link related issue(s): Fixes #

Change Type

  • feat
  • fix
  • refactor
  • docs
  • test
  • chore

Context

User-facing impact

  • No false unknown-input warnings while editing a ref. After the ref is typed, the diagnostics match the inputs declared at that ref.
  • A ref that really has no template gets one warning. It shows Unable to fetch component '…' on the component: line, instead of an unknown-input warning on every input.
  • Failed fetches are retried. They are no longer cached, so the next validation, completion or hover fetches the ref again.

GitLab scope

  • gitlab.com
  • self-managed GitLab
  • both

Affected areas

  • Component Browser
  • Hover provider
  • Completion provider
  • Validation provider
  • Cache and refresh behavior (failed fetches are no longer cached)
  • GitLab API calls/auth/token storage
  • Docs only

What changed by bucket

Bucket Files Approach
Stale results src/providers/validationProvider.ts validate() records document.version before the async pass. If the version has changed by the time the findings are ready, it skips diagnosticCollection.set.
Missing template src/services/component/componentFetcher.ts On the repository route, when the project exists but no template path loads at the ref, fetchComponentMetadata throws a 404 NetworkError. The existing catch turns that into the standard placeholder with fetchFailure: { kind: 'not-found' }.
Don't cache failures src/providers/validationProvider.ts, src/providers/completionProvider.ts, src/providers/componentDetector.ts A fetched component with fetchFailure set is treated as not fetched. Validation reports a fetch failure, completion falls back to another cached version, and hover falls back to the cached-version note. None of them add it to the cache.

Behaviour details worth reviewing

  • The version guard relies on every change scheduling a pass. onDidChangeTextDocument always calls scheduleValidation, so a discarded pass is always followed by one for the newer text. Open and save don't change document.version, so their passes are never discarded.
  • MCP validation benefits too. The MCP service already turns the fetch-failure placeholder into a not-found error, so validate_* tools now report a ref with no template as a fetch failure with the 404 hint, not as unknown inputs.
  • Hover for a ref with no template. When nothing else is cached, hover now shows the placeholder's "could not fetch" description, not the project description with no inputs.
  • gitlab.example.com example URLs. A failed fetch for these now returns null, so validation falls through to the mock component, which is what the mock is for.
  • Already-cached empty entries stay. A cached component with no inputs looks the same whether the fetch failed or the component really has none, so existing entries aren't purged. Refreshing the component cache clears them.

Validation

Local checks

  • npm run compile
  • npm test (877 passing)
  • npm run lint (clean)
  • npm run test:extension-host (25 passing)
  • Manual verification in VS Code Extension Host

Manual test notes

  • Reference a component at a tag, with inputs. Retype the ref as an existing branch, pausing partway through. Check that no unknown-input warnings remain once validation finishes.
  • Reference a ref that doesn't exist. Check for one Unable to fetch component warning and no unknown-input warnings. Then correct the ref and check that the warning clears without a cache refresh.

Tests

  • tests/unit/componentFetcherUrl.test.ts: when the project exists but the ref has no template, fetchComponentMetadata returns a placeholder with fetchFailure: { kind: 'not-found', statusCode: 404 } and no inputs.
  • The stale-pass guard and the don't-cache checks live in vscode-bound providers. A regression test for the race would need to delay a fetch inside the extension host, and the bundled extension's services can't be stubbed from the test process, so they're covered by the manual notes above.

Breaking Changes

  • No breaking changes
  • Breaking changes (describe below)

Screenshots / Recordings (if UI behavior changed)

  • Before: after retyping the ref, every input under the include shows Unknown input '…' until another edit.
  • After: no diagnostics once validation finishes.

Risk and Rollback

  • Main risks: (1) a pass is discarded if the document changes while it runs, so diagnostics can take one more pass to appear during continuous typing; (2) a ref with no template is now reported as a fetch failure everywhere, including MCP tools.
  • Rollback strategy: revert the commit. No cache format change.

Release Notes Draft

  • Changing a component's version no longer flags every input as unknown until the next edit.

Checklist

  • Branch is up to date with target branch
  • Commit messages follow conventional commits
  • Added/updated docs for behavior or settings changes
  • Added/updated tests for new behavior
  • No secrets or tokens in code, logs, screenshots, or test fixtures

@X-Guardian
X-Guardian marked this pull request as ready for review November 17, 2026 17:41
@eFAILution
eFAILution changed the base branch from main to beta November 17, 2026 18:34
@eFAILution

Copy link
Copy Markdown
Owner

Switched the base to beta since that's where PRs land here, and main only takes the release PR. Beta is caught up with main, so the diff is the same.

@eFAILution
eFAILution merged commit e68c34f into eFAILution:beta Nov 17, 2026
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: changing a component version flags every input as unknown until another edit

2 participants