Skip to content

refactor(uniformbuilder): sort weapon qual plates by catalog awardPriority - #243

Merged
SyniRon merged 1 commit into
mainfrom
claude/triage-issue-242-ac2fb5
Sep 18, 2026
Merged

SyniRon merged 1 commit into
mainfrom
claude/triage-issue-242-ac2fb5

Conversation

@SyniRon

@SyniRon SyniRon commented Sep 14, 2026

Copy link
Copy Markdown
Collaborator

Closes #242

Built on #241, which merged while this was in progress. Rebased onto main, so the diff is this change alone.

What changed

  • Every weapon qual entry in AWARD_CATALOG carries awardPriority, its rank in the S1 Uniforms SOP weapon order. All three entries for a weapon carry the same number. Ranks 9 and 10 are left open for Carbine and Auto Rifle, which the SOP lists and MILPAC does not award yet. The section comment says so.
  • WeaponQual records the rank as each qual is filed and sortQuals sorts by it. The hand list weaponOrder and its indexOf sort are gone. The level arrays are still arrays of tags, because the canvas names the plate file after the tag.
  • Catalog test: one row per tag checks the three entries carry one number. A missing or disagreeing entry prints the set it broke.
  • Canvas test: the reverse-SOP test holds all ten weapons and is the one place a person types out the SOP order. A guard beside it reads the catalog for which weapons exist, order aside, and goes red when a weapon qual entry lands with no row in that list.
  • The "stacks above Mk-82" family, its count guard and its comment block are gone.

Why

Adding a weapon took three edits that had to agree by hand: the catalog entries, the slot in weaponOrder, and the plate file. The plate had a test. The slot did not, and no canvas test could see a missing slot for the last SOP weapon, because last is where the SOP puts it. #229 was one instance of that class. Ribbons, medals, unit citations and tabs already sort by awardPriority from the catalog. Weapon quals were the one ordered type that did not.

What a member sees on the uniform does not change.

For the reviewer

  • Mutations run against the finished branch, each restored afterwards. Pistol given Rifle's number: the reverse-SOP test fails. Pistol and Aeroweapons swapped: the same test fails. Pistol Expert loses its priority: the catalog row for pistol fails with [null,7]. An eleventh weapon added with Mk-82's number and no row in the held list: the guard fails naming Carbine Expert.
  • The brief's criterion "no two tags share a priority fails a catalog test" is struck through on Derive the weapon qual sort order from the award catalog #242. The tie fails the canvas test instead, because the held list is reversed and a stable sort keeps a tied pair reversed. With the guard, every catalog weapon is in that list, so a catalog row would be a structural copy that cannot go red alone.
  • The weaponQualPlates.js comment named the deleted list, so it is reworded. No code change there.
  • Checks: npm test exit 0 (215 sprite assertions, 46 catalog, 29 canvas, 13 numerals, server). npm run format:check clean.

This was generated by AI

…ority

Weapon quals were the one ordered award type that did not read its order
from the catalog. WeaponQual kept a hand list of tags in S1 SOP order and
sortQuals used indexOf into it, so adding a weapon took three edits that
had to agree by hand: the catalog entries, the slot, and the plate file.
The plate had a test. The slot did not, and no canvas test can see a
missing slot for the last weapon in the SOP, because last is where the
SOP puts it. #229 was one instance of that class.

Every weapon qual catalog entry now carries awardPriority, its rank in
the SOP. Ribbons, medals and tabs already sort by that field. WeaponQual
records the rank as each qual is filed and sorts by it. The hand list is
gone. Ranks 9 and 10 are left for Carbine and Auto Rifle, which the SOP
lists and MILPAC does not award yet.

Tests. The reverse-SOP canvas test now holds all ten weapons and is the
one place a person types out the SOP order, so a swapped or tied
priority fails there. A guard beside it checks that list names every
weapon qual in the catalog, so the next weapon cannot land without a
place in it. A catalog row per tag checks the three entries carry one
number, so a missing priority fails on the day the entry lands, last
weapon included. The "stacks above the last weapon" family is gone. The
catalog row covers what it covered with no blind spot, and its anchor
would have gone red for the wrong reason on the next weapon the SOP
appends.

Stacked on #241. What a member sees on the uniform does not change.

Closes #242

> *This was generated by AI*
@SyniRon SyniRon added enhancement New feature or request client Affects the client workspace labels Sep 14, 2026
@SyniRon
SyniRon requested a review from Vercin-G as a code owner September 14, 2026 23:33
@SyniRon SyniRon added enhancement New feature or request client Affects the client workspace labels Sep 14, 2026
@SyniRon
SyniRon enabled auto-merge (squash) September 14, 2026 23:35
@SyniRon
SyniRon merged commit 63688c9 into main Sep 18, 2026
2 checks passed
@SyniRon
SyniRon deleted the claude/triage-issue-242-ac2fb5 branch September 18, 2026 02:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

client Affects the client workspace enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Derive the weapon qual sort order from the award catalog

2 participants