BUG: one stochastic component wrapper can be stored on a rocket twice
メンテナーはふだん 3 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
Start by reading Components.add and the rocket methods that add parachutes and positioned surface components; then find their existing tests. Add coverage for rejecting the same wrapper twice while accepting separate wrappers around one deterministic component. Done means duplicate wrappers are refused and the requested cases pass.
索引モデルが issue の本文から書いたものです。
説明
What happens
Nothing stops the same stochastic wrapper from being stored twice on one rocket. Components.add does not check, and parachutes and air_brakes are plain lists that append.
chute = StochasticParachute(parachute=calisto_main_chute, cd_s=0.1, lag=0.2)
stochastic_rocket.add_parachute(chute)
stochastic_rocket.add_parachute(chute)
stochastic_rocket._set_stochastic(99)
Both list entries are the one object, so the second reseed overwrites the first:
parachutes[0] is parachutes[1]: True
_seed of each entry: 154423647178671419759920218774039641014
154423647178671419759920218774039641014
The rocket ends up with two parachutes that are not independent. They draw one after the other from the same generator, and StochasticParachute.create_object derives the pressure noise seed from _seed and the parachute name, which are now the same for both, so the noise is identical rather than merely correlated.
A positioned component is worse. __components_map is keyed by the wrapper, so adding one at two positions leaves only the second position, and both entries are reset from it.
Why it is worth stating
On develop today every nested component shares one seed anyway, so this is not visible as a separate problem. #1170 gives each component its own child, and the guarantee it states is that two components sample independently. A wrapper stored twice is the case where that does not hold, so the contract needs an owner.
Fix
The clean rule is that one stochastic wrapper belongs to one collection entry, and two components need two wrappers. Wrapping the same deterministic object twice stays supported, since each call builds a separate wrapper.
Rejecting by identity at add time reads well and is cheap. Copying the wrapper instead would be worse: it may hold a Function, a callable, a CustomSampler or a shared generator, and copy semantics for those are not something to decide implicitly.
Tests worth having: the same StochasticParachute twice is refused, the same surface wrapper at two positions is refused, and two separate wrappers around one deterministic component are accepted and seeded independently.
Related
Two neighbouring problems, both separate from this one:
add_air_brakesappends the air brake but keeps a singleair_brake_controller, so several air brakes all use the controller from the last call;set_rail_buttonsis named as a setter but callsadd, so calling it twice consumes draws for a set of buttons thatcreate_objectthen overwrites.
- 主要言語
- Python
- スター
- 1.1k
- フォーク
- 280
- 平均マージ
- 3日 2時間
- マージ済み PR(30日)
- 24
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
RocketPy-Team/RocketPy のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
RocketPy-Team/RocketPy#1255 ·
メンテナーはふだん 3 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 92/100
RocketPy-Team/RocketPy#1241 ·
メンテナーはふだん 3 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
RocketPy-Team/RocketPy#1202 ·
メンテナーはふだん 3 日以内に返信
-
Monte Carlo test fixtures write their logs into the working directory対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
RocketPy-Team/RocketPy#1189 ·
メンテナーはふだん 3 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
RocketPy-Team/RocketPy#1171 · コメント 1 件 ·
メンテナーはふだん 3 日以内に返信
RocketPy-Team/RocketPy の issue をすべて見る
似ている issue
-
docs(contributing): the two things that silently block a PR対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンavailable documentation good first issue
難易度 1/5 1〜3時間 初心者へのやさしさ 95/100
Nixitov/Riptide-Native#944 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
JTHCode/secretguard#24 ·
メンテナーはふだん 1 日以内に返信
-
area: middleware documentation good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
-
enhancement good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
メンテナーはふだん 1 日以内に返信
-
good first issue
難易度 1/5 1時間未満 初心者へのやさしさ 95/100
omarelshamy25x/shamy-hijri#63 ·
メンテナーはふだん 1 日以内に返信