add typed IPC command-schema framework (T-120)
test / unit + widget + golden + a11y (push) Failing after 28s
test / integration_test (xvfb) (push) Has been skipped
test / bundle smoke (xvfb 5s) (push) Has been skipped
test / daemon subprocess + web WASM smoke (push) Has been skipped
test / dart doc (lib API) (push) Failing after 23s
test / unit + widget + golden + a11y (push) Failing after 28s
test / integration_test (xvfb) (push) Has been skipped
test / bundle smoke (xvfb 5s) (push) Has been skipped
test / daemon subprocess + web WASM smoke (push) Has been skipped
test / dart doc (lib API) (push) Failing after 23s
Per D-74: commands register an argument schema beside their handler
instead of hand-validating args inline. DaemonDispatcher accumulates a
cmd->schema registry and, before invoking a handler, normalises the
argv-translator shape ({positional, flags}) into named args, coerces
types, and checks per-arg constraints (charset/pattern, leading-dash
rejection, numeric range, list caps). Violations return userError so no
handler sees malformed input. Schema adoption is opt-in per command —
unschema'd commands dispatch unchanged.
panel.resize adopts a schema (dropping the _ResizeArgs hand-lift from
T-119); git.checkout and git.push gain schemas that reject leading-dash
refs at the dispatcher and, via positional ordering, fix the C-client
CLI path — `clide git checkout <branch>` now reaches the handler, where
the positional token previously never mapped to `branch`. The T-104
validateGitRef + count/path caps stay in place as defense-in-depth
because the git client is reachable directly from the UI, not only
through the dispatcher.
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -252,6 +252,17 @@ void main() {
|
||||
expect(r.data['branch'], 'next');
|
||||
});
|
||||
|
||||
test('git.checkout via argv positional reaches the handler (D-74)', () async {
|
||||
// `clide git checkout next` → {positional: ['next']}; the schema's
|
||||
// positional ordering maps it to `branch` at the dispatcher.
|
||||
await Process.run('git', ['branch', 'next'], workingDirectory: sandbox.path);
|
||||
final r = await call('git.checkout', {
|
||||
'positional': ['next'],
|
||||
});
|
||||
expect(r.ok, isTrue, reason: r.error?.message);
|
||||
expect(r.data['branch'], 'next');
|
||||
});
|
||||
|
||||
test('git.checkout to an unknown branch surfaces a tool error', () async {
|
||||
final r = await call('git.checkout', {'branch': 'no-such-branch'});
|
||||
expect(r.ok, isFalse);
|
||||
|
||||
@@ -55,7 +55,7 @@ void main() {
|
||||
final r = await call(const {'slot': 'sidebar', 'to': 'lots'});
|
||||
expect(r.ok, isFalse);
|
||||
expect(r.error!.kind, 'user_error');
|
||||
expect(r.error!.message, contains('numeric'));
|
||||
expect(r.error!.message, contains('number'));
|
||||
});
|
||||
|
||||
test('rejects an unknown slot with not-found', () async {
|
||||
|
||||
Reference in New Issue
Block a user