bcquality/custom/knowledge/api/expose-bc-entities-as-api-pages-for-external-agents.bad.al
Tharanga Chandrasekara 07140e2223 Add new action skills for AL testing and documentation
- Introduced `al-test-writer` to generate AL test codeunits for production objects based on TDD principles.
- Added `al-userguide-test-writer` to create test codeunits from user guide steps, mapping actions and assertions.
- Implemented `bc-extension-test-guide` to generate a comprehensive TEST_GUIDE.md for Business Central extensions, covering various categories.
- Created `bc-webclient-runner` to automate UI testing of the Business Central web client, capturing screenshots and asserting UI states.
- Developed `page-scripting-e2e` to produce a recording plan for Page Scripting, ensuring a structured approach to browser-level testing.
2026-06-07 12:26:47 +12:00

60 lines
1.9 KiB
AL

// Anti-pattern: an unstable, over-broad agent surface. The version is not a
// fixed contract, the entity is exposed through a part page the agent cannot
// see, and every write is left open. Demonstration-only.
// Smell 1: a ListPart can never surface as an agent tool. Only top-level API
// pages are picked up, so this entity is silently unreachable.
page 50121 "Agent Customer Part"
{
PageType = ListPart;
SourceTable = Customer;
layout
{
area(Content)
{
repeater(Group)
{
field(no; Rec."No.") { }
field(name; Rec.Name) { }
}
}
}
}
// Smell 2: a top-level API page that is over-broad and unstable.
page 50122 "Agent Vendor API"
{
PageType = API;
SourceTable = Vendor;
APIPublisher = 'contoso';
APIGroup = 'purchasing';
// The version is bumped in place on each change instead of adding a new one,
// so every tool the agent discovered against v1.0 stops resolving.
APIVersion = 'v2.0';
EntityName = 'vendor';
EntitySetName = 'vendors';
// Nothing is locked down. A read-only agent workflow still gets create,
// modify, and delete tools, so a mistaken or prompt-injected agent can
// mutate or delete vendors it had no business touching.
// InsertAllowed / ModifyAllowed / DeleteAllowed left at permissive defaults.
layout
{
area(Content)
{
repeater(Group)
{
// The entire table sprayed out, far beyond what the agent needs,
// widening the schema and the write blast radius for no reason.
field(no; Rec."No.") { }
field(name; Rec.Name) { }
field(blocked; Rec.Blocked) { }
field(balance; Rec."Balance (LCY)") { }
field(iban; Rec.IBAN) { }
field(paymentTerms; Rec."Payment Terms Code") { }
}
}
}
}