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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant