fix(alarms): strip only paired markdown, and three loose ends - #823
Merged
Conversation
cleanRuleSummary removed every asterisk, underscore and backtick in the string. PoracleNG's rowtext emits only **bold** today, so nothing on screen changes -- but it interpolates template names, areas and saved-place labels into that sentence unescaped, and work_gym is a name, not italics. Stripping is now pair-aware: code spans first (a backtick pair wins over emphasis inside it), then **bold**, *italic*, __underline__ and _italic_. The two underscore forms additionally require a non-word character outside the delimiter, which is the boundary Discord itself applies, so an underscore between two word characters is left alone. Verified against PoracleNG 5.2.1 on the dev instance: every live description returned by /api/tracking/allProfiles?includeDescriptions=true uses ** and nothing else, and all of them come through unchanged.
Reported as a defect from #816: the pill labels call translate.instant inside a computed, instant is not a signal, so a language switch should leave already-rendered pills in the previous language. It does not, and the reason is worth writing down rather than papering over. @ngx-translate v18 backs its store with signals, and instant() reads _currentLang and _translations on the way to a value -- so calling it inside a computed registers them as dependencies and the labels invalidate on a switch like any other signal read. The premise held on the versions before v18; this repo has been on v18 since #377, well before #816. So: no behaviour change, because there is no defect to fix. What was missing is the guard. The new spec switches language through I18nService, the path the language menu takes, and asserts the rendered pill follows. Confirmed it goes red when the instant() call is wrapped in untracked(), which is exactly the shape a future ngx-translate dropping those signal reads would produce.
usesRewardSlot took over in the template when #821 gave pokecoins the same control, and nothing else read isStardust -- only its own two assertions, which is a property kept alive by the test that tests it. The assertions were worth keeping, so they now name usesRewardSlot: on a stardust rule it is the flag that puts the floor field on screen, and on the pokemon-encounter twin it is the flag that keeps reward from being overwritten on save. STARDUST stays, REWARD_SLOT_TYPES is built from it.
Squash-merging nine branches in a row left the section with two Added blocks and two Changed blocks. Each merge resolved its CHANGELOG conflict by keeping both sides, which is right for the bullets and wrong for the heading above them. The release workflow promotes this section verbatim, so the published notes would have carried the duplicates. Bullets are unchanged and all fifteen are still here; only the headings are merged, into Keep a Changelog's order.
…lowups # Conflicts: # CHANGELOG.md
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.
Four small things left behind by today's nine merges. One commit each so they read independently.
1.
cleanRuleSummarystripped markdown characters that were not markdown —73b554cFlagged by #819. The old body was
.replace(/[*_]/g, ''): every delimiter character, anywhere. Nothing in production descriptions contains one today, but **area names and saved-place labels routinely do** —work_gymwould have silently becomeworkgym` the first time Poracle rendered one into a sentence.Stripping now runs in pairs: code spans first, then
**bold**,*italic*,__underline__,_italic_. The underscore forms carry(?<!\w)/(?!\w)lookarounds, the same boundary Discord itself applies, sowork_gymsurvives and a real_italic_still loses its delimiters.Checked against the live 5.2.1 server rather than assumed: all 19 descriptions across fort, invasion, lure, pokemon and quest use
**and nothing else, and every one survives the new function unchanged.processor/internal/rowtext/*.goagrees —**is the only markup PoracleNG emits.The underscore test was red before the fix (
my_template→mytemplate); the paired-emphasis test is its legitimate-case twin.2. The active-hours language-switch bug does not exist —
267e107I reported this one and I was wrong, so this commit adds a guard rather than a fix.
The claim was that
ActiveHoursChipComponentcallstranslate.instant()inside acomputed(), which cannot see a language change. That was true on ngx-translate ≤17. This repo has been on v18 since #377, well before #816, and v18 backs its store with signals:instant()reads_currentLangand_translations, so calling it inside acomputed()registers them as dependencies and a language switch invalidates the labels like any other signal read.Verified twice — a probe counting recomputations across
use('en')→use('it'), and the component's own test passing unmodified.So the new test switches language through
I18nService.use(), the path the language menu actually takes, and asserts the pill text goes from "hourly" to "ogni ora". It can be made red: wrapping theinstant()call inuntracked()— the shape a future ngx-translate dropping those signal reads would produce — fails it. A comment names the route so nobody files this again.No changelog entry: nothing changed for users and there was no defect.
3.
isStardustremoved —5864e63Genuinely dead:
usesRewardSlottook the template over in #821 andisStardustwas read only by its own two assertions. Both assertions are kept, retargeted atusesRewardSlot— on a stardust rule that is the flag putting the floor field on screen, and in the pokémon-encounter case it is the flag stoppingrewardbeing overwritten on save. Same coverage, pointed at the property that is load-bearing.isPokecoinsstays live;STARDUSTstays becauseREWARD_SLOT_TYPESis built from it.4. The
[Unreleased]section had duplicate headings —e7df068My fault, and worth fixing before a release rather than after. Squash-merging nine branches in a row left the section with two
### Addedblocks and two### Changedblocks: each merge resolved its CHANGELOG conflict by keeping both sides, which is right for the bullets and wrong for the heading above them. The release workflow promotes the section verbatim, so the published notes would have carried the duplicates.All fifteen bullets are unchanged and still present; only the headings are merged, into Keep a Changelog's order.
Verification
npx jest --ci— 116 suites, 1392 tests (was 1389; three new). Productionng buildsucceeds.eslintandprettier --checkclean on every file touched. No backend files changed. Seven files, +73/−14, no line-ending churn.Noticed, out of scope
prettier --checkfails onCHANGELOG.mdat baseline, before any change here. It sits outside the configured scope (src/**/*.{ts,html,scss}) so CI never sees it, but running prettier from the repo root trips on it.cleanRuleSummary's fort case is still poor —Fort updates: pokestop | distance: 5000m ["name"]keeps a raw JSON array mid-sentence, which is why fort cards do not render the line at all. Fixing it means translatingchange_typesclient-side, which is a feature rather than a cleanup.