[Bug] `#save all` copies the shared rules into the character's folder, where they stop following the shared file

Open
#446 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 5 days

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
55/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
csharp
Domain
desktop

Research direction

Start with the #save handling that passes each word to its list's save, then SaveHighlights, which writes Highlights.Rules rather than only the character's own entries. CfgFormat.HighlightLines shows why the @window suffix is lost. Done means a typed save writes only the character's entries, creates no file for a list that has none, and keeps the window in highlights.cfg. The reporter offers a fix with tests, so check with the maintainers before duplicating it.

Written by the indexing model from the issue text.

Description

area:core bug P1

What happened

I keep a few highlights in the shared Config folder so every character has them. They are limited to the Experience window. Each character also has its own folder under Profiles.

On 5.0.1-beta.1, #save all writes a file for every list into the character's folder, and each file holds every rule that is loaded, the shared ones included. From the next login the character has its own copy of each shared highlight, and the copy wins over the shared one:

  • the copies are no longer limited to the Experience window, so they apply in every window;
  • change a shared highlight's colour, and the character keeps the old colour;
  • delete a shared highlight, and the character still has it;
  • change a shared highlight's text, and the character has both the old one and the new one.

A highlight added to the shared file still arrives, until the next #save all copies that one too.

It is not only highlights. I put one shared alias, trigger, substitute, gag, shunt, macro, class and variable in Config: #save all copied each one into the character's folder, and each was still there for that character after I removed it from the shared file.

This repeats every time my script calls put #save all. I believe making copies of each shared highlight is an unintended effect, and so is a copy applying in every window when the original was limited to one.

What you expected

#save all to save what belongs to the character, and leave the shared rules where they are.

Steps to reproduce

  1. Have a highlight in the shared Config/highlights.json that is limited to one window, and a character whose own folder has no highlights.cfg.
  2. Log that character in and type #highlight. The rule is listed with its window, for example @experience.
  3. Type #save all.
  4. The character's folder now has highlights.cfg holding the shared highlight, and a file for every other list. Most are empty.
  5. Log out, close Genie, and change that highlight's colour in Config/highlights.json.
  6. Start Genie, log the character in and type #highlight. The rule has the old colour and no window.

Environment

  • OS + version: Ubuntu 26.04
  • Genie 5 version: 5.0.1-beta.1
  • Install type: AppImage
  • Connection mode: Direct SGE

Logs / session capture

One shared highlight, as #highlight lists it:

before #save all:                               % +(34)\b → #FFFFFF/#800000 (Regex) @experience
next login, shared file changed to #123456:     % +(34)\b → #FFFFFF/#800000 (Regex)
after deleting the character's highlights.cfg:  % +(34)\b → #123456/#800000 (Regex) @experience

The character's folder before and after one #save all:

before:  macros.json
after:   aliases.cfg (0 bytes)  classes.cfg (0)  gags.cfg (0)  highlights.cfg (377)  macros.cfg (336)
         macros.json  names.cfg (0)  presets.cfg (1192)  shunts.cfg (0)  substitutes.cfg (0)
         triggers.cfg (0)  variables.cfg (0)

Anything else

Cause, as far as I can read it: #save passes each word to that list's own save, as I suggested in #440, and those saves write every loaded entry. SaveHighlights writes Highlights.Rules, not only the rules that belong to the character. #highlight save typed by itself does the same on 5.0.0; #save all is what makes a script do it for every list at once.

The windows go because the line written to highlights.cfg has no place for them: CfgFormat.HighlightLines writes the pattern, colours, match type, class, sound and speak.

Workaround: none that lasts while a script sends #save all. Deleting the character's new highlights.cfg, while it holds only the copies, brings the shared highlights back at the next login, until the next #save all.

I have a fix with tests for the copying (a typed save writes the character's own entries and makes no file for a list that has none) and can open a pull request if that is welcome.

Dominant language
C#
Stars
2
Forks
5
Avg merge
4d 3h
Merged PRs (30d)
22

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from GenieClient/Genie5

All issues in GenieClient/Genie5

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.