Expand description
Test/integration-suite checking (P5.4,
design/tracks/semantics-in-the-checker.md §6) — closes category 7 of
bynk-check/src/analysis.rs’s own residual-gap accounting, the last of
the seven. bynk-emit/src/project/tests_emit.rs held
process_tests/process_integration_tests, real production code (not
fixture noise, despite the filename) checking + emitting suite/test integration bodies — but it ran only inside bynk-emit::run_checks
(Mode::Analyse included), never inside bynk_check::analysis::analyse_project,
the entry point the LSP now uses. That gap meant no diagnostics and no
RefSink bindings (go-to-definition/find-references) for anything inside
a test file, in the editor — see analysis.rs’s own module doc for the
full accounting this closes.
What moved here — every check-only helper process_tests/
process_integration_tests used, plus every function that is genuinely
dual-use: called both by this module’s own phase_test_bodies/
phase_integration_bodies (the checking half, real diagnostic/RefSink
sinks) and by bynk-emit’s TypeScript lowering (throwaway sinks, needed
only for the resolved-type view a body’s emission depends on). Dual-use
functions are pub, and bynk-emit calls them qualified
(bynk_check::test_suites::foo(...)) rather than duplicating them — see
build_privileged_resolved, typecheck_case_body,
check_history_binding, register_call_record_types,
history_handlers, history_variant_name, prop_binding_generable
and infer_participants for which and why (each names its own emit-side
call sites). Duplicating a dual-use function instead of relocating it is
exactly the drift risk this whole design track exists to close (§9,
“Relocating checks risks a quiet R4.6/R4.11 regression”).
What stayed in bynk-emit (pure TypeScript emission, or verified
emit-only by call-site count): block_uses_observation,
target_service_handler_kinds, is_attackable_contract,
numeric_or_scalar_base, attackable_contracts,
json_codec_qual_for_target, prop_history_binding, prop_is_history,
SystemCaseInput, RunnableTest, discovered_location,
discovery_manifest, sanitise_suite, emit_integration_module and its
http-driver/harness helpers, and the ~2,600-line TypeScript-codegen tail
starting at emit_test_module (emit_stub_class, gen_ts_for_ty,
emit_test_property_function, emit_test_history_property_function, and
the rest).
bynk-emit/src/project/tests_emit.rs’s own process_tests/
process_integration_tests keep their exact signatures (run_checks’s
callers need no change) — their bodies now call
phase_test_bodies/phase_integration_bodies for the checking half,
then proceed to their existing, unmoved Phase-5 emission logic using the
“ready for emission” data these return.
bynk-emit depends on bynk-check (a production dependency, never the
reverse), so this move has no circular-dependency subtlety to solve —
unlike P5.3’s phase_platform_lock, which needed a from-scratch pure
reimplementation because its old home reached into a bynk-emit
TypeScript-codegen helper. This is a plain code-motion job, just a large
one.
Structs§
- Resolved
Stub - v0.118: a capability seam with one or more
stuboverrides applied (testing track slice 6). Groups everystub Cap.method(…)clause — both suite-scoped and case-scoped — targeting the same capabilitycap. The resolvedCapabilityDeclsupplies each overridden method’s parameter names and return type for stub emission.
Constants§
- PROP_
GEN_ DEPTH - v0.114: the recursion cap for property-binding generability (mirrors the
checker’s
MOCK_DEPTHfor bareVal).
Functions§
- build_
privileged_ resolved - Build a
resolver::ResolvedCommonsbacked byowning_unit’s privileged view: its types, fns, methods, plus types/fns from every commons ituses, plus exported types from every consumed context. The same shape used by the production pipeline. Returns theResolvedCommonsplus a synthetic commons span for the test. - check_
history_ binding - v0.119 (testing track slice 7, ADR 0155): type-check a
for all run: History[Agent]binding. The subject is a run of the agent — a generated, driven call-history — bound as an ordinaryList[Step]. Validates the DECISION-B rules (agent-only, every handler parameter generable), registers the synthetic call-sum / step / state record types intoresolved.typesso the predicate’sList+ value surface (.call is …,.old/.new,.accepted) type-checks, and returns the boundList[Step]type. - history_
handlers - The agent’s drivable
on callhandlers — the ones a history sequences. Other handler kinds (http/cron/message/open/close) are not RPC entry points and are never part of a generated call-history. - history_
variant_ name - The
.callvariant tag for a handler: the handler name with its first letter upper-cased (spend→Spend,topUp→TopUp). The reader matches this withis/match(s.call is Spend). - infer_
participants - v0.118: infer a
system-tier suite’s wired participants — the target’s transitiveconsumesclosure (testing track slice 6). A BFS from the target followingconsumesedges; the returned list starts with the target and includes every context reachable through it (deterministic breadth order). - phase_
integration_ bodies - P5.4 (
design/tracks/semantics-in-the-checker.md§6): the checking half oftest integration "name"suite processing — participant inference, thesystem-needs-a-serialisation-edge gate, duplicate-case-name detection, the harness-root cross-context view, and per-case body type-checking (including theWire/by Nobodytier gates). Formerly the pre-emission logic ofbynk-emit’s ownprocess_integration_tests; emission stays inbynk-emit::project::tests_emit::process_integration_tests, which calls this function for its checking half and then emits only for the groups this returns. Unlikephase_test_bodies’sResolvedStubmap, the only thing worth handing back here is the harness’sresolver::CrossContextInfo— it’s built from clone-heavy maps (harness_consumes/harness_uses), so recomputing it a second time on the emit side would be wasted work.participants/uses_targets/case_inputsare cheap and pure (a BFS, a linear scan), so the emit-side loop recomputes those itself fromparsed/unit_consumes, using the now-relocatedinfer_participants.bynk_check::analysis::analyse_projectcalls this too and discards the returned map — it never emits. Closes category 7 ofbynk-check/src/analysis.rs’s own residual-gap accounting, alongsidephase_test_bodies. - phase_
test_ bodies - P5.4 (
design/tracks/semantics-in-the-checker.md§6): the checking half oftest <target>suite processing — target resolution, duplicate-case- name detection,stub-clause resolution, and case/property body type-checking. Formerly Phases 2-4 ofbynk-emit’s ownprocess_tests; Phase 5 (TypeScript emission) stays inbynk-emit::project::tests_emit::process_tests, which calls this function for its checking half and then emits only for the targets this returns — every target this function resolves, has no duplicate case names, and whose bodies type-check clean is exactly “ready for emission”.bynk_check::analysis::analyse_projectcalls this too and discards the returned map — it never emits, so only the diagnostic/RefSinkside effects matter there. Closes category 7 ofbynk-check/src/analysis.rs’s own residual-gap accounting, alongsidephase_integration_bodies. - prop_
binding_ generable - Whether a
for all x: Tbinding’s type is refinement-generable: refined types must not carry aMatchespredicate (no refinement-driven generator), and sums/records must have every component recursively generable within the depth cap. Mirrors the checker’scan_mock_bare. - register_
call_ record_ types - Register a synthetic call-record type per capability operation of the target
context (v0.117, testing track slice 5), so
trace(Cap.op)— typedList[<CallRecord>]— supports field access on its records. The record’s fields are the operation’s parameters. - typecheck_
case_ body - Type-check a test
case/propertybody against the target unit’s privileges, returning the inferredexpr_typesmap. The check path feeds real diagnostic/ref sinks; the emit path reuses it with throwaway sinks to give the case-body lowering full type information (so collection kernels — notablytrace(Cap.op)’sList[…]methods — dispatch on the receiver’s checked type). - value_
block - v0.118: wrap a single expression as a
{ tail: e }block, so astubvalue can be type-checked or lowered in the same op-body position a provider operation’s tail occupies.