Skip to content

fix(input-mapper): track unsaved profile title IDs - #27882

Merged
oneandonlydean merged 2 commits into
boykopovar:mainfrom
vibeforj-afk:fix/input-mapper-profile-dirty-state
Dec 6, 2026
Merged

oneandonlydean merged 2 commits into
boykopovar:mainfrom
vibeforj-afk:fix/input-mapper-profile-dirty-state

Conversation

@vibeforj-afk

@vibeforj-afk vibeforj-afk commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

What

Track the profile title ID as part of the mapper's unsaved state. Reset and imports that replace the destination prompt before discarding an edited ID. Copying the INI and importing a custom filename preserve the destination's unsaved state.

Tested

Arch Linux, Node 26. Ran all 105 mapper tests, including four regressions for reset/import, clipboard export and custom filenames and matching profile imports. The conventions check passed. A targeted search found no overlapping mapper PR. The branch-wide checker stopped at #862 because Git could not fetch its head. I checked its changed files through the GitHub API and confirmed it only touches the graphics driver and its tests.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt and the licence notice of code adapted from upstream (see AGENTS.md)
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes

Summary by CodeRabbit

  • Bug Fixes
    • Resetting a profile now prompts before clearing an edited destination.
    • Copying a mapping no longer marks an edited destination as saved.
    • Imports with a recognized destination matching the current one no longer prompt unnecessarily. Imports with custom filenames preserve the current destination, while imports with a different recognized destination prompt before replacing it.

@coderabbitai

coderabbitai Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Changes: Profile destination dirty-state handling

Layer / File(s) Summary
Separate mapping and title ID snapshots
tools/input-mapper/app.js
Mapping state is captured separately from the title ID. isDirty can include or exclude the title ID, and replacement confirmation receives the computed dirty state.
Apply dirty-state rules to reset, import, and copy
tools/input-mapper/app.js, tools/input-mapper/tests/app.test.js
Reset checks the full state and clears the title ID before saving its snapshot. Import checks and updates the title ID only when the filename provides one. Copy saves only the mapping snapshot. Tests cover destination edits and resulting prompts and warnings.

Suggested reviewers: marczx10, jjenkx

Change: Bug fix

Security architecture risk: Minimal · up to c2d4e

The change protects unsaved profile destinations without adding a new way to access, import, or export configuration.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Library detection encountered an error. Review will continue without library-specific context.

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c65ab18a-7923-4dda-8443-ed44c7b9ed51
Commits

Reviewing files that changed from the base of the PR and between c2d4eeb and b9aef66.

Files selected for processing: 2

  • tools/input-mapper/app.js
  • tools/input-mapper/tests/app.test.js

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

@vibeforj-afk
vibeforj-afk marked this pull request as ready for review November 27, 2026 18:14
Comment thread tools/input-mapper/app.js Outdated
}
if (!await confirmReplacement() || request !== replacementRequest) return;
const titleId = inputTitleId(file.name);
if (!await confirmReplacement(isDirty(titleId !== undefined)) || request !== replacementRequest) return;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When only the title ID is dirty, importing a profile named for the ID already in the field still opens the discard dialog. I reproduced it by importing anyps5-input.PPSA00001.ini, editing only the ID to PPSA00002, then importing anyps5-input.PPSA00002.ini. Cancel leaves the import unapplied even though it would preserve the edited destination and there are no unsaved mapping edits.

The 104 existing tests pass on Node 22.23.5. A focused test for this case fails at c2d4eebf6178 with one dialog instead of zero. All 105 tests pass with the title-ID dirty check limited to imports that would change the field value.

Suggested change
if (!await confirmReplacement(isDirty(titleId !== undefined)) || request !== replacementRequest) return;
const replacesTitleId = titleId !== undefined && titleId !== byId('profile-title-id').value;
if (!await confirmReplacement(isDirty(replacesTitleId)) || request !== replacementRequest) return;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed on b9aef661006e. All 105 input-mapper tests passed on Node 22.23.5, including the matching-destination import without a prompt and the custom-filename import that preserves the unsaved destination.

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed — looks good

Nothing blocks this change; the inspected behavior and regressions support merging.

What I ran

Reviewed head c2d4eebf617859f141a72785700e6a60dc8c7782. No commands or tests were run in this review; the author reports running 104 mapper tests and a conventions check, which I did not independently verify.

Results

Check Result Note
Change inspection passed Both changed files read
Tests in this review not run Author-reported results only

Findings

Blocking

None.

Non-blocking

None.

Not verified

No tests were run. The author-reported test and conventions results were not independently checked. Excluded files: none listed in the review bundle. Files reviewed and read: tools/input-mapper/app.js and tools/input-mapper/tests/app.test.js.

To get this to a good state

Nothing is required.

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed — looks good

The change at head b9aef661006eb61a39a2a1b04892b3372be4bdab tracks the profile title ID in dirty state and handles reset, copy, and imports consistently; I found no blocking defects in the changed code.

What I ran

No commands or tests were run. I read the prepared diff and both changed files through repo_read.py; the description reports tests and a conventions check, which I did not run.

Results

Check Result Note
Changed lines reviewed passed Both changed files read
Tests and conventions check not run Author-reported only

Findings

Blocking

None.

Non-blocking

None.

Sources

Reviewed tools/input-mapper/app.js and tools/input-mapper/tests/app.test.js, along with description.md, commits.md, manifest.json, and diff.patch in the prepared review bundle.

Not verified

Tests, conventions check, CI, and runtime behavior were not independently verified. files.json was not available through the reader; the review manifest lists both changed files as included, and both files' changed lines were read.

To get this to a good state

Nothing is required.

@ligmaSec ligmaSec left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All 105 input-mapper Node tests passed from the exact branch archive. The new cases cover changing only the profile destination, copying while the destination is still unsaved, and imports that either match or preserve that destination.

AI-assisted: yes.

@oneandonlydean
oneandonlydean merged commit 09fb8eb into boykopovar:main Dec 6, 2026
4 of 8 checks passed
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.

5 participants