feat(notification): add six app stop reasons - #24
Merged
Conversation
Notify users when an app is stopped because it cannot be scheduled or because of disk, CPU or memory pressure, so a stop no longer surfaces as "unknown". Adds Unschedulable, DiskPressure, SystemCPUPressure, SystemMemoryPressure, K8sRequestCPUPressure and K8sRequestMemoryPressure with templates in all seven supported languages. Replace the reason if-else chain with a lookup table in a dependency-free module so adding a reason is a single entry and the mapping can be tested without loading @bytetrade/core, whose published bundle fails to parse. A reason whose template is missing from the seeds is dropped silently, so the new spec asserts the mapping and the seeds stay in agreement. Co-authored-by: Cursor <cursoragent@cursor.com>
…DE/es-ES/fr-FR/it-IT/ja-JP
fnalways
approved these changes
Aug 10, 2026
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
Apps that stop because they cannot be scheduled, or because the node is under disk / CPU / memory pressure, currently fall through to the
stopped_unknown_v3template and tell the user nothing useful. This adds a dedicated reason and notification for each case:Unschedulablestopped_unschedulable_v3DiskPressurestopped_disk_pressure_v3SystemCPUPressurestopped_system_cpu_pressure_v3SystemMemoryPressurestopped_system_memory_pressure_v3K8sRequestCPUPressurestopped_k8s_request_cpu_pressure_v3K8sRequestMemoryPressurestopped_k8s_request_memory_pressure_v3Each template is seeded in all seven supported languages (en-US, zh-CN, de-DE, es-ES, fr-FR, it-IT, ja-JP) and follows the wording of the existing stop templates.
PrismaService.updateTemplateList()creates them on startup and leaves existing templates untouched, so no migration is needed.The reason mapping also moved out of the
if / else ifchain inUsersServiceinto a lookup table in a new dependency-freestop-reasonmodule. Adding a reason is now a single entry, and the mapping can be imported by tests without pulling in@bytetrade/core.Test plan
npm testpasses (45 tests)stop-reason.spec.tscovers the mapping, the fallback tostopped_unknown_v3for an unmapped reason, and that every mapped template id actually exists in the seeds with all seven languages and a{{title}}variable. This last check matters becausenatsClientPublishdrops a notification silently when the template is missing.npx tsc --noEmitpassesNote on the test setup
The published
@bytetrade/corebundle contains an empty identifier (var = (autoFunc, ...) => ...) and cannot be parsed by Node, which is why the existingtemplate.service.spec.tshad not been runnable. Tests now map the package to a small stub, so that suite runs again as well. The same bad bundle still breaksnpm run buildunder webpack; that is pre-existing and out of scope here.Made with Cursor