Expose the source a read resolves to: period, branch, tier and whether it is an input
Maintainer thường phản hồi trong vòng 3 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 28/100
Hướng nghiên cứu
Start in holders/holder.py: read get_array/_readable_branches (305–352, 665–687), _stores_user_input (262–285), _seed_input_storage (214–240), and the _set/put_in_cache input-location handling (242–260, 544–609). Then trace carry logic in simulations/simulation.py (143–162, 1221–1236) and the deletion behavior in data_storage/in_memory_storage.py (305–321). Done means a side-effect-free Holder.read_source(period, branch_name) returning period, carried, branch, tier, derived and is_input, with tests for the listed cases and the calculate differential.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Problem
Country packages need to know whether the value core returns for a variable is an input someone supplied, and today they can only find out by copying core's read logic from private members. policyengine-uk's plan for deterministic draws needs three facts for a (variable, period, branch):
- The slot
Holder.get_arrayreads. That is the first branch in_readable_branchesthat stores the period, reading memory before disk (holders/holder.py:305–352,:665–687). - The carry source, where that slot is empty or derived. That is the latest of
get_input_periods(branch)starting at or before the period, ranked by_latest_input_key(simulations/simulation.py:143–162,:1221–1236). - Whether the value in that tier is an actual input. That comes from
_user_input_storage's locations, or the storage mark for a restored or register-only input (_stores_user_input,holders/holder.py:262–285;_seed_input_storage,:214–240).
The input record alone can't answer the third question at 3.32.27:
- A same-slot overwrite.
put_in_cache(value, period, branch)with its defaultderived=False, over an input in the same slot, replaces the array._setthen drops that tier from the slot's input locations (:242–260,:544–609), but_user_input_keyskeeps the key, andget_input_periodsstill counts the period. Core itself always passesderived=True(simulations/simulation.py:1115,:1266,:1350,:1383), so this value comes from a caller. - A child branch's shadow. A child branch's non-derived value hides a parent's input for the same period, while the key names the parent.
Deleting derived caches to force a recompute isn't a safe workaround. InMemoryStorage.delete removes every period that the given one contains on that branch (data_storage/in_memory_storage.py:305–321), so it can remove supplied inputs.
Proposal
Add a public, read-only method, for example Holder.read_source(period, branch_name="default"). It returns None when nothing reaches the period, and otherwise a small record:
period: the stored period core reads, in storage form (_storage_period). That is the requested slot, or the carry source.carried: whetherperiodis the carry source rather than the requested slot.branchandtier("memory"or"disk").derived: the storage mark.is_input: whether that tier still holds the valueset_inputstored there, by_stores_user_input's rule.
The method must change nothing in storage or in any cache. It covers the pass-through path only: a variable with no formula, uprating, defined_for, adds or subtracts, calculate_output or requires_computation_after, requested at its definition period and one period long. Outside that path it raises.
Tests
- Cases: a same-slot
derived=Falseoverwrite, a child branch's shadow, memory over disk, restored and register-only inputs, clones, inputs at several units, and two inputs that start on the same day. - A differential: on the pass-through path, where no derived value stands in the slot, the array at
read_source's answer equalscalculate's.
Context
policyengine-uk's deterministic rules engine plan reads required draws through a helper built on these facts. It uses the private members, pinned by tests, until a public method exists. The cross-country approach (pe-us) states presence as "core's read resolves to an actual input" and points to this issue.
- Ngôn ngữ chính
- Python
- Star
- 22
- Fork
- 30
- Merge trung bình
- 4 ngày 16 giờ
- Pull request đã merge (30 ngày)
- 35
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của PolicyEngine/policyengine-core
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
PolicyEngine/policyengine-core#605 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
PolicyEngine/policyengine-core#549 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
`restore_simulation` silently drops memberless group entitiesCó thể đã có người làm @Adelagric đã nhận 48 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
PolicyEngine/policyengine-core#547 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
PolicyEngine/policyengine-core#632 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Remove the Reform and chart functions that call the Public APICó thể đã có người làm @anth-volk đã nhận 6 ngày trước. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
PolicyEngine/policyengine-core#628 ·
Maintainer thường phản hồi trong vòng 3 ngày
Tất cả issue của PolicyEngine/policyengine-core
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
btclib-org/btclib-ecc#404 ·
-
changelog investigate
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 78/100
ramnes/notion-sdk-py#430 ·
-
bug good first issue
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 91/100
hyeonjoong/debussy#56 ·
-
README устарел: статус проекта, версия 0.1.0 при описании тега v0.1.1, семантика фолбэка поискаĐang mởdocumentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Lagrunge82/yandex-mail-mcp#43 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
liberation-data/drivine-python#252 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày