Repository navigation
chore(scripts): organize scripts/ by purpose and drop orphan scripts - #847
Merged
Merged
Conversation
`scripts/` had grown 60+ flat entries mixing desktop packaging, local dev
launchers, release installers, coverage/profiling tools, doc generators and
offline tests. Group them by purpose so a reader can find the right script
without a full listing:
- build/ desktop packaging that mirrors the CI pipelines
- dev/ local dev launchers (desktop + mobile)
- release/ installers, signing, upload helpers (lib/ moves with them)
- measure/ coverage, profiling and performance measurement
- docs/ doc generation and structural checks
- tests/ offline regression and native acceptance scripts
`scripts/version.mjs` and `scripts/npm-install-if-needed.mjs` stay at the root:
the Makefile and every workflow invoke them from there.
Every reference was updated with the move (Makefile, 8 workflows, the build.rs
and build-info call sites, desktop/mobile package scripts, current docs);
`docs/archives/**` keeps its historical paths by design. Relative path
resolution inside the moved scripts (`__file__`/`parents[N]`, `dirname`,
`PSScriptRoot`, `../`) was corrected, including the fixtures that now sit next
to `test-windows-installer-preflight.ps1`.
Delete 13 scripts with no remaining caller anywhere in the repo or CI:
banner.sh, banner-png.py, build-mobile-android.sh, measure-coldopen-{run.py,
ts, report.py, html}, measure-encoding-cpu.mjs, measure-live-wire.py,
measure-snapshot-composition.py, measure-stream-vs-snapshot.py,
measure-tauri.sh and reset-ios-simulator-permissions.sh (docs/banner.png is
kept — the READMEs still reference it).
Add scripts/README.md + scripts/README.zh-CN.md documenting the layout, and
whitelist them in the docs checker.
huichen
enabled auto-merge (squash)
September 25, 2026 17:30
…accidental local regeneration)
huichen
added a commit
that referenced
this pull request
Sep 25, 2026
* test(remote): measure the lean lane as received, over real E2EE The existing lane tests count bytes at the FakeNats tap while the state runs Transport::legacy_fixture(), i.e. plaintext before encryption. Add a harness that wires the production v2 path instead — one secure::Transport shared by the command loop and the event drain (build_transport), a phone-side Channel from the real secure_pair handshake, and a subscription whose messages are counted on receipt and again after Channel::open. Every record is asserted to be a sealed one (FRE2 prefix, wire == plaintext + HEADER + TAG). It measures both declaration states over the same journal (live lane) and both get_session_entries shapes (full and before-paged), asserting the undeclared state is byte-identical to the source and that withdrawing the declaration restores it. The ignored measure_real_e2ee_bytes test replays a real run dump supplied by scripts/verify-e2e-bytes.py (read-only agent.db + grpcurl dump of the real history page, protojson int64 strings converted back to numbers). * chore(scripts): file the E2EE measurement under scripts/measure/ `scripts/` was reorganized by #847 while this branch was open, and it settled on `scripts/measure/` for measurement scripts. Moving this one there is more than a path change: the script located the repo root with `parents[1]`, which was correct at `scripts/` and points at `scripts/` itself one level deeper. It now matches the two siblings already in that directory (`parents[2]`), verified by resolving the path and by `--help`. The doc comments and the test's `#[ignore]` reason were updated with it.
huichen
added a commit
that referenced
this pull request
Sep 25, 2026
…856) * test(remote): rerun the lean-lane measurement on a real nats-server The received-bytes harness ran on an in-process FakeNats: real E2EE, real bridge, real client — but not a real broker process. Give the harness a Broker choice and rerun the same measurement through `nats-server` on a loopback port, so the numbers are witnessed by the server that production would use. Subscriptions are now synchronised with a publish/subscribe echo instead of Client::flush(): flush only proves the bytes left this process, while the server handles one connection's commands in order, so the echo of a publish sent after the SUB proves registration. Without that, a publish could overtake the SUB and be dropped (reproduced: ~1 fixture run in 5 stalled on its first message). When the script passes VERIFY_E2E_NATS_MONITOR, the test also snapshots the server's own /connz counters for the phone connection before and after the measured traffic and asserts the window delta equals what the harness received and decrypted — a broker-side witness for every payload byte. scripts/measure/verify-e2e-bytes.py (the post-#847 location) starts the server, prints its version and launch command, runs both brokers and compares the decoded results. It now also fails on a non-zero test exit code: a panic after the result markers were printed looked like a pass. * test(remote): exclude the harness's own probe from broker accounting The real-broker accounting compared the server's `/connz` delta for the phone connection against what the harness received and decrypted, and asserted they were equal. They are not, and my reruns failed deterministically by exactly 32 bytes and 2 messages: left: 72696018 (server out_bytes) right: 72695986 (decrypted) left: 176880 (server out_msgs) right: 176878 (received) The cause is this harness's own subscription-readiness probe, not the transport: `await_subscription` subscribes to `{pattern}.verify-sub-probe` on the **phone** connection and publishes `"verify-sub-probe"` (16 bytes) to it, and `replay_live_lane` runs twice per measurement. That is 2 messages and 2 x 16 = 32 bytes the server counts and the harness does not. Rather than loosen the assertion to a tolerance — which would stop it catching the thing it exists to catch — the probe now reports its payload size and the accounting subtracts it, so the comparison stays an **exact** equality. Per-message framing or header inflation would still fail it. The measurement itself is unaffected and reproduces: real broker and the in-process fake agree byte-for-byte (`liveEqual: true, historyEqual: true`), and the real-broker fixture numbers are identical to the fake's.
huichen
added a commit
that referenced
this pull request
Sep 25, 2026
#847 moved the measurement scripts into `scripts/measure/` and updated the call sites it knew about, but three references still named the old paths, so copying a command out of them fails with `No such file`: - `desktop/src-tauri/src/remote/verify_e2e.rs` (doc) - `scripts/measure/verify-e2e-bytes.py` (docstring) - `packages/rpc/tests/measure_usage_run_nulls.rs` (doc) Found by the independent review (it also flagged the two artifact mentions; those are historical records and stay as written).
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.
What
scripts/had grown to 60+ flat entries mixing desktop packaging, local devlaunchers, release installers, coverage/profiling tools, doc generators and
offline tests — a reader could not tell which script belonged to which
workflow. Group them by purpose:
build/dev/release/lib/moves with them)measure/docs/tests/ci/,screenshots/,skill_reco/andcompaction_experiment/keep theirexisting directories.
version.mjsandnpm-install-if-needed.mjsstay at thescripts/root: the Makefile and every workflow invoke them from there.Reference updates
Every reference moved with the files:
Makefile, 8 workflow files, thebuild.rs/ build-info call sites,agent/src/sandbox/windows/integration_tests.rs,desktop/src-tauri/src/remote_host/sync_measurement.rs, and the current docs.docs/archives/**anddocs/audits/**keep their historical paths on purpose —they are dated snapshots, not current truth.
Relative path resolution inside the moved scripts was corrected as well
(
__file__/parents[N],dirname,PSScriptRoot,../), including the NSISfixtures that now sit next to
tests/test-windows-installer-preflight.ps1.Deletions
13 scripts had no remaining caller anywhere in the repo, the CI workflows or the
docs (verified with a repo-wide
git grepfor both the file name and everyreference form):
banner.sh,banner-png.py,build-mobile-android.sh,measure-coldopen-run.py,measure-coldopen.ts,measure-coldopen-report.py,measure-coldopen.html,measure-encoding-cpu.mjs,measure-live-wire.py,measure-snapshot-composition.py,measure-stream-vs-snapshot.py,measure-tauri.sh,reset-ios-simulator-permissions.sh.docs/banner.pngis kept — both READMEs still embed it.New docs
scripts/README.md+scripts/README.zh-CN.mddescribe the layout with aone-line purpose for every script, and are whitelisted in
scripts/docs/check-docs.py.Verification
python scripts/docs/check-docs.py --scope scripts→ 0 diagnosticspython scripts/tests/test-check-docs.py→ 21/21 OKpython -X utf8 scripts/docs/check-channel-matrix.py→ 13 rows match the codescripts/...path referenced fromMakefile+.github/workflowsexists(19/19), and no moved path is still referenced outside
docs/archives|auditsrelative-path fixes from scratch (
git grep,Test-Path, test suites)Note
Four
mobile/docs/*-2026-09-16.mdfiles still live outsidedocs/(apre-existing
check-docsfinding) and two of them reference the oldscripts/measure/measure-mobile-performance.mjs/serve-mobile-performance.pypaths; that slice is handled by the follow-up docs-reorg PR.