fix(cost): charge NAV_BUILD past the nav-cache short-circuit - #37000
Conversation
The @RequestCost annotation on getNav fired on method entry, so a live-mode navigation served entirely from NavToolCache still paid the full NAV_BUILD(10). That contradicts the cache-aware placement used in DotDirective.render and VelocityLiveMode.writePage, where cached work stays cheap. Move the charge to a direct RequestCostHandler call on the cache-miss/build path: a warm nav now costs 0 and only the folder/menu-item walk pays the flat build fee. Content- backed menu items keep stacking their own content charges - that is intended. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VTt9ymEwfmHV9DSKe1vPuJ
|
Claude finished @sfreudenthaler's task in 1m 18s —— View job PR Review: charge NAV_BUILD past the nav-cache short-circuit
I reviewed New IssuesNo issues found. The change is correct and consistent with the stated intent:
Minor, non-blocking observations (not defects):
· |
…andler Addresses review feedback on #37000: point maintainers at the shared convention behind NavTool.getNav, DotDirective.render and VelocityLiveMode.writePage before a fourth copy of the comment appears. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019Dbp268ibhwu3NavqzrVPg
|
Added a pointer for the cache-short-circuit charge idiom on |
sfreudenthaler
left a comment
There was a problem hiding this comment.
good catch on review. Added a note as well so hopefully humans and bots find it before a reviewer needs to point it out in the future
Proposed Changes
Follow-up to #36978, addressing a review finding that landed after merge:
@RequestCost(Price.NAV_BUILD)onNavTool.getNavfired on method entry, so a live-mode navigation served entirely fromNavToolCachestill paid the full NAV_BUILD(10) — the common case on live traffic.This moves the charge to a direct
RequestCostHandler.incrementCostcall on the cache-miss/build path, matching the cache-aware placement deliberately used inDotDirective.renderandVelocityLiveMode.writePage:findMenuItems,findSubFolders,IdentifierAPI.find), which is not metered anywhere else.CONTENT_FROM_CACHE/CONTENT_FROM_DBcharges through the content factory — that stacking is intended and documented in the code comment.Related to #36977.
🤖 Generated with Claude Code
https://claude.ai/code/session_01VTt9ymEwfmHV9DSKe1vPuJ
This PR fixes: #36977
This PR fixes: #36977