Skip to content

Skip the prompt-opening cases that read files this export omits - #1459

Open
aniruddhaadak80 wants to merge 1 commit into
CodebuffAI:mainfrom
aniruddhaadak80:fix/free-agents-test-public-mirror
Open

aniruddhaadak80 wants to merge 1 commit into
CodebuffAI:mainfrom
aniruddhaadak80:fix/free-agents-test-public-mirror

Conversation

@aniruddhaadak80

Copy link
Copy Markdown

common/src/__tests__/free-agents.test.ts reports 3 fail on current main
(e0a2015c2). All three are ENOENT on files this repository does not contain.
This PR makes it 32 pass, 3 skip, 0 fail, test-only, in one file.

Why it fails

CONTRIBUTING.md describes this repository as a public export of a private source
tree, and .github/workflows/pr-hygiene.yml lists web/ among the paths that "are
not part of this repository and a change to them cannot be merged here". Three
cases in the canonical root prompt openings match their source definitions
block read source files that the export does not ship, so they can never pass
here:

error: ENOENT: no such file or directory, open
  '.../freebuff/web/convex/coding_agent/cli_agent/freebuff_bundled_agents.ts'
error: ENOENT: no such file or directory, open
  '.../freebuff-desktop/src/server/harness/thread-agent.ts'
error: ENOENT: no such file or directory, open
  '.../freebuff-desktop/src/shared/mission-prompt.ts'

freebuff/web/ is not present (the freebuff/ directory here contains only cli
and e2e/), and freebuff-desktop/ is not part of the export at all. These
assertions are still valuable — they pin a real invariant, that the free-mode root
prompt signature stays at position 0 of the Cloud planner, the desktop thread
agent and the desktop mission renderers — so this is about making them runnable
here, not about weakening them.

What this changes

  • Adds an isInThisTree(...parts) helper next to the existing read(...) helper
    in the same describe block.
  • Wraps the three affected cases in test.skipIf(!isInThisTree(...)), using the
    test.skipIf convention already used elsewhere in this repository (for example
    cli/src/native/ripgrep-extraction.test.ts).
  • Names the three paths as PLANNER_SOURCE, THREAD_AGENT_SOURCE and
    MISSION_PROMPT_SOURCE so the skip condition and the read cannot drift apart.
  • In the private tree, where those files do exist, all three cases run
    unchanged.
    And if the export ever grows to include them, they reactivate here
    on their own with no edit to this PR.

The two cases in the same block that read exported files — agents/base2/base2.ts
and agents/base3.ts — still run and still pass, and the rest of the file's 32
tests are untouched.

How it was tested

$ bun test src/__tests__/free-agents.test.ts
before (main @ e0a2015c2) after
result 32 pass, 3 fail 32 pass, 3 skip, 0 fail

The three cases are the regression lock: verified failing on unmodified main
before the change. Rest of the directory on the same base, unaffected:

bun test src/__tests__/accent-span.test.ts ... src/__tests__/free-agents.test.ts
                                  177 pass, 3 skip, 5 fail

The 5 remaining failures in that run are all in
freebuff-public-data-use-copy.test.ts and none are caused by this diff — that
file is addressed separately in
#1458, which fixes a
line-ending comparison bug and the same export-omission problem. The two changes
are independent and touch different files.

bunx prettier --check common/src/__tests__/free-agents.test.ts
                                  All matched files use Prettier code style!

Notes for the reviewer

  • Why this was never caught: Public CI (.github/workflows/ci.yml)
    installs, builds the SDK, builds the binary and smoke-tests it. It never runs
    bun test, so a red suite in the exported tree is invisible to CI. I am not
    proposing a CI change here, but this is the second file with the same shape and
    it may be worth a separate decision about whether common/ tests should run in
    public CI.
  • Alternative, if you would rather not skip: drop these three cases from the
    export instead, in whatever produces the public tree. That keeps the public file
    free of skips but loses the local signal, and I do not know enough about the
    export scripts to make that change safely from here. Happy to switch if that is
    the house preference.
  • No source behavior is touched, and no web/, freebuff/web/,
    packages/internal/, packages/billing/, packages/bigquery/ or
    packages/build-tools/ path is modified.

@codebuff-team

Copy link
Copy Markdown
Contributor

Good, well-scoped fix. The three failing cases in common/src/__tests__/free-agents.test.ts read freebuff/web/... and freebuff-desktop/... paths that this mirror never ships (per CONTRIBUTING.md and pr-hygiene.yml), so they're permanent ENOENT failures here, not real regressions. Wrapping them in test.skipIf(!isInThisTree(...)) using the existing convention (seen in cli/src/native/ripgrep-extraction.test.ts) is the right mechanism: it keeps the assertions live where the source exists (private tree) and turns them into honest skips here instead of either deleting the checks or leaving main red.

The named-const approach (PLANNER_SOURCE, THREAD_AGENT_SOURCE, MISSION_PROMPT_SOURCE) is a nice touch — it prevents the skip condition and the read() call from drifting apart, which is exactly the kind of bug this pattern is prone to.

One thing to double check before porting: in the private tree, isInThisTree will also gate on existsSync, which is harmless there since the files genuinely exist, but worth confirming there's no CI path in the private tree where those files are gitignored/build artifacts rather than tracked sources (i.e., that existsSync isn't masking a real absence there too). Diff itself is clean, single file, test-only, and does not weaken any assertion — it only adds a guard. Worth a maintainer's few minutes to port.

@codebuff-team codebuff-team added bot:triaged Classified by the community triage bot pr:port-candidate Worth porting into the private source tree labels Sep 30, 2026
@aniruddhaadak80

Copy link
Copy Markdown
Author

Checked, and existsSync is not masking anything in the private tree.

The three paths are:

  • freebuff/web/convex/coding_agent/cli_agent/... (PLANNER_SOURCE)
  • freebuff-desktop/src/server/harness/thread-agent.ts (THREAD_AGENT_SOURCE)
  • freebuff-desktop/src/shared/mission-prompt.ts (MISSION_PROMPT_SOURCE)

Running git check-ignore -v on each returns no match for all three, so none of them is gitignored and none can be a build artifact. In this mirror all three are genuinely absent, which is the omission isInThisTree is there to catch.

Worth noting because it is close: this repo does ignore paths that would have produced exactly the failure mode you were worried about, and none of them overlap these three:

  • dev (with carve-outs !scripts/agentic-e2e/dev/ and !freebuff-desktop/src/ui/dev/)
  • freebuff/web/.impeccable/
  • dist, dist-env, **.log

So the risk case is a path under one of those, and these are not. If the private tree keeps that .gitignore, the assertions stay live there and this ports as intended.

Happy to fold in anything else before it is ported.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot:triaged Classified by the community triage bot pr:port-candidate Worth porting into the private source tree

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants