Repository navigation
Fix org self-growth loop 500 when employees are already active - #46
Closed
XYAIStudio wants to merge 2 commits into
Closed
XYAIStudio wants to merge 2 commits into
XYAIStudio wants to merge 2 commits into
Conversation
The loop's _promote always tried draft→market→…→active. Colleagues already at active (or other illegal pairs) raised ValueError and the API surfaced INTERNAL_ERROR. Skip already-reached and illegal edges, record them in the proof notes, and map leftover ValueError to 400. Co-authored-by: XYAI Labs <haoboy8@gmail.com>
Co-authored-by: XYAI Labs <haoboy8@gmail.com>
9 of 12 tasks
Owner
Author
|
Superseded by #47 (includes the active→market loop skip fix). |
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.
Summary
POST /api/org-module/loop/runcrashed withINTERNAL_ERROR500 when the self-growth loop tried to promote colleagues that were alreadyactive(typical on a deployed org, or when the same slug is imported twice). The lifecycle FSM only allowsactive → shadow|offboard, so_promote's blindactive → marketstep raisedValueError: cannot move active → market.This change:
market → recruit → shadow → active) only along allowed edges.active), the step is a skip/noop recorded in the loop proof notes.transition; leftoverValueErrors from the loop are mapped to 400 instead of an opaque 500.「运行自增长循环」on an already-deployed org should now complete successfully with skip notes instead of a toast 500.
Target branch
develop(feature / fix — default)main(requested for this fix)Type of change
Test plan
_promoteon an already-activeemployee succeeds withoutValueErrorand records a skip note_promoteonoffboardskips illegal transitions instead of raising_promotefromshadowstill reachesactiverun_growth_loopsucceeds when import leaves employeesactivecan_transition,already_at_or_beyond) coveractive → marketuv run pytest tests/unit/test_org_loop.py tests/unit/test_lifecycle.py tests/unit/test_org_notes.py tests/unit/i18n tests/e2e/test_org_growth_loop.py— 87 passeduv run mypy --stricton the touched modules — cleanactive— expect 200 + skip notes, not 500Checklist
CHANGELOG.md