Skip to content

feat(views): two-way anonymise page, real IDs on the left, anonymised on the right - #108

Merged
manuroe merged 3 commits into
mainfrom
feat/anonymise-two-panes
Oct 29, 2026
Merged

manuroe merged 3 commits into
mainfrom
feat/anonymise-two-panes

Conversation

@manuroe

@manuroe manuroe commented Oct 29, 2026

Copy link
Copy Markdown
Owner

Summary

Until now the anonymise page could only read anonymised text back with real IDs. With this PR it works both ways. The left pane holds text with real IDs and the right pane holds the anonymised version. You can edit either one, and the pane you edited last drives the other. Text typed with real IDs is anonymised with the salt alone, so its aliases match the anonymised rageshakes. The salt can now be changed from the page itself, and a salt change anonymises everything again.

As before, raw files and mappings stay in the tab's memory only.

Changes

  • refactor(components): extract the salt field from the burger menu: SaltField is now a separate component, used by both the menu and the page.
  • feat(utils): anonymise text with the salt, and read whose rageshake it is: adds anonymizeText, which leaves aliases already in the text as they are, and countRealIdentifiers, which runs the same scan as the CLI precheck. An anonymised file now carries its owner's user and device ID. They come from details.json, else from the latest Element Web login line (sorted by timestamp, because archive order is not chronological).
  • feat(views): two-way anonymise page, real IDs on the left, anonymised on the right: two editable panes, each with a drop zone above it. The zone above the left pane loads a rageshake for its mapping only. The zone above the right pane anonymises the rageshake and downloads the result. A text file goes into the pane below its zone. The header shows whose rageshakes are loaded, has a dropdown listing them with Forget all, and a key button that opens the salt. The batch notice is gone. When the salt changes, every file is anonymised again, a file dropped to download is downloaded again, and the typed text's mapping is rebuilt.

For reviewers

  • Each salt change, once typing settles (500 ms), downloads again every file that was dropped to download. Without that, the file you shared would no longer match the page's salt. Say if a single "Save again" would be better.
  • A file whose re-run fails with a new salt loses its old mapping, which would be wrong for the new salt. It is tried again on the next salt change.
  • With no rageshake loaded, Forget all stays hidden, so real IDs typed on the left are kept until the tab reloads.

Testing

  • npm run build, npm run lint and npm test -- --run --coverage pass (2646 tests, coverage thresholds met). Each commit also typechecks and passes tests on its own.
  • Not tried in a real browser yet. To check on #/anonymize:
    • type @alice:matrix.org on the left and see an alias appear on the right;
    • edit the right pane and see the left one follow;
    • drop a .tar.gz on each zone and check that only the right zone downloads;
    • change the salt and check that the right-hand file downloads again with new aliases.

The anonymise page needs the same salt editor; it moves to its own
component, with an id per instance so two can render at once.
…t is

anonymizeText anonymises text written with real IDs. Aliases depend only
on the salt, so the result matches the anonymised rageshakes. Aliases
already in the text are left as they are, including ones a raw log
mapped: hashing an alias again gives one that no log holds.
countRealIdentifiers runs the same scan as the CLI precheck, so text
that passes here also passes there.

An anonymised file now carries its owner's user and device ID. They come
from details.json, else from the latest Element Web login line. Log lines
are sorted by timestamp first, because the order of files in an archive
is not chronological.
… on the right

The page could only read anonymised text back. Now both panes can be
edited, and the one edited last drives the other. Text typed with real
IDs is anonymised with the salt alone (debounced). Anonymised text is
read back using the mappings of the loaded rageshakes and of the text
typed. The anonymised side warns while real IDs are still in it.

Each pane has a drop zone above it, and the zone says why the file is
dropped: above the left to reveal real IDs (mapping only), above the
right to anonymise and download. Text files go into the pane below.

The header shows whose rageshakes are loaded, like the summary page. A
dropdown lists the rageshakes and has Forget all. The batch notice is
gone. A key button opens the salt. When the salt changes, every file
is anonymised again, a file dropped to download is downloaded again,
and the mapping of the typed text is rebuilt. A file whose re-run fails
loses its stale mapping and is retried on the next salt change.
@github-actions

Copy link
Copy Markdown
Contributor

🚀 PR Preview ready:
https://manuroe.github.io/shakeview/pull/108/

@codspeed

codspeed Bot commented Oct 29, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

1 warning

⚠️ 4 benchmarks are dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

✅ 30 untouched benchmarks


Comparing feat/anonymise-two-panes (48965dd) with main (218d13b)

Open in CodSpeed

@manuroe
manuroe merged commit 2d947c5 into main Oct 29, 2026
5 checks passed
@manuroe
manuroe deleted the feat/anonymise-two-panes branch October 29, 2026 22:00
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