Skip to content
Topaz6.0 · Before release
Download

Search documentation

Specification 6.0 · Not released · Tested product 5.21.3

Use arrow keys to choose a result. Press Enter to open.

Type an API name, diagnostic number, rule, or project topic.

    Tools

    compiler observe

    Writes a compiler observation for a source unit or package.

    Invocation, options and results

    Link

    topaz compiler observe

    Synopsis
    1. topaz compiler observe [entry]

    Input

    Use topaz compiler observe [entry] --out-dir <dir>. Accept --compiler rust or --compiler self, --locked, --verbose, --root <dir>, --terminal typed or --terminal rust-source, --language-version <version>, --compiler-memory-mib <MiB> and --compiler-time-ms <ms>.

    The default terminal is rust-source and the current profile compiler default is self. Memory and time values are positive decimal integers using the shared option and environment precedence. Require one output directory and at most one entry operand.

    Reject --terminal ast, an unknown terminal, bootstrap producer or self source options, repeated options, missing values, equals forms and every unlisted option. Reject --locked when an explicit standalone entry is supplied.

    Without an entry load the package selected by --root or the current directory. With an entry use its directory as the default source root. Require the resolved output path to be outside that source root.

    Options and conflicts

    OptionDefaultContractConflicts
    --compiler rust|selfself

    compiler selector (default self); rust selects the reference compiler Also rejects combination with --producer, --self-source.

    None listed
    --lockedfalse

    Verify topaz.lock before compiling the selected package.

    None listed
    --verbosefalse

    Reports the selected compiler and whether it was explicit or the default. For version, prints the detailed release report.

    None listed
    --root <dir>entry directory; . in package mode

    The explicit source root or package root for this invocation.

    None listed
    --out-dir <dir>Not specified

    write canonical observations through generated Rust source to --out-dir (no entry = package mode) Required. compiler observe requires --out-dir

    None listed
    --terminal typed|rust-sourcerust-source

    compiler preview: ast or typed; compiler observe: typed or rust-source (defaults: preview=typed, observe=rust-source)

    None listed
    --language-version <5.21>5.21

    language version selector

    None listed
    --compiler-memory-mib <MiB>8192

    self compiler worker memory budget (8192); overrides TOPAZ_COMPILER_MEMORY_MIB A positive integer is required. Environment input: TOPAZ_COMPILER_MEMORY_MIB.

    None listed
    --compiler-time-ms <ms>1800000

    self compilation wall-clock budget (1800000); overrides TOPAZ_COMPILER_TIME_MS A positive integer is required. Environment input: TOPAZ_COMPILER_TIME_MS.

    None listed

    Output channels

    stdout

    stderr

    Exit status

    0

    A complete valid observation of the selected compiler route is published.

    1

    Arguments, source selection, compiler admission, package state, observation construction or publication fails.

    Effects

    Read the selected source tree and already materialized package dependencies without editing them. Create output parents as needed only after validating that the destination is outside the source root.

    Stage and validate the entire bundle in a sibling directory. An existing output directory may be replaced only when it is already a valid managed observation bundle. Reject unmanaged directories, special files and symlinked bundle members.

    Publish the complete bundle and retain the previous managed bundle if installation of its replacement fails. Remove only staging and backup paths owned by the operation. A crash may leave a private recovery directory and must not turn arbitrary sibling files into cleanup targets.

    Perform no registry access, dependency fetch or compiler download. Observation ends at compiler data or generated source and does not invoke a native build or run the user program.

    Successful runs without host resource failure are repeatable. The same source bytes and logical paths, package graph, dependency bytes, language profile, compiler identity, product release, terminal and budgets produce the same canonical observation content.

    Comparing different compilers or producers requires the declared comparison layer. Provenance identifies the producer and is not erased to make distinct compiler routes look identical. Human output paths and resource failures require the same environment for byte equality.

    Package mode uses the manifest entry and table dependency declarations. --locked requires a valid matching topaz.lock before compilation. Registry dependencies and Lispex package configuration require this explicit option even when a lock already exists.

    Without --locked, a package with neither registry dependencies nor Lispex configuration loads local path dependencies using their declared content hashes. Missing or changed dependency content fails without a fetch. A locked operation also rejects a missing or stale lock without repairing it.

    Observation does not create or rewrite a package lock or vendor tree. Standalone entry mode rejects --locked.

    Operation

    Link

    Use observations to inspect compiler results at a selected terminal. Observation files describe the selected inputs and compiler.

    Option conditions

    Link

    --terminal applies to compiler observe or compiler preview only

    --producer requires --terminal rust-source

    --self-source requires compiler preview --producer stage2 --terminal rust-source

    --locked applies to package-mode check, run, emit, build, test, doc, bench, compiler observe, compiler preview. Selected-entry test also accepts it when --root contains topaz.toml.

    --compiler cannot be combined with bootstrap --producer or --self-source

    compiler observe requires --out-dir

    compiler observe supports only --terminal typed or rust-source

    Behavior contract

    Link
    Ruletools-commands-compiler-observe.rule.behavior

    Command behavior

    Arguments and rejection

    Use topaz compiler observe [entry] --out-dir <dir>. Accept --compiler rust or --compiler self, --locked, --verbose, --root <dir>, --terminal typed or --terminal rust-source, --language-version <version>, --compiler-memory-mib <MiB> and --compiler-time-ms <ms>.

    The default terminal is rust-source and the current profile compiler default is self. Memory and time values are positive decimal integers using the shared option and environment precedence. Require one output directory and at most one entry operand.

    Reject --terminal ast, an unknown terminal, bootstrap producer or self source options, repeated options, missing values, equals forms and every unlisted option. Reject --locked when an explicit standalone entry is supplied.

    Without an entry load the package selected by --root or the current directory. With an entry use its directory as the default source root. Require the resolved output path to be outside that source root.

    Output

    On success write a human completion line identifying the output directory to standard output. Diagnostics and verbose compiler selection information use standard error. There is no selectable JSON report and --format json is rejected.

    The output directory contains topaz-observation.json using topaz.compiler.observation-bundle/v1, request and response records, source and diagnostic records, phase records through the requested terminal and producer provenance. Every member has the schema and digest required by the bundle manifest.

    A typed terminal contains no invented later phase result. A Rust source terminal records generated source rather than a native executable. An observation result may describe compiler diagnostics and must retain their outcome faithfully.

    Exit status

    Exit 0 only after publishing a complete valid observation of the selected compiler route. A recorded compiler rejection can be a valid observation and must be identified in its response record.

    Exit 1 for invalid arguments or source selection, an unsupported explicit compiler route, missing or invalid package state, compiler or resource failure that prevents an observation, invalid bundle construction, unsafe output destination or publication failure.

    No failure may trigger an implicit preview producer or substitute compiler.

    Filesystem effects

    Read the selected source tree and already materialized package dependencies without editing them. Create output parents as needed only after validating that the destination is outside the source root.

    Stage and validate the entire bundle in a sibling directory. An existing output directory may be replaced only when it is already a valid managed observation bundle. Reject unmanaged directories, special files and symlinked bundle members.

    Publish the complete bundle and retain the previous managed bundle if installation of its replacement fails. Remove only staging and backup paths owned by the operation. A crash may leave a private recovery directory and must not turn arbitrary sibling files into cleanup targets.

    Network access

    Perform no registry access, dependency fetch or compiler download. Observation ends at compiler data or generated source and does not invoke a native build or run the user program.

    Reproducibility

    Successful runs without host resource failure are repeatable. The same source bytes and logical paths, package graph, dependency bytes, language profile, compiler identity, product release, terminal and budgets produce the same canonical observation content.

    Comparing different compilers or producers requires the declared comparison layer. Provenance identifies the producer and is not erased to make distinct compiler routes look identical. Human output paths and resource failures require the same environment for byte equality.

    Packages and locks

    Package mode uses the manifest entry and table dependency declarations. --locked requires a valid matching topaz.lock before compilation. Registry dependencies and Lispex package configuration require this explicit option even when a lock already exists.

    Without --locked, a package with neither registry dependencies nor Lispex configuration loads local path dependencies using their declared content hashes. Missing or changed dependency content fails without a fetch. A locked operation also rejects a missing or stale lock without repairing it.

    Observation does not create or rewrite a package lock or vendor tree. Standalone entry mode rejects --locked.

    Why

    An observation records the installed compiler route requested by the caller. A preview instead selects a compiler development producer. Those intentions differ even when both produce the same source representation. Keeping a validated bundle outside the source root prevents observation output from changing its own input.

    Source evidence

    The linked public CLI recipe checks the exact displayed argument rejection before the requested operation. It does not execute the successful operation or verify its effects.

    The reviewed recipe rejects an invalid terminal before source or output work. Successful bundle creation and replacement are outside the execution allowlist.

    Example contract

    Link
    Ruletools-commands-compiler-observe.rule.invocation

    Example contract

    The invocation topaz compiler observe main.tpz --language-version 5.21 --terminal invalid is expected to exit with 1.

    Reject an unknown terminal before observation generation or compiler preview execution.

    Why

    The terminal selects which compiler representation an observation contains. Rejecting an unknown terminal prevents the command from silently choosing a different representation.

    Source evidence

    Example

    Link

    Argument-rejection example

    Link
    main.tpzArgument-rejection exampleOpen in Playground
    1. function identity<T>(value: T) -> T {
    2. value
    3. }
    target product 5.21.3
    Expected result

    Expected result

    Textual rejection details remain Pending in the reference model. The independent Tools example gate expects exit 1.

    Reject an unknown terminal before observation generation or compiler preview execution.

    Source evidence

    Verification scope

    Link

    Observed with Topaz 5.21.3 on 2026-11-06T08:36:29.642Z. This invocation passed; exit 1. 3 assertions were evaluated against the independent expected result. Execution record. This result covers the displayed invocation.

    Related references

    Link

    Compiler selection

    Packages, locks and targets

    Menu

    Download