Skip to content

Quest CLI 0.15.1

Latest

Choose a tag to compare

@jeremy-newhouse jeremy-newhouse released this 22 Nov 08:28
· 10 commits to dev since this release
a880ca4

0.15.0 was a release candidate only. It was published solely under the
0.15.0-rc.1 dist-tag and was never moved to latest; 0.15.1 is the first
release of everything under ## 0.15.0 below, plus this section.

Fixed

  • The node wrapper no longer orphans the native quest child when it is
    stopped by SIGTERM, SIGINT or SIGHUP
    (QCLI-567, opum-doc DEC-282 (a1) item 7
    and (a2)). bin/quest.cjs ran the child with spawnSync, which blocks the
    event loop, so a caller that timed out and killed only the wrapper left the
    native process running (PPID 1). It now spawns asynchronously, forwards those
    three signals, and, when none of stdin, stdout and stderr is a terminal
    (every daemon and supervisor caller), runs the child in its own session and
    process group: a forwarded signal goes to the group and the wrapper sweeps
    the group on exit, so grandchildren (git, gh) die with it. When any of
    the three is a terminal the child stays in the caller's group, so Ctrl-C,
    Ctrl-Z and /dev/tty prompts work as before.
    When the child dies by a signal the wrapper now dies by the same signal
    (re-raised), where 0.15.0 exited 1, so a caller sees death by signal; for
    SIGPIPE, SIGXFSZ and SIGUSR1, which Node does not leave at the default
    action, it exits 128+n instead.
    Residual, stated until the lifeline ships (QCLI-571, DEC-282 (a2) item 2):
    SIGKILL of the wrapper, or a caller's group-wide SIGKILL off a terminal,
    cannot be intercepted and can still orphan the child. With a terminal on any
    of the three the child shares the caller's group, so a SIGTERM to the wrapper
    reaches the child only, not its grandchildren. The caller remedy is
    TERM-then-KILL: SIGTERM the wrapper, wait a few seconds, then SIGKILL. Off a
    terminal, a plain SIGTERM, which is what Node execFile timeouts send, is
    fully handled.

Changed

  • quest task list --across-refs is serialised across the worktrees of one
    clone by an advisory lock, and a waiter reuses the result the previous run
    just recorded
    (QCLI-568, opum-doc DEC-282 (a7) to (a16)). The lock lives at
    <git-common-dir>/quest/across-refs.lock; the run that holds it records its
    whole result under <git-common-dir>/quest/across-refs-results/, keyed by the
    normalised request, and a waiter that acquires the lock replays that record,
    stdout and stderr byte for byte, only when the plan identity matches (each
    planned ref's sha), the record finished while the waiter waited, and the same
    build wrote it. Anything else recomputes. The cold run is as slow as before,
    or slightly slower: 619 to 623 s measured at the 40-ref, 2,000-record shape
    (allow about 650 s)
    , because it is the run that fills the cache.
    How this lock differs from the 0.15.0 lock (the release candidate), which
    broke any holder older than 10 minutes.
    The holder re-stamps the lock every
    30 seconds, and staleness is judged by silence since the last stamp,
    never by the holder's age. A live holder on the same host is NEVER broken by
    age (a wedged one is bounded by each waiter's 660 s wait, after which that
    waiter runs unlocked and writes one note: line on stderr); a dead same-host
    pid is broken after 30 s, and a holder on another host after 10 minutes of
    silence. The lock is advisory: it only saves duplicated work, and Git's
    conditional ref update remains the ordering authority. A hand remedy for a
    wedge is in the timeout message: remove the lock file once you have checked
    the named pid is not a running quest process.
  • quest task list --across-refs now caches each ref's records, keyed by that
    ref's .quest tree hash, so an unchanged ref is not re-read
    (QCLI-563,
    opum-doc DEC-282 (a13), sibling of the QCLI-567 entry). The cache lives under
    <git-common-dir>/quest/across-refs-cache/, shared by every worktree of one
    clone: manifests/<tree-key>.json names each record path and the blob oid that
    holds its text, and blobs/<oid> stores that text once however many trees
    contain the path. It is safe to delete at any time (deleting it only costs a
    re-read). It is bounded to the newest 64 manifests by last use, plus every key
    the current run itself used; pruning also garbage-collects blob files that no
    surviving manifest references. Writes are atomic. The first run on a
    repository is as slow as before
    -- 619 to 623 s measured at a 40-ref,
    2,000-real-record shape -- because it is the run that fills the cache; later runs are fast. The
    drift hint no longer says "Nothing was written -- the view is read-only"; it
    now names what the view may have written: the read cache under
    across-refs-cache/ and the whole-result records under
    across-refs-results/ (the transient lock file across-refs.lock is not
    named). If the cache FAILS (an
    unwritable directory, ENOSPC, an unreadable common dir), the command writes one
    note: -prefixed stderr line, at most once per process, naming the cause and
    saying the read ran uncached; it writes nothing to stdout and changes no exit
    code or JSON. A plain cache miss (absent or corrupt entry) is normal and writes
    nothing.

Known residual

  • A caller that spawns the wrapper with stdout and stderr piped, as lore
    does, gets the native quest in its own process group
    (DEC-282 (a4),
    QCLI-571). The wrapper sees no terminal there, so a group SIGKILL of the
    caller, such as kill(-lorepid, SIGKILL), reaches the wrapper but not native
    quest. SIGKILL or an OOM kill of the caller leaves it running; a SIGTERM to
    the caller races the wrapper's own sweep. The lifeline (QCLI-571) closes it:
    native quest exits when its wrapper's pipe closes, whoever killed the
    wrapper. It does not block this release and is scheduled as the first item of
    the following patch release.