Skip to content

Add support for state_header access in the SDK - #205

Merged
ed255 merged 32 commits into
mainfrom
feat/actiom-state-3
Aug 3, 2026
Merged

Add support for state_header access in the SDK#205
ed255 merged 32 commits into
mainfrom
feat/actiom-state-3

Conversation

@ed255

@ed255 ed255 commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator

Resolve #201

I had to merge the In/Out records into a single IO one because even after the splitter did its thing, there were predicates that had 9 wildcards (our max is 8).
I believe this change doesn't introduce any performance regression and gets rid of one wildcard in some occasions.

Note for the reviewer: I haven't yet tested the correct behavior of the synchronizer after this PR nor an end 2 end flow because I don't have access to my everyday machine and I did this on 8GB of RAM 🫠

/// slot index is `ts - 1` and the step name is `step_{ts-1}`.
pub(crate) fn chain_step_at(ts: usize, chain_max_ts: usize) -> Option<usize> {
(chain_packed(chain_max_ts) && ts > 0 && ts < chain_max_ts).then_some(ts - 1)
(chain_packed(chain_max_ts) && ts > 0 && ts < chain_max_ts).then(|| ts - 1)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There was an underflow here (which was detected in debug mode).
On underflow this results in None, but in debug an underflow panics. By using a closure the subtraction only happens when the check passes.

@ed255
ed255 force-pushed the feat/actiom-state-3 branch from 8150748 to dffc01c Compare July 29, 2026 16:50
@ed255
ed255 force-pushed the feat/actiom-state-3 branch from dffc01c to b46f259 Compare July 29, 2026 17:08
@ed255
ed255 force-pushed the feat/actiom-state-3 branch from 1fccba6 to 2c61de0 Compare July 29, 2026 17:49
@ed255
ed255 requested a review from dhvanipa July 29, 2026 19:11
@dhvanipa
dhvanipa requested a review from robknight July 30, 2026 15:56
@dhvanipa

Copy link
Copy Markdown
Collaborator

what does d-- in "kind": "d--" mean? I think d is dictionary but not sure what the dashes are

@dhvanipa

dhvanipa commented Jul 30, 2026

Copy link
Copy Markdown
Collaborator

FYI - confirmed e2e objects are produced and synchronizer runs fine

Some docs are outdated and the GUI rendering is broken cuz of the new object structure but I updated those here #206

Comment thread libs/sdk/src/lib.rs Outdated
@ed255

ed255 commented Jul 31, 2026

Copy link
Copy Markdown
Collaborator Author

what does d-- in "kind": "d--" mean? I think d is dictionary but not sure what the dashes are

This is inspired by the read/write/execute flags of files display in Unix. So d-- means:

  • dictionary: yes
  • set: no
  • array: no
    The reason for using bit flags is because there are cases where a container can be multiple kinds at the same time. Here's the full context Add ContainerKind 0xPARC/pod2#526

@robknight robknight left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems good overall, just some questions about how io is handled and some outdated comments which need tidying up.

Comment thread libs/sdk/src/fmt_podlang.rs Outdated
Comment thread libs/sdk/src/fmt_podlang.rs Outdated
Comment thread libs/sdk/src/fmt_podlang.rs Outdated
Comment thread libs/sdk/src/fmt_podlang.rs Outdated
Comment thread libs/sdk/src/fmt_podlang.rs Outdated
Comment thread libs/sdk/src/lib.rs
Comment thread libs/sdk/src/tests.rs
let res = executor.action("Tick", vec![ticker0]).unwrap();
let ticker1_tx = res.tx.clone();
let [_ticker1] = res.objs();
apply_tx(&mut state, &ticker1_tx);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are no asserts in this test. Are we just testing for panics?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The intention here is to run the action and make sure it succeeds and the statements are built satisfied. So yeah, we're testing for panics because we're unrwapping the result of executor.action. Do you think some asserts would be useful here?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I just wanted to check the rationale.

Comment thread libs/sdk/src/lib.rs
Comment thread libs/sdk/src/fmt_podlang.rs Outdated
Comment thread libs/txlib/src/lib.rs Outdated
@ed255

ed255 commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator Author

I've merged #206 into this PR's branch, which fixed most (if not all) of the documentation issues @robknight mentioned.

@robknight
robknight self-requested a review August 3, 2026 19:16

@robknight robknight left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, the merge addresses the issues I raised.

@ed255
ed255 merged commit 14419f4 into main Aug 3, 2026
3 checks passed
@ed255
ed255 deleted the feat/actiom-state-3 branch August 3, 2026 19:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Extend SDK to read StateHeader ergonomically

4 participants