Employee-Self-Service-Agent-Developer-Kit / tests
AGENTS.md28 starsChanged 6 months agoMITView on GitHub
If you are an AI coding agent (Copilot CLI, Claude, or any other) working on the test suite under this directory, read this file first and follow it strictly. This file is the test-authoring companion to solutions/ess-maker-skills/scripts/flightcheck/AGENTS.md. That sibling file covers the rules for the production checks themselves (the code customers run via /flightcheck). The cardinal rule applies in both places: Every FlightCheck check that calls an external API must be backed by a captured cassette of real responses AND…
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.
Of the AGENTS.md files we read, the 11,773 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository2 other files it gives its agents.
- samples/AGENTS.mdAGENTS.md
- .github/copilot-instructions.mdCopilot instructions
The file
Show its rules and text
We split this AGENTS.md into the rules it gives an agent
25 rules. About 0 are common, 7 are distinctive, and 18 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈7
Distinctive · estimate
This author's own choices. Worth a look.
18
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 3
If you are an AI coding agent (Copilot CLI, Claude, or any other) working on the test suite under this directory, read this file first and …
- Very specific: line 24
If you're here because you're about to add a new check, stop, read solutions/ess-maker-skills/scripts/flightcheck/AGENTS.md first, then …
- Distinctive: line 33
When you add a new FlightCheck check, identify which of these you're building.
- Very specific: line 63
NOT interchangeable. A cassette of Get_Workers does not validate that ISU users exist — different request, different response, often …
- Very specific: line 70
NOT exposed via the publicly-available SOAP services on a typical Workday tenant — Security service isn't in the published service list.
- Distinctive: line 94
If the docs prescribe a config step you don't have a cassette for, treat it the same as any unconfirmed API: stop and request a cassette …
- Very specific: line 134
If you'd need a placeholder mock for any test, stop, do not guess, do not invent a mock.
- Very specific: line 163
tests/mocks/<api>.pymodule header: Every mock module declares `MOCK_STATUS = "validated" | "validatable" | "documented" - Very specific: line 175
If the registry tier and the mock module's MOCK_STATUS disagree, the registry wins — the mock module needs to be updated (or the registry …
- Very specific: line 185
For
validatedAPIs: when a new FlightCheck check needs an endpoint that is not in the "Confirmed endpoints" table of INDEX.md, stop and … - Distinctive: line 224
Do not invent a wrapper, mock, or schema fragment.
- Very specific: line 240
Add a builder to the appropriate tests/mocks/<api>.py module.
- Very specific: line 254
Ensure the module declares MOCK_STATUS = "validated" and MOCK_CASSETTE = "tests/fixtures/cassettes/<file>.yaml".
- Very specific: line 256
Update tests/fixtures/cassettes/INDEX.md "Confirmed endpoints" table to record the new endpoint coverage.
- Distinctive: line 293
Add a builder that returns a payload with the same shape.
- Very specific: line 308
Ensure the module declares MOCK_STATUS = "documented".
- Very specific: line 312
If a documented builder later gets cassette coverage, promote it to validated (and update the docstring + module header).
- Very specific: line 373
If a placeholder mock would be needed for any of the above, stop and follow "What to do when you need a new endpoint" above to promote the …
- Very specific: line 381
If you discover the kit's production code has a bug while writing tests (see the four bugs already pinned in tests/scripts/test_auth.py, …
- Distinctive: line 398
Don't invent endpoint URLs, method names, or response shapes — every field in a mock must trace to a captured cassette, a public schema, or …
- Very specific: line 401
Don't use a placeholder mock in a FlightCheck test.
- Very specific: line 405
Don't pick a weaker tier than the API tier registry mandates.
- Very specific: line 409
Don't disable require_validated_mock() enforcement in conftest.py to make a test pass.
- Very specific: line 411
Don't redact a cassette by hand without running it through tests/captures/_redact.py — the script enforces the canonical substitution table.
- Distinctive: line 414
Don't commit cassettes that contain real names, real tenant friendly names, real instance identifiers, or real third-party URLs (real …
≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Instructions for AI agents writing FlightCheck tests under tests/
If you are an AI coding agent (Copilot CLI, Claude, or any other) working on the test suite under this directory, read this file first and follow it strictly.
This file is the test-authoring companion to
solutions/ess-maker-skills/scripts/flightcheck/AGENTS.md. That
sibling file covers the rules for the production checks themselves
(the code customers run via /flightcheck). The cardinal rule applies
in both places:
Every FlightCheck check that calls an external API must be backed by a captured cassette of real responses AND a test that exercises the check against the cassette.
The check-author file (flightcheck/AGENTS.md) tells you what to do
when adding a new check. This file tells you what to do when adding
or modifying tests — primarily, how to use the existing cassettes and
mock builders, how to enforce the rule that no integration test runs
against an unconfirmed API, and how to handle the "the cassette I need
doesn't exist yet" situation.
If you're here because you're about to add a new check, stop, read
solutions/ess-maker-skills/scripts/flightcheck/AGENTS.md first, then
come back here to write the corresponding test. The two documents
deliberately cross-reference each other.
Two layers of FlightCheck checks (and corresponding API categories)
When you add a new FlightCheck check, identify which of these you're building. The wrong API category will give you a passing test that validates nothing useful.
Layer 1 — Runtime data path
The check exercises the same APIs the agent's topics call to fetch
data at runtime. Example: WD-WF-001 calls Get_Workers (Workday
Human_Resources SOAP) to verify the kit can retrieve worker data.
Mock + cassette home: tests/mocks/{system}.py runtime builders +
tests/fixtures/cassettes/flightcheck_{system}.yaml.
Layer 2 — Configuration validation path
The check exercises admin APIs to verify the customer set up the
integration correctly per the Microsoft Learn integration docs.
Example: a future WD-CFG-001 might call Get_API_Clients (Workday
Identity_Management SOAP) to verify the API client registration step
in the docs was performed.
Mock + cassette home: tests/mocks/{system}.py config builders +
tests/fixtures/cassettes/{system}_config.yaml.
These two paths use different APIs entirely. For Workday the
runtime path is SOAP with WS-Security UsernameToken (basic auth via
ISU credentials); the configuration validation path is REST with OAuth
2.0 bearer auth against admin endpoints (/ccx/api/{module}/v{n}/{tenant}/...).
For ServiceNow the runtime path is the Table API; the configuration
validation path is the OAuth Entity / System Definition API. They are
NOT interchangeable. A cassette of Get_Workers does not validate
that ISU users exist — different request, different response, often
different protocol entirely. Same goes the other way.
A 2026-05 capture attempt confirmed that the Workday admin SOAP
operations the kit's docs reference (Get_API_Clients,
Get_Authentication_Policies, Get_Domain_Security_Policies) are
NOT exposed via the publicly-available SOAP services on a typical
Workday tenant — Security service isn't in the published service
list. The path forward for Workday config validation is the REST
admin API surface, which requires a separately registered API Client
with the Application Credentials grant (different credentials from
the ISU service account used for runtime SOAP).
A subsequent 2026-05 WQL exploration captured the Workday WQL admin
surface in workday_wql_admin.yaml (6 useful data sources, including
oAuth20RefreshTokenDataSource, allSecurityGroups, allCustomReports,
allIntegrationSystemsAudited, publicWebServices, allWorkers).
However, building a runtime FlightCheck check on this cassette is
currently BLOCKED by a chicken-and-egg auth problem: WQL requires
OAuth, OAuth requires registering a FlightCheck-specific API Client in
Workday, and that registration is nearly the same workflow as the ESS
Workday integration setup the check would validate. See the WQL
section of tests/fixtures/cassettes/INDEX.md for the full discussion
and the four workarounds considered (none are currently viable
without either Microsoft-side changes to the ESS Workday extension
pack OR re-validating that admin SOAP operations are reachable via
WS-Security UsernameToken on this tenant). The cassette stays
committed as discovery evidence; do NOT write a check that depends on
WQL bearer auth without first solving this.
If the docs prescribe a config step you don't have a cassette for, treat it the same as any unconfirmed API: stop and request a cassette per the workflow above.
The cardinal rule
You may not write FlightCheck integration tests against APIs whose contracts you have not verified using one of the three permitted tiers (
validated,validatable,documented). Theplaceholdertier is NEVER permitted in a FlightCheck test.
The full tier definitions live in
solutions/ess-maker-skills/scripts/flightcheck/AGENTS.md →
"The cardinal rule" / "The four mock tiers." The per-API tier
assignment lives in tests/fixtures/cassettes/INDEX.md →
"API tier registry." Read both before writing your test.
Quick summary for test authors:
| Tier | What backs the mock | Cassette? |
validated | Real captured cassette in tests/fixtures/cassettes/. Test replays the cassette via responses / respx. | Required |
validatable | Public schema (CSDL / OpenAPI / well-known config) + MS Learn doc with example response, both cited in the mock builder docstring. The check author already verified the property names and types against the schema. Your test uses the hand-built mock derived from the schema. | Not required (welcome as supplementary) |
documented | Verbatim copy of the vendor's documented example response, with the doc URL (anchored) cited in the mock builder docstring. Your test uses the hand-built mock derived from the doc example. | Not required |
placeholder | Schema-grounded best guess. Refused by the conftest enforcement helper. | N/A |
For the validated tier, the unit of confirmation is **method + path
- response shape**, not the exact query string. Server-side query
parameters that narrow, project, sort, or paginate the same resource
(
$filter,$select,$top,$orderby,$skip, ServiceNowsysparm_query/sysparm_fields, Workday WQLWHERE/LIMIT, etc.) do NOT require a new cassette — the existing capture for the same path + method covers all narrowing variants. See the "What counts as the same endpoint" section insolutions/ess-maker-skills/scripts/flightcheck/AGENTS.mdfor the full rule, including the exceptions ($expand,$count=true,$apply, and anything that switches list-shape vs single-item-shape).
If you'd need a placeholder mock for any test, stop, do not
guess, do not invent a mock. Either pick a stronger tier and do
the per-tier verification, or tell the user to capture / promote
the API surface first.
This rule does not apply to:
- Tests of the kit's pure-logic helpers (no network).
- Tests of the test infrastructure itself (the redactor, the conftest fixtures).
- Regression tests pinning known bugs (those are explicitly testing what the broken code does, not what reality returns).
It does apply to:
- Any new check under
solutions/ess-maker-skills/scripts/flightcheck/checks/that calls an external API. - Any test under
tests/flightcheck/that exercises a check end-to-end. - Any new mock builder you'd add to
tests/mocks/.
How to identify which tier an API is in
Two places to look, in this order:
tests/fixtures/cassettes/INDEX.md→ "API tier registry" — the canonical per-API tier list (validated / validatable / documented). If the API isn't in the registry, STOP and tell the user; the tier must be decided before you can pick a verification path.tests/mocks/<api>.pymodule header. Every mock module declaresMOCK_STATUS = "validated" | "validatable" | "documented" | "placeholder". The first three are usable in FlightCheck tests; the last one is rejected byrequire_validated_mock()at test collection time.- Each mock builder's docstring. A
validatedbuilder cites the cassette + line range. Avalidatablebuilder cites the schema URL (e.g.https://graph.microsoft.com/v1.0/$metadata) + the MS Learn operation doc. Adocumentedbuilder cites the MS Learn doc URL with anchor + has the example response copied verbatim.
If the registry tier and the mock module's MOCK_STATUS disagree,
the registry wins — the mock module needs to be updated (or the
registry corrected with rationale).
What to do when you need a new endpoint
The action depends on which tier the API is in:
For validated APIs: when a new FlightCheck check needs an
endpoint that is not in the "Confirmed endpoints" table of INDEX.md,
stop and tell the user. Use this template:
I need to write a test for FlightCheck check
<checkpoint id>, which calls<HTTP method> <full URL pattern>on<service name>. This API is in thevalidatedtier and no existing cassette covers this path + method. I cannot verify the response shape my mock would produce matches reality.Before I continue, please capture a cassette for this endpoint:
- If a recording wrapper for this endpoint already exists in
tests/captures/, set the required env vars and run it. Otherwise:- Create a new recording wrapper modelled on
tests/captures/record_flightcheck_pp_admin.py. Set the required env vars (e.g.ESS_DATAVERSE_URLfor tenant resolution, plus any service-specific creds) and run it.- Review the captured cassette in
tests/fixtures/cassettes/.raw/by eyeball for any leftover real names / emails / instance IDs the redactor missed.- Commit the redacted cassette to
tests/fixtures/cassettes/.- Add a row to
tests/fixtures/cassettes/INDEX.mddescribing what endpoints the cassette covers.- Tell me when done and I'll resume.
For validatable APIs: fetch the published schema yourself and
verify each property the check consumes — see flightcheck/AGENTS.md
"Workflow" step 2 for the per-API schema URLs. Add a builder to
tests/mocks/<api>.py derived from the schema; cite the schema URL
and the MS Learn operation doc in the docstring. No need to ask the
user for anything if the schema covers what you need.
For documented APIs: fetch the MS Learn (or vendor) operation
doc, copy the example response verbatim into the new builder
docstring, cite the doc URL with anchor. Note documented is the
weakest tier — use it only when validatable and validated aren't
feasible for that API.
Do not invent a wrapper, mock, or schema fragment. The whole point of the tier system is that everything in a builder traces back to a real captured response, a published schema, or a vendor-documented example.
How to add a new mock builder
The procedure depends on the API's tier. Look it up in
tests/fixtures/cassettes/INDEX.md → "API tier registry" first.
Validated tier (cassette-backed)
Once a cassette is captured:
- Open the cassette and locate the response shape for the endpoint.
- Add a builder to the appropriate
tests/mocks/<api>.pymodule. - In the builder's docstring, cite the cassette path and approximate
line range. Example:
def my_new_response(*, ...) -> dict[str, Any]: """... Cited consumers: - solutions/ess-maker-skills/scripts/flightcheck/checks/my_check.py:42 Source (validated): tests/fixtures/cassettes/my_capture.yaml line 1234-1280 """ - Ensure the module declares
MOCK_STATUS = "validated"andMOCK_CASSETTE = "tests/fixtures/cassettes/<file>.yaml". - Update
tests/fixtures/cassettes/INDEX.md"Confirmed endpoints" table to record the new endpoint coverage.
Validatable tier (schema-backed, no cassette)
- Fetch the API's published schema (see
flightcheck/AGENTS.md"Workflow" step 2 for per-API schema URLs). - Locate the entity type your builder represents. Read off the field names and types you'll populate.
- Add a builder to the appropriate
tests/mocks/<api>.pymodule. - In the builder's docstring, cite the schema URL + the MS Learn
operation doc. Example:
def my_user(*, ...) -> dict[str, Any]: """User response shape used by FOO-NNN. Cited consumers: - solutions/ess-maker-skills/scripts/flightcheck/checks/<category>.py:NN Source (validatable): Schema: https://graph.microsoft.com/v1.0/$metadata EntityType Name="user" — fields used: id (Edm.String) displayName (Edm.String) userPrincipalName (Edm.String) Docs: https://learn.microsoft.com/graph/api/user-get """ - Ensure the module declares
MOCK_STATUS = "validatable"andMOCK_SCHEMA_SOURCE = "<schema URL>". (The conftest enforcement helper accepts validatable as usable for FlightCheck tests.)
Documented tier (vendor docs, no schema)
- Open the vendor's API reference page for the operation.
- Locate the example response section. Copy the example JSON verbatim into the builder docstring.
- Add a builder that returns a payload with the same shape; allow keyword overrides for the fields a test will want to vary.
- Cite the doc URL with anchor in the docstring. Example:
def my_env_var(*, name: str = "X", value: str = "v") -> dict: """Dataverse environment variable definition record. Cited consumers: - solutions/ess-maker-skills/scripts/flightcheck/checks/workday.py:NN Source (documented): https://learn.microsoft.com/power-apps/developer/data-platform/webapi/reference/environmentvariabledefinition#response Example response copied verbatim 2026-XX-XX. """ - Ensure the module declares
MOCK_STATUS = "documented".
Promoting a builder to a higher tier
If a documented builder later gets cassette coverage, promote it to
validated (and update the docstring + module header). If a
placeholder builder is encountered, it must be promoted before any
FlightCheck test can use it — pick whichever of the three permitted
tiers fits the API.
How to write a FlightCheck integration test
Pattern (mirrors tests/flightcheck/checks/test_workday_env_vars.py):
import pytest, responses
from tests.mocks import dataverse as dv # validated, validatable, or documented — never placeholder
from tests.conftest import require_validated_mock
@responses.activate
def test_my_check_passes_when_state_is_good(...):
require_validated_mock(dv) # fails fast if dv.MOCK_STATUS == "placeholder"
# Arrange: register mocks for the desired tenant state.
responses.add(**dv.query(...))
# Act: run the actual production check.
from flightcheck.checks.my_check import my_check
results = my_check(runner)
# Assert: checkpoint id, status, priority, result, remediation.
assert results[0].status == "Passed"
assert "expected text" in results[0].resultEach new check needs at minimum:
- One GOOD-state test (mock returns valid data → check returns PASSED).
- One BAD-state test (mock returns invalid/missing data → check returns FAILED with the expected remediation pointing at a real fix path).
- Edge tests for any branches in the check logic (no token, partial data, unexpected error response).
Every GOOD / BAD / WARNING test MUST assert on specific phrases from
both result and remediation, not just on status. A test that
checks only status == "Warning" lets misleading text regress
silently — including production incidents where the warning text
implied a runtime break that doesn't actually exist (see the AUTH-005
Assignment required = No rewrite for an example caught only in PR
review). At minimum, pin:
- A phrase from
resultthat names the current state the test set up (e.g."0 users/groups assigned","set to No","3 individual user(s) assigned but no security groups"). - A phrase from
remediationthat captures both WHY the operator should act (impact for FAILED / hardening framing for WARNING) and HOW (a concrete click-path or command). For WARNING tests, also pin the WARNING-kind framing required by principle 9 offlightcheck/AGENTS.md— e.g."Hardening recommendation","not a functional blocker". - For status-bucketed checks (principle 7 of
flightcheck/AGENTS.md), add a multi-resource test that verifies N resources in the same status collapse to ONE row that lists all of them — not N rows.
If a placeholder mock would be needed for any of the above, stop
and follow "What to do when you need a new endpoint" above to
promote the builder (or capture a cassette) per the API's tier.
Pinning latent bugs
If you discover the kit's production code has a bug while writing tests
(see the four bugs already pinned in tests/scripts/test_auth.py,
tests/flightcheck/checks/test_workday_connections.py, and
tests/flightcheck/test_pp_admin_client.py), pin it with a regression
test that asserts the current buggy behavior. Include in the test docstring:
- A clear description of the bug.
- The recommended fix (file, line, and the proposed change).
- A "TODO: when fixed, flip this assertion to ..." note so a future reader knows to update the test alongside the fix.
This prevents silent regressions while making the bug visible.
Things you should not do
- Don't invent endpoint URLs, method names, or response shapes — every field in a mock must trace to a captured cassette, a public schema, or a vendor-documented example.
- Don't use a
placeholdermock in a FlightCheck test. Therequire_validated_mock()enforcement helper rejects placeholder at collection time. Promote the builder to validated / validatable / documented first. - Don't pick a weaker tier than the API tier registry mandates. If
INDEX.mdsays an API isvalidated, treating it asdocumentedto avoid capturing a cassette is a violation. Change the registry (with rationale) if you genuinely need a different tier. - Don't disable
require_validated_mock()enforcement inconftest.pyto make a test pass. - Don't redact a cassette by hand without running it through
tests/captures/_redact.py— the script enforces the canonical substitution table. - Don't commit cassettes that contain real names, real tenant friendly names, real instance identifiers, or real third-party URLs (real ServiceNow dev tenant URL, real SuccessFactors company id, etc.). The redactor handles known patterns; eyeball each cassette before commit for anything it missed.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

