Skip to content

fefactor(backend): build apis - #12955

Draft
matmair wants to merge 4 commits into
inventree:masterfrom
matmair:refactor-build-apis
Draft

matmair wants to merge 4 commits into
inventree:masterfrom
matmair:refactor-build-apis

Conversation

@matmair

@matmair matmair commented Sep 30, 2026

Copy link
Copy Markdown
Member

similar to #12317, follow up to #12693

@matmair matmair added this to the 1.6.0 milestone Sep 30, 2026
@matmair matmair self-assigned this Sep 30, 2026
@matmair matmair added api Relates to the API refactor labels Sep 30, 2026
@netlify

netlify Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for inventree-web-pui-preview canceled.

Name Link
🔨 Latest commit b140d11
🔍 Latest deploy log https://app.netlify.com/projects/inventree-web-pui-preview/deploys/6ad39ee1f784be315a85e0f7

@codecov

codecov Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 99.27007% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 87.29%. Comparing base (ddd4603) to head (b140d11).

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #12955      +/-   ##
==========================================
+ Coverage   87.15%   87.29%   +0.13%     
==========================================
  Files        1522     1522              
  Lines      105631   105565      -66     
  Branches    11768    11890     +122     
==========================================
+ Hits        92062    92151      +89     
+ Misses      13502    13347     -155     
  Partials       67       67              
Flag Coverage Δ
backend 92.12% <99.27%> (+0.01%) ⬆️

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

Components Coverage Δ
Backend Apps 92.75% <99.26%> (+<0.01%) ⬆️
Backend General 94.58% <ø> (+0.07%) ⬆️
Frontend 79.42% <ø> (+0.34%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

'cancel_build': {
'name': 'cancel',
'return_code': 201,
'serializer_class': build.serializers.BuildCancelSerializer,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI:

Passing BuildCancelSerializer here also makes the transition handler use it to serialize the Build instance for the response. Since Build has no remove_allocated_stock attribute, a successful request with remove_allocated_stock=true now returns false (the field default). Previously the response reflected the validated input. The same issue affects BuildCompleteSerializer below.

If I understand it correctly, current transition_action expects model serializer (or serializer with only model as input), not Action-options serializer.

if input_serializer_class
else self.get_serializer_class()
)
serializer = serial(instance, context=self.get_serializer_context())
return Response(serializer.data, status=return_code)

Purchase-order completion already has the same problem, with some transitions returning the serialized model(cancel_order , hold_order, place_order) and completion returning {"accept_incomplete": false}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes that replicates old API behaviour; see the TODOs for a breaking change

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Problem is that old API returned validated input ({remove_allocated_stock: true}; now it returns defaults {remove_allocated_stock: false} for identical call

@SchrodingersGat

Copy link
Copy Markdown
Member

@matmair it would be great to get this one closed out soon, we are close to being able to release 1.6.0

@matmair

matmair commented Oct 17, 2026

Copy link
Copy Markdown
Member Author

This has the risk of breaking things; I have moved it to 1.7.0

@matmair matmair modified the milestones: 1.6.0, 1.7.0 Oct 17, 2026
@codspeed

codspeed Bot commented Oct 17, 2026

Copy link
Copy Markdown

Merging this PR will degrade performance by 12.55%

❌ 1 regressed benchmark
✅ 43 untouched benchmarks
⏩ 2 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Benchmark BASE HEAD Efficiency
❌ test_search_performance[build] 77.8 ms 88.9 ms -12.55%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing matmair:refactor-build-apis (b140d11) with master (ddd4603)

Open in CodSpeed

Footnotes

  1. 2 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

@SchrodingersGat SchrodingersGat modified the milestones: 1.7.0, 1.8.0 Nov 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants