Skip to content

Conversation

@Oddant1
Copy link
Contributor

@Oddant1 Oddant1 commented Sep 30, 2025

Close #823

@github-project-automation github-project-automation bot moved this to Backlog in 2025.10 👻 Sep 30, 2025
@Oddant1 Oddant1 moved this from Backlog to In Development in 2025.10 👻 Sep 30, 2025
@Oddant1 Oddant1 added the stat:blocked This cannot be resolved until something else has changed. label Sep 30, 2025
@Oddant1 Oddant1 changed the title Start adding capture NEW: Add functionality that can capture values set inside of an action in provenance Oct 6, 2025
Comment on lines +190 to +195
def random_seed_method(random_seed: qtype.CaptureHolder = None) -> int:
if random_seed.value is None:
random_int = random.randrange(sys.maxsize)
random_seed.set_value(random_int)

return random_seed.value
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should we throw an error if a value was never set on the CaptureHolder?

Copy link
Contributor

Choose a reason for hiding this comment

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

I like that idea and it's easier to relax that rule if we had to.

I think so long as param.set_value(None) is legal than there's no real downside.

Copy link
Contributor Author

@Oddant1 Oddant1 Dec 19, 2025

Choose a reason for hiding this comment

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

@ebolyen How do we feel about rules for sentinel values? Are we ok with making the assumption there will only be one sentinel value? Do we feel ok with making the assumption that sentinel value will be the default value for the param? Makes a difference to how we determine if a value was set on the capture

Copy link
Contributor

Choose a reason for hiding this comment

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

I see some of the issues here.

I like how simple the above code looks. Adding a rule about set_value would either mean you make defaults special to it, or have to do somewhat ugly things.

    if random_seed.value is None:
        random_int = random.randrange(sys.maxsize)
    else:
        random_int = random_seed.value

    random_seed.set_value(random_int)

This just doesn't flow very nicely. So if we want to avoid setting what has already been set, then we need the default value to be treated as un-set, which is pretty much how we handle None, but if it was a value like 3 it gets weird. Although arguably, if 3 was the default, then there's nothing much to capture in the first place.

Given all of that, I think maybe the best approach is the default must be None and we treat that as un-set. Then to determine if param.set_value() has been called, we use a simple flag instead of the value itself. This permits None to be the value, but it requires the plugin to decide that rather than happening on accident and let's you skip param.set_value if it is anything other than None.

So then our logic would look like:

def _is_set(self):
    return self._set_value_called or self.value is not None

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok I did a buncha refactoring to follow these rules

@Oddant1 Oddant1 self-assigned this Oct 9, 2025
@Oddant1
Copy link
Contributor Author

Oddant1 commented Oct 9, 2025

If a value was passed into a capture parameter, do we want to treat that as the capture being set?

I think doing that would be nice, but the value they explicitly passed in may be a sentinel value for capturing. The default value for a Capture parameter may not be a sentinel, or it may not be the only sentinel.

@gregcaporaso gregcaporaso moved this from In Development to Needs Review in 2025.10 👻 Oct 16, 2025
@gregcaporaso gregcaporaso assigned ebolyen and unassigned Oddant1 Oct 16, 2025
@lizgehret lizgehret moved this to Needs Review in 2026.1 ❄️ Oct 16, 2025
@ebolyen ebolyen assigned Oddant1 and unassigned ebolyen Nov 5, 2025
@Oddant1 Oddant1 requested a review from ebolyen December 2, 2025 22:25
@Oddant1 Oddant1 assigned ebolyen and unassigned Oddant1 Dec 15, 2025
@Oddant1 Oddant1 moved this from In Development to In Review in 2026.1 ❄️ Dec 15, 2025
@Oddant1 Oddant1 removed the stat:blocked This cannot be resolved until something else has changed. label Dec 15, 2025
Copy link
Contributor

@ebolyen ebolyen left a comment

Choose a reason for hiding this comment

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

Looks pretty good, but still need to pull it down and play with it.

One thing we'll need to do is add an import alias to qiime2.plugin. Also I think the actual implementation may want to be outside of core/type/primitive.py, but I don't actually have a nice place for it to live. Maybe a new core/arguments.py module?

@Oddant1
Copy link
Contributor Author

Oddant1 commented Dec 19, 2025

but I don't actually have a nice place for it to live

@ebolyen Maybe it just goes in signature.py?

@ebolyen
Copy link
Contributor

ebolyen commented Dec 22, 2025

Maybe it just goes in signature.py?

Yeah that sounds fine to me.
image

qiime2/core/type/signature.py (1964 - Full Color)

@Oddant1 Oddant1 requested a review from ebolyen December 22, 2025 22:52
Copy link
Contributor

@ebolyen ebolyen left a comment

Choose a reason for hiding this comment

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

LGTM, just two tiny comments. Feel free to merge when ready.

Oddant1 and others added 2 commits December 23, 2025 10:27
@Oddant1 Oddant1 merged commit 67a87d0 into rachis-org:dev Dec 23, 2025
4 checks passed
@Oddant1 Oddant1 moved this from In Review to Changelog Needed in 2026.1 ❄️ Dec 23, 2025
@Oddant1 Oddant1 assigned Oddant1 and unassigned ebolyen Dec 23, 2025
@Oddant1 Oddant1 moved this from Changelog Needed to Completed in 2026.1 ❄️ Jan 26, 2026
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.

develop approach for storing random seeds in provenance

2 participants