PolicyEngine / PolicyEngine/chronicle

Bundle expectations: per-source deltas that compose across parallel PRs

Open
#157 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
0
Forks
1
Avg merge
11h 48m
Merged PRs (30d)
45

Description

Filed from #137's review: four UK-wave PRs (#137, #139, #141, #155) branch from the same base and each rewrites the absolute totals in tests/test_chronicle_bundle.py (fact_count, source_package_count, per-entity and per-source splits). Each is right on its own branch and stale the moment a sibling merges — so the current shape costs one hand-recomputed rebase per sibling merge, and the tempting conflict resolution (take one side's numbers) yields a green test that has stopped checking anything.

Proposal: keep the whole-bundle snapshot as a final tripwire, but move the load-bearing assertions to per-source (or per-package) counts:

  • a by_source mapping asserted key-by-key, so a PR touching only slc and a PR touching only obr compose without conflict — their diffs to the mapping are disjoint;
  • derived totals (sum of the mapping) asserted against the snapshot, so drift between the two representations still fails loudly;
  • per-package fact counts inside each source's packages, so an accidental record-set drop inside one package can't hide in a source-level aggregate.

A sibling merge then rebases with zero constant edits when sources are disjoint (the common case), and a genuine collision surfaces as a real semantic conflict on one mapping line instead of four unrelated integers.

Current cost is real: this wave alone has done four hand re-measurements (~13-minute suite runs each) that per-source deltas would have made no-ops.

🤖 Generated with Claude Code

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in tests/test_chronicle_bundle.py and inspect the existing whole-bundle, per-entity, and per-source assertions. Run that test file before and after reorganizing expectations around per-source and per-package counts. Done means disjoint source changes avoid constant conflicts while derived totals and the whole-bundle snapshot still catch drift or dropped records.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing-qa
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.