astep() passes unprocessed inputs to pre_run_step hooks
メンテナーはふだん 6 日以内に返信
評価
調査の方向性
同期版の _step() と非同期版の _astep() の実装を読み、_process_inputs() が pre_run_step に対してどこで実行されるかに注目してください。処理済み入力と必須入力の不足に関するテストを、issue の例を参考に追加または適宜修正してください。両方の経路で、hook に action と同じ処理済み入力が渡され、検証に失敗した場合は hook がスキップされれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Application.astep() passes raw, unprocessed inputs to pre_run_step lifecycle hooks, while Application.step() passes the validated and processed inputs that are actually provided to the action. This causes inconsistent lifecycle and tracking behavior between synchronous and asynchronous execution.
Current behavior
Application.step() calls _process_inputs() before invoking the pre_run_step hook. Consequently, undeclared inputs are removed and required inputs are validated before the hook runs.
Application.astep() invokes pre_run_step with the original input dictionary before calling _process_inputs().
For an action that declares no inputs:
step hook inputs: {}
astep hook inputs: {"unused": 123}
There is also inconsistent behavior when a required input is missing:
pre_run_step calls:
step: 0
astep: 1
This means lifecycle adapters and tracking clients can record inputs that were never passed to the action.
Stack Traces
Not applicable. The inconsistency occurs without an exception when undeclared inputs are supplied.
Screenshots
Not applicable.
Steps to replicate behavior
- Run the following script:
import asyncio
from burr.core import ApplicationBuilder, State, action
from burr.lifecycle import PreRunStepHook
class CaptureInputs(PreRunStepHook):
def __init__(self):
self.inputs = []
def pre_run_step(self, *, inputs, **kwargs):
self.inputs.append(inputs)
@action(reads=[], writes=[])
def noop(state: State) -> State:
return state
sync_hook = CaptureInputs()
sync_app = (
ApplicationBuilder()
.with_actions(noop)
.with_entrypoint("noop")
.with_hooks(sync_hook)
.build()
)
sync_app.step(inputs={"unused": 123})
async_hook = CaptureInputs()
async_app = (
ApplicationBuilder()
.with_actions(noop)
.with_entrypoint("noop")
.with_hooks(async_hook)
.build()
)
asyncio.run(async_app.astep(inputs={"unused": 123}))
print("step hook inputs:", sync_hook.inputs)
print("astep hook inputs:", async_hook.inputs)
- Observe the output:
step hook inputs: [{}]
astep hook inputs: [{"unused": 123}]
Library & System Information
- Apache Burr: current
main(9088aad8cb6de62b9923816b89eaa562c1162c65) - Python 3
- Reproduced on Linux
Expected behavior
step() and astep() should have consistent lifecycle semantics:
- Inputs should be validated and processed before
pre_run_stepis invoked. - The hook should receive the processed inputs that will be passed to the action.
- The same processed input dictionary should be used by both the hook and the action.
pre_run_stepshould not be invoked when input validation fails.
Additional context
In _step(), _process_inputs() is called before pre_run_step, and the resulting action_inputs are passed to both the hook and the action.
In _astep(), pre_run_step currently receives the original inputs dictionary, and _process_inputs() is called later during action execution.
Related issue #36 added action inputs to lifecycle hooks and tracking, but it does not cover this synchronous/asynchronous inconsistency.
- 主要言語
- Python
- スター
- 2.6k
- フォーク
- 209
- 平均マージ
- 10日 9時間
- マージ済み PR(30日)
- 17
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
apache/burr のほかの issue
-
Notebook UI launcher should use the current Python interpreter対応中かも @sivakumar-mahalingam が 1 日前に担当しました。 オープンstatus/needs-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
メンテナーはふだん 6 日以内に返信
-
`burr` fails to start when the Python path has a space in it対応中かも @enekoreto が 4 日前に担当しました。 オープンstatus/needs-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 6 日以内に返信
-
Add more instructions for applying ORM migrations for S3 deployment対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンarea/storage area/ui help wanted kind/documentation priority/low
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 6 日以内に返信
-
Add documentation on how to run the Burr UI server再び着手できるかも @iamSerafinnn が 134 日前に担当しましたが、オープン中のプルリクエストはありません。 オープンarea/ui good first issue kind/documentation priority/low
難易度 2/5 半日 初心者へのやさしさ 68/100
メンテナーはふだん 6 日以内に返信
-
status/needs-triage
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
メンテナーはふだん 6 日以内に返信
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
eclipse-score/inc_someip_gateway#356 ·
メンテナーはふだん 2 日以内に返信
-
[BUG]: `GitHubRestAdapter.check_user_permission` and `has_write_access` raise `TypeError` (missing `params`), silently disabling the inactivity lifecycle対応中かも @tarunagnihotri534 が今日担当しました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
AOSSIE-Org/Gitcord-GithubDiscordBot#167 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
mihai-vlc/sublime-jsfmt#56 ·
-
comp/cli comp/plugins P2 type/bug
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
NousResearch/hermes-agent#141917 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 78/100
riscv/riscv-opcodes#441 ·