Skip to content

Shared picks namespace (walker moved, remove-at/put-at); lint clean - #47

Merged
codeGlaze merged 9 commits into
integrationfrom
refactor/picks-namespace
Oct 4, 2026
Merged

codeGlaze merged 9 commits into
integrationfrom
refactor/picks-namespace

Conversation

@codeGlaze

@codeGlaze codeGlaze commented Oct 4, 2026 •

Copy link
Copy Markdown
Owner

Description:

Two pieces, in separate commits so they review apart.

1. A shared picks namespace (439593dd, b33c765a, 909655cf, 453aff1d)

One engine over a character's stored picks, for two pieces of planned work:

  • the character-rescue work, which must list and remove picks on the server without the app;
  • the hidden-pick work, which sets picks aside and puts them back.

The KB spec is character-rescue.md, "Layer 1 spec", on feature/grant-rows.

  • Moved, not rewritten. walk-entries, walk-picks, picks-of and relink-picks leave the browser-only content_reconciliation.cljs for src/cljc/orcpub/dnd/e5/picks.cljc, as walk (now public), walk-typed, keys-of and relink.
    • The bodies are token-identical to the originals, comments stripped and strings masked.
    • The two callers are updated, with no aliases left behind.
    • Their test moves to test/cljc, so it also runs in the JVM suite that CI gates on. It's also listed in the browser test runner.
  • New: remove-at and put-at.
    • A pick is addressed by [selection key, entry key] pairs (the app's option-path format), never by index, so removing one pick can't move another.
    • :removed records :multiselect? (the template's own word) because an emptied or absent selection no longer shows its shape. An emptied multiselect keeps [], the same state unticking leaves, and saving strips it (entity/remove-empty-fields).
    • put-at writes a pick back only into an empty place. If a multiselect already holds the key, or a one-pick selection already holds any pick, it writes nothing and returns nil, as it does when the path is gone. A pick the player made while the old one was set aside is never overwritten or duplicated; nil tells the caller the held copy is retired. It checks no rule.
    • Tests fail if remove-at drops by position, if put-at loses a vector's metadata, if it duplicates a re-picked key, or if it overwrites a one-pick selection (each checked by removing the guard).
  • Not touched: entity/flatten-options (the build) and extract-content-keys (Missing Content).

2. Lint is clean (ad3c612b, 29e9e2b6)

The 50 warnings and 3 infos on integration are fixed, not suppressed. No behaviour change.

  • Locals that shadowed core or library vars are renamed for what they hold.
    • old/new pairs become before/after.
    • after becomes plugins-after; var becomes env-var; get becomes lookup; integer? becomes integer-setting?; import becomes imported-pack; choice-tags becomes tags-by-selection; plus test locals.
    • Map keys are unchanged ({env-var :var …}).
  • Unused refers and imports are removed. The seven in equipment_subs were used only by the commented-out ORPHANED remote-item block; they come back with it.
  • Smaller fixes: three nested lets merged, two redundant str calls and a duplicate require dropped.
  • One more from the merge: the locale-safety merge brought in one more warning, an unused hostile-locales in pedestal_test. It's removed too.

integration (locale safety, #46) is merged in (8877678f). The only conflict was CHANGELOG.md; both blocks are kept.

A follow-up is recorded in the shared TODO on agents/develop: declare which config settings expect a whole number, rather than inferring it from the capacity group.

Checklist:

  • The code change is tested and works locally. On the head: lein lint 0 errors, 0 warnings; lein test 571 tests / 0 failures; cljs suite 546 tests / 0 failures (run by hand); lein fig:build clean.
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation if necessary
  • There is no commented out code in this PR.
  • My changes generate no new warnings (check the console)
  • docs/branch-changelog.md is updated in the house style (docs/branch-changelog.template.md), and I decided whether this branch earns a ## Highlights. No Highlights (refactor and cleanup); folded into Summer Patch (3cbe12df).

…t-at

orcpub.dnd.e5.picks (cljc) is one engine over a character's stored
picks, for the character-rescue work (which must list and remove picks
on the server, without the app) and the hidden-pick work (which sets
picks aside and puts them back).

walk-entries, walk-picks, picks-of and relink-picks move from the
browser-only content_reconciliation.cljs, bodies token-identical, as
walk (now public), walk-typed, keys-of and relink. Callers updated; no
aliases. Their test moves to test/cljc, so it also runs in the JVM
suite CI gates on.

New: remove-at and put-at, addressing a pick by [selection key, entry
key] pairs (the app's option-path format), never by index, so removing
one pick does not move another. A multi-pick keeps its vector and its
metadata; put-at returns nil when the path to the pick is gone and
checks no rule. Tests fail when remove-at drops by position or put-at
loses the metadata.

entity/flatten-options (the build) and extract-content-keys (Missing
Content) are not touched.
The removed-pick record's flag is now :multiselect?, the template's own
word (::t/multiselect?) for a selection that stores a vector. The
namespace and remove-at/put-at docstrings state the shapes: a
multiselect keeps its vector, emptied by its last pick as unticking
does; a single pick's selection is dissoc'd; the flag tells put-at
which, since neither shows it afterwards.
Behaviour-preserving only:
- locals that shadowed core or library vars renamed for what they hold:
  old/new pairs -> before/after (library, library_links, e5 re-key),
  after -> plugins-after (homebrew and pack deletion), var -> env-var,
  get -> lookup, integer? -> integer-setting? (config report),
  import -> imported-pack, choice-tags -> tags-by-selection, and test
  locals; map keys unchanged ({env-var :var ...});
- unused refers and imports removed; the seven in equipment_subs were
  used only by the commented-out ORPHANED remote-item block and come
  back with it;
- three nested lets merged, two redundant str calls and a duplicate
  require dropped, export_paths_test refers clojure.test explicitly.

lein lint: 0 errors, 0 warnings.

codeGlaze commented Oct 4, 2026 •

Copy link
Copy Markdown
Owner Author

@greptileai review

codeGlaze added a commit that referenced this pull request Oct 4, 2026
@greptile-apps

greptile-apps Bot commented Oct 4, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

[Medium risk] Refactors pick-handling code and fixes lint warnings.

The PR appears safe to merge based on the reviewed changes and resolved findings.

Summary

The PR moves pick traversal into a shared namespace, adds pick removal and restoration helpers, and cleans up lint warnings. The follow-up change makes restoration return nil rather than overwrite a selection or duplicate an existing pick.

Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[Stored character picks] --> B[remove-at]
  B --> C[Character without pick]
  B --> D[Removed pick and address]
  C --> E[put-at]
  D --> E
  E --> F{Address available and slot eligible?}
  F -->|Yes| G[Restored character]
  F -->|No| H[nil; nothing written]
Loading

Reviews (4) · Last reviewed commit: "picks/put-at: never overwrite a one-pick..."

Comment thread src/cljc/orcpub/dnd/e5/picks.cljc Resolved
Comment thread test/cljc/orcpub/dnd/e5/picks_test.cljc Resolved
… the runner

put-at for a multiselect now leaves the vector as it is when it already
holds the pick's key (the player picked it again while it was set
aside), instead of appending a duplicate that a later remove-at would
take out together. The new test fails without the check.

picks-test is added to orcpub.test-runner's list, so the per-test
reporter mode runs it too; the full browser suite already did (546
tests, now 2828 assertions with the new one).

codeGlaze commented Oct 4, 2026 •

Copy link
Copy Markdown
Owner Author

Both review findings are addressed in 909655cf.

  1. Duplicate multiselect picks: valid, and fixed. put-at now leaves a multiselect vector unchanged when it already holds the pick's key, so it never appends a second copy. A new test covers the re-picked-meanwhile case, and it fails without the check.
  2. Browser suite skips pick tests: half right. picks-test is now listed in orcpub.test-runner, so the per-test reporter mode runs it. But the full browser suite (test/e2e/cljs-harness.js) already ran it: it picks up every compiled test namespace. Its count went from 2827 to 2828 assertions with the new test.

Checks on 909655cf: lint 0 warnings, JVM 542 tests, browser 546 tests, all passing.

codeGlaze commented Oct 4, 2026 •

Copy link
Copy Markdown
Owner Author

@greptileai review

CHANGELOG.md conflicted: both sides added a Summer Patch block in the
same place; both kept, integration's first.
Defined with the tests in 402ea5e and never used: the file explains the
locale defect cannot be reproduced in one JVM, and the guard is running
the suite under a non-English JVM. It was the one lint warning the
locale-safety merge brought in; lint is back to 0 warnings.

codeGlaze commented Oct 4, 2026 •

Copy link
Copy Markdown
Owner Author

@greptileai review

…othing is written

put-at now behaves the same for both shapes: it writes the pick back
only into an empty place. A multiselect vector already holding the key,
or a one-pick selection already holding any pick, is left alone and
put-at returns nil, as it does when the path is gone. A pick the player
made while the old one was set aside is never overwritten or
duplicated; nil tells the caller the held copy is retired.

Tests: the re-picked key and a one-pick selection chosen again both
return nil; each fails when its guard is removed.

codeGlaze commented Oct 4, 2026 •

Copy link
Copy Markdown
Owner Author

@greptileai review

@codeGlaze
codeGlaze merged commit d213795 into integration Oct 4, 2026
6 checks passed
codeGlaze added a commit that referenced this pull request Oct 4, 2026
codeGlaze added a commit that referenced this pull request Oct 5, 2026
… accounts, #49)

Brings the shared picks namespace this branch's step 1 builds on. No
conflicts; no duplicate definitions.
@codeGlaze
codeGlaze deleted the refactor/picks-namespace branch October 6, 2026 13:51
codeGlaze added a commit that referenced this pull request Oct 7, 2026
continuous-integration.yml ran only for develop and main, so no PR into
integration (#47 to #56) was linted or had the app build checked; only
locale.yml's JVM suite ran there. Integration is added to its push and
pull_request branches. The dependency-graph job keeps to develop and
main, as before. Checked on integration's code: lint 0 errors 0
warnings, fig:build clean.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant