Skip to content

chore: add .gitattributes to enforce LF line endings repo-wide#354

Merged
sethjuarez merged 11 commits into
mainfrom
fix/gitattributes-lf-normalization
Apr 19, 2026
Merged

chore: add .gitattributes to enforce LF line endings repo-wide#354
sethjuarez merged 11 commits into
mainfrom
fix/gitattributes-lf-normalization

Conversation

@sethjuarez

Copy link
Copy Markdown
Member

Problem

Without a .gitattributes, \git config core.autocrlf=true\ (the default on Windows) converts stored LF to CRLF on checkout. This caused every
pm run generate\ to produce spurious diffs (LF vs CRLF) on all generated runtime files.

The workaround was an ambiguous \git checkout -- \ cleanup step after every generate. This was fragile — applied too broadly, it would silently revert real content changes (e.g., new group exports from \model/init.py).

Fix

Add a .gitattributes\ that enforces \�ol=lf\ for all text file types repo-wide:

  • All source, config, and generated files: \ ext eol=lf\
  • Binary files (.png, .exe): \�inary\
  • Lock files: \ ext eol=lf -diff\ (normalized but not shown in diffs)

All existing tracked files have been re-normalized to LF as part of this commit.

Effect


  • pm run generate\ produces LF → \git status\ shows zero noise after generate
  • The post-generate CRLF cleanup step is no longer needed — remove it from the workflow
  • Works for all contributors regardless of their \core.autocrlf\ setting
  • CI (Linux) was already using LF — no change there

After merging

Everyone with an existing clone should run:
\
git rm --cached -r .
git reset --hard HEAD
\
to re-normalize their working tree.

sethjuarez and others added 11 commits April 17, 2026 22:06
…lidation, wire)

Add new TypeSpec model files for types specified in spec.md but not yet modeled:

- F1: Error types (InvokerError, ValidationError, FileNotFoundError) in core/errors.tsp
- F2: Tracing types (TraceValue, TraceTime, TraceSpan, TraceFile) in tracing/tracer.tsp
- F3: Streaming types (StreamOptions) in streaming/stream.tsp
- F4: Validation types (ValidationResult) in core/validation.tsp
- F5: Anthropic wire format types (content blocks, messages, request/response) in wire/anthropic-types.tsp

All types include @doc annotations and @sample examples matching the spec.
Generated code emitted to all runtimes (Python, TypeScript, Go, Rust, C#).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
… paths

- Add FileNotFoundError, InvokerError, ValidationError, ValidationResult to
  model/core/__init__.py and model/__init__.py (generated files missing exports)
- Fix 73 generated TS test files: ../../src/model/index -> ../../../src/model/index
  (wrong depth for tests in tests/model/<group>/ subdirectories, pre-existing from E1)
- Fix 5 hand-written TS tests: ../src/model/prompty.js / ../src/model/tool.js
  -> ../src/model/index.js (E1 moved files to subdirs, breaking direct imports)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Auto-fixed 21 import-block ordering errors (I001) flagged by ruff check:
- 17 test files: yaml import must follow stdlib imports with blank line separator
- _StreamOptions.py: removed unused 'field' import
- model/tracing/__init__.py, model/wire/__init__.py: alphabetized imports

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Keep consolidated index.js import (F branch has the correct fix).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Apply ruff format to new files (core, tracing, streaming, wire model files)
and corresponding test files. Resolves ruff format --check CI failures.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…issing TS model group exports

- Rename hand-written exception class InvokerError -> InvokerNotFoundException in InvokerRegistry.cs
  to avoid collision with generated TypeSpec DTO InvokerError (partial class)
- Rename Key property to InvokerKey and update 4 throw sites
- Update PipelineTests.cs: Assert.Throws<InvokerNotFoundException> and ex.InvokerKey
- Add missing wire/streaming/tracing group exports to TypeScript model/index.ts
- Add missing core group members (FileNotFoundError, InvokerError, ValidationError,
  ValidationResult) to model/core/index.ts

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
… fix docs and C# examples

- Add AnthropicWireMessage and all wire types to Python model/__init__.py
- Add StreamOptions to Python model/__init__.py
- Add TraceFile, TraceSpan, TraceTime to Python model/__init__.py
- Fix docs reference/index.md slug: 'reference/index' -> 'reference' to fix broken /reference/ links
- Fix C# docs examples: Pipeline.ParseAsync now requires context parameter (pass null)
- Fix C# docs examples: Message.Role is now Role enum, not string; use Role.System/Role.User

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
xUnit runs test classes in parallel by default. PromptyLoadsTests and
ChatTests both mutate OPENAI_API_KEY, causing ChatBasic_InvokeAsync_With
MockedExecutor to race and see a null env var. Adding [Collection]
serializes the two classes without changing logic.

Also commit the ruff isort fix for model/__init__.py (I001).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Without .gitattributes, git's core.autocrlf=true on Windows converts
stored LF to CRLF on checkout. This caused generated files to appear
modified after every 'npm run generate', requiring an ambiguous
'git checkout -- unintended CRLF drift' cleanup step that was easy
to apply too broadly and accidentally revert real content changes.

With this file:
- All text files are stored and checked out as LF on all platforms
- 'npm run generate' produces LF, git sees no diff → zero noise
- The post-generate CRLF cleanup step is no longer needed

Re-normalized all existing tracked files as part of this commit.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
dotnet format on Windows defaults to CRLF line endings. After
.gitattributes normalizes all files to LF, dotnet format --verify-no-changes
fails on the Windows CI runner because it wants \r\n.

Adding a repo-root .editorconfig with end_of_line = lf makes dotnet
format consistent with the .gitattributes LF policy on all platforms.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@sethjuarez
sethjuarez merged commit 5b7c5e1 into main Apr 19, 2026
26 checks passed
@sethjuarez
sethjuarez deleted the fix/gitattributes-lf-normalization branch June 9, 2026 19:50
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.

1 participant