fix(balance-analyser): emit real patrol radius, not spawn rate (closes #124)#128
Merged
Merged
Conversation
…#124) The `guard_patrol_radius` recommendation at `tools/balance-analyser.jl:761` was reporting `stats.guard_spawn_rate` (guards-per-1000-pixels) in place of an actual patrol radius. Levels like backbone (3 guards / 1650px = 1.818) got recommendations of "guard_patrol_radius 1.818 → 1.545" — a unit-mismatched, gameplay-meaningless number. Fix (Option A from #124): - Add `mean_patrol_radius::Float64` to `LevelStats` (in pixels — matches the `patrolRadius` field already carried by every guard in `LevelConfig.res`) - Compute it in `level_dict_to_stats` as the mean of all `guardPlacements[].patrolRadius` - Reference it correctly at the `guard_patrol_radius` recommendation call site - Emit `mean_patrol_radius` in the JSON output (`generate_report`) so the ReScript reader can consume it - Mirror the field as `meanPatrolRadius: float` in `BalanceAnalyserModel.levelSummary` + `parseLevelSummary` The four valid recommendations in `balance-report.json` (alert_threshold, defence_density, guard_spawn_rate ×2) are unaffected — only the three that hit the `guard_patrol_radius` branch were corrupted. `balance-report.json` itself needs regeneration to consume the fix; that is a separate data update that lands alongside applying the recommendations to `LevelConfig.res` (idaptik#19 follow-up). Closes #124 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Signed-off-by: hyperpolymath <6759885+hyperpolymath@users.noreply.github.com>
🔍 Hypatia Security ScanFindings: 71 issues detected
View findings[
{
"reason": "Issue in boj-build.yml",
"type": "missing_timeout_minutes",
"file": "boj-build.yml",
"action": "flag",
"rule_module": "workflow_audit",
"severity": "medium"
},
{
"reason": "Issue in build-validation.yml",
"type": "missing_timeout_minutes",
"file": "build-validation.yml",
"action": "flag",
"rule_module": "workflow_audit",
"severity": "medium"
},
{
"reason": "Issue in cflite-pr.yml",
"type": "missing_timeout_minutes",
"file": "cflite-pr.yml",
"action": "flag",
"rule_module": "workflow_audit",
"severity": "medium"
},
{
"reason": "Issue in codeql.yml",
"type": "missing_timeout_minutes",
"file": "codeql.yml",
"action": "flag",
"rule_module": "workflow_audit",
"severity": "medium"
},
{
"reason": "Issue in containers.yml",
"type": "missing_timeout_minutes",
"file": "containers.yml",
"action": "flag",
"rule_module": "workflow_audit",
"severity": "medium"
},
{
"reason": "Issue in containers.yml",
"type": "missing_timeout_minutes",
"file": "containers.yml",
"action": "flag",
"rule_module": "workflow_audit",
"severity": "medium"
},
{
"reason": "Issue in dco.yml",
"type": "missing_timeout_minutes",
"file": "dco.yml",
"action": "flag",
"rule_module": "workflow_audit",
"severity": "medium"
},
{
"reason": "Issue in dogfood-gate.yml",
"type": "missing_timeout_minutes",
"file": "dogfood-gate.yml",
"action": "flag",
"rule_module": "workflow_audit",
"severity": "medium"
},
{
"reason": "Issue in dogfood-gate.yml",
"type": "missing_timeout_minutes",
"file": "dogfood-gate.yml",
"action": "flag",
"rule_module": "workflow_audit",
"severity": "medium"
},
{
"reason": "Issue in dogfood-gate.yml",
"type": "missing_timeout_minutes",
"file": "dogfood-gate.yml",
"action": "flag",
"rule_module": "workflow_audit",
"severity": "medium"
}
]Powered by Hypatia Neurosymbolic CI/CD Intelligence |
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
Closes #124.
tools/balance-analyser.jl:761was emittingstats.guard_spawn_rateas the value of theguard_patrol_radiusrecommendation. Three of seven recommendations inbalance-report.json(city, security, backbone) were corrupted by this — wrong units, wrong magnitudes, gameplay-meaningless.Option A fix (per #124):
mean_patrol_radius::Float64toLevelStats(in pixels, matchingLevelConfig.res)guardPlacements[].patrolRadiusinlevel_dict_to_statsmean_patrol_radiusin the JSON outputmeanPatrolRadius: floatinBalanceAnalyserModel.levelSummary+ parserTest plan
julia tools/balance-analyser.jlregeneratesbalance-report.jsonwith patrol_radius recommendations in pixels (e.g. ~210→179 for backbone) rather than spawn-rate unitsnpx rescriptsucceeds —meanPatrolRadiusfield add is purely additiveFollow-up
`balance-report.json` regeneration + applying the four valid recommendations to per-level configs lands in idaptik#19 once this merges.
Closes #124
Refs #19
🤖 Generated with Claude Code