Skip to content

Add offline codegen drift check + fleet --pull=always lint tasks#264

Merged
ptr727 merged 5 commits into
developfrom
conformance/codegen-drift-check
Jul 12, 2026
Merged

Add offline codegen drift check + fleet --pull=always lint tasks#264
ptr727 merged 5 commits into
developfrom
conformance/codegen-drift-check

Conversation

@ptr727

@ptr727 ptr727 commented Jul 12, 2026

Copy link
Copy Markdown
Owner

Closes #259.

Offline codegen drift check

Adds a deterministic, offline codegen drift guard that runs on every PR, so a regression in the code-emitting tooling (SaveCodeAsync / SaveJsonAsync / GetCodeGenString) is caught on the PR that introduces it rather than deferred to the next upstream-triggered codegen run.

  • Split download from generate in LanguageTagsCreate. New --skip-download (-s) option regenerates from the already-committed LanguageData/ directory with no network access. DownloadDataAsync is refactored so path resolution is shared (ResolveDataFilePaths); UseExistingData resolves the same paths and verifies each source file is present. Program.ExecuteAsync branches on the flag.
  • New codegen-drift job in validate-task.yml: regenerate offline (--skip-download), run the same dotnet csharpier format the codegen workflow uses, then git diff --exit-code. It fails when regenerated output drifts from the committed *DataGen.cs / *.json (i.e. an emitter or committed source-data change was not regenerated in the same PR) and passes when they match. It is strictly offline, so upstream registry drift can never trip it — refreshing from upstream stays the scheduled run-codegen-pull-request-task.yml job. Because test-pull-request reuses validate-task, this runs on every push with no dependency on upstream availability. Actions SHA-pinned consistent with the existing workflows.
  • AGENTS.md documents the contributor workflow: if you change an emitter or the committed source data, regenerate offline and commit both the change and the regenerated files in the same PR.

Acceptance criteria

  • Generate-only mode exists and needs no network — done (--skip-download).
  • PR job fails when regenerated output differs from committed files; passes when they match — done (git diff --exit-code after offline regen + format; failure path verified locally).
  • No dependency on upstream data availability or content — done (strictly offline).
  • Contributor workflow documented in AGENTS.md — done.

Fleet --pull=always

.vscode/tasks.json: --pull=always inserted after --rm in each Docker Lint task (editorconfig-checker, actionlint, markdownlint-cli2, cspell) so local runs always pull the :latest linter image. JSONC valid, CRLF preserved.

Validation

  • dotnet build clean (warnings-as-errors), dotnet test 310 passed / 0 failed.
  • Offline regen + dotnet csharpier format . reproduces the committed LanguageTags/*DataGen.cs and LanguageData/*.json exactly (git diff shows only the intended source edits).
  • Drift failure path confirmed: a stray change to a generated file makes git diff --exit-code exit non-zero.
  • csharpier check, dotnet format style --verify-no-changes, actionlint, and markdownlint all clean.
  • No LanguageData/ data file hand-edited; EOL preserved throughout.

Closes #259.

Codegen drift check (offline, deterministic):
- LanguageTagsCreate gains a --skip-download (-s) option that regenerates the
  embedded data from the already-committed LanguageData/ directory with no
  network access. DownloadDataAsync is split so path resolution is shared;
  UseExistingData resolves the same paths and verifies each source file exists.
- validate-task.yml gains a codegen-drift job: regenerate offline, run the same
  CSharpier the codegen workflow uses, then git diff --exit-code. It fails when
  an emitter or committed source-data change was not accompanied by a
  regeneration in the same PR, and is strictly offline so upstream registry
  drift can never trip it (refreshing from upstream stays the scheduled codegen
  workflow's job). Because test-pull-request reuses validate-task, this runs on
  every push and produces no dependency on upstream availability.
- AGENTS.md documents the contributor workflow: change an emitter or the
  committed source data, regenerate offline, and commit both in the same PR.

Fleet lint change:
- .vscode/tasks.json: add --pull=always after --rm to each Docker Lint task so
  local runs always pull the :latest linter image.

Verified: dotnet build clean (warnings-as-errors), dotnet test 310 passed,
offline regen + csharpier reproduces the committed *DataGen.cs / *.json exactly
(git diff clean), csharpier/format-style/actionlint/markdownlint all clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 12, 2026 03:39
@codecov

codecov Bot commented Jul 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.43%. Comparing base (e1233f1) to head (db2b85c).

Additional details and impacted files
@@           Coverage Diff            @@
##           develop     #264   +/-   ##
========================================
  Coverage    87.43%   87.43%           
========================================
  Files           11       11           
  Lines         1973     1973           
  Branches       243      243           
========================================
  Hits          1725     1725           
  Misses         166      166           
  Partials        82       82           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an offline (“no upstream registry download”) codegen path to the LanguageTagsCreate tool and wires a deterministic drift check into PR validation so emitter/source-data changes must regenerate and commit outputs in the same PR. Also updates local VS Code Docker lint tasks to always pull the latest linter images.

Changes:

  • Add --skip-download (-s) to regenerate from committed LanguageData/ without network fetches.
  • Add a codegen-drift job to validate-task.yml that runs offline regen + CSharpier format and then checks for diffs.
  • Document the offline-regeneration workflow in AGENTS.md and update VS Code lint tasks to use docker run --pull=always.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
LanguageTagsCreate/Program.cs Branches execution between online download and offline “use existing data” mode.
LanguageTagsCreate/CreateTagData.cs Refactors path resolution and adds UseExistingData() validation for offline regeneration.
LanguageTagsCreate/CommandLine.cs Introduces the --skip-download CLI option and plumbs it into options parsing.
.github/workflows/validate-task.yml Adds the codegen-drift PR job (offline regen + format + drift detection).
AGENTS.md Documents the contributor workflow for offline regeneration when emitters/data change.
.vscode/tasks.json Forces local Docker-based lint tasks to always pull :latest images.

Comment thread .github/workflows/validate-task.yml Outdated
git diff --exit-code ignores untracked files, so a brand-new emitted output file
would slip through. Add a git status --porcelain check to catch it.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 12, 2026 03:45

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Comment thread AGENTS.md Outdated
…iner

CSharpier is a local dotnet tool, so a fresh clone needs 'dotnet tool restore' first.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 12, 2026 03:49

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Comment thread .github/workflows/validate-task.yml Outdated
…atch

git diff --exit-code prints the full patch, which for generated data files (multi-MB
*DataGen.cs) floods the Actions log. A git status --porcelain check covers both tracked
modifications and untracked files; print it plus a diffstat instead.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 12, 2026 03:54

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Comment thread .github/workflows/validate-task.yml
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 12, 2026 03:58

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.

@ptr727
ptr727 merged commit 76e42b5 into develop Jul 12, 2026
14 checks passed
@ptr727
ptr727 deleted the conformance/codegen-drift-check branch July 12, 2026 04:01
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.

2 participants