Skip to content

test(cli): isolate install plan receipt fixture#1149

Open
aaiyer wants to merge 1 commit into
DeusData:mainfrom
aaiyer:fix/cli-install-plan-json-leak
Open

test(cli): isolate install plan receipt fixture#1149
aaiyer wants to merge 1 commit into
DeusData:mainfrom
aaiyer:fix/cli-install-plan-json-leak

Conversation

@aaiyer

@aaiyer aaiyer commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Fixes the cli_install_plan_receipt_no_mutation_issue388 test harness so it cannot inherit a developer or CI runner CODEX_HOME while using a temporary HOME fixture.

The observed 4,976-byte LeakSanitizer report was a harness-cleanup symptom, not a production allocation defect:

  • With inherited CODEX_HOME, production correctly resolved the Codex path outside the temporary fixture.
  • The receipt assertion then failed before free(json).
  • The same pre-fix sanitizer binary passed all 222 CLI tests when run with CODEX_HOME unset.

The fixture now saves, unsets, and restores CODEX_HOME. It also records the receipt and no-mutation results, then frees the JSON, restores the environment, and removes the temporary directory before reporting an assertion failure.

Reproduce-first evidence

  • RED: with inherited CODEX_HOME, ASan/UBSan CLI execution failed at the install-plan receipt assertion and LeakSanitizer reported 4,976 bytes allocated through yyjson in cbm_build_install_plan_json.
  • CONTROL: the same pre-fix binary with CODEX_HOME unset passed 222/222 CLI tests without a leak.
  • GREEN: the patched focused CLI ASan/UBSan suite passes 222/222 under the inherited CODEX_HOME environment, without a sanitizer report.

Checks

  • One signed-off commit; scripts/check-dco.sh upstream/main..HEAD passes
  • Focused CLI ASan/UBSan suite: 222/222
  • scripts/lint.sh --ci
  • make -f Makefile.cbm security
  • scripts/check-no-test-skips.sh
  • clang-format 20.1.8 dry-run
  • git diff --check
  • Independent focused review: 0 High / 0 Medium / 0 Low
  • Full local scripts/test.sh: started but stopped after the relevant CLI phase while unrelated deep/matrix suites continued pathologically long; it did not reach a final summary. GitHub CI is authoritative for the exhaustive suite.

Scope

Only tests/test_cli.c changes. Production behavior is unchanged.

Signed-off-by: Anand Aiyer <anand@aiyer.com>
@aaiyer
aaiyer requested a review from DeusData as a code owner July 17, 2026 15:04
@DeusData DeusData added bug Something isn't working priority/normal Standard review queue; useful PR with ordinary maintainer urgency. labels Jul 18, 2026
@DeusData DeusData added this to the 0.9.1-rc milestone Jul 18, 2026
@DeusData

Copy link
Copy Markdown
Owner

Thanks for separating the fixture cleanup symptom from production behavior. This is classified as a normal-priority 0.9.1-rc test-reliability fix. We will review it alongside #1150 because both touch the same CODEX_HOME fallback fixture; the combined result must preserve environment restoration and cleanup on every assertion path without masking production path precedence.

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

Labels

bug Something isn't working priority/normal Standard review queue; useful PR with ordinary maintainer urgency.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants