Carry annual stock capital service counters

This commit is contained in:
Jan Petykiewicz 2026-04-18 02:00:55 -07:00
commit ecfc78f410
7 changed files with 43 additions and 3 deletions

View file

@ -106,7 +106,8 @@ full annual dividend adjustment branch over owned current cash, public float, cu
building-growth policy, and recent profit history instead of leaving that policy on shell-side building-growth policy, and recent profit history instead of leaving that policy on shell-side
dialog notes. The same periodic service now also carries the annual bond lane's retired-versus- dialog notes. The same periodic service now also carries the annual bond lane's retired-versus-
issued principal totals as first-class runtime summary state, which is the owner seam behind the issued principal totals as first-class runtime summary state, which is the owner seam behind the
later debt-news family. `simulation_service_periodic_boundary_work` is now beginning to use that same owner later debt-news family, and it now carries the paired issued-share and repurchased-share counts
behind the equity-offering and `2887` buyback news tails too. `simulation_service_periodic_boundary_work` is now beginning to use that same owner
surface too: the runtime chooses one annual-finance action per active company and already commits surface too: the runtime chooses one annual-finance action per active company and already commits
the shellless creditor-pressure-bankruptcy, deep-distress-bankruptcy, dividend-adjustment, the shellless creditor-pressure-bankruptcy, deep-distress-bankruptcy, dividend-adjustment,
stock-repurchase, stock-issue, and bond-issue branches by mutating owned company activity, stock-repurchase, stock-issue, and bond-issue branches by mutating owned company activity,

View file

@ -13995,6 +13995,8 @@ mod tests {
annual_dividend_adjustment_commit_count: 0, annual_dividend_adjustment_commit_count: 0,
annual_bond_last_retired_principal_total: 0, annual_bond_last_retired_principal_total: 0,
annual_bond_last_issued_principal_total: 0, annual_bond_last_issued_principal_total: 0,
annual_stock_repurchase_last_share_count: 0,
annual_stock_issue_last_share_count: 0,
chairman_issue_opinion_terms_raw_i32: BTreeMap::new(), chairman_issue_opinion_terms_raw_i32: BTreeMap::new(),
chairman_personality_raw_u8: BTreeMap::new(), chairman_personality_raw_u8: BTreeMap::new(),
}, },

View file

@ -1241,6 +1241,10 @@ pub struct RuntimeServiceState {
#[serde(default)] #[serde(default)]
pub annual_bond_last_issued_principal_total: u64, pub annual_bond_last_issued_principal_total: u64,
#[serde(default)] #[serde(default)]
pub annual_stock_repurchase_last_share_count: u64,
#[serde(default)]
pub annual_stock_issue_last_share_count: u64,
#[serde(default)]
pub chairman_issue_opinion_terms_raw_i32: BTreeMap<u32, Vec<i32>>, pub chairman_issue_opinion_terms_raw_i32: BTreeMap<u32, Vec<i32>>,
#[serde(default)] #[serde(default)]
pub chairman_personality_raw_u8: BTreeMap<u32, u8>, pub chairman_personality_raw_u8: BTreeMap<u32, u8>,

View file

@ -502,6 +502,8 @@ fn service_company_annual_finance_policy(
state.service_state.annual_finance_service_calls += 1; state.service_state.annual_finance_service_calls += 1;
state.service_state.annual_bond_last_retired_principal_total = 0; state.service_state.annual_bond_last_retired_principal_total = 0;
state.service_state.annual_bond_last_issued_principal_total = 0; state.service_state.annual_bond_last_issued_principal_total = 0;
state.service_state.annual_stock_repurchase_last_share_count = 0;
state.service_state.annual_stock_issue_last_share_count = 0;
let mut mutated_company_ids = BTreeSet::new(); let mut mutated_company_ids = BTreeSet::new();
let mut applied_effect_count = 0u32; let mut applied_effect_count = 0u32;
@ -605,6 +607,10 @@ fn service_company_annual_finance_policy(
proceeds_per_tranche as f64, proceeds_per_tranche as f64,
false, false,
); );
state.service_state.annual_stock_issue_last_share_count = state
.service_state
.annual_stock_issue_last_share_count
.saturating_add(u64::from(batch_size));
} }
let Some(market_state) = state let Some(market_state) = state
.service_state .service_state
@ -838,6 +844,10 @@ fn service_company_annual_finance_policy(
break; break;
}; };
market_state.outstanding_shares = next_outstanding_shares; market_state.outstanding_shares = next_outstanding_shares;
state.service_state.annual_stock_repurchase_last_share_count = state
.service_state
.annual_stock_repurchase_last_share_count
.saturating_add(u64::from(batch_size));
} }
if mutated { if mutated {
applied_effect_count += 1; applied_effect_count += 1;
@ -2899,6 +2909,14 @@ mod tests {
state.service_state.annual_finance_last_actions.get(&22), state.service_state.annual_finance_last_actions.get(&22),
Some(&crate::RuntimeCompanyAnnualFinancePolicyAction::StockIssue) Some(&crate::RuntimeCompanyAnnualFinancePolicyAction::StockIssue)
); );
assert_eq!(
state.service_state.annual_stock_issue_last_share_count,
4_000
);
assert_eq!(
state.service_state.annual_stock_repurchase_last_share_count,
0
);
assert_eq!(state.companies[0].current_cash, 390_000); assert_eq!(state.companies[0].current_cash, 390_000);
assert_eq!( assert_eq!(
state.service_state.company_market_state[&22].outstanding_shares, state.service_state.company_market_state[&22].outstanding_shares,
@ -3059,6 +3077,11 @@ mod tests {
state.service_state.annual_finance_last_actions.get(&23), state.service_state.annual_finance_last_actions.get(&23),
Some(&crate::RuntimeCompanyAnnualFinancePolicyAction::StockRepurchase) Some(&crate::RuntimeCompanyAnnualFinancePolicyAction::StockRepurchase)
); );
assert_eq!(state.service_state.annual_stock_issue_last_share_count, 0);
assert_eq!(
state.service_state.annual_stock_repurchase_last_share_count,
1_000
);
assert_eq!( assert_eq!(
state.companies[0].current_cash, state.companies[0].current_cash,
1_600_000 - expected_repurchase_total 1_600_000 - expected_repurchase_total

View file

@ -261,6 +261,8 @@ pub struct RuntimeSummary {
pub annual_dividend_adjustment_commit_count: u64, pub annual_dividend_adjustment_commit_count: u64,
pub annual_bond_last_retired_principal_total: u64, pub annual_bond_last_retired_principal_total: u64,
pub annual_bond_last_issued_principal_total: u64, pub annual_bond_last_issued_principal_total: u64,
pub annual_stock_repurchase_last_share_count: u64,
pub annual_stock_issue_last_share_count: u64,
pub total_trigger_dispatch_count: u64, pub total_trigger_dispatch_count: u64,
pub dirty_rerun_count: u64, pub dirty_rerun_count: u64,
pub total_company_cash: i64, pub total_company_cash: i64,
@ -1389,6 +1391,12 @@ impl RuntimeSummary {
annual_bond_last_issued_principal_total: state annual_bond_last_issued_principal_total: state
.service_state .service_state
.annual_bond_last_issued_principal_total, .annual_bond_last_issued_principal_total,
annual_stock_repurchase_last_share_count: state
.service_state
.annual_stock_repurchase_last_share_count,
annual_stock_issue_last_share_count: state
.service_state
.annual_stock_issue_last_share_count,
total_trigger_dispatch_count: state total_trigger_dispatch_count: state
.service_state .service_state
.trigger_dispatch_counts .trigger_dispatch_counts

View file

@ -157,7 +157,8 @@ The highest-value next passes are now:
directly from owned bond slots, and now also commits the shellless “repay matured live bonds, directly from owned bond slots, and now also commits the shellless “repay matured live bonds,
compact the table, then issue the exact staged count” path during periodic service; the same compact the table, then issue the exact staged count” path during periodic service; the same
service surface now also carries the per-cycle retired-versus-issued principal totals that feed service surface now also carries the per-cycle retired-versus-issued principal totals that feed
the later debt-news family the later debt-news family plus the issued-share and repurchased-share counts behind the later
equity-offering and buyback news tails
- the project rule on the remaining closure work is now explicit too: when one runtime-facing field - the project rule on the remaining closure work is now explicit too: when one runtime-facing field
is still ambiguous, prefer rehosting the owning source state or real reader/setter family first is still ambiguous, prefer rehosting the owning source state or real reader/setter family first
instead of guessing another derived leaf field from neighboring raw offsets instead of guessing another derived leaf field from neighboring raw offsets

View file

@ -236,7 +236,8 @@ The annual bond lane now rides it as well, using the simulated post-repayment ca
linked-transit threshold split to stage `500000` principal issue counts without shell ownership, linked-transit threshold split to stage `500000` principal issue counts without shell ownership,
and periodic boundary service now commits the same shellless matured-bond repay/compact/issue path instead of and periodic boundary service now commits the same shellless matured-bond repay/compact/issue path instead of
stopping at the staging reader. That same service seam now also carries the retired-versus-issued stopping at the staging reader. That same service seam now also carries the retired-versus-issued
principal totals needed by the later debt-news tail. principal totals needed by the later debt-news tail, plus the issued-share and repurchased-share
counts needed by the later equity-offering and buyback news tails.
The annual dividend-adjustment lane now rides that same seam too: the runtime now rehosts the The annual dividend-adjustment lane now rides that same seam too: the runtime now rehosts the
shared year-or-control-transfer metric reader, the board-approved dividend ceiling helper, and the shared year-or-control-transfer metric reader, the board-approved dividend ceiling helper, and the
full annual dividend branch over owned cash, public float, current dividend, and building-growth full annual dividend branch over owned cash, public float, current dividend, and building-growth