Skip to content

fix(fugu): accept a bare integer access index in workflow parse-gate#255

Open
rsnetworkinginc wants to merge 1 commit into
mini-router:mainfrom
rsnetworkinginc:fix-fugu-bare-int-access
Open

fix(fugu): accept a bare integer access index in workflow parse-gate#255
rsnetworkinginc wants to merge 1 commit into
mini-router:mainfrom
rsnetworkinginc:fix-fugu-bare-int-access

Conversation

@rsnetworkinginc

Copy link
Copy Markdown

Summary

The Fugu workflow parse-gate normalizes each step's access entry through
_normalize_access (src/trinity/fugu/workflow.py). It accepted the string
form ("0"), the list form ([0]), and the "all"/empty shorthands, but a
bare integer access index (0) fell through every branch and returned
None — 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:

model_id    = [0, 1, 2]
subtasks    = ["solve", "check", "answer"]
access_list = ["none", 0, 1]

was scored r = 0 even though "none", "0", and [0] in the same position
all parse fine. This penalizes correct workflows for a cosmetic formatting
choice the parser never documented as invalid.

Closes #225.

Fix

Handle a bare int in _normalize_access as a single index, mirroring the
existing string-digit branch:

  • bool is rejected first (it is an int subclass and never a valid index).
  • an int j is accepted as [j] only when 0 <= j < step_index, so
    forward 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, GREEN
after):

  • access_list = ["none", 0, 1] now parses to [[], [0], [1]].
  • a bare-int forward reference (access_list = [0, 1]) is still rejected.
$ python -m pytest tests/test_fugu_workflow.py -q
.........                                                                 [100%]
9 passed

No behavior change for any previously-accepted or previously-rejected form.

…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.
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.

fugu: workflow parser rejects a bare-int access index (accepts "0"/[0] but not 0)

1 participant