Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transitioning to assisted versioning mode doesn't catch errors with old artifacts #47

Open
jqmp opened this issue Oct 31, 2019 · 0 comments
Labels
bug Something isn't working enhancement New feature or request

Comments

@jqmp
Copy link
Collaborator

jqmp commented Oct 31, 2019

(This is a bit of an edge case, since it requires switching versioning modes. The only time I've encountered it was while trying to prepare a demo of the different versioning modes. But it'd be nice to figure out if there's an easy fix.)

Assisted versioning mode is intended to catch user errors by detecting when the user has updated a function's code but not its version. However, it can't do this for artifacts that were computed in the manual versioning mode. Here's an example as a failing test:

def test_indirect_versioning_mode_transition(builder):
    builder.assign('x', 2)

    @builder
    def y():
        return 3

    @builder
    def f(x, y):
        return x + y

    assert builder.build().get('f') == 5

    @builder  # noqa: F811
    def y():
        return 4

    # Since we're using manual versioning, it makes sense that we get a
    # stale value here.
    assert builder.build().get('f') == 5

    builder.set('core__versioning_mode', 'assist')

    # Ideally we'd get an error here, but we don't (the test fails).
    with pytest.raises(CodeVersioningError):
        builder.build().get('f')

This is because we (1) load f from the cache, (2) don't notice that the bytecode has changed (because we're in manual mode), (3) update the cache to indicate that f's value exactly satisfied what we wanted, which (4) which prevents any future bytecode checks for particular combination of artifact+code. I'm not 100% sure, but it may be possible to skip step (3) in manual mode, which should fix this.

@jqmp jqmp added bug Something isn't working enhancement New feature or request labels Feb 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant