"Builds and runs the oracle test of any project that has the oracle-capture harness: the legacy system is the oracle, the runner sends the same request to legacy and new and compares the answers. Covers scenarios, the offline gate, safety guards, the live run (credentials only from the environment) and how to classify each difference. Reads oracle-test.yml. Use when: \"oracle\", \"teste oráculo\", \"rodar oracle\", \"paridade legado\", \"cenário oracle\", \"rodada viva\"."
Install
npx skillscat add lukeware-hub/plugin-oracle-test/oracle-runner Install via the SkillsCat registry.
Oracle runner
The legacy system is the oracle. You never write an expected status or body. The runner calls both
sides and compares them. Talk to the user in pt-BR, in plain words. Explain any term you use.
0. Load the project
- Find
oracle-test.ymlat the project root. If it is missing, run theoracle-setupskill first. - Read the project guide (
guide) and the files indocs. Domain rules come from there: routes,
precision, dates, known cases. This skill holds no project-specific rule. - Legacy version: if
legacy.snapshotis set, check it withgit -C <snapshot> rev-parse --short HEAD
againstlegacy.commit. A mismatch goes into the report as a warning. Before a live run, ask whether
the deployed legacy islegacy.version. If nobody confirms, the report says it was not confirmed. - Flags and categories: run
sh "${CLAUDE_PLUGIN_ROOT}/scripts/run-py.sh" detect_harness.py --root .
(with the config's runner, tags and scenarios). Use only flags it lists. The atestation flag isattest_flag, whose name changes between projects.
1. Scenarios (harness.scenarios)
- Read the scenario schema from the project's runner (
scenario.goor its tests). The YAML is strict: an
unknown key fails the load. - Each scenario cites, in a comment, the requirement, decision or legacy line it proves, as the guide asks.
- Coverage checklist, each item marked covered, not applicable (with the reason) or pending:
positive with known data; missing or empty credential; unknown id; validation errors (missing field,
bad format, wrong type); boundaries the guide lists; scenarios that write state come last. maskandcompareonly for a field that is really volatile, or a difference decided by a recorded
decision. Never mask a whole node that hides cardinality or type. Aknown_diffneedsscope, a
decision id and a validexpires, or the runner refuses the whole file.
2. Offline gate (no network, no credentials)
Run harness.offline (usually make oracle-test). The loader validates every scenario, even with--filter. Fix load errors before any live run.
3. Safety guards (not negotiable)
taxpayer_idand any document number come only from the project's sanctioned allowlist. The runner
aborts before any HTTP call otherwise. Never use--allow-unsanctioned-taxpayer. Never add an id to the
allowlist yourself: that needs a recorded human decision.--gen-fixturesneeds--three-way(legacy determinism attested), a match below 400 on both sides, and
the project'sattest_flag. Never with an unsanctioned id or a body with personal data. Respect the--fixture-max-*limits. Review the fixture diff and do not commit it.- Hosts:
httpsonly (httponly on localhost), inside--allowed-hosts. - Sensitive headers (
Authorization,Cookie,Set-Cookie,X-Api-Key) are never in--header-allowlist. - Latency samples (
--latency-*) are information, never a gate. One live run is one sample per scenario,
not a latency measure.
4. Credentials (only from the environment or CI secrets)
On GitHub, the workflow reads the repository secrets; check only that they exist (gh secret list, names only).
- Check presence only, never print a value:
for v in <live.env_required>; do [ -n "$(printenv "$v")" ] && echo "$v ok" || echo "$v faltando"; done - If any is missing: stop. Tell the user which variable names to define in their own terminal or
in CI secrets, then restart Claude Code. Never ask for the value in the chat. Never putVAR=valuein a
command. Never pass a secret by flag (--token,--*-client-secret): it shows in the transcript and
inps. Never read a value from.env, an API collection, the Downloads folder or a shell profile. - Never write a secret to a file, log, report, fixture or memory. The runner redacts known secrets. That is
a safety net, not a permission.
5. Live run: interview first, then run
The goal of a live run: send the same requests to two systems, the old one (legacy) and the new one,
on the endpoints the user picks, and compare the answers. The interview finds out which endpoints, where
the tests come from, and what to do with the result.
A live run calls real systems. Never start one without the interview below, and never without the
user's final "Disparar" answer, even when the user already said "roda" or "executa". Ask with the
AskUserQuestion tool, in pt-BR and in plain words. Every question says, in one line, why it matters. The
recommended option comes first, marked "(Recomendado)" with its reason. Build every option from facts
(config, detect output, guide), never from guesses.
Before asking, gather silently: oracle-test.yml, the guide, the detect output (categories,scenario_count, endpoints, filter_supports_endpoints, ci_workflows, flags), the last full run inreport.history, the time in timezone.
5.1 First round (one AskUserQuestion call, 4 questions)
- Onde rodar?
- "GitHub: workflow
<live.ci.workflow>na<live.ci.ref>": offer it whenlive.ciis set. Recommend it
whenlive.local_allowedis false or the guide forbids local runs. Note that it runs the code of<live.ci.ref>, not of the current branch. - "Esta máquina": offer it only when
live.local_allowedis true and the guide allows it. - "Cancelar".
- "GitHub: workflow
- De onde vêm os testes? (multiSelect) Why: the tests decide what is compared.
- "Cenários do projeto (Recomendado)":
<scenario_count>testes prontos em<harness.scenarios>. - "Um roteiro": a document with the steps to test.
- "Uma lista de endpoints": the routes to test, in a file or typed.
- "Uma massa de dados no SVC": ids of products, proposals or clients that exist in the test environment.
- "Cenários do projeto (Recomendado)":
- Quais endpoints testar? (multiSelect) Why: each endpoint is one route that both systems answer.
Options fromendpoints(biggest first), each with a plain name and its count, e.g.
"Simulação de produto ·POST /…/products/{id}/preview(245 testes)". With more than 3 endpoints:
"Todos ( endpoints, testes) (Recomendado)" and the three biggest; "Other" takes more
endpoints (MÉTODO /caminho), a test group fromreport.labels, or a scenario id. Recommend "Todos"
for a round that enters the comparison, because a filtered run is partial. - Enviar o resultado por WhatsApp? Why: the group report is a short text anyone understands.
- "Sim, montar o texto e copiar (Recomendado)": the plugin writes it and copies it; it never sends a
message by itself, the user pastes it in the group. - "Não, só o resumo aqui no chat".
- "Sim, montar o texto e copiar (Recomendado)": the plugin writes it and copies it; it never sends a
5.2 Where the tests are (only when 5.1 question 2 picked something besides the project scenarios)
Ask Onde eles estão? with AskUserQuestion. Search the repository first and offer up to 3 files found
(e.g. *.postman_collection.json, *.http, *.csv, docs/** with "roteiro" or "massa" in the name);
"Other" takes a path or a link. Then:
- Read only the structure: methods, paths, field names, ids of test records. Never copy a secret, a token,
a password or personal data (document numbers, names, e-mails) into the chat, the scenarios or the
report. A link you cannot open is an open item: say so, do not guess its content. - Roteiro or lista de endpoints: map each item to the
endpointsof the scenarios. Show what already has
tests and what has none. A new scenario is a change to the project: propose it and write it only with
the user's OK, never commit it. - Massa de dados: its ids become the test data of 5.3 (
--varor the workflow id inputs). Check that each
id is of the kind the scenario expects (product, proposal...). - The endpoints found here become the selection of 5.1 question 3; say which ones in one line.
5.3 Second round (only what still matters, at most 4 questions per call)
- Repetir cada pedido duas vezes no sistema antigo? This is three-way. Yes separates noise of the old
system from real differences, and it is slower. Recommend yes for a full round, no for a quick check.
Ask this only if the runner (or the workflow input) supports it. - A versão do sistema antigo no ambiente de teste é a
<legacy.version>? Options: "Sim, confirmada",
"Não sei" (the report says it was not confirmed), "Outra versão" (Other: type which). - Dados de teste, when the runner has
--varor the workflow has id inputs, and 5.2 gave no ids:
"Usar os dados padrão do arquivo de cenários (Recomendado)" or "Usar outro produto/proposta" (Other: the
id). Explain that an id that does not exist in the test environment makes both sides fail the same way,
so it proves nothing. - Parar com erro se houver diferença? (fail-on-diff): recommend yes. The report comes out either way.
- Local runs only: show the credential presence check (section 4). If any is missing, stop here.
- Midnight: if it is within 10 minutes of midnight in
timezoneand scenarios use relative dates, say so
and offer "Esperar" or "Cancelar".
5.4 The filter
- All endpoints: no filter.
- Some endpoints, and
filter_supports_endpointsis true: the filter is thefilter_termof each one,
joined by commas (POST /a/{id}/b,GET /c/{id}). A test group or id from "Other" joins the same list. - Some endpoints, and the runner cannot filter by endpoint: run without the filter (or with the test group,
if one covers them all) and pass--endpoint "<filter_term>"for each one plus--scenarios <harness.scenarios>to the report; it keeps only those endpoints and marks the round partial. Say in
the confirmation that the run takes longer because every test runs.
5.5 Confirmation
Show a short summary in plain words: the two systems compared (old <legacy.version> x new), where,
which endpoints and how many tests, where the tests come from, repetition, test data, version, whether the
WhatsApp text will be made, and the exact command (never a secret). Then ask: "Disparar agora?" with the
options "Disparar", "Ajustar" (back to 5.1) and "Cancelar". Run only on "Disparar".
5.6 Run on GitHub (live.ci)
gh workflow run <live.ci.workflow> --ref <live.ci.ref> -f <input>=<value> ..., using only the names inlive.ci.inputs(from the detect output). Never fill a credential input, even if the workflow has
one (secret_inputs_never_use): a typed value stays visible in the run history.- Find the run:
gh run list --workflow <file> --branch <ref> --event workflow_dispatch --limit 1 --json databaseId,url,createdAt.
Check that it was created after the dispatch. Tell the user the link. - Wait in the background (
gh run watch <id> --exit-status) and say that you are waiting. A failed job
still produces the report when the result file exists.- Batched workflows: some projects split the live run into batches to fit the job time limit: a first job
lists the batches, one job per batch (each with its own login and time limit, a few at the same time),
then a final job joins the batch reports into one. Tell the user the run has several jobs and takes
longer in total than one batch.gh run watchfollows the whole run; the artifact of 4 comes from the
final job, with the same name and format. - A batch job that failed or timed out leaves no batch report: the final job joins what arrived and fails
with "relatório incompleto: X de N lote(s)". Say which batches are missing (gh run view <id>lists the
jobs) and that the report is partial. Never present a partial report as the full round.
- Batched workflows: some projects split the live run into batches to fit the job time limit: a first job
dir="$(mktemp -d)"; gh run download <id> -n <live.ci.artifact_prefix><id> -D "$dir". The result is$dir/<live.ci.json_name>. Then runreport-whatsappwith it,--link <run url>, the WhatsApp
answer of 5.1 and, for the fallback of 5.4, the--endpointand--scenariosarguments.
5.7 Run on this machine (only when allowed)
- Result file in the system temp folder, never in the project, because the JSON holds response values:
json="$(mktemp -d)/oracle-result.json". - Command:
- With the Makefile contract (
live.commandempty):ORACLE_FILTER="<filter>" ORACLE_JSON_FILE="$json" ORACLE_ARGS="<extra flags>" make <live.make_target> - Without it:
live.commandwith{filter},{json_file}and{args}replaced. - Extra flags only from the detected list, e.g.
--three-way.
- With the Makefile contract (
- Afterwards, always run the
report-whatsappskill with$json(with the WhatsApp answer of 5.1 and
the 5.4 fallback arguments), even when the run failed or had differences. If the run broke before writing the JSON, quote the runner error (no secrets) and stop.
6. Classify each difference
| Class | Signs | Where it goes |
|---|---|---|
| Bug in the new service | the new answer differs from the legacy, stable across runs | bug or PR for the new service owner |
| Accepted difference | intentional | only with a recorded decision + expiry + human approval, then known_diff |
| Legacy not deterministic | --three-way marks it |
narrow mask on the volatile field |
| Data or environment error | unexpected 401/404, missing test data, timeout, wrong URL | fix data or credentials, not the service |
| Suspicious match | same error on both sides (e.g. 404 x 404) | not proof of values; check that the data should exist |
7. Limits
- A match is evidence for this run, never "approved": the responsible person accepts it.
- No commit, push, PR or edit of the new service's code without the user's explicit words.
- Never invent an expected answer. The legacy system is the oracle.