Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions benchmarks/message_pool_performance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <benchmark/benchmark.h>

#include <cstdint>
Expand Down Expand Up @@ -256,3 +261,5 @@ static void BM_MessageReset(benchmark::State& state) {
BENCHMARK(BM_MessageReset);

BENCHMARK_MAIN();

#pragma GCC diagnostic pop
3 changes: 3 additions & 0 deletions include/agents/lead_agent_base_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,10 @@ concurrency::Task<core::Response> LeadAgentBase<StateEnum>::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)
Expand Down
16 changes: 14 additions & 2 deletions include/core/message.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::string> 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<std::string> 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)
*
Expand Down
6 changes: 5 additions & 1 deletion src/agents/component_lead_agent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::string> ComponentLeadAgent::decomposeGoal(
Expand Down
8 changes: 6 additions & 2 deletions src/agents/module_lead_agent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::string> ModuleLeadAgent::decomposeGoal(
Expand Down
3 changes: 3 additions & 0 deletions src/agents/task_agent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,16 @@ concurrency::Task<core::Response> 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)
{
std::lock_guard<std::mutex> 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);
Expand Down
3 changes: 3 additions & 0 deletions src/agents/task_execution_strategy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ concurrency::Task<core::Response> 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);
Expand Down
30 changes: 30 additions & 0 deletions src/core/message.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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();

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down
3 changes: 3 additions & 0 deletions src/core/message_pool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
6 changes: 6 additions & 0 deletions src/core/message_serializer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()};
Expand Down Expand Up @@ -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()};
Expand Down
7 changes: 7 additions & 0 deletions tests/e2e/component_coordination_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <gtest/gtest.h>

#include <memory>
Expand Down Expand Up @@ -248,3 +253,5 @@ int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}

#pragma GCC diagnostic pop
7 changes: 7 additions & 0 deletions tests/e2e/module_coordination_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <gtest/gtest.h>

#include <memory>
Expand Down Expand Up @@ -264,3 +269,5 @@ int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}

#pragma GCC diagnostic pop
7 changes: 7 additions & 0 deletions tests/e2e/task_cancellation_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <gtest/gtest.h>

#include <chrono>
Expand Down Expand Up @@ -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
7 changes: 7 additions & 0 deletions tests/integration/test_registry_integration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <gtest/gtest.h>

#include <atomic>
Expand Down Expand Up @@ -648,3 +653,5 @@ TEST_F(RegistryIntegrationTest, ClearRegistryClearsAll) {
EXPECT_FALSE(bus_->hasAgent("agent_" + std::to_string(i)));
}
}

#pragma GCC diagnostic pop
7 changes: 7 additions & 0 deletions tests/unit/test_agent_concepts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <gtest/gtest.h>

#include "agents/chief_architect_agent.hpp"
Expand Down Expand Up @@ -316,3 +321,5 @@ TEST(AgentConcepts, UsageDocumentation) {
EXPECT_TRUE(bus.hasAgent("task"));
EXPECT_TRUE(bus.hasAgent("chief"));
}

#pragma GCC diagnostic pop
7 changes: 7 additions & 0 deletions tests/unit/test_agent_core.cpp
Original file line number Diff line number Diff line change
@@ -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 <gtest/gtest.h>
#include <spdlog/sinks/ringbuffer_sink.h>
#include <spdlog/spdlog.h>
Expand Down Expand Up @@ -647,3 +652,5 @@ TEST(AgentCoreLogTest, BackpressureRecoveryLogsInfo) {

keystone::concurrency::Logger::shutdown();
}

#pragma GCC diagnostic pop
7 changes: 7 additions & 0 deletions tests/unit/test_async_task_agent.cpp
Original file line number Diff line number Diff line change
@@ -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 <gtest/gtest.h>

#include <algorithm>
Expand Down Expand Up @@ -221,3 +226,5 @@ TEST_F(AsyncTaskAgentTest, FailedAgentRejectsMessages) {
const auto& history = agent_->getCommandHistory();
EXPECT_TRUE(history.empty());
}

#pragma GCC diagnostic pop
7 changes: 7 additions & 0 deletions tests/unit/test_chief_architect_agent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <gtest/gtest.h>

#include "agents/chief_architect_agent.hpp"
Expand Down Expand Up @@ -279,3 +284,5 @@ TEST_F(ChiefArchitectAgentTest, ConcurrentStateAccess) {
}
EXPECT_EQ(count, 100);
}

#pragma GCC diagnostic pop
7 changes: 7 additions & 0 deletions tests/unit/test_component_lead_agent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <gtest/gtest.h>

#include "agents/component_lead_agent.hpp"
Expand Down Expand Up @@ -441,3 +446,5 @@ TEST_F(ComponentLeadAgentTest,
auto state = component->getCurrentState();
EXPECT_NE(state, agents::ComponentLeadAgent::State::WAITING_FOR_MODULES);
}

#pragma GCC diagnostic pop
7 changes: 7 additions & 0 deletions tests/unit/test_interface_segregation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <gtest/gtest.h>

#include "agents/task_agent.hpp"
Expand Down Expand Up @@ -186,3 +191,5 @@ TEST(InterfaceSegregation, CompileTimeEnforcement) {
// Now registry->registerAgent() works
(void)registry; // Suppress unused warning
}

#pragma GCC diagnostic pop
7 changes: 7 additions & 0 deletions tests/unit/test_lead_agent_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <gtest/gtest.h>

#include "agents/lead_agent_base.hpp"
Expand Down Expand Up @@ -503,3 +508,5 @@ TEST_F(LeadAgentBaseTest, AllowsMultipleGoalProcessing) {
// Second goal should be accepted
EXPECT_TRUE(response2.success);
}

#pragma GCC diagnostic pop
Loading
Loading