Repository navigation
core: a typed verify_scene takes only the usage measurements it needs - #1270
Merged
Merged
Conversation
… needs With the usage checks on, every verify_scene call took every usage measurement, whatever type it asked for. The circulation measurement (passages, turning circles, pockets) is nearly all of the cost on a large building, so a question about skirting or a blocked door paid for it too. usageIssues now lists its measurements with the finding types each gives, and the usage check passes the type asked for: a usage type takes its own measurement, any other type takes none. A misspelt usage type still takes all of them, so its answer names the types there are. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
pop returned a new pair and every sift step swapped through two temporary arrays. It now returns the value, leaves the key on the heap, and moves the sifted entry once. Same comparisons in the same order, so the same paths. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
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.
What does this PR do?
With the usage checks on (
setSdfChecks(true)),verify_scenetook every usage measurement on every call, whatevertypeit asked for. On a large building the circulation measurement (passages, turning circles, pockets) is nearly all of the cost, so a question about skirting or a blocked door paid for it too, and arun_batchof several typed checks paid for it once per call.Two changes in
packages/core:usageIssuesnow lists its measurements with the finding types each gives (typesoption), and the usage check passes the type asked for. A usage type takes its own measurement; any other type takes none;usage_roomtakes the one behind the findings a room entry holds. A misspelt usage type still takes all of them, so its answer names the types there are.Measured on a saved six-storey residential scene (1,244 nodes) on an Apple-silicon laptop, usage checks on:
type)typethat is not a usage finding (door_blocked,rooms_no_skirting,item_overlap, …)usage_clash,usage_opening_blocked,usage_bed_clearance,usage_fixture_clearance,usage_door_over_stairusage_door_swingusage_entry_narrowusage_passage_narrow,usage_pocket,usage_turning_narrow,usage_roomThe circulation types still cost seconds: that measurement is where the time goes, and this PR only stops other questions from paying for it.
Results. On that scene the full report and the model's reading of it are byte-identical before and after, and so are the findings and their count for each of the 15 types asked. One thing differs: an answer with no findings lists the other types found (
types), and that list now holds the types of what the question measured. For a type that is not a usage finding it no longer lists usage types.How to test
cd packages/core && bun test src/agent-operations/verify-scene-typed.test.ts: on a small two-room scene whose report holds six usage types beside the ordinary ones, each typed answer equals the findings of that type in the whole report; a room with a type answers the same; a misspelt usage type answers with every type; the report for a non-usage type holds no usage findings.bun test src/spatial/usage-field src/agent-operations src/agent-tools(1,806 pass) and, inpackages/mcp,bun test src/tools/verify-scene.test.ts src/tools/scene-query.test.ts(12 pass).setSdfChecks(true), and timeAGENT_OPERATIONS.verify_scene(nodes, { type: 'door_blocked' }, context)against{}.Screenshots / screen recording
N/A — non-visual change
Checklist
bun devbun checkto verify)mainbranch🤖 Generated with Claude Code
Note
Medium Risk
Changes which usage measurements run for typed queries and how empty-result metadata lists types; heap refactor must preserve path results but is covered by existing usage-field tests.
Overview
When
verify_sceneis called with atype, usage checks no longer run the full circulation and fixture suite on every request.usageIssuesmaps each measurement to the finding types it produces and runs only matching measurements; non-usage types skip usage work entirely,usage_roomstill folds to pocket/turning types, and unknown usage types fall back to measuring everything (so answers can list valid types).The usage scene check wires this through
askedTypes(input.type)before callingusageIssues.The grid path
Heapis also tweaked sopopreturns only the cell index and exposes the priority viaheap.key, avoiding per-step tuple allocation inwidestPath,travel, andshortestRoute.A new
verify-scene-typed.test.tsasserts typed reports match the full report per type, room+type behavior, misspelling fallback, and that non-usage types emit no usage findings.Reviewed by Cursor Bugbot for commit 2d5dc8a. Bugbot is set up for automated code reviews on this repo. Configure here.