Skip to content

feat(backend): switch to a more formal FSM approach - #12507

Merged
SchrodingersGat merged 61 commits into
inventree:masterfrom
matmair:full-fsm
Aug 11, 2026
Merged

SchrodingersGat merged 61 commits into
inventree:masterfrom
matmair:full-fsm

Conversation

@matmair

@matmair matmair commented Jul 30, 2026 •

Copy link
Copy Markdown
Member

This PR refactors the first few models to use django-fsm2 for handling state transitions in models. This approach also moves common behavior into a shared decorator like:

  • refreshing state before evaluation
  • keeping the whole transaction atomic
  • triggering events after all state checks and actions are done

It also fixates a currently sometimes differing behavior: it disallows runs of transitions if there is no change in state.

Todo:

  • look at db efficiency
  • should we always raise validation errors instead of failing silently? (would be breaking)
  • this would be a great place to add specific transition permissions -> do we want to add that now / later? --> maybe later
  • add depreciation for the redundant _can checks
  • look into moving away from signals for transition handling

@matmair matmair added this to the 1.5.0 milestone Jul 30, 2026
@matmair matmair self-assigned this Jul 30, 2026
@matmair matmair added enhancement This is an suggested enhancement or new feature api Relates to the API breaking Indicates a major update or change which breaks compatibility labels Jul 30, 2026
@netlify

netlify Bot commented Jul 30, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for inventree-web-pui-preview ready!

Name Link
🔨 Latest commit ffd1395
🔍 Latest deploy log https://app.netlify.com/projects/inventree-web-pui-preview/deploys/6a7b56c3a8c5ab0009e44d4f
😎 Deploy Preview https://deploy-preview-12507--inventree-web-pui-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 91 (🔴 down 7 from production)
Accessibility: 81 (no change from production)
Best Practices: 100 (no change from production)
SEO: 78 (no change from production)
PWA: -
View the detailed breakdown and full score reports
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@codecov

codecov Bot commented Jul 30, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.65320% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.76%. Comparing base (77d8470) to head (ffd1395).

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #12507      +/-   ##
==========================================
- Coverage   86.77%   86.76%   -0.02%     
==========================================
  Files        1447     1448       +1     
  Lines       96790    96792       +2     
  Branches    11180    11180              
==========================================
- Hits        83991    83978      -13     
- Misses      12735    12750      +15     
  Partials       64       64              
Flag Coverage Δ
backend 90.83% <98.65%> (+0.05%) ⬆️
migrations 38.52% <41.75%> (+0.05%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
Backend Apps 92.21% <98.65%> (+0.06%) ⬆️
Backend General 93.72% <100.00%> (+0.16%) ⬆️
Frontend 79.57% <ø> (-0.13%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@matmair
matmair marked this pull request as ready for review August 3, 2026 21:34
@matmair

matmair commented Aug 4, 2026

Copy link
Copy Markdown
Member Author

@SchrodingersGat ready for review and merge

@SchrodingersGat SchrodingersGat modified the milestones: 1.5.0, 1.6.0 Aug 8, 2026
@SchrodingersGat

Copy link
Copy Markdown
Member

@matmair please address conflicts and then I am happy to merge

@matmair

matmair commented Aug 11, 2026 •

Copy link
Copy Markdown
Member Author

merge conflict adressed @SchrodingersGat

@matmair matmair added the full-run Always do a full QC CI run label Aug 11, 2026
@matmair matmair closed this Aug 11, 2026
@matmair matmair reopened this Aug 11, 2026
@SchrodingersGat
SchrodingersGat merged commit 40c5281 into inventree:master Aug 11, 2026
83 of 84 checks passed
@SchrodingersGat

Copy link
Copy Markdown
Member

Thanks for this improvement!

@matmair

matmair commented Aug 11, 2026

Copy link
Copy Markdown
Member Author

Working on docs for plugins for this; have been building some very low LOC plugins with this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api Relates to the API breaking Indicates a major update or change which breaks compatibility enhancement This is an suggested enhancement or new feature full-run Always do a full QC CI run refactor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants