Skip to content

pm-aggregator tests: a run leaves three files of machine state in the package directory, and runs the real quota gather #14167

In review

Description

@dezren39

What happens

Running the aggregator's tests leaves three files in pm-stack/aggregator/ that git neither tracks nor ignores:

?? pm-stack/aggregator/fleet-feed.json
?? pm-stack/aggregator/meta-renewal.json
?? pm-stack/aggregator/quota-gatherer-heartbeat.json

To see it

cd pm-stack/aggregator
rm -f fleet-feed.json meta-renewal.json quota-gatherer-heartbeat.json
bun test test/health-priming.test.ts
git status --short .

Of the test files that name these files, run one at a time, test/health-priming.test.ts is the one that leaves them (seen 2026-11-24 on main at 7dbf2c9990, three runs out of three).

Why

The test starts the real server (bun run src/server.ts, PM_AGG_SOURCE=live) with the caller's whole environment and the package directory as its working directory. It points the feed, registry, comments and snapshots at a temporary directory, but the server's background jobs also write to paths it does not point anywhere, and those default to the working directory (loadConfig in src/config.ts: quotaCurrentFile and the heartbeat beside it; the renewal state; and a feed written to the working directory even though PM_AGG_FEED_FILE names another).

What the files hold shows the jobs ran for real, not against a stand-in:

  • quota-gatherer-heartbeat.json: "error": "opencode quota subcommand failed: Executable not found in $PATH: \"opencode\"". Where opencode is installed, the test runs the real quota gather.
  • fleet-feed.json: the checkout's real HEAD.

What it risks

  • An agent that stages everything (git add -A) commits three files of machine state. None of them was added in the last 600 commits on main (as far back as was looked).
  • On a machine where the dashboard runs from this directory with the default paths, a test run writes over the files the dashboard is using.
  • The test's result depends on what is installed on the machine that runs it.

Done when

  • A run of the suite leaves git status clean.
  • The server the test starts writes only under the test's temporary directory, and does not run the quota gather or the renewal check against the real machine (every path it can write is pointed at the temporary directory, or the jobs are off for the test).
  • A check in the suite fails if a run leaves files in the package directory.

Generated by Claude Code

Activity

  1. added
    kind/bug
    kind/test
    app/pm-stack
    source/agent
    on Nov 24, 2026
  2. developing-today commented on Nov 24, 2026

    @developing-today
    Contributor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    app/pm-stackkind/bugkind/testsource/agentstatus:in-review

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions