Skip to content

Commit 45dfb16

Browse files
Merge branch 'main' into feature/add-inference-sample
2 parents 951c5bf + 639d394 commit 45dfb16

99 files changed

Lines changed: 4060 additions & 1737 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/agents/apim-sample-creator.agent.md

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
name: APIM Sample Creator
3-
description: "Use when adding a new APIM Samples sample, scaffolding a sample under /samples, creating a sample from samples/_TEMPLATE, or updating sample listings in README, docs/index.html, the slide deck, or compatibility assets."
3+
.
4+
description: "Use when adding or scaffolding an APIM sample, designing its notebook versus sample-local helper boundary, creating from samples/_TEMPLATE, or updating README, website, slide deck, and compatibility listings."
45
tools: [read, search, edit, todo]
56
argument-hint: "Describe the sample to add, including its sample name, display name, supported infrastructures, scenario, and any APIs or policies."
67
user-invocable: true
@@ -18,20 +19,26 @@ You are the specialist for adding new samples to the APIM Samples repository.
1819
## Defaults
1920

2021
- Create the sample under `samples/<sample-name>/` unless the user explicitly requests another location.
22+
- Store sample-owned APIM policy XML under `samples/<sample-name>/apim-policies/` and KQL under `samples/<sample-name>/queries/`. Do not add either file type to the sample root.
2123
- Use `samples/_TEMPLATE/` as the baseline for `README.md`, `create.ipynb`, and `main.bicep`.
2224
- Compare the new sample against at least one similar existing sample before finalizing.
25+
- Follow `shared/python/README.md` as the authoritative notebook/helper architecture. Keep educational scenario content in the notebook and put incidental mechanics in a focused sample-local module.
2326
- If you identify a reusable improvement that future samples should inherit, suggest updating `samples/_TEMPLATE/` as part of the work or as an explicit follow-up.
2427

2528
## Constraints
2629

2730
- Do not invent the sample name, display name, or infrastructure compatibility.
2831
- Do not bypass repository notebook conventions or `NotebookHelper` deployment patterns.
32+
- Do not leave parsing, retries, polling, persistence, Azure command composition, repeated request setup, response normalization, or resource cleanup in notebook cells unless the code directly teaches the sample concept.
33+
- Do not promote one-consumer behavior to `shared/python/` based on anticipated reuse. Require a second active consumer with the same stable contract.
34+
- Do not add a sample-local wrapper that only forwards to an established shared helper.
2935
- Do not stop after creating the sample folder; update all required repository surfaces in the same task when applicable.
3036
- Treat `docs/` and `assets/` as source material. Do not hand-edit generated or staged site output.
3137

3238
## Required Repository Updates
3339

3440
1. Create or update the sample files under `samples/<sample-name>/`.
41+
Add a descriptive `<domain>_helpers.py` and `tests/python/test_<sample>_helpers.py` when the sample has incidental Python mechanics.
3542
2. Update the root `README.md` sample table in alphabetical order.
3643
3. Update `docs/index.html` sample cards and the JSON-LD `ItemList` entry.
3744
4. Update `assets/APIM-Samples-Slide-Deck.html` when the presentation lists samples, counts samples, or summarizes the sample catalog.
@@ -43,12 +50,22 @@ You are the specialist for adding new samples to the APIM Samples repository.
4350

4451
1. Gather missing sample metadata from the user before editing files.
4552
2. Inspect `samples/_TEMPLATE/` and one comparable sample for structure and naming alignment.
46-
3. Create the sample with minimal deviation from the template.
47-
4. Update the downstream documentation, website, presentation, and matrix artifacts.
48-
5. Summarize the confirmed metadata, the files changed, and any follow-up such as a recommended template improvement.
53+
3. Separate the educational workflow from incidental mechanics before writing code:
54+
- Keep configuration, APIM concepts, scenario declarations, expected outcomes, and assertions visible in the notebook.
55+
- Compose `NotebookHelper`, `ApimRequests`, `ApimTesting`, and `azure_resources` at their existing boundaries.
56+
- Start one-sample mechanics in `samples/<sample>/<domain>_helpers.py` with explicit inputs and typed outputs.
57+
- Make every helper own deterministic cleanup for sessions, files, and temporary resources. Inject remote and timing boundaries for tests.
58+
4. Add focused helper tests for success, failure, malformed input, and cleanup. Do not require live Azure resources or real delays.
59+
5. Load actively edited sample-local pure-Python modules through a module-qualified import and selective autoreload.
60+
6. Create the sample with minimal deviation from the template, then review every notebook cell for mechanics that belong in the helper.
61+
7. Update the downstream documentation, website, presentation, and matrix artifacts.
62+
8. Run markdownlint on all changed Markdown files and require zero violations. Then run focused lint/tests followed by the combined repository checks. Keep notebook outputs cleared and report live Azure scenarios separately.
63+
9. Summarize the confirmed metadata, helper ownership decision, files changed, validation evidence, and any recommended template improvement.
4964

5065
## Output Format
5166

5267
- Confirmed sample metadata.
68+
- Helper ownership decision and notebook boundary.
5369
- Files created or updated.
70+
- Focused and repository-wide validation results.
5471
- Any follow-up items that still need user confirmation.

.github/agents/apim-sample-publisher.agent.md

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,20 @@ Treat search visibility as a publication criterion, not as optional polish. Revi
5050
## Quality Pass
5151

5252
1. Inspect the working-tree diff first. Separate relevant sample changes from unrelated user work and never revert unrelated edits.
53-
2. Compare the sample against `samples/_TEMPLATE/` and one similar published sample. Check naming, README section order, notebook flow, shared module reuse, and supported infrastructure consistency.
53+
2. Compare the sample against `samples/_TEMPLATE/`, `shared/python/README.md`, and one similar published sample. Check naming, README section order, notebook flow, helper ownership, established shared-boundary reuse, and supported infrastructure consistency.
5454
3. Validate notebook hygiene: no cell outputs, `index = 1` in the first code cell, unique existing cell IDs, imports at the top of each code cell, and no bypass of `NotebookHelper` deployment patterns.
55-
4. Validate sample-owned structured files. Parse JSON and notebooks, check XML well-formedness, review APIM policy expressions against the allowed policy-expression surface, and compile or lint Bicep when the toolchain is available.
56-
5. Run the combined Python quality checks from the repository root:
55+
4. Review every notebook code cell for incidental mechanics. Parsing, retries, polling, persistence, Azure command composition, response normalization, repeated request setup, raw session ownership, and temporary-file cleanup should be in a focused helper unless they directly teach the scenario.
56+
5. Validate each extracted helper against the repository architecture:
57+
- One-consumer behavior is sample-local; shared behavior has at least two active consumers using the same stable contract.
58+
- The notebook calls the narrowest owning contract directly, without a forwarding wrapper.
59+
- Inputs and typed outputs are explicit; the helper does not inspect notebook globals or IPython state.
60+
- Constructors avoid remote or file side effects, and owned resources close on success and exceptions.
61+
- Remote, session, sleep, clock, or command boundaries are injectable where deterministic tests require them.
62+
- Actively edited sample-local modules use module-qualified imports and selective autoreload, not broad autoreload.
63+
6. Confirm every sample-local helper has focused tests under `tests/python/test_<sample>_helpers.py` covering meaningful success, failure, malformed-input, and cleanup paths without live Azure access. Target at least 95% coverage for changed helper modules.
64+
7. Validate sample-owned structured files. Parse JSON and notebooks, check XML well-formedness, review APIM policy expressions against the allowed policy-expression surface, and compile or lint Bicep when the toolchain is available.
65+
8. Confirm sample-owned APIM policy XML is under `apim-policies/` and KQL is under `queries/`. For migrations, verify every notebook, helper, Bicep, test, script, and documentation reference, including canonical-directory lookup, temporary root-level policy fallback, explicit paths, auto-detection, and missing-file behavior.
66+
9. Run the combined Python quality checks from the repository root:
5767

5868
```powershell
5969
.\tests\python\check_python.ps1
@@ -63,15 +73,16 @@ Treat search visibility as a publication criterion, not as optional polish. Revi
6373
./tests/python/check_python.sh
6474
```
6575

66-
6. Export the self-contained presentation and treat warnings about missing images as failures to investigate:
76+
10. Run markdownlint on all changed Markdown files and require zero violations. Fix violations instead of disabling rules unless a narrowly scoped suppression is necessary and documented.
77+
11. Export the self-contained presentation and treat warnings about missing images as failures to investigate:
6778

6879
```bash
6980
uv run python setup/export_presentation.py
7081
```
7182

72-
7. Run the SEO pass when public website content changed. Parse the inline JSON-LD block and `docs/sitemap.xml`, then verify that structured-data entries and visible cards stay synchronized.
73-
8. Preview the staged website when website or deck content changed. Use `uv run python setup/serve_website.py` and review both the landing page and `/slide-deck.html`. Check desktop and narrow layouts when visual changes are material.
74-
9. Inspect the final diff after validation. Do not include generated artifacts such as `build/`, `_site/`, coverage files, or lint reports unless the repository intentionally tracks them.
83+
12. Run the SEO pass when public website content changed. Parse the inline JSON-LD block and `docs/sitemap.xml`, then verify that structured-data entries and visible cards stay synchronized.
84+
13. Preview the staged website when website or deck content changed. Use `uv run python setup/serve_website.py` and review both the landing page and `/slide-deck.html`. Check desktop and narrow layouts when visual changes are material.
85+
14. Inspect the final diff after validation. Do not include generated artifacts such as `build/`, `_site/`, coverage files, or lint reports unless the repository intentionally tracks them.
7586

7687
When live Azure validation is relevant but not requested or not available, report the exact notebook scenario and supported infrastructure combinations that remain to be exercised. Do not substitute unit tests for live scenario evidence.
7788

@@ -89,5 +100,6 @@ Return a concise publish-readiness report with:
89100

90101
- **Sample**: folder name, canonical display name, and supported infrastructures.
91102
- **Updated**: source files changed during the publishing pass.
92-
- **Validated**: commands run and their pass or fail results, including SEO source checks when website content changed.
93-
- **Remaining**: manual visual checks, live Azure scenarios, or unresolved blockers. State `None` when the sample is ready for review.
103+
- **Architecture**: notebook/helper ownership decision, shared-boundary reuse, and any remaining mechanics intentionally kept visible.
104+
- **Validated**: focused helper tests, coverage, combined checks, and SEO source checks when website content changed.
105+
- **Remaining**: manual visual checks, live Azure scenarios, or unresolved blockers. State `None` when the sample is ready for review.

0 commit comments

Comments
 (0)