Skip to content

fix: reconstruct nested dataclass lists in MC _dict_to_config (#12)#13

Merged
abhicris merged 1 commit into
kcolbchain:mainfrom
gtx20060124-bot:pr/fix-mc-nested-dataclass
Jun 19, 2026
Merged

fix: reconstruct nested dataclass lists in MC _dict_to_config (#12)#13
abhicris merged 1 commit into
kcolbchain:mainfrom
gtx20060124-bot:pr/fix-mc-nested-dataclass

Conversation

@gtx20060124-bot

Copy link
Copy Markdown
Contributor

Summary

Fixes 4/18 Monte Carlo tests that fail with:

AttributeError: dict object has no attribute volume_usd_m0

Root cause

mc_run round-trips SimConfig through _dataclass_to_dict and back through _dict_to_config. The reconstruct step did a flat setattr, destroying nested List[RevenueStream] and List[VestBucket] — they became flat dicts instead of dataclass objects.

Fix

  • Detect list fields whose originals are dataclass lists
  • Recursively reconstruct via _dict_to_dataclass helper
  • Also handles nested dict → dataclass reconstruction

Closes kcolbchain/token-simulator #12

…hain#12)

_dataclass_to_dict flattens nested lists (RevenueStream, VestBucket)
to dicts but _dict_to_config did a flat setattr, destroying structure.

Fix: detect list fields whose originals are dataclass lists and
recursively reconstruct via _dict_to_dataclass helper.

Closes kcolbchain/token-simulator kcolbchain#12
@abhicris

Copy link
Copy Markdown

Welcome to kcolbchain, @gtx20060124-bot — glad you're here. 🌱

Here's what happens from this PR:

  1. Our automated review looks for obvious issues (tests, secrets, size) within a couple of hours.
  2. If it's clean and CI passes, we merge without back-and-forth.
  3. If we need changes, we'll leave a specific comment — not a generic nit. Push another commit and we re-review.

While you wait:

  • Run the repo's tests locally (see the repo README.md).
  • Keep the PR scoped to one concern — bigger PRs land slower.
  • Don't commit tokens or .env contents.

What happens after your first merge

Thanks for writing the code. We're building this to last.

@abhicris

Copy link
Copy Markdown

🤖 Audit verdict: safe

Code adds legitimate nested dataclass reconstruction logic with no malicious intent, credential leakage, or security vulnerabilities.

Audited by the kcolbchain PR pipeline. See pipeline docs.

@abhicris abhicris merged commit ce04f39 into kcolbchain:main Jun 19, 2026
@abhicris

Copy link
Copy Markdown

Merged — thank you, @gtx20060124-bot. Your first kcolbchain contribution is in. 🎉

A few things that unlocked with this merge:

If you want to stay in the loop on what we're shipping: https://kcolbchain.com/ROADMAP.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants