Skip to content

chore: fix existing CI drift (biome format + typecheck)#72

Merged
NianJiuZst merged 4 commits into
NianJiuZst:mainfrom
MeloMei:chore/fix-existing-ci-drift
Jun 15, 2026
Merged

chore: fix existing CI drift (biome format + typecheck)#72
NianJiuZst merged 4 commits into
NianJiuZst:mainfrom
MeloMei:chore/fix-existing-ci-drift

Conversation

@MeloMei

@MeloMei MeloMei commented Jun 15, 2026

Copy link
Copy Markdown

Summary

Follow-up to the discussion thread in #68. Fixes the existing CI failures on main so that biome ci and bunx tsc --noEmit both report zero errors. Split into three commits so each concern can be reviewed independently.

Background

After #68 was merged, CI on main was still red. A clean checkout reproduces both:

  • bunx biome ci --linter-enabled=false src test index.ts package.json tsconfig.json → 18 format / organize-imports errors
  • bunx tsc --noEmit → 19 type errors

The biome errors are pre-existing drift from the biome bump in #63 that never got a full reformat sweep. The typecheck errors are a mix of pre-existing drift (mostly test mocks not updated when repositoryTargeting was added in #58, and a few dead helpers in analyze.ts) and two type leaks I introduced in #68 itself.

Commits

1. chore(format): apply biome to existing files (16 files)

Pure mechanical output of bunx biome check --write. No logic changes.

  • 10 source files (src/...) — whitespace and import-order normalization
  • 6 test files (test/...) — same

2. fix(config): align profile redact helpers with LLMProviderProfile type (1 file)

Fixes the two type errors I introduced in #68 at src/orchestration/config.ts:467 and :538. The redact / restore helpers were typed as Record<string, { apiKey?: string; [key: string]: unknown }>, which doesn't accept Record<string, LLMProviderProfile> because LLMProviderProfile lacks an index signature. Aligning the helpers to use LLMProviderProfile directly removes the impedance mismatch.

3. chore(types): clean up pre-existing typecheck drift (6 files)

  • src/orchestration/analyze.ts — drop unused parseGitHubRepoFullName import and two unused private methods (selectTopSuggestion, promptForSuggestion); both were superseded by candidate-based variants.
  • test/agent-orchestrator.test.ts — add repositoryTargeting to the local createConfig factory; replace scout({ localOnly: true }) with scout({}) since localOnly was removed in remove scout local mode #65.
  • test/agent-run.test.ts — drop a duplicate presets key in the createConfig factory.
  • test/init-orchestrator.test.ts — add the missing scoring block in the init mock.
  • test/machine-agent.test.ts — add repositoryTargeting to its createConfig factory.
  • test/machine-commands.test.ts — add repositoryTargeting to the five AppConfig / snapshot mocks that were missing it.

Verification

$ bunx biome ci --linter-enabled=false src test index.ts package.json tsconfig.json
Checked 134 files in 195ms. No fixes applied.
(0 errors)

Local typecheck against the precise lines reported in the CI log was used to drive the fixes. I do not have Bun installed locally so the actual bunx tsc --noEmit pass will run on CI for this PR.

Notes

  • Recommend reviewing commits independently; the format commit is the largest by diff size but shouldn't need close reading.
  • No behavior changes; only types, mocks, and dead-code cleanup.
  • If the maintainer prefers, the format commit and the typecheck cleanup commit can be merged via different strategies (e.g. squash the format commit, keep the typecheck cleanup commit).

Copilot AI review requested due to automatic review settings June 15, 2026 11:50

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Updates repository targeting/preset-related flows and config typing, along with broad formatting/consistency changes across orchestrators and tests.

Changes:

  • Align tests/config fixtures with repositoryTargeting and new config shape (e.g., scoring in init tests).
  • Refactor/format orchestration and content rendering code for readability; remove unused analyze selection helpers.
  • Tighten typing around LLM provider profile secret redaction/restoration.

Reviewed changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated no comments.

Show a summary per file
File Description
test/scout-targeting.test.ts Reformat spies/expectations for readability.
test/preset-orchestrator.test.ts Reformat preset setup and expectation blocks.
test/machine-commands.test.ts Add repositoryTargeting to mocked config/snapshots.
test/machine-agent.test.ts Add repositoryTargeting to test config factory.
test/init-orchestrator.test.ts Update init expectations for scoring + preset prompting and formatting.
test/doctor.test.ts Reformat preset targeting inspection test cases.
test/agent-run.test.ts Adjust config merge order + reformat long assertion.
test/agent-orchestrator.test.ts Add repositoryTargeting to config + tweak scout invocation.
src/services/repository-targeting.ts Reformat error/return types for clarity.
src/services/index.ts Reorder export list for ResolvedRepositoryScope.
src/services/content.ts Simplify array construction and reformat suggestion flattening.
src/orchestration/preset.ts Reformat UI rendering and messaging.
src/orchestration/init.ts Reformat key-values rendering lines; reorder import.
src/orchestration/config.ts Introduce LLMProviderProfile typing for secret redact/restore.
src/orchestration/analyze.ts Remove unused import/helpers; reformat candidate/group building.
src/orchestration/agent.ts Reformat long expressions and UI payloads.
src/infra/config.ts Reformat repository preset normalization.
src/commands/scout.ts Inline action options type.
src/commands/preset.ts Reformat command registration and required option configuration.
src/commands/index.ts Reorder export list.
Comments suppressed due to low confidence (1)

src/orchestration/config.ts:589

  • restoreProfileSecrets only restores an existing secret when the imported profile explicitly contains apiKey: '<REDACTED>'. If an imported profile omits apiKey entirely (e.g., older export format or user-edited config), this will return the profile without an apiKey and can unintentionally wipe the stored secret on import. Consider also restoring from existingProfile.apiKey when p.apiKey is missing/undefined (and existingProfile.apiKey exists), not only when it equals the redaction sentinel.
  private redactProfileSecrets(profiles: Record<string, LLMProviderProfile>): Record<string, LLMProviderProfile> {
    return Object.fromEntries(
      Object.entries(profiles).map(([name, profile]) => [name, { ...profile, apiKey: '<REDACTED>' }]),
    );
  }

  private restoreProfileSecrets(
    imported: Record<string, unknown>,
    existing: Record<string, LLMProviderProfile>,
  ): Record<string, LLMProviderProfile> {
    return Object.fromEntries(
      Object.entries(imported).map(([name, profile]) => {
        const p = profile as LLMProviderProfile;
        const existingProfile = existing[name];
        if (p.apiKey === '<REDACTED>' && existingProfile?.apiKey) {
          return [name, { ...p, apiKey: existingProfile.apiKey }];
        }
        return [name, p];
      }),
    );
  }

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@NianJiuZst NianJiuZst merged commit 539a1a8 into NianJiuZst:main Jun 15, 2026
1 check passed
@MeloMei MeloMei deleted the chore/fix-existing-ci-drift branch June 16, 2026 02:48
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.

3 participants