mirror of
https://github.com/kuhyx/utils.git
synced 2026-11-17 23:25:05 +01:00
main was red on file length, the noqa ban, codespell, test naming and dart coverage; this change touches every one of those jobs. - sickdays: set_enabled is keyword-only; the panel test splits in two with shared probes; the sync wire format moves to DOCS-sync.md. - earned_time: _focus types the project as a Protocol, no noqa; the gate-maturity section moves to DOCS-maturity.md; codespell knows the `checkin` event name. - focus_project: real fixes for every noqa (local-day clocks, typed fakes, logged broad catches, split helpers). The public API that focus-guard calls keeps its signatures; their PLR0913 exemption lives in pyproject with the reason, not in noqa. - crdt-sync: pylint gets nacl/argon2, docstrings, and allows the public E2eLayout.of; _blobs moves to _e2e_blobs.py. - crdt_sync_dart: Argon2Params and the header errors move to e2e_params.dart (re-exported); tests split and reach 100% lines. - sql_drills: test helpers get a leading underscore, as in earned_time. Todo: fda71ed1 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
56 lines
1.4 KiB
Dart
56 lines
1.4 KiB
Dart
/// Migration over flat `<node>.json` leaves and non-log source blobs.
|
|
library;
|
|
|
|
import 'package:crdt_sync/crdt_sync.dart';
|
|
import 'package:test/test.dart';
|
|
|
|
import 'e2e_fakes.dart';
|
|
|
|
const _old = 'app/notes';
|
|
|
|
void main() {
|
|
final layout = E2eLayout.of(_old);
|
|
|
|
Future<E2eKey> key(RemoteStore remote) => unlockE2e(
|
|
store: remote,
|
|
pathPrefix: layout.prefix,
|
|
passphrase: 'pw',
|
|
params: cheapArgon,
|
|
e2ePath: layout.e2ePath,
|
|
);
|
|
|
|
test('a flat leaf is read one by one when the backend has no bulk', () async {
|
|
final inner = MemoryRemote({
|
|
'$_old/node.json': encodeLog(logOf({'a': 'milk'})),
|
|
});
|
|
final remote = PlainRemote(inner);
|
|
final report = await copyToEncrypted(
|
|
store: remote,
|
|
key: await key(remote),
|
|
fromPrefix: _old,
|
|
layout: layout,
|
|
);
|
|
expect(report.copied, 1);
|
|
final blob = inner.files['${layout.prefix}/node.json']!;
|
|
expect(blob, isNot(contains('milk')));
|
|
});
|
|
|
|
test('a source blob that is not a JSON object is skipped', () async {
|
|
final remote = MemoryRemote({
|
|
'$_old/list/log.json': '[1,2]',
|
|
'$_old/shape/log.json': '{"a":5}',
|
|
});
|
|
final report = await copyToEncrypted(
|
|
store: remote,
|
|
key: await key(remote),
|
|
fromPrefix: _old,
|
|
layout: layout,
|
|
);
|
|
expect(report.copied, 0);
|
|
expect(
|
|
report.skipped,
|
|
unorderedEquals(['list/log.json', 'shape/log.json']),
|
|
);
|
|
});
|
|
}
|