Skip to content

Stop flagging unrelated tests when a property such as limit changes its number - #4478

Closed
dtoelke wants to merge 1 commit into
garrytan:mainfrom
dtoelke:call-site-literals-need-the-module
Closed

dtoelke wants to merge 1 commit into
garrytan:mainfrom
dtoelke:call-site-literals-need-the-module

Conversation

@dtoelke

@dtoelke dtoelke commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

/ship's changed-number check no longer flags unrelated tests when an ordinary property such as limit changes.

Why: lowering limit: 120 to 30 reported every test that used the word "limit" and held the number 120, so /ship stopped on files that had nothing to do with the change.

Nothing to do: constants with uppercase names and one-character values are matched exactly as before.

Why (in your own words)

We lowered a rate limit from 120 to 30 in one module and updated its test. /ship then failed PREGATE_LITERALS on 30 other test files. None of them touched the rate limiter: each one used the word "limit" somewhere and held the number 120 somewhere.

docs/pregate.md and the comment on consumersOf already say that a call-site name such as attempts or limit is an ordinary word, so a test counts only when it also names the changed module. The code applied that rule only to one-character values. This change applies it whatever the value's length. It is one condition in consumersOf.

Live evidence

repro.sh builds a throwaway repo: src/rate-limits.ts with { limit: 120, ... }, its own test, and two unrelated tests that use the word "limit" and the number 120. A branch lowers the limit to 30 and updates the module's own test, then it runs gstack-pregate --base main --only literals.

Before, on main at dd4266d:

preflight  literals  fail                141 ms  2 test location(s) still carry an old literal (PREGATE_LITERALS)
    literals: tests/pagination.test.ts:2: limit still 120 (now 30 in src/rate-limits.ts)
    literals: tests/upload.test.ts:2: limit still 120 (now 30 in src/rate-limits.ts)
PREGATE: fail tree=42cc85e53e48 head=ac5717e1c320 checks=1 of 8
exit=1

After, on this branch:

preflight  literals  pass                137 ms  1 changed literal(s), no test still carries an old value (3 test-tree files scanned)
PREGATE: pass tree=42cc85e53e48 head=92e39621dab8 checks=1 of 8

The new test in test/pregate-selection.test.ts fails on main's lib/pregate/checks/literals.ts and passes here:

# main's literals.ts with the new test
+   "tests/pagination.test.ts:2",
+   "tests/upload.test.ts:2",
(fail) literals (pure) > consumersOf: a longer call-site literal needs the changed module in the file too

# this branch
 7 pass
 0 fail

The reproduction script:

#!/usr/bin/env bash
# repro.sh <gstack checkout>
set -eu
GSTACK=$1
T=$(mktemp -d)
git init -q --bare "$T/origin.git"
git init -q -b main "$T/work" && cd "$T/work"
git config user.email [email protected] && git config user.name repro && git config commit.gpgsign false
git remote add origin "$T/origin.git"
mkdir -p src tests
echo '# repro' > README.md
echo 'export const SEND_RATE = { limit: 120, windowMs: 60_000 };' > src/rate-limits.ts
printf '%s\n' "import { SEND_RATE } from '../src/rate-limits';" "expect(SEND_RATE.limit).toBe(120);" > tests/rate-limits.test.ts
printf '%s\n' "const page = await list({ limit: 50 });" "expect(page.rows.length).toBeLessThanOrEqual(120);" > tests/pagination.test.ts
printf '%s\n' "// the size limit is checked before the upload starts" "expect(chunk(120)).toHaveLength(3);" > tests/upload.test.ts
git add -A && git commit -q -m base && git push -q -u origin main
git checkout -q -b change
echo 'export const SEND_RATE = { limit: 30, windowMs: 60_000 };' > src/rate-limits.ts
printf '%s\n' "import { SEND_RATE } from '../src/rate-limits';" "expect(SEND_RATE.limit).toBe(30);" > tests/rate-limits.test.ts
git commit -q -am 'lower the send rate limit'
GSTACK_HOME="$T/home" "$GSTACK/bin/gstack-pregate" --base main --only literals 2>&1 || echo "exit=$?"

Scope

  • Changed: one condition in consumersOf (lib/pregate/checks/literals.ts) and its comment, one test, one sentence in docs/pregate.md, a changelog fragment.
  • Verified live by: the reproduction above on macOS with Bun 1.3.13; bun run typecheck; the consumersOf tests in test/pregate-selection.test.ts. The same rule has run in a private monorepo's /ship since 2026-11-08.
  • Did NOT test: Windows; the full free suite (bun run test).
  • What it gives up: a test that holds the old number of a lowercase property and neither imports nor names the changed module is no longer reported.

Liveness proof (required for external contributors)

Checklist

  • Liveness screenshot attached (GSTACK PR typed live into a real surface) or PR author is @garrytan (owner exemption)
  • This is not a generated-file-only diff (I edited the source/template and regenerated)
  • No ETHOS.md edits, and no changes to voice / founder perspective / YC references
  • New public command / external service / host adapter has an accepted issue linked (or N/A)
  • Linked issue or reproduction: reproduction above

…ts number

A call-site name (limit, attempts) is an ordinary word, so a test counts as
a consumer of its old value only when the test also names the changed
module. That gate applied to one-character values alone: lowering
limit: 120 to 30 reported every test holding the word and the number. It
now applies whatever the value's length.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
@trunk-io

trunk-io Bot commented Nov 18, 2026

Copy link
Copy Markdown

Merging to main in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here

@capy-ai

capy-ai Bot commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

Thank you, @dtoelke. I checked this against main (fda9dea) with my own fixture: consumersOf still reports an unrelated test that only uses the word limit and holds 120 when limit goes from 120 to 30, while docs/pregate.md already says a call-site name like limit needs the changed module in the file too. Your one-condition change applies the documented rule, and keeps the case where an importer of the module still holds the old number.

We're taking it. As with every outside change to gstack's checks, we'll rebuild it on current main with you credited, rather than merging this branch, and link the new PR here when it's up.

@capy-ai capy-ai Bot added bug Something isn't working S3 Severity 3: everything else labels Nov 18, 2026
garrytan added a commit that referenced this pull request Nov 18, 2026
The #4478 test's uppercase control asserted an empty list on a fixture
that never held the name, so it proved nothing. It now holds a file that
names SEND_LIMIT without the module and expects it reported.

Three fixture lines in this test come from @dtoelke's #4478.

Co-authored-by: dtoelke <[email protected]>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
capy-ai Bot added a commit that referenced this pull request Nov 18, 2026
… limit (#4478) (#4496)

/ship's changed-number check no longer stops on tests that only use the
same word as a changed property: lowering `limit: 120` to `30` used to
report every test that said "limit" and held 120.

Why: `docs/pregate.md` already said a test counts for a word like
`limit` only when it also names the changed module, but the code
enforced that only for one-character values. Tests that import the
module are still reported.

Nothing to do. Thanks to @dtoelke, who reported this and sent the first
fix in #4478.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: dtoelke <[email protected]>
@capy-ai capy-ai Bot closed this in #4496 Nov 18, 2026
@capy-ai

capy-ai Bot commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

Thank you @dtoelke. We rebuilt this change on current main as #4496, which is now merged (0ab5657) with you credited as co-author: the changed-number check now reads a test file for a lowercase call-site name only when that file also names the changed module, so word-only matches stop being flagged. Closing this one in favour of #4496.

@stackpt-agent
stackpt-agent deleted the call-site-literals-need-the-module branch November 18, 2026 19:18
@garrytan garrytan mentioned this pull request Nov 19, 2026
capy-ai Bot added a commit that referenced this pull request Nov 19, 2026
- `gstack-artifact validate` no longer passes a run.json that gstack-autoplan never wrote. (#4494)
- /ship's changed-number check no longer stops on tests that only share a word with the change (#4478). (#4496)
- On Capy, /ship no longer edits or comments on pull requests as you. (#4518)
- The destructive-command check stops asking about scratch deletes and catches the real damage it used to miss. (#4513)
- The destructive-command check reads commands more carefully, closing gaps found after the last release. (#4525)
- The Codex readiness check and the second-model review now pick the same model for a custom Codex provider (GST-3089). (#4491)
- gstack's Codex hooks work when your Codex folder's path has a `(`, `&` or other shell character in it. (#4528)
- Uninstalling gstack keeps your own Codex hooks trusted. (#4528)
- Codex hook setup matches Codex more closely. (#4528)
- On Windows, setup copies the Claude Code hook code that gstack's Codex hooks import (#4528)
- /review's checklist on Codex reads shell commands more carefully. (#4528)
- On Codex, gstack now suggests the right skill for a prompt and stops destructive commands before they run. (#4512)
- On Codex, /review is now held once when it tries to finish without its adversarial pass or its report, as it already is on Claude Code. (#4522)
- On Codex, gstack's skill suggestion now names the skill the way Codex lists it. (#4523)
- On Codex, gstack's suggested prompts and docs now name skills the way Codex lists them. (#4524)
- /review on Codex with gpt-6.1-sol is no longer held back for a second-model pass it already ran. (#4526)
- On Codex, office-hours, plan-design-review and gstack-upgrade work again when you name them. (#4510)
- gstack knows when Codex is running unattended. (#4510)
- Codex reviewers start with a clean context. (#4510)
- Docs no longer say Codex has no hook support. (#4510)
- A command whose output was cut off no longer counts as a finished read. (#4492)
- A folder marked as published data can no longer hide source code or agent files from /ship's review. (#4516)
- Correction to the on-by-default helper hooks entry: the hook still routes only to /review, /qa and /verify, so skills you've installed yourself aren't suggested yet. With gstack's skills it routes 14 of 60 real bug reports (was 17), and long prompts are no longer skipped. (#4505)
- /sync-gbrain's read check now works when the first page in your code source is over 64 KB. (#4497)
- Free-suite CI no longer fails before any test runs when Ubuntu's package mirror is slow. (#4530)
- Syncing a second repo no longer makes the first one ask for /sync-gbrain again. (#4532)
- gstack's helper hooks are now on by default in Claude Code, OpenClaw and Hermes, and the prompt-routing hook fires on real bug reports. (#4503)
- `gstack-pregate clear --receipt` accepts a remote gate run from before a merged release when the release only regenerated a declared release output. (#4483)
- The second-model review now keeps the reviewer's own result, and reports a used-up budget as a budget stop. (#4515)
- When the reviewer wrote its review to the result file it was asked for, Codex then replaced that file with its short closing message ("Done, I wrote the review"), so the review was thrown away and reported as missing its markers. (#4515)
- When the provider refuses the call with HTTP 402 Payment Required (usually a metering proxy that hit its allowance, or an account out of credits or quota), gstack used to record only "exit 1". (#4515)
- The pre-commit /verify check now fails a check that times out, and its checks share one time budget (GST-3201). (#4527)
- /ship's review collector no longer reads a reviewer's own scope list or list of passed checks as findings (GST-3201). (#4527)
- Merge-queue stack tests fail when git cannot list a PR's added test files (GST-3201). (#4527)
- /ship can now review results PRs that publish raw session data. (#4511)
- /ship's review pass works when the checkout you ship isn't the project's default checkout. (#4507)
- A second review round no longer reports done when nothing was reviewed. (#4520)
- The prompt-routing hook now suggests skills you install yourself, and no longer sends ordinary bug reports to /qa (GST-3123). (#4506)
- gstack's script runner and merge-queue checks now also refuse cut-off output. (#4502)
- A failed second-model review reports the cause that actually stopped it, and the runner never deletes its own prompt. (#4519)
- `gstack-ship-queue ready` now fills in the trial merges and the second-model trail read instead of printing lines to fill. (#4529)
- Five small ship-tool fixes. (#4529)
- A ruling the owner gives while a `/ship` run is open can be relayed. (#4529)
- /ship no longer kills a working test run as stalled when the test command starts its workers in their own session. (#4533)
- /ship no longer stops a review because the state-machine reader started its reply the way its instructions say. (#4504)
- When Claude Code runs /verify right before a commit, it now gets a quick check instead of the full fix loop (GST-3150). (#4508)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working S3 Severity 3: everything else

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants