Skip to content

Commit 1938fe0

Browse files
luisleo526claude
andcommitted
Value-initialise partial pending orders and pin the is_long audit (R4-C L5b)
Value-initialise partial PendingOrder test fixtures before vector relocation and mirror use (A41). Audit the five product construction paths; each assigns is_long before it can be read, so preserve the relocated member declaration verbatim and add no allow-list exception (A41). Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_016iF71UAEuQ7F6eqWgecAHm
1 parent 2c964db commit 1938fe0

7 files changed

Lines changed: 13 additions & 12 deletions

‎tests/test_native_reverse_to.cpp‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,14 +115,15 @@ struct Book final : PineStrategyHost {
115115
void exhaust_wins() { win_trades_count_ = std::numeric_limits<int>::max(); }
116116
void exhaust_lifecycle() { exit_leg_event_seq_ = UINT64_MAX; }
117117
void pending_exit() {
118-
PendingOrder order;
118+
PendingOrder order{};
119119
order.type = OrderType::EXIT;
120120
order.id = "retained";
121121
order.from_entry = "seed-11";
122122
order.incarnation = 700;
123123
order.created_seq = 700;
124124
order.legs.attach(order.incarnation, position_cycle_seq_);
125125
pending_orders_.push_back(std::move(order));
126+
CHECK(!pending_orders_.back().is_long);
126127
}
127128
size_t pending_count() const { return pending_orders_.size(); }
128129
const PendingOrder* pending_data() const { return pending_orders_.data(); }

‎tests/test_native_settlement_callers.cpp‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ struct Book final:PineStrategyHost{
8888
auto& lots(){return pyramid_entries_;}const auto& lots()const{return pyramid_entries_;}
8989
const auto& rows()const{return trades_;}const auto& actions()const{return stream_order_actions_;}
9090
double ledger(const char* id)const{auto at=id_unclosed_qty_.find(id);return at==id_unclosed_qty_.end()?0:at->second;}
91-
void retain_exit(){PendingOrder o;o.id="retained";o.from_entry="old";o.type=OrderType::EXIT;o.incarnation=999;o.created_seq=999;pending_orders_.push_back(std::move(o));}
91+
void retain_exit(){PendingOrder o{};o.id="retained";o.from_entry="old";o.type=OrderType::EXIT;o.incarnation=999;o.created_seq=999;pending_orders_.push_back(std::move(o));}
9292
size_t pending()const{return pending_orders_.size();}const PendingOrder* pending_data()const{return pending_orders_.data();}
9393
};
9494

@@ -112,7 +112,7 @@ void refused_provenance(bool zero,bool scratch){
112112
b.open(3,100,33,"untouched");
113113
if(scratch)b.lots()[0].market_pyramid_add=true;
114114
const auto hash=b.broker_state_hash();const auto action_count=b.actions().size();bool threw=false;
115-
try{if(scratch){PendingOrder o;o.from_entry="A";o.legs.set_stop_price(99);(void)b.scratch(o,110);}
115+
try{if(scratch){PendingOrder o{};o.from_entry="A";o.legs.set_stop_price(99);(void)b.scratch(o,110);}
116116
else b.by_all(110,"A");}catch(const std::runtime_error& e){threw=true;CHECK(std::string(e.what()).size()>0);}
117117
CHECK(threw);CHECK(b.broker_state_hash()==hash&&b.rows().empty()&&b.actions().size()==action_count);
118118
near(b.qty(),5);
@@ -184,7 +184,7 @@ void frozen_quantity_provenance(double sign){
184184

185185
void raw_cycles_and_noeffect(double sign){
186186
scenario="RAW one cycle allocator and after-Applied stamps";Book b;
187-
PendingOrder o;o.type=OrderType::RAW_ORDER;o.id="raw";o.is_long=sign>0;o.qty=1.25;o.incarnation=11;
187+
PendingOrder o{};o.type=OrderType::RAW_ORDER;o.id="raw";o.is_long=sign>0;o.qty=1.25;o.incarnation=11;
188188
o.created_position_side=PositionSide::FLAT;b.raw(o,100);
189189
REQUIRE(b.lots().size()==1);CHECK(b.cycle()==1&&b.next_cycle()==2);CHECK(b.ledger("raw")==1.25);
190190
PendingOrder add=o;add.id="raw-add";add.incarnation=22;add.created_position_side=sign>0?PositionSide::LONG:PositionSide::SHORT;
@@ -203,15 +203,15 @@ void source_slots_and_scratch(){
203203
b.partial(110,1,cause);CHECK(b.lots().size()==1);CHECK(b.slots()==(cause==Bracket?7:1));}
204204
scenario="R20 release remains after bracket slot restoration";Book unique;unique.pyramid(2);
205205
unique.bar(0,100);unique.open(1,100,11,"A");unique.bar(1,100);unique.open(1,100,22,"B");unique.bar(3,110);
206-
PendingOrder o;o.type=OrderType::EXIT;o.id="X";o.from_entry="A";o.qty=1;o.qty_percent=50;o.incarnation=99;o.created_seq=99;
206+
PendingOrder o{};o.type=OrderType::EXIT;o.id="X";o.from_entry="A";o.qty=1;o.qty_percent=50;o.incarnation=99;o.created_seq=99;
207207
o.created_bar=2;o.created_position_side=PositionSide::LONG;o.created_position_cycle_seq=unique.cycle();
208208
o.quantity_request.request(QuantityIntent::units(1));o.quantity_request.reserve(1,2);o.legs.set_limit_price(110);
209209
unique.exit(o,110);REQUIRE(unique.lots().size()==1);CHECK(unique.lots()[0].entry_incarnation==22&&unique.slots()==1);
210210
scenario="KI62 second one-ticket fill after primary bracket";Book scratch;
211211
scratch.bar(1,100);scratch.open(1,100,55,"A");scratch.bar(3,110);
212212
scratch.open(1,100,11,"A");scratch.open(2,100,11,"A");scratch.open(4,100,22,"Other");
213213
scratch.lots()[1].market_pyramid_add=true;scratch.lots()[2].market_pyramid_add=true;scratch.slots(5);
214-
PendingOrder bracket;bracket.type=OrderType::EXIT;bracket.id="scratch-bracket";bracket.from_entry="A";
214+
PendingOrder bracket{};bracket.type=OrderType::EXIT;bracket.id="scratch-bracket";bracket.from_entry="A";
215215
bracket.qty=1;bracket.qty_percent=12.5;bracket.incarnation=100;bracket.created_seq=100;
216216
bracket.quantity_request.request(QuantityIntent::units(1));bracket.quantity_request.reserve(1,8);
217217
bracket.legs.set_limit_price(110);

‎tests/test_opposite_intent_facts.cpp‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ admission::Journal journal_with(admission::BookObservation peer,
4949
}
5050

5151
PendingOrder current_order(const std::shared_ptr<const admission::CommandObservation>& current) {
52-
PendingOrder order;
52+
PendingOrder order{};
5353
order.type = OrderType::ENTRY;
5454
order.is_long = current->buy;
5555
order.created_position_side = PositionSide::FLAT;
@@ -123,7 +123,7 @@ void removed_peer_and_unknown_peer_fail_closed() {
123123
}
124124

125125
void absent_current_draft_and_controls_fail_closed() {
126-
PendingOrder manual;
126+
PendingOrder manual{};
127127
manual.type = OrderType::ENTRY;
128128
manual.created_position_side = PositionSide::FLAT;
129129
manual.created_seq = 2;

‎tests/test_pending_quantity_intent.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ void legacy_mirror_prefix_and_new_facts() {
335335
CHECK(std::memcmp(prefix.data(),&out,sizeof(prior_mirror::pf_pending_order_v1_t)) == 0);
336336
for (size_t i=sizeof(prior_mirror::pf_pending_order_v1_t); i<prefix.size(); ++i)
337337
CHECK(prefix[i] == 0xA5);
338-
PendingOrder plain;
338+
PendingOrder plain{};
339339
fill_pending_order_mirror(plain,&out);
340340
CHECK(out.quantity_intent_kind == 0 && out.quantity_reservation_present == 0);
341341
CHECK(out.requested_partial == 0 && out.full_percent_exit_request == 0);

‎tests/test_settlement_observation_boundary.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ struct Book final : pineforge::source::PineStrategyHost {
134134
uint64_t lifecycle_sequence() const { return exit_leg_event_seq_; }
135135
uint64_t next_order() const { return next_order_incarnation_; }
136136
void pending_exit() {
137-
PendingOrder order;
137+
PendingOrder order{};
138138
order.id = "pending"; order.type = OrderType::EXIT; order.incarnation = 700; order.created_seq = 700;
139139
order.legs.attach(order.incarnation, position_cycle_seq_);
140140
pending_orders_.push_back(std::move(order));

‎tests/test_source_exact_reversal.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ struct Book final : pineforge::source::PineStrategyHost {
9393
}
9494
void already_resolved_slippage() { slippage_ = 99; }
9595
void retain_exit() {
96-
PendingOrder order;
96+
PendingOrder order{};
9797
order.id = "retained";
9898
order.from_entry = "old";
9999
order.type = OrderType::EXIT;

‎tests/test_source_fifo_endpoints.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ void frozen_reservation(double sign) {
362362
book.open(sign * .7, 100, 11, "old-first", 7);
363363
book.bar(2, 100);
364364
book.open(sign * .1, 100, 12, "old-second", 1);
365-
PendingOrder order;
365+
PendingOrder order{};
366366
order.type = OrderType::EXIT;
367367
order.id = "frozen-basket";
368368
order.from_entry = "";

0 commit comments

Comments
 (0)