diff --git a/benchmarks/message_pool_performance.cpp b/benchmarks/message_pool_performance.cpp index c197baa..984d478 100644 --- a/benchmarks/message_pool_performance.cpp +++ b/benchmarks/message_pool_performance.cpp @@ -5,6 +5,11 @@ * Phase D.2: Verify message pooling reduces allocation overhead */ +// KeystoneMessage::command is [[deprecated]]; benchmarks intentionally access +// it to measure legacy-field allocation behaviour. +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + #include #include @@ -256,3 +261,5 @@ static void BM_MessageReset(benchmark::State& state) { BENCHMARK(BM_MessageReset); BENCHMARK_MAIN(); + +#pragma GCC diagnostic pop diff --git a/include/agents/lead_agent_base_impl.hpp b/include/agents/lead_agent_base_impl.hpp index 3c450a3..eb55998 100644 --- a/include/agents/lead_agent_base_impl.hpp +++ b/include/agents/lead_agent_base_impl.hpp @@ -59,7 +59,10 @@ concurrency::Task LeadAgentBase::processMessage( // Step 3: This is a new goal - decompose and delegate coordination_.transitionTo(planning_state_, stateToString(planning_state_)); + _Pragma("GCC diagnostic push") + _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") coordination_.setCurrentGoal(msg.command); + _Pragma("GCC diagnostic pop") coordination_.setRequesterId(msg.sender_id); // Step 4: Decompose goal into subtasks (hook method - subclass implements) diff --git a/include/core/message.hpp b/include/core/message.hpp index c78cca3..bcb5a03 100644 --- a/include/core/message.hpp +++ b/include/core/message.hpp @@ -140,10 +140,22 @@ struct KeystoneMessage { correlation_id; ///< Optional correlation ID for distributed tracing // Payload and timing - std::string command; ///< Command string to execute (legacy/convenience) - std::optional payload; ///< Optional payload data + [[deprecated("command is a legacy/convenience field; use payload with ActionType instead")]] + std::string command; ///< Command string to execute (legacy/convenience) + std::optional payload; ///< Optional payload data std::chrono::system_clock::time_point timestamp; ///< Message timestamp + // Declare special members out-of-line so their definitions (in message.cpp) + // can suppress -Wdeprecated-declarations for the internal move/copy of the + // deprecated 'command' field. External code that reads/writes 'command' + // directly will still receive the deprecation diagnostic. + KeystoneMessage(); + KeystoneMessage(const KeystoneMessage&); + KeystoneMessage(KeystoneMessage&&) noexcept; + KeystoneMessage& operator=(const KeystoneMessage&); + KeystoneMessage& operator=(KeystoneMessage&&) noexcept; + ~KeystoneMessage(); + /** * @brief Create a new message with generated ID (legacy interface) * diff --git a/src/agents/component_lead_agent.cpp b/src/agents/component_lead_agent.cpp index debf5ef..8d1f706 100644 --- a/src/agents/component_lead_agent.cpp +++ b/src/agents/component_lead_agent.cpp @@ -35,7 +35,11 @@ void ComponentLeadAgent::setAvailableModuleLeads( bool ComponentLeadAgent::isSubordinateResult(const core::KeystoneMessage& msg) { // Check if this is a module result - return msg.command == "module_result"; + _Pragma("GCC diagnostic push") + _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") + bool result = msg.command == "module_result"; + _Pragma("GCC diagnostic pop") + return result; } std::vector ComponentLeadAgent::decomposeGoal( diff --git a/src/agents/module_lead_agent.cpp b/src/agents/module_lead_agent.cpp index f141011..2f43277 100644 --- a/src/agents/module_lead_agent.cpp +++ b/src/agents/module_lead_agent.cpp @@ -37,8 +37,12 @@ void ModuleLeadAgent::setAvailableTaskAgents( bool ModuleLeadAgent::isSubordinateResult(const core::KeystoneMessage& msg) { // Exclude TASK_FAILED so processSubordinateFailure() handles it instead - return msg.command == "response" && - msg.action_type != core::ActionType::TASK_FAILED; + _Pragma("GCC diagnostic push") + _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") + bool result = msg.command == "response" && + msg.action_type != core::ActionType::TASK_FAILED; + _Pragma("GCC diagnostic pop") + return result; } std::vector ModuleLeadAgent::decomposeGoal( diff --git a/src/agents/task_agent.cpp b/src/agents/task_agent.cpp index 9e65b56..6d9a78e 100644 --- a/src/agents/task_agent.cpp +++ b/src/agents/task_agent.cpp @@ -76,6 +76,8 @@ concurrency::Task TaskAgent::processMessage( try { // Execute the bash command + _Pragma("GCC diagnostic push") + _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") std::string result = executeBash(msg.command); // Log the execution (lock guards concurrent processMessage coroutines) @@ -83,6 +85,7 @@ concurrency::Task TaskAgent::processMessage( std::lock_guard lock(log_mutex_); command_log_.emplace_back(msg.command, result); } + _Pragma("GCC diagnostic pop") auto response = core::Response::createSuccess(msg, agent_id_, result); sendResponseMessage(msg, result); diff --git a/src/agents/task_execution_strategy.cpp b/src/agents/task_execution_strategy.cpp index ba63e4e..9d0582c 100644 --- a/src/agents/task_execution_strategy.cpp +++ b/src/agents/task_execution_strategy.cpp @@ -33,7 +33,10 @@ concurrency::Task TaskExecutionStrategy::process( const core::KeystoneMessage& msg) { try { // Execute the bash command + _Pragma("GCC diagnostic push") + _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") std::string result = executeBashCommand(msg.command); + _Pragma("GCC diagnostic pop") // Create success response auto response = core::Response::createSuccess(msg, "strategy", result); diff --git a/src/core/message.cpp b/src/core/message.cpp index 6df836f..be505ed 100644 --- a/src/core/message.cpp +++ b/src/core/message.cpp @@ -7,6 +7,27 @@ namespace keystone { namespace core { +// --------------------------------------------------------------------------- +// Out-of-line special-member definitions for KeystoneMessage. +// +// Defined here (rather than defaulted in the header) so that we can suppress +// -Wdeprecated-declarations for the internal copy/move of the deprecated +// 'command' field. Callers that access 'command' directly still get the +// warning. +// --------------------------------------------------------------------------- +_Pragma("GCC diagnostic push") +_Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") + +KeystoneMessage::KeystoneMessage() = default; +KeystoneMessage::KeystoneMessage(const KeystoneMessage&) = default; +KeystoneMessage::KeystoneMessage(KeystoneMessage&&) noexcept = default; +KeystoneMessage& KeystoneMessage::operator=(const KeystoneMessage&) = default; +KeystoneMessage& KeystoneMessage::operator=(KeystoneMessage&&) noexcept = + default; +KeystoneMessage::~KeystoneMessage() = default; + +_Pragma("GCC diagnostic pop") + namespace { // Simple UUID generation (not cryptographically secure, but sufficient for // Phase 1) Thread-safe: uses thread_local to avoid data races across threads @@ -34,7 +55,10 @@ KeystoneMessage KeystoneMessage::create( msg.msg_id = generate_uuid(); msg.sender_id = sender; msg.receiver_id = receiver; + _Pragma("GCC diagnostic push") + _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") msg.command = cmd; + _Pragma("GCC diagnostic pop") msg.payload = data; msg.timestamp = std::chrono::system_clock::now(); @@ -67,7 +91,10 @@ KeystoneMessage KeystoneMessage::create(const std::string& sender, msg.timestamp = std::chrono::system_clock::now(); // Legacy field: set command based on action type + _Pragma("GCC diagnostic push") + _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") msg.command = actionTypeToString(action); + _Pragma("GCC diagnostic pop") // Phase C: Initialize priority and deadline (FIX: was missing!) msg.priority = Priority::NORMAL; @@ -114,7 +141,10 @@ KeystoneMessage KeystoneMessage::createCancellation( msg.session_id = session; msg.task_id = task_id; // Set the task to cancel msg.priority = Priority::HIGH; // Cancellations are high priority + _Pragma("GCC diagnostic push") + _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") msg.command = "CANCEL_TASK"; + _Pragma("GCC diagnostic pop") msg.timestamp = std::chrono::system_clock::now(); return msg; } diff --git a/src/core/message_pool.cpp b/src/core/message_pool.cpp index b7a0552..97efc8f 100644 --- a/src/core/message_pool.cpp +++ b/src/core/message_pool.cpp @@ -45,7 +45,10 @@ void MessagePool::release(KeystoneMessage&& msg) { msg.msg_id.clear(); msg.sender_id.clear(); msg.receiver_id.clear(); + _Pragma("GCC diagnostic push") + _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") msg.command.clear(); + _Pragma("GCC diagnostic pop") msg.payload.reset(); msg.priority = Priority::NORMAL; msg.deadline.reset(); diff --git a/src/core/message_serializer.cpp b/src/core/message_serializer.cpp index 306a995..aa7c21d 100644 --- a/src/core/message_serializer.cpp +++ b/src/core/message_serializer.cpp @@ -28,7 +28,10 @@ SerializableMessage SerializableMessage::fromKeystoneMessage( cista::offset::string{value.c_str()}; } + _Pragma("GCC diagnostic push") + _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") smsg.command = cista::offset::string{msg.command.c_str()}; + _Pragma("GCC diagnostic pop") if (msg.payload.has_value()) { smsg.payload = cista::offset::string{msg.payload.value().c_str()}; @@ -73,7 +76,10 @@ KeystoneMessage SerializableMessage::toKeystoneMessage() const { std::string{value.data(), value.size()}; } + _Pragma("GCC diagnostic push") + _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") msg.command = std::string{command.data(), command.size()}; + _Pragma("GCC diagnostic pop") if (has_payload) { msg.payload = std::string{payload.data(), payload.size()}; diff --git a/tests/e2e/component_coordination_test.cpp b/tests/e2e/component_coordination_test.cpp index c28572f..2c9cc4b 100644 --- a/tests/e2e/component_coordination_test.cpp +++ b/tests/e2e/component_coordination_test.cpp @@ -15,6 +15,11 @@ * - Full 4-layer message flow */ +// KeystoneMessage::command is [[deprecated]]; test files intentionally access +// it to verify backward-compat behaviour. +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + #include #include @@ -248,3 +253,5 @@ int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } + +#pragma GCC diagnostic pop diff --git a/tests/e2e/module_coordination_test.cpp b/tests/e2e/module_coordination_test.cpp index 1cfd8aa..7485431 100644 --- a/tests/e2e/module_coordination_test.cpp +++ b/tests/e2e/module_coordination_test.cpp @@ -13,6 +13,11 @@ * - Multi-agent coordination */ +// KeystoneMessage::command is [[deprecated]]; test files intentionally access +// it to verify backward-compat behaviour. +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + #include #include @@ -264,3 +269,5 @@ int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } + +#pragma GCC diagnostic pop diff --git a/tests/e2e/task_cancellation_test.cpp b/tests/e2e/task_cancellation_test.cpp index 69c4419..5520e1d 100644 --- a/tests/e2e/task_cancellation_test.cpp +++ b/tests/e2e/task_cancellation_test.cpp @@ -11,6 +11,11 @@ * 6. Parent receives acknowledgement */ +// KeystoneMessage::command is [[deprecated]]; test files intentionally access +// it to verify backward-compat behaviour. +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + #include #include @@ -271,3 +276,5 @@ TEST(E2E_TaskCancellation, MissingTaskIdReturnsError) { EXPECT_EQ(response.status, Response::Status::Error); EXPECT_TRUE(response.result.find("missing task_id") != std::string::npos); } + +#pragma GCC diagnostic pop diff --git a/tests/integration/test_registry_integration.cpp b/tests/integration/test_registry_integration.cpp index dedd82e..073d190 100644 --- a/tests/integration/test_registry_integration.cpp +++ b/tests/integration/test_registry_integration.cpp @@ -14,6 +14,11 @@ * - Edge cases (optional, 3-5 more tests) */ +// KeystoneMessage::command is [[deprecated]]; test files intentionally access +// it to verify backward-compat behaviour. +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + #include #include @@ -648,3 +653,5 @@ TEST_F(RegistryIntegrationTest, ClearRegistryClearsAll) { EXPECT_FALSE(bus_->hasAgent("agent_" + std::to_string(i))); } } + +#pragma GCC diagnostic pop diff --git a/tests/unit/test_agent_concepts.cpp b/tests/unit/test_agent_concepts.cpp index 364cb7d..31863d4 100644 --- a/tests/unit/test_agent_concepts.cpp +++ b/tests/unit/test_agent_concepts.cpp @@ -9,6 +9,11 @@ * - Compile-time errors for incomplete interfaces */ +// KeystoneMessage::command is [[deprecated]]; test files intentionally access +// it to verify backward-compat behaviour. +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + #include #include "agents/chief_architect_agent.hpp" @@ -316,3 +321,5 @@ TEST(AgentConcepts, UsageDocumentation) { EXPECT_TRUE(bus.hasAgent("task")); EXPECT_TRUE(bus.hasAgent("chief")); } + +#pragma GCC diagnostic pop diff --git a/tests/unit/test_agent_core.cpp b/tests/unit/test_agent_core.cpp index a4f7368..30fba78 100644 --- a/tests/unit/test_agent_core.cpp +++ b/tests/unit/test_agent_core.cpp @@ -1,3 +1,8 @@ +// KeystoneMessage::command is [[deprecated]]; test files intentionally access +// it to verify backward-compat behaviour. +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + #include #include #include @@ -647,3 +652,5 @@ TEST(AgentCoreLogTest, BackpressureRecoveryLogsInfo) { keystone::concurrency::Logger::shutdown(); } + +#pragma GCC diagnostic pop diff --git a/tests/unit/test_async_task_agent.cpp b/tests/unit/test_async_task_agent.cpp index ceb9517..1fe600f 100644 --- a/tests/unit/test_async_task_agent.cpp +++ b/tests/unit/test_async_task_agent.cpp @@ -1,3 +1,8 @@ +// KeystoneMessage::command is [[deprecated]]; test files intentionally access +// it to verify backward-compat behaviour. +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + #include #include @@ -221,3 +226,5 @@ TEST_F(AsyncTaskAgentTest, FailedAgentRejectsMessages) { const auto& history = agent_->getCommandHistory(); EXPECT_TRUE(history.empty()); } + +#pragma GCC diagnostic pop diff --git a/tests/unit/test_chief_architect_agent.cpp b/tests/unit/test_chief_architect_agent.cpp index f6141e1..cb6ea44 100644 --- a/tests/unit/test_chief_architect_agent.cpp +++ b/tests/unit/test_chief_architect_agent.cpp @@ -11,6 +11,11 @@ * Total: 15 tests */ +// KeystoneMessage::command is [[deprecated]]; test files intentionally access +// it to verify backward-compat behaviour. +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + #include #include "agents/chief_architect_agent.hpp" @@ -279,3 +284,5 @@ TEST_F(ChiefArchitectAgentTest, ConcurrentStateAccess) { } EXPECT_EQ(count, 100); } + +#pragma GCC diagnostic pop diff --git a/tests/unit/test_component_lead_agent.cpp b/tests/unit/test_component_lead_agent.cpp index c0f6ed5..e0d1cb8 100644 --- a/tests/unit/test_component_lead_agent.cpp +++ b/tests/unit/test_component_lead_agent.cpp @@ -12,6 +12,11 @@ * Total: 16 tests */ +// KeystoneMessage::command is [[deprecated]]; test files intentionally access +// it to verify backward-compat behaviour. +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + #include #include "agents/component_lead_agent.hpp" @@ -441,3 +446,5 @@ TEST_F(ComponentLeadAgentTest, auto state = component->getCurrentState(); EXPECT_NE(state, agents::ComponentLeadAgent::State::WAITING_FOR_MODULES); } + +#pragma GCC diagnostic pop diff --git a/tests/unit/test_interface_segregation.cpp b/tests/unit/test_interface_segregation.cpp index d170c46..51d05da 100644 --- a/tests/unit/test_interface_segregation.cpp +++ b/tests/unit/test_interface_segregation.cpp @@ -7,6 +7,11 @@ * Principle. */ +// KeystoneMessage::command is [[deprecated]]; test files intentionally access +// it to verify backward-compat behaviour. +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + #include #include "agents/task_agent.hpp" @@ -186,3 +191,5 @@ TEST(InterfaceSegregation, CompileTimeEnforcement) { // Now registry->registerAgent() works (void)registry; // Suppress unused warning } + +#pragma GCC diagnostic pop diff --git a/tests/unit/test_lead_agent_base.cpp b/tests/unit/test_lead_agent_base.cpp index 51602d3..9a88a6a 100644 --- a/tests/unit/test_lead_agent_base.cpp +++ b/tests/unit/test_lead_agent_base.cpp @@ -12,6 +12,11 @@ * Total: 22 tests */ +// KeystoneMessage::command is [[deprecated]]; test files intentionally access +// it to verify backward-compat behaviour. +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + #include #include "agents/lead_agent_base.hpp" @@ -503,3 +508,5 @@ TEST_F(LeadAgentBaseTest, AllowsMultipleGoalProcessing) { // Second goal should be accepted EXPECT_TRUE(response2.success); } + +#pragma GCC diagnostic pop diff --git a/tests/unit/test_message_bus_async.cpp b/tests/unit/test_message_bus_async.cpp index 40477a4..cbf0434 100644 --- a/tests/unit/test_message_bus_async.cpp +++ b/tests/unit/test_message_bus_async.cpp @@ -3,6 +3,11 @@ * @brief Tests for MessageBus with WorkStealingScheduler integration */ +// KeystoneMessage::command is [[deprecated]]; test files intentionally access +// it to verify backward-compat behaviour. +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + #include #include @@ -508,3 +513,5 @@ TEST(MessageBusAsyncTest, MessageToDeletedAgentGraceful) { // No crash = success SUCCEED(); } + +#pragma GCC diagnostic pop diff --git a/tests/unit/test_message_pool.cpp b/tests/unit/test_message_pool.cpp index b49d462..4667c16 100644 --- a/tests/unit/test_message_pool.cpp +++ b/tests/unit/test_message_pool.cpp @@ -1,3 +1,8 @@ +// KeystoneMessage::command is [[deprecated]]; test files intentionally access +// it to verify backward-compat behaviour. +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + #include #include @@ -328,3 +333,5 @@ TEST_F(MessagePoolTest, MoveSemantics) { auto stats = MessagePool::getStats(); EXPECT_EQ(stats.total_releases, 1); } + +#pragma GCC diagnostic pop diff --git a/tests/unit/test_message_serializer.cpp b/tests/unit/test_message_serializer.cpp index 37d458e..f57fcd0 100644 --- a/tests/unit/test_message_serializer.cpp +++ b/tests/unit/test_message_serializer.cpp @@ -3,6 +3,11 @@ * @brief Unit tests for MessageSerializer (Cista-based) */ +// KeystoneMessage::command is [[deprecated]]; test files intentionally access +// it to verify backward-compat behaviour. +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + #include #include "core/message.hpp" @@ -201,3 +206,5 @@ TEST(MessageSerializerTest, LegacyCreateCompatibility) { EXPECT_EQ(deserialized.content_type, ContentType::TEXT_PLAIN); EXPECT_EQ(deserialized.command, "echo hello"); } + +#pragma GCC diagnostic pop diff --git a/tests/unit/test_module_lead_agent.cpp b/tests/unit/test_module_lead_agent.cpp index 858743d..a5c96b6 100644 --- a/tests/unit/test_module_lead_agent.cpp +++ b/tests/unit/test_module_lead_agent.cpp @@ -11,6 +11,11 @@ * Total: 12 tests */ +// KeystoneMessage::command is [[deprecated]]; test files intentionally access +// it to verify backward-compat behaviour. +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + #include #include "agents/component_lead_agent.hpp" @@ -522,3 +527,5 @@ TEST_F(ModuleLeadAgentTest, ConcurrentCoordination) { } EXPECT_EQ(count, 50); } + +#pragma GCC diagnostic pop diff --git a/tests/unit/test_task_agent.cpp b/tests/unit/test_task_agent.cpp index 1f8428a..ab1358e 100644 --- a/tests/unit/test_task_agent.cpp +++ b/tests/unit/test_task_agent.cpp @@ -11,6 +11,11 @@ * Total: 15 tests */ +// KeystoneMessage::command is [[deprecated]]; test files intentionally access +// it to verify backward-compat behaviour. +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + #include #include "agents/task_agent.hpp" @@ -235,3 +240,5 @@ TEST_F(TaskAgentTest, HandleBusUnavailable) { // Sending without bus should throw EXPECT_THROW(agent->sendMessage(msg), std::runtime_error); } + +#pragma GCC diagnostic pop diff --git a/tests/unit/test_task_cancellation.cpp b/tests/unit/test_task_cancellation.cpp index e93c583..b6a6d70 100644 --- a/tests/unit/test_task_cancellation.cpp +++ b/tests/unit/test_task_cancellation.cpp @@ -9,6 +9,11 @@ * - MessageBus routing of CANCEL_TASK messages */ +// KeystoneMessage::command is [[deprecated]]; test files intentionally access +// it to verify backward-compat behaviour. +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + #include #include "agents/async_agent.hpp" @@ -212,3 +217,5 @@ TEST(TaskCancellation, ThreadSafeCancellation) { EXPECT_TRUE(agent->isCancelled(task_id)); } } + +#pragma GCC diagnostic pop