afv-library/skills
Gaurav Bajpai fc4d14bce0
test(bdt): unit tests + adversarial fixtures @W-22196528@
Adds the full test suite for bdt_analyze.py: 92 unit tests backed by
9 JSON fixtures (4 normative + 5 adversarial). All tests stdlib-only,
runnable via `python3 -m unittest tests.test_bdt_analyze`.

tests/test_bdt_analyze.py coverage:

DAG primitives:
- roots() / sinks() / topo_order() on minimal + branching graphs.
- upstream() / downstream() reachability correctness.
- Cycle tolerance: topo_order + traversals do not infinite-loop or
  raise when the graph contains a cycle; cycle is reported via
  broken_references-adjacent signals.
- Broken-reference tolerance: nodes referencing non-existent upstreams
  are handled gracefully; broken_references() enumerates them.

CLI subcommands (happy-path + error-path for each):
- summary, sources, outputs, stages, nodes, node, lineage,
  field-trace, formula, definitions — each exercised in both
  human-readable and --json modes.
- Exit-code discipline: unknown node -> exit 2, malformed input ->
  exit 3, success -> exit 0.
- Unknown-action graceful degradation: nodes whose action isn't in
  the catalog still appear in summary/nodes output with a generic
  label rather than crashing.
- Output size budgets: default-mode outputs are asserted to stay
  within configured character caps.

Field discovery:
- fields_produced() / fields_consumed() / _scrape_field_refs()
  heuristics tested against both clean and noisy formula bodies.
- TestFieldTraceFocus — narrowing tests preventing false-positive
  substring hits in formula text.

Dual-shape input:
- TestInputShapeDetection — editor export vs. Connect API
  single-definition auto-detection.
- TestMultiDefinition — Connect API multi-definition payload:
  definitions subcommand, --definition N routing, out-of-range
  index error handling.

Fixtures (tests/fixtures/):
- minimal.json               — smallest valid editor-export BDT.
- window_and_aggregate.json  — window + aggregate composition.
- api_input_single.json      — Connect API single-definition payload.
- api_input_multi.json       — Connect API multi-definition payload.

Adversarial fixtures (tests/fixtures/adversarial/):
- cycle.json           — graph with a cycle; parser must not hang.
- broken_ref.json      — node referencing a non-existent upstream.
- unknown_action.json  — node with an action not in the catalog.
- no_ui.json           — BDT missing the UI layer entirely.
- empty_nodes.json     — valid envelope but zero nodes.

Suite status: Ran 92 tests, OK.

@W-22196528@
2026-04-23 23:29:05 +05:30
..
applying-slds @W-21965936@ Add applying and validating SLDS skills to afv-library (#187) 2026-04-21 14:43:15 +05:30
building-ui-bundle-app fix: trigger ui-bundle skill for React app prompts @W-21916680@ (#175) 2026-04-07 09:34:42 +05:30
building-ui-bundle-frontend fix: tighten ui-bundle skill descriptions to reduce false triggers @W-21800526@ (#162) 2026-04-03 09:22:32 +05:30
creating-b2b-commerce-store @W-21274365 Add instructions to create commerce b2b store from vibes (#22) 2026-03-27 18:24:35 +05:30
deploying-ui-bundle fix: tighten ui-bundle skill descriptions to reduce false triggers @W-21800526@ (#162) 2026-04-03 09:22:32 +05:30
developing-agentforce feat: replace agentforce-development skill with three specialized skills @W-21937872@ (#184) 2026-04-09 17:04:48 +05:30
explaining-batch-data-transform test(bdt): unit tests + adversarial fixtures @W-22196528@ 2026-04-23 23:29:05 +05:30
generating-apex @W-21788755 feat: Apex trigger skills UPDATE (#150) 2026-03-31 12:55:08 +05:30
generating-apex-test @W-21788755 feat: Apex trigger skills UPDATE (#150) 2026-03-31 12:55:08 +05:30
generating-custom-application feat: consolidate webapp data skills into using-webapp-salesforce-data @W-21338965@ (#81) 2026-03-23 22:25:33 +00:00
generating-custom-field feat: consolidate webapp data skills into using-webapp-salesforce-data @W-21338965@ (#81) 2026-03-23 22:25:33 +00:00
generating-custom-lightning-type feat: consolidate webapp data skills into using-webapp-salesforce-data @W-21338965@ (#81) 2026-03-23 22:25:33 +00:00
generating-custom-object feat: consolidate webapp data skills into using-webapp-salesforce-data @W-21338965@ (#81) 2026-03-23 22:25:33 +00:00
generating-custom-tab feat: consolidate webapp data skills into using-webapp-salesforce-data @W-21338965@ (#81) 2026-03-23 22:25:33 +00:00
generating-experience-lwr-site refactor: mv skill to dev branch (#182) 2026-04-21 14:43:15 +05:30
generating-flexipage @W-21783760 Update instructions to ensure templates plugin is installed (#124) 2026-03-30 19:36:21 +05:30
generating-flow fix: @W-21915952@ Update SKILL.md to allow user to make changes in the generated flow (#189) 2026-04-21 11:57:05 +05:30
generating-fragment feat: consolidate webapp data skills into using-webapp-salesforce-data @W-21338965@ (#81) 2026-03-23 22:25:33 +00:00
generating-lightning-app W-21661930 Update lex app skill (#88) 2026-03-23 18:32:48 +05:30
generating-list-view feat: consolidate webapp data skills into using-webapp-salesforce-data @W-21338965@ (#81) 2026-03-23 22:25:33 +00:00
generating-permission-set W-21660521 feat: Agentforce Vibes - Unable to assign agent access in permission set (#145) 2026-03-31 22:21:02 +05:30
generating-ui-bundle-features fix: tighten ui-bundle skill descriptions to reduce false triggers @W-21800526@ (#162) 2026-04-03 09:22:32 +05:30
generating-ui-bundle-metadata fix: tighten ui-bundle skill descriptions to reduce false triggers @W-21800526@ (#162) 2026-04-03 09:22:32 +05:30
generating-ui-bundle-site fix: @W-21889983@ Disallow Modifying React Site Metadata Except for Templated Properties (#185) 2026-04-09 00:25:10 +05:30
generating-validation-rule feat: consolidate webapp data skills into using-webapp-salesforce-data @W-21338965@ (#81) 2026-03-23 22:25:33 +00:00
implementing-ui-bundle-agentforce-conversation-client fix: tighten ui-bundle skill descriptions to reduce false triggers @W-21800526@ (#162) 2026-04-03 09:22:32 +05:30
implementing-ui-bundle-file-upload fix: tighten ui-bundle skill descriptions to reduce false triggers @W-21800526@ (#162) 2026-04-03 09:22:32 +05:30
observing-agentforce feat: replace agentforce-development skill with three specialized skills @W-21937872@ (#184) 2026-04-09 17:04:48 +05:30
searching-media @fix @W-21829074 - Updated skill instructions to wait for the user input (#177) 2026-04-21 14:17:29 +05:30
switching-org feat: Add switching-org skill @W-21436488@ (#74) 2026-03-20 18:22:21 -07:00
testing-agentforce feat: replace agentforce-development skill with three specialized skills @W-21937872@ (#184) 2026-04-09 17:04:48 +05:30
trigger-refactor-pipeline feat: consolidate webapp data skills into using-webapp-salesforce-data @W-21338965@ (#81) 2026-03-23 22:25:33 +00:00
uplifting-components-to-slds2 @W-21965936@ Add applying and validating SLDS skills to afv-library (#187) 2026-04-21 14:43:15 +05:30
using-ui-bundle-salesforce-data fix: tighten ui-bundle skill descriptions to reduce false triggers @W-21800526@ (#162) 2026-04-03 09:22:32 +05:30
validating-slds @W-21965936@ Add applying and validating SLDS skills to afv-library (#187) 2026-04-21 14:43:15 +05:30