mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-11-16 03:09:33 +01:00
fix(agent): address inspection and staging review feedback
This commit is contained in:
1 parent
a24b0ec7bb
commit
4c2f050a96
24 files changed
+517
-116
No files matched your search
@@ -1,6 +1,7 @@
|
||||
/** @fileoverview Guarded staging one-shot and content-verification safety. */
|
||||
import { beforeEach, expect, it } from 'vitest';
|
||||
import { createHash } from 'node:crypto';
|
||||
import { CODEX_REASONING_EFFORTS } from '../src/types/session.js';
|
||||
import { GuardedStageStore, type GuardedInputTarget } from '../src/agent-staging.js';
|
||||
const sha = (s: string) => createHash('sha256').update(s).digest('hex');
|
||||
let store: GuardedStageStore;
|
||||
@@ -21,7 +22,8 @@ beforeEach(() => {
|
||||
store = new GuardedStageStore(() => time, 2, 1000);
|
||||
target = {
|
||||
id: 's',
|
||||
snapshot: () => (composer === null ? null : { generation, revision, composerSha: sha(composer) }),
|
||||
snapshot: () =>
|
||||
composer === null ? null : { generation, revision, composerSha: sha(composer), availableColumns: 100 },
|
||||
submit: async () => target.write('\r'),
|
||||
write: async (text) => {
|
||||
writes.push(text);
|
||||
@@ -151,3 +153,18 @@ it('reserves receipt capacity before concurrent stages type', async () => {
|
||||
release!();
|
||||
await first;
|
||||
});
|
||||
|
||||
it.each([...CODEX_REASONING_EFFORTS, 'default'])(
|
||||
'accepts the shared Codex effort word %s in the footer',
|
||||
async (word) => {
|
||||
const { readGuardedCodexComposer } = await import('../src/agent-staging.js');
|
||||
expect(readGuardedCodexComposer(`› hello\n GPT-6 ${word} · ~/case\n`)).toBe('hello');
|
||||
}
|
||||
);
|
||||
|
||||
it('refuses messages that reach the available pane columns before typing', async () => {
|
||||
target.snapshot = () => ({ generation, revision, composerSha: sha(composer ?? ''), availableColumns: 4 });
|
||||
for (const text of ['four', '界界']) await expect(store.stage(target, 'alice', text)).rejects.toThrow();
|
||||
expect(writes).toEqual([]);
|
||||
await expect(store.stage(target, 'alice', 'abc')).resolves.toMatchObject({ submitted: false });
|
||||
});
|
||||
Reference in new issue
Block a user