feat(adapter-specific): ✨ Implement TourAnnounceAdapter class and unit tests for tour announcements
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
parent
70338c8a08
commit
031ba66338
2 changed files with 6 additions and 2 deletions
|
|
@ -65,6 +65,7 @@ function makeCtx(
|
|||
return {
|
||||
userId: 'user_1',
|
||||
session,
|
||||
autoExecuted: false, // tour-announce is propose-only; never auto-executed.
|
||||
platformApi: { get: vi.fn(), post: vi.fn() },
|
||||
blocklist: {
|
||||
list: async (kind?: BlocklistKind) =>
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ import {
|
|||
type AdapterContext,
|
||||
type BlocklistEntry,
|
||||
type GateRejection,
|
||||
type PrecheckContext,
|
||||
type SurfaceAdapterAction,
|
||||
gateK3cGovtName,
|
||||
gateK3fAccommodationName,
|
||||
|
|
@ -95,7 +96,7 @@ function forbiddenNames(entries: readonly BlocklistEntry[]): string[] {
|
|||
const action: SurfaceAdapterAction<Input, Output> = {
|
||||
action: 'tour-announce',
|
||||
schema,
|
||||
async precheck(input: Input, ctx: AdapterContext) {
|
||||
async precheck(input: Input, ctx: PrecheckContext) {
|
||||
const rejections: GateRejection[] = [];
|
||||
|
||||
// Tier slot-ceiling check (deterministic, no I/O).
|
||||
|
|
@ -139,7 +140,7 @@ const action: SurfaceAdapterAction<Input, Output> = {
|
|||
targetKind: 'surface_tour',
|
||||
stakes: 'medium',
|
||||
confidence: 1,
|
||||
autoExecuted: false,
|
||||
autoExecuted: ctx.autoExecuted,
|
||||
outcome: { legs: announced },
|
||||
});
|
||||
|
||||
|
|
@ -153,4 +154,6 @@ export const descriptor: ActionDescriptor = {
|
|||
verb: 'tour-announce',
|
||||
action: action as SurfaceAdapterAction<unknown, unknown>,
|
||||
autoExecutable: false,
|
||||
auditTargetKind: 'surface_tour',
|
||||
auditStakes: 'medium',
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue