Thanks to visit codestin.com
Credit goes to github.com

Skip to content

test(lib): cover the highest-value gaps in four logic modules - #543

Merged
ndycode merged 2 commits into
mainfrom
claude/audit-25-coverage-gaps
Jun 10, 2026
Merged

ndycode merged 2 commits into
mainfrom
claude/audit-25-coverage-gaps

Conversation

@ndycode

@ndycode ndycode commented Jun 10, 2026

Copy link
Copy Markdown
Owner

Summary

Test-only PR closing the highest-value coverage gaps in lib/, found by ranking the full-suite coverage report by absolute uncovered lines and picking the modules whose gaps are real logic (parsers, validators, decision functions) rather than OS integration or env-failing suites' residue. Zero production-code changes; 632 new test lines across 1 new + 3 extended suites (47 tests).

Per-file coverage (line metric, before → after)

Module Before After
lib/storage/snapshot-inspectors.ts 34.7% 100% (describeAccountsWalSnapshot had zero coverage)
lib/runtime/runtime-current-account.ts 77.6% 99.0%
lib/codex-manager/commands/usage.ts 86.1% 100%
lib/codex-manager/commands/models.ts 72.2% 100%

Deliberately skipped despite ranking high: storage.ts (gap inflated by the environment-failing EACCES suites), repair-commands.ts (4% residue of a huge interactive module), bridge.ts (network/OS integration), event-handler.ts (thin facade).

Behaviors now pinned (contracts derived from the implementations)

  • WAL snapshot inspector: forged checksums and malformed journal JSON never reach the normalizer; schema-unknown content falls back to the legacy raw-parse path with schemaErrors surfaced; non-numeric storedVersion dropped; EACCES reads classified existing-but-invalid with stat metadata preserved.
  • Runtime current-account resolution: fractional index hints truncate; negative/out-of-range/NaN rejected; an index hint contradicting the signal's id/email is refused. Helper-status file: 1 MB size cap, string trimming, wrong-typed fields → null.
  • usage: --since relative durations (30m/24h/7d/2W, case-insensitive) resolved against fake-timer clocks; epoch and date-string passthrough; the atomic writer creates nested dirs, consumes .tmp on success, retries rename on EBUSY, and removes the staged temp on non-retryable ENOSPC.
  • models: --help short-circuits before account loading; missing/empty/flag-like --model values error; unavailable (account disabled) availability lines; quota-cache load failures swallowed.

Suspected bug (pinned, not fixed)

runtime-current-account.ts's isRecord() accepts JSON arrays, so an [] helper-status file yields an all-null status object instead of null. Harmless today (the downstream kind check rejects it) but likely an oversight — the test pins current behavior with a comment so a deliberate fix shows up as an explicit diff.

Validation

  • npm run typecheck; eslint --max-warnings=0 on all 4 files
  • All 47 tests passed twice (determinism); canaries (storage-flagged, backup-metadata-builder, codex-manager-status-command) pass
  • Independently re-verified: all 4 suites, 47/47

Risk / Rollback

Pure test addition; revert the single commit.

https://claude.ai/code/session_01XNtnkLbBiXZxfQQYLMpucB


Generated by Claude Code

note: greptile review for oc-chatgpt-multi-auth. cite files like lib/foo.ts:123. confirm regression tests + windows concurrency/token redaction coverage.

Greptile Summary

test-only PR closing the top coverage gaps in four logic modules \u2014 WAL snapshot inspection, usage-command --since parsing + atomic writer retry, and runtime current-account resolution. zero production-code changes; 632 new test lines across one new suite and three extended ones.

  • snapshot-inspectors.test.ts (new, 202 lines): pins all eight branches of describeAccountsWalSnapshot \u2014 non-existing snapshot, outer/inner JSON parse failures, forged checksum, schema-unknown legacy path, EACCES read error, and the happy path.
  • runtime-current-account.test.ts: adds index-fallback resolution, fractional/negative/NaN rejection, id/email contradiction guard, whitespace-only field handling, and a full readAppRuntimeHelperStatus block (size cap, field normalization, the documented isRecord-accepts-arrays quirk).
  • codex-manager-usage-command.test.ts / codex-manager-models-command.test.ts: cover --since relative/epoch/date-string parsing (fake-timer clock), --help short-circuit, --model flag-like-value rejection, disabled-account unavailability text, and the atomic writer\u2019s nested-dir creation, EBUSY retry, and ENOSPC fast-fail + temp-file cleanup paths.

Confidence Score: 5/5

pure test addition — no production code changes, all new tests isolated in temp dirs with correct env-var and spy cleanup

every new test exercises a clearly-defined branch of the implementation; assertions match the source logic; env mutations are saved/restored in beforeEach/afterEach; removeWithRetry is used throughout for windows-safe temp dir cleanup; no test shares mutable state across describe blocks

no files require special attention; the ebusy retry test in codex-manager-usage-command.test.ts uses a real 10 ms sleep that could be made deterministic with fake timers, but it is not a correctness issue

Important Files Changed

Filename Overview
test/snapshot-inspectors.test.ts new suite (202 lines): covers non-existing WAL, malformed journal JSON, bad/missing checksum, valid snapshot, legacy schema-fallback, non-JSON content, EACCES read failure — all paths in describeAccountsWalSnapshot are hit; assertions match source logic
test/runtime-current-account.test.ts extends existing suite with index-fallback, fractional/negative/NaN index rejection, contradicting id/email guard, whitespace-only field handling, and a full readAppRuntimeHelperStatus block; env var isolation via beforeEach/afterEach is correct; removeWithRetry used for cleanup
test/codex-manager-usage-command.test.ts extends suite with --since parsing (fake-timer clock), atomic writer nested-dir creation, EBUSY retry (real 10 ms sleep), and ENOSPC fast-fail + temp-file cleanup; removeWithRetry used for temp dirs
test/codex-manager-models-command.test.ts extends suite with --help short-circuit, --model rejection, per-account availability text, disabled-account unavailability reason, and null-storage + quota-cache-throw resilience

Sequence Diagram

sequenceDiagram
    participant Test
    participant runUsageCommand
    participant parseSinceValue
    participant defaultWriteFile
    participant fs_rename

    Note over Test,fs_rename: --since parsing (fake timers)
    Test->>+runUsageCommand: --since 30m
    runUsageCommand->>parseSinceValue: 30m
    parseSinceValue-->>runUsageCommand: NOW-30x60000
    runUsageCommand-->>-Test: captured since value

    Note over Test,fs_rename: atomic writer EBUSY retry
    Test->>+runUsageCommand: --out usage.txt
    runUsageCommand->>+defaultWriteFile: path, contents
    defaultWriteFile->>fs_rename: rename attempt 0
    fs_rename-->>defaultWriteFile: EBUSY
    defaultWriteFile->>defaultWriteFile: sleep 10ms
    defaultWriteFile->>fs_rename: rename attempt 1
    fs_rename-->>defaultWriteFile: ok
    defaultWriteFile-->>-runUsageCommand: resolved
    runUsageCommand-->>-Test: exitCode 0

    Note over Test,fs_rename: atomic writer ENOSPC fast-fail
    Test->>+runUsageCommand: --out usage.txt
    runUsageCommand->>+defaultWriteFile: path, contents
    defaultWriteFile->>fs_rename: rename
    fs_rename-->>defaultWriteFile: ENOSPC
    defaultWriteFile->>defaultWriteFile: unlink tmp
    defaultWriteFile-->>-runUsageCommand: throw
    runUsageCommand-->>-Test: exitCode 1 tmp removed
Loading

Fix All in Codex

Prompt To Fix All With AI
Fix the following 2 code review issues. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 2
test/codex-manager-usage-command.test.ts:333-338
the EBUSY retry path calls `sleep(10 * 2 ** attempt)` which runs as a real 10 ms pause here since no fake timers are installed. on a loaded windows ci runner that can be longer and is non-deterministic. the stream-failover suite uses `vi.useFakeTimers()` for the same reason — install fake timers before the spy and advance with `vi.advanceTimersByTimeAsync` so the retry is instant and deterministic.

```suggestion
	it("retries the final rename on transient EBUSY and still succeeds", async () => {
		tempDir = await fs.mkdtemp(join(tmpdir(), "codex-usage-retry-"));
		vi.useFakeTimers();
		const renameSpy = vi
			.spyOn(fs, "rename")
			.mockRejectedValueOnce(Object.assign(new Error("busy"), { code: "EBUSY" }));
		const runPromise = runUsageCommand(["--out", "usage.txt"], deps());
		await vi.advanceTimersByTimeAsync(100);
		vi.useRealTimers();
		const exitCode = await runPromise;
```

### Issue 2 of 2
test/snapshot-inspectors.test.ts:37-46
**`isRecord` dep is accepted by the function signature but never called in the body**`describeAccountsWalSnapshot` takes `deps.isRecord` in its type but the implementation delegates all schema checks to `safeParseJson` + Zod, so the field is dead. the test correctly satisfies the type, but no spy assertion documents whether it should be called or not. worth either removing the dep from the source type or adding `expect(deps.isRecord).not.toHaveBeenCalled()` to make the contract explicit.

Reviews (2): Last reviewed commit: "test: import the helper status filename ..." | Re-trigger Greptile

…me-current-account, usage and models commands

Per-file line coverage (same metric as the full-suite baseline run):
- lib/storage/snapshot-inspectors.ts: 34.7% -> 100% (66 uncovered lines -> 0);
  describeAccountsWalSnapshot was fully untested
- lib/runtime/runtime-current-account.ts: 77.6% -> 99.0% (43 -> 2)
- lib/codex-manager/commands/usage.ts: 86.1% -> 100% (45 -> 0)
- lib/codex-manager/commands/models.ts: 72.2% -> 100% (20 -> 0)

Behaviors pinned:
- WAL snapshot inspection: missing-file short-circuit, malformed/forged
  journal entries (checksum mismatch never reaches the normalizer),
  schema-valid fast path, raw-JSON legacy fallback with schemaErrors
  surfaced and non-numeric storedVersion dropped, EACCES read failures
  reported as existing-but-invalid.
- Runtime current-account resolution: index fallback (truncation,
  negative/out-of-range/NaN rejection) and contradiction checks where a
  signal's id/email disagrees with the indexed account; helper status
  file parsing (1 MB cap, type normalization, malformed JSON). Pinned
  quirk: isRecord() accepts JSON arrays, so an "[]" status file yields an
  all-null status object instead of null (downstream kind check still
  rejects it) - suspected oversight, behavior pinned, not fixed.
- usage --since parsing (relative 30m/24h/7d/2W against the clock via
  fake timers, epoch passthrough as number, date strings as strings) and
  the default atomic report writer (nested mkdir, .tmp consumed on
  success, EBUSY rename retry, non-retryable failure cleans the staged
  temp file that briefly exists next to the destination).
- models command: --help short-circuits before account loading, --model
  value validation (missing/empty/flag-like), text-mode availability
  lines incl. disabled-account reasons, quota cache load failures
  swallowed.

https://claude.ai/code/session_01XNtnkLbBiXZxfQQYLMpucB
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

@coderabbitai

coderabbitai Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

This PR expands test coverage across four test files with no changes to implementation. New tests validate CLI command argument parsing, file I/O atomicity and retry logic, runtime account resolution edge cases, and WAL snapshot inspection failure scenarios.

Changes

Test coverage expansion for CLI and runtime commands

Layer / File(s) Summary
Models command CLI validation
test/codex-manager-models-command.test.ts
Five test cases cover --help flag handling (early exit without account load), --model argument validation (rejects missing/empty/flag-like values with exit code 1), text mode output (logs per-account availability), disabled account reporting, and graceful fallback when no accounts are configured and quota cache fails.
Usage command argument parsing and file writer
test/codex-manager-usage-command.test.ts
Imports expanded with timer cleanup, filesystem utilities, and removeWithRetry. Added --since parsing tests (relative durations resolve with fake clock, numeric epochs pass through, date strings preserved, missing values return exit code 1 with error and usage). File writer tests validate atomic writes into nested directories, successful retry after transient EBUSY, and cleanup on non-retryable rename failures.
Runtime account resolution and status reading
test/runtime-current-account.test.ts
Imports wired to include readAppRuntimeHelperStatus and filesystem utilities. Tests cover resolveRuntimeCurrentAccount index fallback/validation (fractional index truncation, negative/out-of-range rejection, index-id/email contradiction detection, whitespace-only id/email handling). Extended readAppRuntimeHelperStatus tests validate missing files, malformed JSON, non-record payloads, 1MB size cap enforcement, field normalization (string trimming, type validation), and array payload regression behavior.
WAL snapshot inspection scenarios
test/snapshot-inspectors.test.ts
Test harness with mocked dependencies, deterministic fake SHA-256, and journal/storage helpers. Eight test cases validate describeAccountsWalSnapshot: non-existent snapshots (exists/valid false, no read call), malformed journal JSON (invalid, stat retained, no parse), schema validation failures (missing checksum rejected), checksum mismatches (invalid, skip normalization), valid checksummed snapshots (valid true, parsed version/accountCount), legacy content fallback (invalid, surfaced schema errors, legacy payload to normalizer), non-JSON checksummed content (invalid, no normalization), and EACCES read failures (existing but invalid, stat preserved).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • ndycode/codex-multi-auth#473: Updated readAppRuntimeHelperStatus behavior (1MB cap, defensive stat/parse handling) is directly covered by the expanded tests in test/runtime-current-account.test.ts:356-555.
  • ndycode/codex-multi-auth#506: Models command --help and --model parsing changes exercise the same entry points being tested in test/codex-manager-models-command.test.ts:55-141.

review notes:

  • test/codex-manager-models-command.test.ts lacks tests for windows path handling in help output or concurrent quota cache loads during runModelsCommand. account disabled reason string is hardcoded; no i18n coverage.
  • test/codex-manager-usage-command.test.ts rename retry logic only tests EBUSY; missing coverage for EACCES, EAGAIN, or other transient errors on windows. fake timer teardown in afterEach is solid but confirm vi.useRealTimers() is called unconditionally.
  • test/runtime-current-account.test.ts 1MB size cap validation looks correct, but tests don't cover symlink loops or concurrent file modifications during readAppRuntimeHelperStatus. whitespace-only id/email handling is well-covered; no tests for non-ASCII normalization edge cases.
  • test/snapshot-inspectors.test.ts WAL inspection mocks are thorough, but tests don't validate concurrent snapshot reads or checksum computation race conditions. legacy schema fallback path is well-exercised; no regression test for schema version leakage if version field is undefined rather than non-numeric.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed title follows conventional commit format with type(scope) and summary ≤72 chars in lowercase imperative; accurately summarizes test-only coverage expansion.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed The PR description is thorough and well-structured with clear summary, coverage metrics, pinned behaviors, and validation details; however, the Docs and Governance Checklist is incomplete.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/audit-25-coverage-gaps
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch claude/audit-25-coverage-gaps

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Comment thread test/runtime-current-account.test.ts

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@test/runtime-current-account.test.ts`:
- Around line 537-555: The test documents that isRecord() currently treats
arrays as records causing an all-null status for "[]"; change the implementation
of isRecord in lib/runtime/runtime-current-account.ts so it explicitly returns
false for arrays (use Array.isArray(value) ? false : typeof value === "object"
&& value !== null) to prevent arrays from being treated as records; keep
existing callers such as appRuntimeHelperStatusToSignal unchanged so they now
receive null for array inputs.

In `@test/snapshot-inspectors.test.ts`:
- Line 39: The isRecord mock in the test currently accepts arrays (isRecord:
(value: unknown) => typeof value === "object" && value !== null) which diverges
from production behavior; update the mock to exclude arrays (add
!Array.isArray(value)) and add a test case feeding a journal entry whose content
is a JSON array (e.g., ["item1","item2"]) to snapshot inspector functions
(referencing isRecord and the inspector functions in snapshot-inspectors) to
assert the inspector rejects or handles array content as the real implementation
should.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: a73c276b-9c6a-42cb-96cc-9ebd8a61f6ca

📥 Commits

Reviewing files that changed from the base of the PR and between 98d9819 and 5082734.

📒 Files selected for processing (4)
  • test/codex-manager-models-command.test.ts
  • test/codex-manager-usage-command.test.ts
  • test/runtime-current-account.test.ts
  • test/snapshot-inspectors.test.ts
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Greptile Review
🧰 Additional context used
📓 Path-based instructions (6)
test/**/*.test.ts

📄 CodeRabbit inference engine (test/AGENTS.md)

test/**/*.test.ts: Vitest globals (describe, it, expect) are enabled and should be used without explicit imports
Maintain 80% coverage threshold across statements, branches, functions, and lines
Use removeWithRetry for Windows filesystem cleanup instead of bare fs.rm to handle EBUSY/EPERM/ENOTEMPTY backoff
Use source files in tests, not compiled dist/ files; test the source directly
Do not skip tests without justification; include rationale if a test must be skipped
Relax ESLint rules for test files as specified in eslint.config.js

Files:

  • test/codex-manager-models-command.test.ts
  • test/runtime-current-account.test.ts
  • test/snapshot-inspectors.test.ts
  • test/codex-manager-usage-command.test.ts
**/*.ts

📄 CodeRabbit inference engine (AGENTS.md)

Do not use as any, @ts-ignore, or @ts-expect-error type assertions

Files:

  • test/codex-manager-models-command.test.ts
  • test/runtime-current-account.test.ts
  • test/snapshot-inspectors.test.ts
  • test/codex-manager-usage-command.test.ts
**/*.{ts,js}

📄 CodeRabbit inference engine (AGENTS.md)

Use ESM module syntax exclusively; the project is ESM-only with "type": "module"

Files:

  • test/codex-manager-models-command.test.ts
  • test/runtime-current-account.test.ts
  • test/snapshot-inspectors.test.ts
  • test/codex-manager-usage-command.test.ts
test/**/*.ts

📄 CodeRabbit inference engine (AGENTS.md)

Windows filesystem operations must include retry handling for transient EBUSY, EPERM, and ENOTEMPTY errors where tests cover Windows locks

Files:

  • test/codex-manager-models-command.test.ts
  • test/runtime-current-account.test.ts
  • test/snapshot-inspectors.test.ts
  • test/codex-manager-usage-command.test.ts
test/**

⚙️ CodeRabbit configuration file

tests must stay deterministic and use vitest. demand regression cases that reproduce concurrency bugs, token refresh races, and windows filesystem behavior. reject changes that mock real secrets or skip assertions.

Files:

  • test/codex-manager-models-command.test.ts
  • test/runtime-current-account.test.ts
  • test/snapshot-inspectors.test.ts
  • test/codex-manager-usage-command.test.ts
**

⚙️ CodeRabbit configuration file

**: # PROJECT KNOWLEDGE BASE

Generated: 2026-04-25
Commit: a87e005
Branch: main
Package version: 2.2.0

OVERVIEW

codex-multi-auth is a Codex CLI-first OAuth account manager and optional forwarding wrapper for the official Codex CLI. The installed codex-multi-auth entrypoint handles account-management commands locally, codex-multi-auth-codex forwards official Codex commands through this package's wrapper when explicitly used, and runtime rotation can route live Responses traffic through a localhost account-rotation proxy by default. The plugin-host entrypoint remains exported for compatibility, but the primary product surface is the account manager, optional wrapper, storage, runtime proxy, and repair tooling.

STRUCTURE

./
├── scripts/
│   ├── codex.js              # codex-multi-auth-codex wrapper, official CLI forwarder, shadow CODEX_HOME/runtime proxy setup
│   ├── codex-multi-auth.js   # standalone package CLI entrypoint
│   ├── codex-routing.js      # auth command and compatibility alias routing
│   ├── codex-bin-resolver.js # official Codex binary discovery
│   ├── codex-app-router.js   # persistent localhost router for packaged Codex app bind
│   └── codex-app-launcher.js # reversible user-level app launcher routing helper
├── index.ts                  # optional plugin-host runtime entry
├── lib/                      # core runtime logic (see lib/AGENTS.md)
│   ├── auth/                 # OAuth flow, PKCE, callback server
│   ├── runtime/              # Codex CLI/app integration helpers, app bind, live sync, runtime observability
│   ├── request/              # request transform, SSE, failover, backoff
│   ├── storage/              # path resolution, migrations, backups, restore, import/export
│   ├── codex-cli/            # Codex CLI state sync and writer helpers
│   ├── codex-manager/        # command modules and settings panels
│   ├── prompts/              # model-family prompts, GitHub ETag cache
│   ├── recovery/             # conve...

Files:

  • test/codex-manager-models-command.test.ts
  • test/runtime-current-account.test.ts
  • test/snapshot-inspectors.test.ts
  • test/codex-manager-usage-command.test.ts
🧠 Learnings (2)
📚 Learning: 2026-06-04T06:14:18.093Z
Learnt from: ndycode
Repo: ndycode/codex-multi-auth PR: 510
File: test/scheduling-strategy-config.test.ts:1-1
Timestamp: 2026-06-04T06:14:18.093Z
Learning: In ndycode/codex-multi-auth, do not flag explicit imports from "vitest" (e.g., describe, it, expect, beforeEach/afterEach, etc.) in test files as issues—even if the Vitest config sets `globals: true`. The repo’s established convention is to keep these imports for consistency with neighboring tests; removing them would make files outliers.

Applied to files:

  • test/codex-manager-models-command.test.ts
  • test/runtime-current-account.test.ts
  • test/snapshot-inspectors.test.ts
  • test/codex-manager-usage-command.test.ts
📚 Learning: 2026-06-04T06:14:24.975Z
Learnt from: ndycode
Repo: ndycode/codex-multi-auth PR: 510
File: test/runtime-rotation-proxy.test.ts:2478-2491
Timestamp: 2026-06-04T06:14:24.975Z
Learning: In ndycode/codex-multi-auth test files (e.g. `test/*.test.ts`), when creating V3 storage fixtures for accounts, it’s an intentional convention to use `as never` for deliberately minimal stored-account objects that only include `refreshToken`, `addedAt`, and `lastUsed`. Do not treat `as never` here as a type-safety problem: optional/other fields are expected to be populated by the runtime during execution, and the cast is used solely to keep the fixture minimal and consistent across existing tests.

Applied to files:

  • test/codex-manager-models-command.test.ts
  • test/runtime-current-account.test.ts
  • test/snapshot-inspectors.test.ts
  • test/codex-manager-usage-command.test.ts
🔇 Additional comments (9)
test/codex-manager-models-command.test.ts (1)

56-141: LGTM!

test/codex-manager-usage-command.test.ts (1)

1-7: LGTM!

Also applies to: 235-365

test/snapshot-inspectors.test.ts (3)

1-11: LGTM!


50-128: LGTM!


130-202: LGTM!

test/runtime-current-account.test.ts (4)

1-12: LGTM!


460-483: LGTM!


484-555: LGTM!


379-398: fractional index truncation is already implemented and matches the test expectations

  • lib/runtime/runtime-current-account.ts:79-83 normalizes lastAccountIndex via Math.trunc(...) and returns null for non-finite values (so NaN is rejected) and negatives.
  • lib/runtime/runtime-current-account.ts:257-258 rejects any normalized index >= storage.accounts.length, so 2 correctly null for a 2-account storage.
  • test/runtime-current-account.test.ts:379-398 aligns with this behavior (1.91, -1/2/NaN → null).

Comment thread test/runtime-current-account.test.ts
Comment thread test/snapshot-inspectors.test.ts
…g it

Use APP_RUNTIME_HELPER_STATUS_FILE from lib/runtime-constants.js so a
rename of the status file cannot silently turn the readAppRuntimeHelperStatus
tests into file-not-found nulls.

https://claude.ai/code/session_01XNtnkLbBiXZxfQQYLMpucB
ndycode pushed a commit that referenced this pull request Jun 10, 2026
Adds the follow-up table (#543-#546 plus the per-branch unit suites) and
updates the remaining-deferred note now that proxy phase 2 and login
phase 4 are in progress.

https://claude.ai/code/session_01XNtnkLbBiXZxfQQYLMpucB
@ndycode
ndycode merged commit 4cb9624 into main Jun 10, 2026
2 checks passed
luo178 pushed a commit to luo178/codex-multi-auth that referenced this pull request Jun 23, 2026
The local isRecord copy in runtime-current-account.ts had drifted from
the canonical lib/utils.ts guard and accepted JSON arrays, so an []
helper-status file produced an all-null status object instead of null
(harmless today only because the downstream kind check rejected it).
Deletes the drifted duplicate in favor of the canonical import and flips
the behavior-pinning test from PR ndycode#543 to the corrected contract.

https://claude.ai/code/session_01XNtnkLbBiXZxfQQYLMpucB
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.

2 participants