fix: filter resolved beans from blocked_by/blocking in JSON output (Refs: beans-k0as)#175
Open
SamLeatherdale wants to merge 1 commit intohmans:mainfrom
Conversation
- Add `ActiveBlockedByIds` and `ActiveBlockingIds` methods on `Core` that exclude completed/scrapped beans using the existing `isResolvedStatus` check - Apply filtering in `BeanBlockedByIds` and `BeanBlockingIds` GraphQL resolvers so the API reflects live blockers only - Apply filtering in `beans show --json` and `beans list --json` before serialization so CLI consumers see the same filtered view - Add tests for both new Core methods Refs: beans-k0as Made-with: Cursor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The
blocked_byandblockingarrays in CLI JSON output (beans show --json,beans list --json) and the GraphQLblockingIds/blockedByIdsfields return raw frontmatter — they include bean IDs regardless of whether those referenced beans are already completed or scrapped.This causes agents and scripts to misread a bean as still blocked when all its blockers are already done. For example, a bean with:
will look blocked to an agent even if both
b622and4kkihavestatus: completed. The agent has no way to know the dependency is resolved without fetching each blocker individually.The runtime
--readyfilter (viafindActiveBlockersLocked) already correctly ignores resolved blockers when deciding which beans are available to work on — but the serialized output was not aligned with this behaviour, creating a confusing inconsistency.This is related to #68.
Fix
Added
ActiveBlockedByIdsandActiveBlockingIdsmethods onCorethat walk the frontmatter ID lists and exclude any entries whose referenced beans are completed or scrapped, reusing the existingisResolvedStatuscheck. Applied in:BeanBlockedByIds/BeanBlockingIdsGraphQL resolversbeans show --jsonandbeans list --jsonCLI outputAfter the fix, a bean whose blockers are all completed will have an empty (omitted)
blocked_byfield in JSON, making its unblocked state immediately clear.Test plan
beans show --json <id>for a bean with only completed blockers shows noblocked_byfieldbeans list --jsonsimilarly omits resolved blocker IDsbeans show --json <id>for a bean with a mix of active and completed blockers shows only the active blocker IDsActiveBlockedByIdsandActiveBlockingIdspass (go test ./pkg/beancore/...)Refs: beans-k0as
Made with Cursor