Adds copilot-cli prompts for migration work

This commit is contained in:
torsten committed 2026-08-18 10:26:12 +02:00
1 parent 4cd1a76c35
commit ab94e9fd61
2 files changed
+406

No files matched your search

@@ -0,0 +1,167 @@
# GitHub Copilot Instructions: Qt5/C++11 to Qt6/C++23 Migration
## Mission
Migrate the legacy Qt5/C++11 desktop application to Qt6/C++23, preserve behavior unless change is strictly required, and validate the result completely in the repository’s Docker-based CI workflow.
## Operating Mode
- Work autonomously from analysis through validation.
- Do not stop after editing code.
- Continue until configure, build, tests, and policy checks have been attempted in Docker.
- Do not ask for confirmation during normal implementation.
- Stop early only if required source material is missing, the task is impossible, or a destructive action would be required.
## Boundaries
- Read the legacy project from `${PROJECT_DIR}/qt5-before/qt5-legatus-legacy`.
- Write the migrated project to `${PROJECT_DIR}/qt6-after/qt6-migrated-legatus`.
- Do not modify the legacy source tree in place.
- Limit changes to the target tree and only the CI/build/test files needed to support migration and validation.
## Main Migration Targets
- Upgrade Qt5 to Qt6.
- Upgrade C++11/14/17 code to C++23.
- Keep Qt Core, Gui, and Widgets explicitly linked.
- Replace `QRegExp` with `QRegularExpression`.
- Replace `QDesktopWidget` and `QApplication::desktop()` with `QScreen`-based Qt6 APIs.
- Remove legacy `QTextCodec` usage and adopt Qt6-safe text handling.
- Replace old `SIGNAL`/`SLOT` syntax with function-pointer connect syntax.
- Replace `0`/`NULL` pointer literals with `nullptr`.
- Preserve `.ui` and `.qrc` integration.
- Preserve behavior unless Qt6 compatibility requires adaptation.
## C++23 Modernization Rules
- Preserve semantics first; modernize second.
- Use `auto` when the type is obvious; avoid it when it hides important type information.
- Prefer structured bindings where clearer.
- Replace raw owning pointers/manual `delete` with RAII, usually `std::unique_ptr`.
- Use `std::make_unique` / `std::make_shared`; use `std::shared_ptr` only for real shared ownership.
- Use `std::string_view` only when lifetime safety is clear.
- Prefer `std::span` for non-owning contiguous data; use `std::mdspan` only when multidimensional access clearly benefits.
- Prefer `.contains()` over `find(...) != end()` where available.
- Prefer algorithms and ranges over manual loops when readability improves.
- Use `[[nodiscard]]` when ignoring a result is likely a bug.
- Prefer early returns over deeply nested control flow.
- Use `std::optional` monadic operations (`and_then`, `transform`, `or_else`) when clearer.
- Prefer `constexpr`, `if constexpr`, concepts, and `requires` over legacy `std::enable_if`/SFINAE where practical.
- Add `noexcept`, `override`, `final`, `= default`, and `= delete` where correct and useful.
- Prefer `enum class` over unscoped enums where practical.
- Prefer `std::print` / `std::println` when supported by the toolchain.
- Prefer typed `std::chrono` durations and `std::jthread` where appropriate.
## Safety Rules
- Do not change business logic unless explicitly requested or required for Qt6 compatibility.
- Do not introduce unsupported Qt6/C++23 features.
- Do not silently change ABI, ownership, lifetime, exception behavior, performance, UI behavior, or event ordering.
- Do not worsen readability for the sake of modernization.
- Do not refactor code.
- Avoid dangling references, dangling `std::string_view`, and ownership ambiguity.
- Keep includes minimal and preserve repository-local formatting/style.
- no code cleanup
- no renaming
- no extraction of functions/classes
- no restructuring of logic
- no stylistic rewrites
- no dependency modernization
- no opportunistic improvements
- no behavior changes beyond path/build necessity
## Tests
- For every code change inside a method, add at least three tests covering the changed behavior.
- Place generated tests in `${PROJECT_DIR}/qt6-after/qt6-migrated-benchmark/tests`.
- Use policy-compatible test filenames such as:
- `test_<name>.cpp`
- `<name>_test.cpp`
- `<name>test.cpp`
- `<name>gtest.cpp`
as searched for in `${PROJECT_DIR}/ci/check_pr_policies.py`
- Update CMake so the migrated app and all tests build and run with CTest.
- Ensure all tests are registered with CTest.
## Docker-First Validation
Use `lifemaps/ci-cpp:latest` as the authoritative environment. Do not substitute host tools for missing container tools. Treat `${PROJECT_DIR}/ci/Dockerfile.ci` as the source of truth for CI dependencies.
### Required validation sequence
1. Configure in Docker
2. Build in Docker
3. Run tests in Docker
4. If tests pass, run `python3 ci/check_pr_policies.py` in Docker
### Recommended commands
- Configure:
`cmake -S ${PROJECT_DIR}/qt6-after/qt6-migrated-benchmark -B build -G Ninja -DCMAKE_BUILD_TYPE=Debug`
- Build:
`cmake --build build --parallel`
- Test:
`ctest --test-dir build --output-on-failure`
- Policy:
`python3 ${PROJECT_DIR}/ci/check_pr_policies.py`
Adapt paths/flags only if repository inspection proves they must differ.
## Missing-Tool Remediation
If Docker validation fails because a required tool/package is missing:
- identify the exact missing dependency
- update `${PROJECT_DIR}/ci/Dockerfile.ci` minimally
- rebuild `lifemaps/ci-cpp:latest`
- rerun the full validation sequence
Continue until:
- validation succeeds, or
- the next blocker is a genuine project/code issue
## Failure Classification
Environment failures:
- command not found
- missing compiler/toolchain utility
- missing Qt dev package
- missing CMake/Ninja/CTest support tool
- missing dependency required by `${PROJECT_DIR}/ci/check_pr_policies.py`
Project failures:
- compile errors
- linker errors
- failing tests
- formatting/policy failures caused by migration changes
## Policy Awareness
- `${PROJECT_DIR}/ci/check_pr_policies.py` checks formatting for changed C/C++ files, expects related tests, and verifies commit-signature conditions in its diff range.
- Ensure Docker validation runs with mounted workspace and git metadata available.
- Do not claim success unless the policy script passes.
## Execution Plan
1. Inspect `${PROJECT_DIR}` and the target tree.
2. Identify Qt5 and legacy C++ constructs to migrate.
3. Migrate incrementally in `qt6-after/qt6-migrated-benchmark`.
4. Add/update tests with each behavior-relevant change.
5. Update CMake/test registration.
6. Validate in Docker.
7. If missing dependencies are found, update `${PROJECT_DIR}/ci/Dockerfile.ci`, rebuild, and rerun.
8. Repeat until success or a real project defect remains.
## Reporting
Group change explanations by:
- CMake / build-system migration
- Qt API replacements
- C++ modernization
- UI/resource preservation
- tests added
- `${PROJECT_DIR}/ci/Dockerfile.ci` / container updates
Also provide a concise changed-files summary.
## Completion Criteria
Success requires:
- migrated project exists under `${PROJECT_DIR}/qt6-after/qt6-migrated-benchmark`
- configure succeeds in Docker
- build succeeds in Docker
- tests succeed in Docker
- `python3 ci/check_pr_policies.py` succeeds in Docker after tests pass
## Final Response
- State whether migration is fully validated or which blocker remains.
- List the exact Docker commands used for image rebuild, configure, build, test, and policy check.
- For every failed attempt, include:
- exact command
- key error
- environment vs project classification
- fix applied
- End with a short summary of any remaining blocker.
+239
View File
@@ -0,0 +1,239 @@
Du arbeitest in einem bestehenden C++/Qt-Projekt, das von Qt5 nach Qt6 migriert wird. Deine Aufgabe ist, die Build- und CI/CD-Infrastruktur technisch sauber und robust an eine neue Verzeichnisstruktur anzupassen. Fokus: Linux/Ubuntu 26.04, CMake, Dockerfile, Shell-Skripte und CI-Pipeline.
## Ausgangslage
Die Repository-/Build-Struktur wurde geändert:
- Die bisherigen Folder und Files:
```
drwxrwxrwx 2 torsten torsten 4096 Jul 17 17:03 cmake/
-rwxrwxrwx 1 torsten torsten 15357 Jul 22 12:32 CMakeLists.txt*
-rw-rw-rw- 1 torsten torsten 92 Jul 14 13:55 CTestCustom.ctest
drwxrwxrwx 2 torsten torsten 4096 Jul 14 14:12 doxygen/
-rw-rw-rw- 1 torsten torsten 0 Aug 13 19:33 .gitkeep
drwxrwxrwx 8 torsten torsten 4096 Jul 21 15:43 Lts/
-rw-rw-rw- 1 torsten torsten 14908 Jul 21 15:45 lts-cc.conf
drwxrwxrwx 3 torsten torsten 4096 Jul 18 15:22 specs/
drwxrwxrwx 4 root root 4096 Jul 14 21:53 strix_runs/
drwxrwxrwx 4 torsten torsten 4096 Aug 14 11:46 tests/
drwxrwxrwx 5 torsten torsten 4096 Jul 14 12:14 TetraIF/
drwxrwxrwx 2 torsten torsten 4096 Jul 14 14:45 translations/
drwxrwxrwx 3 torsten torsten 4096 Jul 14 23:50 Z/
```
wurden nach `qt-migration-legatus/qt6-after/qt6-migrated-legatus/` verschoben.
- `qt-migration-legatus/` ist jetzt ein **Git-Submodule**.
- Innerhalb von `qt-migration-legatus/` gibt es zusätzlich:
- `qt5-before` → enthält die bisherigen Qt5-Eingabefolder, die früher manuell schrittweise ins Projekt kopiert wurden.
- `qt6-after` → enthält die bisherigen Ergebnisse bzw. Zielstände der Qt6-Portierung.
## Ziel
Passe alle relevanten Build-, CI- und Container-Pfade auf die neue Struktur an, sodass der Build unter Ubuntu 26.04 reproduzierbar, robust und wartbar funktioniert.
## Technischer Scope
Untersuche und aktualisiere ausschließlich technische Build-/Infra-Aspekte, insbesondere:
- GitHub Actions / GitLab CI / andere Linux-CI-Konfigurationen
- Shell-Skripte (`.sh`)
- `Dockerfile`
- `.dockerignore`
- CMake-Dateien:
- `CMakeLists.txt`
- `*.cmake`
- Toolchain-/Preset-Dateien, falls vorhanden
- Qt-bezogene Ressourcen-/Include-/Source-/MOC-/UIC-/RCC-Pfade
- Copy-/Sync-/Stage-/Artifact-Schritte
- Submodule-Checkout und Build-Kontext
- Relative Pfade im Repo, im Build-Verzeichnis und im Container
Nicht im Scope:
- PowerShell
- Windows-spezifische Anpassungen
- Fachliche/refaktorierende Codeänderungen außerhalb buildrelevanter Pfade
- Unnötige Modernisierung jenseits der Pfad-/Infra-Migration
## Konkrete Aufgaben
1. Suche systematisch nach allen Referenzen auf die alten Folder
```
drwxrwxrwx 2 torsten torsten 4096 Jul 17 17:03 cmake/
-rwxrwxrwx 1 torsten torsten 15357 Jul 22 12:32 CMakeLists.txt*
-rw-rw-rw- 1 torsten torsten 92 Jul 14 13:55 CTestCustom.ctest
drwxrwxrwx 2 torsten torsten 4096 Jul 14 14:12 doxygen/
-rw-rw-rw- 1 torsten torsten 0 Aug 13 19:33 .gitkeep
drwxrwxrwx 8 torsten torsten 4096 Jul 21 15:43 Lts/
-rw-rw-rw- 1 torsten torsten 14908 Jul 21 15:45 lts-cc.conf
drwxrwxrwx 3 torsten torsten 4096 Jul 18 15:22 specs/
drwxrwxrwx 4 root root 4096 Jul 14 21:53 strix_runs/
drwxrwxrwx 4 torsten torsten 4096 Aug 14 11:46 tests/
drwxrwxrwx 5 torsten torsten 4096 Jul 14 12:14 TetraIF/
drwxrwxrwx 2 torsten torsten 4096 Jul 14 14:45 translations/
drwxrwxrwx 3 torsten torsten 4096 Jul 14 23:50 Z/
```
in:
- CI-Konfigurationen
- CMake-Dateien
- Dockerfile
- Shell-Skripten
- Copy-/Install-/Packaging-Schritten
2. Ermittle für jede Referenz die korrekte neue Zielstruktur:
- `qt-migration-legatus/...`
- `qt-migration-legatus/qt5-before/...`
- `qt-migration-legatus/qt6-after/...`
3. Stelle sicher, dass das Git-Submodule `qt-migration-legatus/` in allen relevanten Build-Kontexten korrekt berücksichtigt wird:
- lokaler CI-Checkout
- Container-Build-Kontext
- reproduzierbarer Checkout in der Pipeline
4. Aktualisiere Build-Logik und Pfade so, dass:
- keine impliziten Annahmen über alte Repo-Layouts bestehen,
- keine fragilen `../..`-Konstruktionen ohne Not bestehen bleiben,
- Pfade zentralisiert oder klar abgeleitet werden, wo sinnvoll.
5. Prüfe speziell für CMake:
- `add_subdirectory(...)`
- `include(...)`
- `target_include_directories(...)`
- `target_sources(...)`
- `configure_file(...)`
- `file(COPY ...)`, `file(GLOB ...)`, `install(...)`
- Pfade zu `.ui`, `.qrc`, Headern, Quellen und generierten Assets
- Variablen, die noch auf alte Layouts zeigen
6. Prüfe speziell für `app/Dockerfile`:
- `COPY`
- `ADD`
- `WORKDIR`
- Build-Argumente / Umgebungsvariablen
- Annahmen über vorhandene Verzeichnisse im Build-Kontext
- Submodule-Verfügbarkeit im Container-Build
- ggf. `.dockerignore`, falls dadurch `qt-migration-legatus/` oder relevante Unterordner ausgeschlossen werden
7. Prüfe speziell für CI/CD:
- Submodule-Checkout/Init/Update
- Cache-Pfade
- Artifact-Pfade
- Test-/Packaging-/Deploy-Stages mit alten Pfadannahmen
- Script-Schritte mit Copy-/Move-/Sync-Operationen
- Container-Build-Aufrufe mit korrektem Context
8. Trenne logisch zwischen:
- Qt5-Altmaterial unter `qt-migration-legatus/qt5-before`
- Qt6-Portierungsstand unter `qt-migration-legatus/qt6-after`
Diese beiden Bereiche dürfen nicht versehentlich vermischt werden. Wenn die aktuelle Pipeline beides nutzt, dokumentiere die Entscheidung explizit.
## Technische Qualitätsanforderungen
- Zielplattform ist **Ubuntu 26.04**.
- Bevorzuge POSIX-nahe Shell-Lösungen (`bash`), keine PowerShell.
- Änderungen sollen **minimal-invasiv**, aber **strukturell robust** sein.
- Keine stillen Magic Paths.
- Wo sinnvoll:
- zentrale Pfadvariablen in CMake,
- klare ENV-/ARG-Namen im Dockerfile,
- explizite Submodule-Schritte in CI.
- Keine unnötigen Refactorings ohne direkten Nutzen für die Migration.
- Bestehendes Verhalten möglichst erhalten.
- Wenn Annahmen nötig sind, markiere sie klar.
## Erwartete Ausgabe
Liefere in dieser Reihenfolge:
1. **Analyse**
- Welche Dateien/Build-Stellen noch auf
```
drwxrwxrwx 2 torsten torsten 4096 Jul 17 17:03 cmake/
-rwxrwxrwx 1 torsten torsten 15357 Jul 22 12:32 CMakeLists.txt*
-rw-rw-rw- 1 torsten torsten 92 Jul 14 13:55 CTestCustom.ctest
drwxrwxrwx 2 torsten torsten 4096 Jul 14 14:12 doxygen/
-rw-rw-rw- 1 torsten torsten 0 Aug 13 19:33 .gitkeep
drwxrwxrwx 8 torsten torsten 4096 Jul 21 15:43 Lts/
-rw-rw-rw- 1 torsten torsten 14908 Jul 21 15:45 lts-cc.conf
drwxrwxrwx 3 torsten torsten 4096 Jul 18 15:22 specs/
drwxrwxrwx 4 root root 4096 Jul 14 21:53 strix_runs/
drwxrwxrwx 4 torsten torsten 4096 Aug 14 11:46 tests/
drwxrwxrwx 5 torsten torsten 4096 Jul 14 12:14 TetraIF/
drwxrwxrwx 2 torsten torsten 4096 Jul 14 14:45 translations/
drwxrwxrwx 3 torsten torsten 4096 Jul 14 23:50 Z/
```
verweisen
- Welche Stellen wegen des neuen Submodules `qt-migration-legatus/` kritisch sind
- Welche Stellen speziell für Qt5-/Qt6-Trennung relevant sind
2. **Konkrete Änderungen**
- als präzise Diffs pro Datei
3. **Begründung**
- kurz und technisch pro wesentlicher Änderung
4. **Risiken / offene Punkte**
- z. B. unklare Zuordnung zwischen `qt5-before` und `qt6-after`
- mögliche Probleme im Docker-Build-Kontext
- Pipeline-Schritte, die vom Runner-Layout abhängen
5. **Validierung**
- konkrete Checks, z. B.:
- Submodule erfolgreich ausgecheckt
- CMake configure/build erfolgreich
- Docker build erfolgreich
- relevante Copy-/Artifact-Pfade vorhanden
- keine Restreferenzen auf
```
drwxrwxrwx 2 torsten torsten 4096 Jul 17 17:03 cmake/
-rwxrwxrwx 1 torsten torsten 15357 Jul 22 12:32 CMakeLists.txt*
-rw-rw-rw- 1 torsten torsten 92 Jul 14 13:55 CTestCustom.ctest
drwxrwxrwx 2 torsten torsten 4096 Jul 14 14:12 doxygen/
-rw-rw-rw- 1 torsten torsten 0 Aug 13 19:33 .gitkeep
drwxrwxrwx 8 torsten torsten 4096 Jul 21 15:43 Lts/
-rw-rw-rw- 1 torsten torsten 14908 Jul 21 15:45 lts-cc.conf
drwxrwxrwx 3 torsten torsten 4096 Jul 18 15:22 specs/
drwxrwxrwx 4 root root 4096 Jul 14 21:53 strix_runs/
drwxrwxrwx 4 torsten torsten 4096 Aug 14 11:46 tests/
drwxrwxrwx 5 torsten torsten 4096 Jul 14 12:14 TetraIF/
drwxrwxrwx 2 torsten torsten 4096 Jul 14 14:45 translations/
drwxrwxrwx 3 torsten torsten 4096 Jul 14 23:50 Z/
```
## Arbeitsweise
Gehe in dieser Reihenfolge vor:
1. Finde alle Referenzen auf
```
drwxrwxrwx 2 torsten torsten 4096 Jul 17 17:03 cmake/
-rwxrwxrwx 1 torsten torsten 15357 Jul 22 12:32 CMakeLists.txt*
-rw-rw-rw- 1 torsten torsten 92 Jul 14 13:55 CTestCustom.ctest
drwxrwxrwx 2 torsten torsten 4096 Jul 14 14:12 doxygen/
-rw-rw-rw- 1 torsten torsten 0 Aug 13 19:33 .gitkeep
drwxrwxrwx 8 torsten torsten 4096 Jul 21 15:43 Lts/
-rw-rw-rw- 1 torsten torsten 14908 Jul 21 15:45 lts-cc.conf
drwxrwxrwx 3 torsten torsten 4096 Jul 18 15:22 specs/
drwxrwxrwx 4 root root 4096 Jul 14 21:53 strix_runs/
drwxrwxrwx 4 torsten torsten 4096 Aug 14 11:46 tests/
drwxrwxrwx 5 torsten torsten 4096 Jul 14 12:14 TetraIF/
drwxrwxrwx 2 torsten torsten 4096 Jul 14 14:45 translations/
drwxrwxrwx 3 torsten torsten 4096 Jul 14 23:50 Z/
```
2. Identifiziere alle Build-/CI-/Docker-Stellen, die `D` als Submodule korrekt einbinden müssen.
3. Leite pro Fundstelle den neuen Zielpfad ab.
4. Schlage minimal robuste Änderungen vor.
5. Liefere die Änderungen als Diffs.
6. Formuliere am Ende eine kurze Validierungs-Checkliste für Ubuntu-26.04-CI.
## Zusätzliche Vorgaben
- Wenn du alte Pfade durch neue ersetzt, tue das nicht blind global, sondern kontextabhängig.
- Wenn CMake- oder Dockerfile-Logik bisher auf manuell kopierte Inhalte ausgelegt ist, passe sie so an, dass die neue Struktur explizit und nachvollziehbar verwendet wird.
- Wenn ein Build-Schritt semantisch eher auf „Eingabe vor Portierung“ verweist, nutze bevorzugt `qt-migration-legatus/qt5-before`.
- Wenn ein Build-Schritt auf bereits portierte Qt6-Artefakte oder Zielstände verweist, nutze bevorzugt `qt-migration-legatus/qt6-after`.
- Wenn die vorhandene Logik diese Entscheidung nicht eindeutig macht, dokumentiere die Annahme direkt bei der Änderung.
- Ergänze nur dort knappe Kommentare, wo die neue Struktur sonst schwer verständlich wäre.
Beginne mit einer vollständigen Bestandsaufnahme aller relevanten Pfadreferenzen und liefere danach die minimalen robusten Änderungen für CI/CD, CMake und Dockerfile unter Ubuntu 26.04.