[FEATURE] Implement deterministic comparison of historical Flow state JSON
Python PR scope
Add a small Python comparison helper and read-only CLI presentation for two persisted states of the same Flow. Focus on changed fields, additions, and removals.
Difficulty: medium. Allocation index: #8118. Project: #8121.
Cohort allocation
This ticket is reserved for maintainer-coordinated allocation to the Stanford semester collaboration. Please wait for @lorenzejay to confirm an assignee before implementing. A comment expresses interest; it does not establish ownership. Public good first issue / help wanted discovery labels will be considered after cohort allocation.
GitHub usernames have not yet been supplied, so no individual assignment is implied.
Acceptance criteria
- [ ] Handle nested dictionaries and treat lists as whole values in the first version; use the standard library rather than adding a diff package.
- [ ] Distinguish an absent key from a key whose value is None; sort paths deterministically.
- [ ] Provide JSON output suitable for tests and a concise text presentation.
- [ ] Test identical states, additions/removals, nested changes, lists, nulls, and wrong-flow record IDs.
- [ ] Reuse history lookup and CLI presentation where appropriate; do not implement a second checkpoint framework.
Dependencies and coordination
- Depends on #8139.
- Depends on #8140.
Starting points
- lib/cli/src/crewai_cli/checkpoint_cli.py
- lib/cli/tests
- lib/crewai/src/crewai/flow/persistence/sqlite.py
Submission
The contributor implements this scope and submits one focused PR linked to this open issue. Include full Python annotations, behavioral tests, and relevant quality checks. No paid API calls are required for the tests. Preserve existing APIs outside the scoped feature. For newly found defects, reproduce them and check active issues/PRs before fixing them. Docs edits, when needed, belong under docs/edge/ and must sync ar, ko, pt-BR per DOCS_TRANSLATIONS.md. Follow .github/CONTRIBUTING.md. Issue prepared with AI assistance.
Hi @lorenzejay, I would like to take this issue to pair with #8140.
Hi maintainers,
I'd be interested in helping with deterministic comparisons of historical Flow state JSON, including nested changes, additions/removals, null values, and stable output. The offline-testable scope is appealing.
I understand this is a Stanford cohort allocation issue, that another contributor has expressed interest, and that #8139 and #8140 are prerequisites. I don't want to conflict with existing ownership or start ahead of those dependencies.
Could you let me know whether an external contributor could be considered for this issue once the prerequisites are ready, or whether there's a smaller independent task I could take on? I'll wait for explicit allocation and scope confirmation before implementation.
Thanks!
Hi @lorenzejay, I'm in the Stanford cohort and would like to take this one. Plan: a standard-library helper that compares two saved flow_states records of the same Flow (nested dicts, lists as whole values, absent key vs None, sorted paths), JSON plus a short text rendering, and tests for identical states, additions/removals, nested changes, lists, nulls and wrong-flow record IDs. I'll build it against fixtures now and integrate with the #8139 lookup and #8140 CLI once those land.
Hi @lorenzejay! I'm also in the Stanford CS 146S cohort and would be interested in contributing to this issue. I noticed a few others have expressed interest, so I wanted to check whether it's still available or whether there's a distinct part I could help with.
I'm particularly interested in implementing the deterministic JSON comparison helper and its regression tests, then integrating it with the historical state lookup and CLI once the prerequisites are ready. Happy to coordinate with the other contributors to avoid duplicate work. Thanks!
Hi @alanhuang05, I claimed this one on Nov 9 (comment above) and the PR is now up at #9453: the comparison helper with its tests, a read-only record reader, and a crewai flow state diff command. @lorenzejay, happy to coordinate however you want to allocate it