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.

    Diagnostics

    TPZ4009 Host close failure

    A host close failure produces TPZ4009 at the close call.

    Diagnostic and cause

    Link

    Host close failure

    Family
    topaz
    Phase
    run
    Code
    TPZ4009
    Operation
    File.close

    Cause and conditions

    open evaluates its path once and opens an existing regular file for reading and writing. It does not create or truncate a file. A successful result is Ok containing a File with the cursor at the first byte.

    String paths use the host path syntax. Relative paths resolve against the working directory for an ordinary installed CLI invocation. A package host applies its configured filesystem base and capability policy. NUL, an empty path, a missing file, a directory, and denied read or write access return Err containing an error string.

    An open error follows the filesystem error context contract with open as the public operation. An error result does not grant a handle, and path validation does not bypass operating system or package permissions.

    File values refer to a resource identity. Copies share the open state and cursor. The handle continues to identify the opened file when the directory entry is renamed or replaced. This is the host resource exception in collection value semantics.

    read consumes the remaining bytes from the shared cursor through EOF. UTF-8 validity and text preservation follow UTF-8 decoding. A successful read returns Ok containing text, and a successful read at EOF returns an empty string.

    A read error returns Err containing an error string without a text value. Bytes already consumed before a host or decoding error are not restored. Callers must not assume the previous cursor position after a read error.

    write encodes its string as UTF-8 and writes all bytes at the shared cursor. It adds no newline. Success advances the cursor by the encoded byte count, overwrites those bytes, and preserves an existing suffix beyond them. A write at EOF extends the file.

    An empty write succeeds without moving the cursor. A closed handle, denied access, or host write failure returns Err. A host failure may leave a written prefix and an advanced cursor. It does not roll back earlier argument effects or file changes.

    close returns unit, releases the resource, and marks every alias closed. Closing an already closed resource also returns unit. A later read or write through any alias returns Err. A host failure while closing produces a structured runtime fault at the close call.

    The Topaz 6.0 host close fault is TPZ4009. Its primary location is the close call. A successful write or close does not promise persistence across a system crash.

    Receiver and argument expressions are evaluated once in source order before each resource operation. Use std.fs for whole file replacement or whole file reads. Use File when successive operations must share a cursor and lifetime.

    Response

    Keep resource recovery in the embedding host until structured close fault production is available. A successful close does not promise persistence across a system crash.

    Source evidence

    Topaz 6.0.0 specifies this diagnostic during runtime.

    The product message wording awaits owner approval.

    The pinned SELF source does not emit this diagnostic.

    A host failure while closing a File produces a structured runtime fault at the close call. The close operation releases the shared resource. File.read and File.write retain their Err results for failed operations. The File contract defines cursor and lifetime behavior.

    Response

    Link

    Keep resource recovery in the embedding host until structured close fault production is available. A successful close does not promise persistence across a system crash.

    Reproduction and verification

    Link

    Menu

    Download