E40 Process Jobs + E94 Control Jobs + E30 communication state
GEM300 layer: SEMI E40-0705 Process Job and E94-0705 Control Job state machines, plus the E30 §6.1 communication-state machine that sits between HSMS SELECT and full GEM communication. Data-driven via data/process_job_state.yaml and data/control_job_state.yaml, mirroring the existing control_state.yaml pattern. Wire coverage: S14F9/F10 CreateObject (CJ) host -> equipment S14F11/F12 DeleteObject (CJ) host -> equipment S16F5/F6 PRJobCommand host -> equipment S16F9 PRJobAlert equipment -> host S16F11/F12 PRJobCreate (simplified body) host -> equipment S16F13/F14 PRJobDequeue host -> equipment S16F27/F28 CJobCommand host -> equipment Process Job FSM exposes 8 states matching PRJOBSTATE bytes (E40 §10.3.2); HOQ is reorder-aware (move-to-head against an insertion-order vector); Stop/Abort on a Queued PJ routes through ABORTING so the host observes PRJOBSTATE=7 on the wire (§6.3); alert_enabled is settable per-PJ for PRALERT control; FSM dispatches through ProcessJobStore::on_change_ dynamically so a late set_state_change_handler() reaches existing PJs. Hardening: loader rejects NoState (sentinel) as initial/from/to and rejects `on: created` rows; static_asserts pin enum values to wire bytes; ProcessJobStore is non-movable to keep the per-PJ this-capture safe. Server simulator cascades the full CJ -> PJ lifecycle on CJSTART so the wire trace exercises every legal state. CEIDs 400/401 fire on CJ state changes via the existing event-report pipeline. Tests: 60+ new assertions across test_process_jobs, test_control_jobs, test_communication_state, test_hsms_connection, plus loader and messages round-trip coverage. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -61,6 +61,67 @@ TEST_CASE("S2F16 EAC ack round-trip") {
|
||||
CHECK(*byte == static_cast<uint8_t>(EquipmentAck::Denied_OutOfRange));
|
||||
}
|
||||
|
||||
TEST_CASE("S2F16 EAC enum matches SEMI E5 wire values") {
|
||||
// Pin the spec values so an inadvertent re-numbering breaks the test
|
||||
// instead of breaking interoperability with conformant hosts.
|
||||
CHECK(static_cast<uint8_t>(EquipmentAck::Accept) == 0);
|
||||
CHECK(static_cast<uint8_t>(EquipmentAck::Denied_UnknownEcid) == 1);
|
||||
CHECK(static_cast<uint8_t>(EquipmentAck::Denied_Busy) == 2);
|
||||
CHECK(static_cast<uint8_t>(EquipmentAck::Denied_OutOfRange) == 3);
|
||||
}
|
||||
|
||||
TEST_CASE("S2F34 DRACK enum matches SEMI E5 wire values") {
|
||||
CHECK(static_cast<uint8_t>(DefineReportAck::Accept) == 0);
|
||||
CHECK(static_cast<uint8_t>(DefineReportAck::InsufficientSpace) == 1);
|
||||
CHECK(static_cast<uint8_t>(DefineReportAck::InvalidFormat) == 2);
|
||||
CHECK(static_cast<uint8_t>(DefineReportAck::RptidAlreadyDefined) == 3);
|
||||
CHECK(static_cast<uint8_t>(DefineReportAck::InvalidVid) == 4);
|
||||
}
|
||||
|
||||
TEST_CASE("S2F36 LRACK enum matches SEMI E5 wire values") {
|
||||
CHECK(static_cast<uint8_t>(LinkEventAck::Accept) == 0);
|
||||
CHECK(static_cast<uint8_t>(LinkEventAck::InsufficientSpace) == 1);
|
||||
CHECK(static_cast<uint8_t>(LinkEventAck::InvalidFormat) == 2);
|
||||
CHECK(static_cast<uint8_t>(LinkEventAck::UnknownCeid) == 3);
|
||||
CHECK(static_cast<uint8_t>(LinkEventAck::UnknownRptid) == 4);
|
||||
CHECK(static_cast<uint8_t>(LinkEventAck::CeidAlreadyLinked) == 5);
|
||||
}
|
||||
|
||||
TEST_CASE("S2F42 HCACK enum matches SEMI E5 wire values") {
|
||||
CHECK(static_cast<uint8_t>(HostCmdAck::Accept) == 0);
|
||||
CHECK(static_cast<uint8_t>(HostCmdAck::InvalidCommand) == 1);
|
||||
CHECK(static_cast<uint8_t>(HostCmdAck::CannotDoNow) == 2);
|
||||
CHECK(static_cast<uint8_t>(HostCmdAck::ParameterInvalid) == 3);
|
||||
CHECK(static_cast<uint8_t>(HostCmdAck::AcceptedWillFinishLater) == 4);
|
||||
CHECK(static_cast<uint8_t>(HostCmdAck::Rejected) == 5);
|
||||
CHECK(static_cast<uint8_t>(HostCmdAck::InvalidObject) == 6);
|
||||
}
|
||||
|
||||
TEST_CASE("S7F4 ACKC7 enum matches SEMI E5 wire values") {
|
||||
CHECK(static_cast<uint8_t>(ProcessProgramAck::Accept) == 0);
|
||||
CHECK(static_cast<uint8_t>(ProcessProgramAck::PermissionNotGranted) == 1);
|
||||
CHECK(static_cast<uint8_t>(ProcessProgramAck::LengthError) == 2);
|
||||
CHECK(static_cast<uint8_t>(ProcessProgramAck::MatrixOverflow) == 3);
|
||||
CHECK(static_cast<uint8_t>(ProcessProgramAck::PpidNotFound) == 4);
|
||||
CHECK(static_cast<uint8_t>(ProcessProgramAck::ModeUnsupported) == 5);
|
||||
CHECK(static_cast<uint8_t>(ProcessProgramAck::PerformanceError) == 6);
|
||||
}
|
||||
|
||||
TEST_CASE("S10F2/F4/F6 ACKC10 enum matches SEMI E5 wire values") {
|
||||
CHECK(static_cast<uint8_t>(TerminalAck::Accepted) == 0);
|
||||
CHECK(static_cast<uint8_t>(TerminalAck::WillNotDisplay) == 1);
|
||||
CHECK(static_cast<uint8_t>(TerminalAck::TerminalNotAvailable) == 2);
|
||||
}
|
||||
|
||||
TEST_CASE("S1F18 ONLACK / S1F16 OFLACK / S1F14 COMMACK enum wire values") {
|
||||
CHECK(static_cast<uint8_t>(OnlineAck::Accept) == 0);
|
||||
CHECK(static_cast<uint8_t>(OnlineAck::NotAccept) == 1);
|
||||
CHECK(static_cast<uint8_t>(OnlineAck::AlreadyOnline) == 2);
|
||||
CHECK(static_cast<uint8_t>(OfflineAck::Accept) == 0);
|
||||
CHECK(static_cast<uint8_t>(CommAck::Accept) == 0);
|
||||
CHECK(static_cast<uint8_t>(CommAck::Denied) == 1);
|
||||
}
|
||||
|
||||
TEST_CASE("S2F18 carries 16-char time string") {
|
||||
auto m = s2f18_date_time_data("2026052812345678");
|
||||
auto t = parse_s2f18(m);
|
||||
@@ -392,6 +453,51 @@ TEST_CASE("S7F3 process-program send round-trip") {
|
||||
CHECK(parsed->ppbody == "step1\nstep2\n");
|
||||
}
|
||||
|
||||
TEST_CASE("S2F25 / S2F26 loopback diagnostic round-trip") {
|
||||
// Arbitrary binary payload — host sends, equipment echoes back.
|
||||
const std::string payload("\x00\x01\x02\xFE\xFF some text", 14);
|
||||
auto req = s2f25_loopback_diagnostic_request(payload);
|
||||
CHECK(req.stream == 2);
|
||||
CHECK(req.function == 25);
|
||||
CHECK(req.reply_expected);
|
||||
auto parsed_req = parse_s2f25(req);
|
||||
REQUIRE(parsed_req.has_value());
|
||||
CHECK(*parsed_req == payload);
|
||||
|
||||
auto rsp = s2f26_loopback_diagnostic_data(payload);
|
||||
auto parsed_rsp = parse_s2f26(rsp);
|
||||
REQUIRE(parsed_rsp.has_value());
|
||||
CHECK(*parsed_rsp == payload);
|
||||
}
|
||||
|
||||
TEST_CASE("S5F9 / S5F10 exception post round-trip") {
|
||||
std::vector<std::string> recovery = {"RETRY", "ABORT", "MANUAL_INTERVENTION"};
|
||||
auto m = s5f9_exception_post_notify(42, "FATAL", "vacuum lost", recovery);
|
||||
CHECK(m.stream == 5);
|
||||
CHECK(m.function == 9);
|
||||
CHECK(m.reply_expected);
|
||||
|
||||
auto parsed = parse_s5f9(m);
|
||||
REQUIRE(parsed.has_value());
|
||||
CHECK(parsed->exid == 42);
|
||||
CHECK(parsed->extype == "FATAL");
|
||||
CHECK(parsed->exmessage == "vacuum lost");
|
||||
CHECK(parsed->exrecvra == recovery);
|
||||
|
||||
CHECK(*ack_byte(s5f10_exception_post_confirm(AlarmAck::Accept)) == 0);
|
||||
}
|
||||
|
||||
TEST_CASE("S5F11 / S5F12 exception clear round-trip") {
|
||||
auto m = s5f11_exception_clear_notify(42, "FATAL", "vacuum restored");
|
||||
auto parsed = parse_s5f11(m);
|
||||
REQUIRE(parsed.has_value());
|
||||
CHECK(parsed->exid == 42);
|
||||
CHECK(parsed->extype == "FATAL");
|
||||
CHECK(parsed->exmessage == "vacuum restored");
|
||||
|
||||
CHECK(*ack_byte(s5f12_exception_clear_confirm(AlarmAck::Accept)) == 0);
|
||||
}
|
||||
|
||||
TEST_CASE("S7F19 / S7F20 EPPD list") {
|
||||
auto req = s7f19_current_eppd_request();
|
||||
CHECK(req.stream == 7);
|
||||
@@ -404,3 +510,77 @@ TEST_CASE("S7F19 / S7F20 EPPD list") {
|
||||
REQUIRE(parsed.has_value());
|
||||
CHECK(*parsed == std::vector<std::string>{"RECIPE-A", "RECIPE-B"});
|
||||
}
|
||||
|
||||
TEST_CASE("S14F9 / S14F10 CreateControlJob round-trip") {
|
||||
auto req = s14f9_create_control_job("CJ-1", {"PJ-1", "PJ-2"});
|
||||
CHECK(req.stream == 14);
|
||||
CHECK(req.function == 9);
|
||||
CHECK(req.reply_expected);
|
||||
|
||||
auto parsed = parse_s14f9(req);
|
||||
REQUIRE(parsed.has_value());
|
||||
CHECK(parsed->ctljobid == "CJ-1");
|
||||
CHECK(parsed->prjobids == std::vector<std::string>{"PJ-1", "PJ-2"});
|
||||
|
||||
auto ack = s14f10_create_control_job_ack("CJ-1", ObjectAck::Success);
|
||||
auto parsed_ack = parse_s14f10(ack);
|
||||
REQUIRE(parsed_ack.has_value());
|
||||
CHECK(parsed_ack->ctljobid == "CJ-1");
|
||||
CHECK(parsed_ack->ack == ObjectAck::Success);
|
||||
}
|
||||
|
||||
TEST_CASE("S14F11 / S14F12 DeleteControlJob round-trip") {
|
||||
auto req = s14f11_delete_control_job("CJ-1");
|
||||
auto parsed = parse_s14f11(req);
|
||||
REQUIRE(parsed.has_value());
|
||||
CHECK(*parsed == "CJ-1");
|
||||
|
||||
auto ack = s14f12_delete_control_job_ack(ObjectAck::Denied_UnknownObject);
|
||||
CHECK(*ack_byte(ack) == 2);
|
||||
}
|
||||
|
||||
TEST_CASE("S16F11 / S16F12 PRJobCreate round-trip") {
|
||||
auto req = s16f11_pr_job_create("PJ-1", "RECIPE-A", {"WFR-1", "WFR-2"});
|
||||
CHECK(req.stream == 16);
|
||||
CHECK(req.function == 11);
|
||||
|
||||
auto parsed = parse_s16f11(req);
|
||||
REQUIRE(parsed.has_value());
|
||||
CHECK(parsed->prjobid == "PJ-1");
|
||||
CHECK(parsed->ppid == "RECIPE-A");
|
||||
CHECK(parsed->mtrloutspec == std::vector<std::string>{"WFR-1", "WFR-2"});
|
||||
|
||||
CHECK(*ack_byte(s16f12_pr_job_create_ack(HostCmdAck::Accept)) == 0);
|
||||
}
|
||||
|
||||
TEST_CASE("S16F13 / S16F14 PRJobDequeue round-trip") {
|
||||
auto req = s16f13_pr_job_dequeue("PJ-1");
|
||||
CHECK(*parse_s16f13(req) == "PJ-1");
|
||||
CHECK(*ack_byte(s16f14_pr_job_dequeue_ack(HostCmdAck::CannotDoNow)) == 2);
|
||||
}
|
||||
|
||||
TEST_CASE("S16F5 / S16F6 PRJobCommand round-trip") {
|
||||
auto req = s16f5_pr_job_command("PJ-1", "PJSTART");
|
||||
auto parsed = parse_s16f5(req);
|
||||
REQUIRE(parsed.has_value());
|
||||
CHECK(parsed->prjobid == "PJ-1");
|
||||
CHECK(parsed->prcmd == "PJSTART");
|
||||
CHECK(*ack_byte(s16f6_pr_job_command_ack(HostCmdAck::Accept)) == 0);
|
||||
}
|
||||
|
||||
TEST_CASE("S16F9 PRJobAlert round-trip with typed state byte") {
|
||||
auto m = s16f9_pr_job_alert("PJ-1", ProcessJobState::Processing);
|
||||
auto parsed = parse_s16f9(m);
|
||||
REQUIRE(parsed.has_value());
|
||||
CHECK(parsed->prjobid == "PJ-1");
|
||||
CHECK(parsed->prjobstate == ProcessJobState::Processing);
|
||||
}
|
||||
|
||||
TEST_CASE("S16F27 / S16F28 CJobCommand round-trip") {
|
||||
auto req = s16f27_cj_command("CJ-1", "CJSTART");
|
||||
auto parsed = parse_s16f27(req);
|
||||
REQUIRE(parsed.has_value());
|
||||
CHECK(parsed->ctljobid == "CJ-1");
|
||||
CHECK(parsed->ctljobcmd == "CJSTART");
|
||||
CHECK(*ack_byte(s16f28_cj_command_ack(HostCmdAck::Accept)) == 0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user