aws-samples / aws-samples/sample-autonomous-cloud-coding-agents

feat(ci): per-file type-checking in pre-commit/editor LSP (tsc --noEmit, ty check) (CA-14)

Offen
#260 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
validation-loop
Vorherrschende Sprache
TypeScript
Sterne
143
Forks
46
Ø Merge
3 T. 10 Std.
Gemergte PRs (30 T.)
24

Beschreibung

> **This is a finding from https://github.com/krokoko/cairn** (action item **CA-14**).

### Component

Tooling / CI

### Describe the feature

Add **per-file type-checking** to pre-commit / editor LSP so type errors surface at Tier 1 (per-file, on save/commit) instead of Tier 3 (the full CI `build`):

- TypeScript: `tsc --noEmit`
- Python: `ty check` (already available as a task)

### Use case

Type checking today runs primarily at CI time (T3), with only partial T1 coverage via the eslint hooks. That is the slowest, latest place to catch a type error — an agent or developer gets the signal only after a full build round-trip. Shifting type checking left to per-file (T1) tightens the inner loop and catches plausible-fabrication (AI001) calls to non-existent APIs at the moment they're written, before they reach the PR gate.

### Proposed solution

1. Add a `tsc --noEmit` pre-commit hook (prek) for changed TS files, scoped per package (`cdk`, `cli`).
2. Add a `ty check` pre-commit hook for changed Python files in `agent/`.
3. Document the recommended editor LSP setup so the same checks run live in-editor.
4. Keep the full CI type check as the authoritative gate (shift-left adds a fast loop, doesn't replace the gate).

### Acceptance criteria

- [ ] A per-file `tsc --noEmit` pre-commit hook runs on changed TS files.
- [ ] A `ty check` pre-commit hook runs on changed Python files.
- [ ] Editor LSP setup for both is documented (developer guide / CONTRIBUTING).
- [ ] The full CI type check remains the authoritative gate; hooks are additive and fast.

### Other information

Source report: `verification-strategy.md` (Shift-Left Recommendations — type checking T3→T1). Effort: **S**. Note: prek hooks are client-side and bypassable with `--no-verify`; the CI `build` check remains the authority. Per ADR-003 this issue needs the `approved` label before work begins.

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Beginne mit den bestehenden prek-Tasks und der vollständigen Type-Check-Konfiguration des CI-Builds für die Bereiche cdk, cli und agent. Lies verification-strategy.md sowie den Entwicklerleitfaden oder die CONTRIBUTING-Dokumentation, bevor du additive Hooks für geänderte TypeScript- und Python-Dateien einrichtest. Erledigt ist die Aufgabe, wenn beide dateibezogenen Prüfungen schnell ausgeführt werden, eine Anleitung für den Editor-LSP vorhanden ist und der CI-Build maßgeblich bleibt.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
python, typescript
Bereich
ci-cd, documentation, tooling
Issue-Typ
Feature
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Ruhig
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
64/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.