Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Define explicit cache ownership contracts through Phase 6

未关闭
#598 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 3 天内回复

还没有人认领这个 Issue。

  • #599 来自 @anth-volk —— 已关闭,未合并

评估

难度
5/5
预计耗时
一周以上
新手友好度
25/100
Issue 类型
重构
描述清晰度
基本清楚
活跃度
活跃
技术栈
python
领域
backend

调研方向

Start by reading the cache and parameter implementations in PolicyEngine Core, then map each cache to the Type A–E ownership and lifecycle requirements in the issue. Break the work into the listed cache, tracing, parameter, and branch behaviors, with deterministic unit and integration tests for the specified cases. Done means the acceptance criteria are met, including downstream migrations without cache-internal changes; Phase 7 remains deferred.

由索引模型根据 Issue 内容生成。

描述

Context

PolicyEngine Core currently uses several caches with different ownership,
isolation, invalidation, and lifetime requirements. Some callers have modified
private cache fields directly because Core did not expose operations for the
required behavior. Parameter tracing also allowed request-specific tracer state
to become associated with reusable parameter views.

Scope

Define and implement the cache architecture through Phase 6:

  • Document Type A model-definition state, Type B policy-system caching, Type C
    parameter-at-date caching, Type D simulation input and result caching, and
    Type E YAML-case execution reuse.
  • Add generic cache contracts for lifecycle, construction, bounded retention,
    revision validation, and branch behavior.
  • Bound YAML policy-system retention and isolate each YAML case's execution
    state.
  • Keep tracer state local to the active calculation and out of cached parameter
    views.
  • Give parameter trees monotonic revisions, retain eager materialization as the
    default, and provide an explicit lazy strategy.
  • Centralize supplied-input provenance and calculated-result invalidation.
  • Allow branches to share immutable array values while retaining independent
    indexes.
  • Expose public parameter replacement, sharing, materialization, and cache
    clearing operations for country packages.

Phase 7, which would separate imported model definitions from policy and
execution state, remains outside this issue.

Downstream migrations

  • PolicyEngine/policyengine-us#9978
  • PolicyEngine/policyengine-uk#2175

Acceptance criteria

  • AI-facing documentation specifies each cache type's owner, key, value,
    lifetime, mutation rules, invalidation, concurrency, and uncached behavior.
  • Generic cache bases use typed key and value parameters and concrete caches
    implement subsystem-specific behavior.
  • Every production commit adds at least 40 deterministic unit cases covering
    standard behavior, rejected behavior, failure cleanup, copying, serialization,
    concurrency, and edge cases.
  • Integration tests compare cached and uncached YAML execution and exercise
    parameter mutation, tracing, simulation cloning, and branch isolation.
  • PolicyEngine US and PolicyEngine UK can migrate without modifying cache
    internals.
  • Phase 7 remains deferred.
主要语言
Python
星标
22
派生
30
平均合并
4 天 16 小时
30 天内合并 PR
35

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

PolicyEngine/policyengine-core 的其他 Issue

查看 PolicyEngine/policyengine-core 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。