fix(fugu): accept a bare integer access index in workflow parse-gate#255
Open
rsnetworkinginc wants to merge 1 commit into
Open
fix(fugu): accept a bare integer access index in workflow parse-gate#255rsnetworkinginc wants to merge 1 commit into
rsnetworkinginc wants to merge 1 commit into
Conversation
…i-router#225) The workflow parse-gate normalizes each step access entry via _normalize_access, which handled the string form ("0"), the list form ([0]) and "all"/empty shorthands, but a bare integer (0) fell through every branch and returned None, rejecting the whole workflow. A bare int is the natural shorthand for a single prior-step index, so the Conductor emitting access_list=["none", 0, 1] had its otherwise-valid workflow scored as a parse failure (r=0). Accept a bare int as a single index, validating 0 <= j < step_index (forward references still reject) and excluding bool. Adds a RED->GREEN regression test.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The Fugu workflow parse-gate normalizes each step's access entry through
_normalize_access(src/trinity/fugu/workflow.py). It accepted the stringform (
"0"), the list form ([0]), and the"all"/empty shorthands, but abare integer access index (
0) fell through every branch and returnedNone— which rejects the entire workflow as a parse failure.A bare int is the natural shorthand for a single prior-step index, so a
Conductor emitting a perfectly valid proposal like:
was scored
r = 0even though"none","0", and[0]in the same positionall parse fine. This penalizes correct workflows for a cosmetic formatting
choice the parser never documented as invalid.
Closes #225.
Fix
Handle a bare
intin_normalize_accessas a single index, mirroring theexisting string-digit branch:
boolis rejected first (it is anintsubclass and never a valid index).intjis accepted as[j]only when0 <= j < step_index, soforward references and negative indices still reject the workflow (same DAG
invariant as the list branch).
The docstring is updated to list the bare-integer form as valid.
Tests
Added
test_parse_accepts_bare_int_access_index(RED before the fix, GREENafter):
access_list = ["none", 0, 1]now parses to[[], [0], [1]].access_list = [0, 1]) is still rejected.No behavior change for any previously-accepted or previously-rejected form.