diff --git a/prompts/migrate-and-test-DDS-targets.prompt.md b/prompts/migrate-and-test-DDS-targets.prompt.md new file mode 100644 index 000000000..e7c14253d --- /dev/null +++ b/prompts/migrate-and-test-DDS-targets.prompt.md @@ -0,0 +1,382 @@ +# Strict Qt6 Test/Validation Prompt: CMake targets under ./qt-migration-legatus/qt6-after/qt6-migrated-legatus/Lts/DDS + +This prompt is binding task context. Keep changes minimal, scoped, and reproducible. + +## Required base prompt + +Before making changes, read and apply: + +- ./prompts/combined-migration-subfolder-rti-compact.prompt.md + +If that prompt is stricter, follow it. This prompt overrides it only for build variants: use ON variants only. Do not pursue OFF variants. + +## Critical instruction for the agent receiving this prompt + +Lts/DDS is already migrated to Qt6. Do not perform a new migration pass unless a small, targeted fix is directly required to make the already-migrated DDS targets configure, build, link, or pass tests. + +Primary task: + +- discover all real CMake targets under `./qt-migration-legatus/qt6-after/qt6-migrated-legatus/Lts/DDS` +- ensure the corresponding already-migrated DDS targets are built or validated by `./qt-migration-legatus/qt6-after/qt6-migrated-legatus/new_docker_build.sh` +- fix the existing test failures for DDS targets +- add or complete functionality and integration tests with already Qt6-migrated modules in the DDS path + +Do not execute this prompt as a planning document. Execute it only as a repository task in the target branch named below. + +## Module in scope + +Work only on CMake targets and directly related tests + +from: + +- `./qt-migration-legatus/qt5-before/qt5-legatus-legacy/Lts/DDS` + +to: + +- `./qt-migration-legatus/qt6-after/qt6-migrated-legatus/Lts/DDS` + +The DDS code is already migrated. Treat the path above as the scoped DDS module path for target discovery, build-script registration, and test repair. + +Do not migrate sibling services or unrelated modules. + +## Mandatory build variants + +Only these variants are valid: + +- BUILD_RTI=ON +- BUILD_GRANTLEE=ON + +Forbidden: + +- BUILD_RTI=OFF +- BUILD_GRANTLEE=OFF + +Rules: + +- Do not implement, fix, preserve, test, or validate OFF variants. +- Do not add CMake logic, tests, stubs, or fallbacks for OFF variants. +- Do not report OFF variants as supported or partially supported. +- Validation must use BUILD_RTI=ON and BUILD_GRANTLEE=ON. + +## Branches and trees + +Target branch: + +- feature/migrate-and-test-DDS-targets + +Qt5 legacy branch, if comparison is needed: + +- story/qt6-migration + +Scoped DDS tree: + + +from Qt5: +- `./qt-migration-legatus/qt5-before/qt5-legatus-legacy/Lts/DDS` +to Qt6: +- `./qt-migration-legatus/qt6-after/qt6-migrated-legatus/Lts/DDS` + +Authoritative validation script to update: + +- `./qt-migration-legatus/qt6-after/qt6-migrated-legatus/new_docker_build.sh` + +Do not modify unrelated trees. Do not restore removed modules. + +## Scope rules + +Touch files outside the DDS target directory only when directly required to configure, generate, build, link, test, or validate DDS targets. + +Allowed outside-scope changes: + +- parent CMakeLists.txt entries required for DDS targets +- central CMake helper fixes required by DDS targets +- shared include path fixes required by DDS targets +- RTI, codegen, ndsgen, KTextTemplate, or Grantlee integration fixes required by DDS targets +- test infrastructure needed by DDS functionality or integration tests +- `./qt-migration-legatus/qt6-after/qt6-migrated-legatus/new_docker_build.sh` changes needed to build or validate all real DDS CMake targets +- minimal Jenkins CI discovery or policy updates needed for DDS tests +- relocation of required stubs or forward declarations to allowed directories + +Not allowed: + +- restoring removed modules +- reintroducing stale dependencies on removed modules +- removing or disabling active modules to hide failures +- disabling DDS targets instead of fixing root causes +- broad refactoring, cleanup, renaming, or modernization +- warning suppression instead of fixing causes +- committing generated files +- consuming generated outputs from the source tree +- fake success, dummy files, handwritten generated replacements, mocks, placeholders, or generated-output stubs + +## CMake targets under DDS + +- Discover real CMake targets defined under `./qt-migration-legatus/qt6-after/qt6-migrated-legatus/Lts/DDS`. +- Add every required real CMake target under that DDS path to `./qt-migration-legatus/qt6-after/qt6-migrated-legatus/new_docker_build.sh` so the validation container builds or validates it. +- Do not invent CMake targets under DDS. +- Do not add targets that do not exist. +- If the DDS folder does not exist, has no CMake targets, or a target is intentionally out of scope, report that fact and the reason. +- Do not weaken validation to make DDS CMake targets pass. + +## Preservation rules + +Preserve module removals from commit: + +- 92ad7d468, "remove all unneeded module listed from Niklas" + +Do not restore removed modules, files, targets, directories, or dependencies. + +Preserve LogViewer reinsert from commit: + +- 1fa789767, "Added LogViewer again" + +Do not remove, disable, or break LogViewer integration. + +Preserve prior IDL warning fixes from commit: + +- be912de9d, "Removes .IDL warnings: multiple enum definitons and builtin-type collisions" + +Do not blindly replay that commit. Use it only as reference. Do not reintroduce removed modules. + +IDL regressions to avoid: + +- multiple enum definitions +- duplicate enumerators +- builtin type or keyword collisions + +Check first for duplicate inputs, stale paths, removed-module references, source-tree generated outputs, source/build-tree confusion, and repeated IDL definitions before treating an issue as semantic. + +## Stubs and forward declarations + +Any required existing stub, compatibility declaration, or forward declaration must live only under approved forward-declaration directories in the active tree, for example: + +- `./qt-migration-legatus/qt6-after/qt6-migrated-legatus/forward-declarations/` +- `./qt-migration-legatus/qt6-after/qt6-migrated-legatus/include/` + +Rules: + +- Do not leave such files in DDS service directories unless they are real DDS source files. +- Do not create or keep stubs for forbidden OFF variants. +- Do not use stubs or forward declarations as replacements for real RTI, ndsgen, KTextTemplate, or Grantlee outputs in ON builds. +- Report every moved, removed, or newly referenced stub/forward declaration. + +## Test repair and additions + +The DDS module is already migrated, but tests still fail. Fix the real causes of DDS test failures. + +For DDS-related code changes, add or update meaningful CTest tests where feasible. + +Required test focus: + +- functionality tests for DDS target behavior +- integration tests using already Qt6-migrated modules in `./qt-migration-legatus/qt6-after/qt6-migrated-legatus/` +- regression tests for the specific failing DDS behavior, when the failure can be reproduced deterministically + +Rules: + +- tests must validate behavior, not only compilation +- tests must be registered with CTest +- tests must run with BUILD_RTI=ON and BUILD_GRANTLEE=ON +- do not add OFF-variant tests +- use deterministic tests without host-local paths +- do not use fake DDS, RTI, ndsgen, KTextTemplate, Grantlee, or generated-output replacements +- if three meaningful tests per C++ behavior change are impossible, add the maximum meaningful set and explain why +- update `./qt-migration-legatus/qt6-after/qt6-migrated-legatus/new_docker_build.sh` so it runs the DDS tests and fails on test failure + +Preferred location: + +- `./qt-migration-legatus/qt6-after/qt6-migrated-legatus/tests` + +Use policy-compatible names, for example: + +- `test_.cpp` +- `_test.cpp` +- `test.cpp` +- `gtest.cpp` + +## Migration checks limited to test/build fixes + +For each DDS CMake target, inspect and adjust only as needed: + +- source and header files directly involved in failing DDS builds or tests +- CMakeLists.txt and parent CMake registration +- ui, qrc, resource, plugin, and service metadata directly required by DDS targets +- RTI IDL, ndsgen, KTextTemplate, and Grantlee inputs/templates used by DDS targets +- tests directly tied to DDS targets + +Fix only real Qt6/C++17 build or test issues, such as: + +- Qt module imports and target links +- moc, uic, and rcc handling +- QRegExp to QRegularExpression when required +- QTextCodec replacement when required +- QDesktopWidget or QApplication::desktop() replacement when required +- QString, QVariant, QMetaType, QDateTime, QAction, QMenu, signal/slot, enum, plugin, or metadata compatibility issues when required +- incorrect or incomplete CTest registration +- missing DDS target registration in the authoritative validation script + +No opportunistic refactoring or style cleanup. + +## Qt link rules + +No active target in the scoped tree may link Qt5 imported targets. + +Search for and fix active uses of: + +- Qt5:: +- find_package(Qt5 +- QT5_ +- Qt5Core +- Qt5Widgets +- Qt5Network + +Use Qt6 equivalents. Prefer central CMake helper fixes when the issue is central and required by DDS targets. + +## Code generation rules + +If generated files are required: + +- reconstruct the real existing generation flow +- generate into the build tree +- consume from the build tree +- list complete OUTPUT and BYPRODUCTS +- set correct DEPENDS and MAIN_DEPENDENCY where useful +- use deterministic WORKING_DIRECTORY +- use VERBATIM +- wire generated sources with target_sources +- wire generated include dirs with target_include_directories +- ensure compilation depends on generation +- ensure incremental rebuilds trigger on input/template changes + +Never commit generated .idl, .h, .hpp, or .cpp outputs. Never consume generated outputs from the source tree. Never fabricate generated outputs. + +## Docker and CI + +Authoritative migration Dockerfile: + +- `./app/Dockerfile` + +Authoritative validation script: + +- `./qt-migration-legatus/qt6-after/qt6-migrated-legatus/new_docker_build.sh` + +Do not use other Dockerfiles as task authority. + +Validation container expectations: + +- repository root at /repo, or the script's documented mount path +- external dependencies under /repo/external, or the script's documented equivalent +- RTI 7.7 at /repo/external/rti_connext_dds-7.7.0, or documented equivalent +- `./rti_license.dat` mounted read-only if RTI requires it +- no developer-local paths + +Jenkins CI must be able to discover and run the DDS tests, or verify that `new_docker_build.sh` runs them. Inspect and minimally update only if needed: + +- `./qt-migration-legatus/ci/Dockerfile.*` +- `./qt-migration-legatus/ci/check_pr_policies.py` + +## Required procedure + +1. Inspect repository state, branch, working tree, submodules, required prompts, DDS path, validation script, and forward-declaration directories. +2. Confirm DDS is already migrated and identify current DDS test failures. +3. Discover all real CMake targets under `./qt-migration-legatus/qt6-after/qt6-migrated-legatus/Lts/DDS`. +4. Add the required DDS CMake targets to `./qt-migration-legatus/qt6-after/qt6-migrated-legatus/new_docker_build.sh`. +5. Identify DDS dependencies, generated inputs, Qt modules, parent CMake entries, removed-module references, LogViewer interactions, and required stub/forward-declaration relocations. +6. Apply the smallest valid test/build fixes. +7. Add or repair required functionality and integration CTest tests with already Qt6-migrated DDS modules. +8. Review RTI, ndsgen, KTextTemplate, and Grantlee generation paths used by DDS targets. +9. Check regressions: Qt5 links, removed modules, LogViewer, IDL warnings, source-tree generated consumption, stale artifacts, and misplaced stubs. +10. Validate in Docker with BUILD_RTI=ON and BUILD_GRANTLEE=ON. +11. Run CTest in the validated build directory. +12. Check Jenkins/policy compatibility. +13. Report factual status. + +Do not overwrite uncommitted user changes. If they block safe work, report the blocker. + +## Required validation + +From: + +- `./qt-migration-legatus/qt6-after/qt6-migrated-legatus` + +Run: + +```bash +BUILD_RTI=ON BUILD_GRANTLEE=ON ./new_docker_build.sh +``` + +CTest must run as part of validation. If a direct clean build is useful, use: + +```bash +cmake -S /repo/qt-migration-legatus/qt5-before/qt5-legatus-legacy -B /repo/build-rti-on-grantlee-on -G Ninja -DCMAKE_BUILD_TYPE=Debug -DBUILD_RTI=ON -DBUILD_GRANTLEE=ON +cmake --build /repo/build-rti-on-grantlee-on --parallel +ctest --test-dir /repo/build-rti-on-grantlee-on --output-on-failure +``` + +Also check whether this file exists and run it only if present: + +```bash +./new_docker-build.h +``` + +If it is absent or a typo, report that. Do not invent a replacement. + +Do not run or validate OFF variants. + +## Success criteria + +Success requires: + +- DDS CMake targets are confirmed already migrated or fixed only where directly required for tests/builds +- all real DDS CMake targets are included in the authoritative validation script +- configure, build, and CTest pass with BUILD_RTI=ON and BUILD_GRANTLEE=ON +- functionality and integration tests for already Qt6-migrated DDS modules are registered with CTest +- `new_docker_build.sh` runs the relevant DDS tests and fails on test failure +- Jenkins/policy discovery accepts the DDS tests and validation changes +- no active Qt5 imported target links remain for DDS targets +- generated outputs are build-tree only and freshly produced when required +- no generated outputs are committed or consumed from the source tree +- no fake generated files, dummy files, mocks, placeholders, or stubbed generated outputs exist +- required stubs/forward declarations are only in allowed directories +- removed modules remain removed +- LogViewer remains preserved +- RTI/codegen and Grantlee/KTextTemplate success is real, not stale or faked + +## If blocked + +Do not fake success. Report: + +- failing command +- key error output +- affected DDS target or service +- category: project, path, merge, CMake, Qt API, codegen, Docker, RTI/license, Grantlee/KTextTemplate, test, CTest, Jenkins CI, stub relocation, or environment +- what was fixed safely +- what remains blocked +- whether stale artifacts were ruled out +- whether generated files were involved +- exact missing files, targets, or generator step +- whether functionality and integration tests were added or repaired +- whether tests and CTest integration succeeded +- whether Docker validation and Jenkins discovery succeeded + +## Final report + +Keep it short. Include: + +- status: validated, partially validated, or blocked +- DDS CMake targets discovered and added to `new_docker_build.sh` +- files changed +- C++ files changed +- functionality tests added or repaired +- integration tests added or repaired +- tests added per C++ change +- CTest registration changes +- CMake and generator changes +- stub/forward-declaration moves or removals +- Docker and Jenkins CI changes +- Qt5 references removed or remaining +- confirmation that removed modules were not restored +- confirmation that LogViewer was preserved +- exact validation commands and results +- result of `new_docker-build.h` if present +- remaining blockers or risks