Skip to content

Repo hygiene: untrack generated artifacts, fix stale doc paths#861

Merged
malpern merged 7 commits into
masterfrom
claude/repo-audit-improvement-m3iae5
Jun 10, 2026
Merged

Repo hygiene: untrack generated artifacts, fix stale doc paths#861
malpern merged 7 commits into
masterfrom
claude/repo-audit-improvement-m3iae5

Conversation

@malpern

@malpern malpern commented Jun 10, 2026

Copy link
Copy Markdown
Owner

Audit "quick win" cleanup (QW1–QW3). No code changes — only .gitignore, two docs, and untracking generated files.

What & why

Untrack 24 MB of generated artifacts (coverage/, coverage-full/, search-index.json) and add .gitignore guards. They regenerate in CI, nothing in the repo references them, and they bloat every clone.

Remove the accidental tilde directory. A literal ~/Library/Application Support/KeyPath/keypath.kbd directory was committed at the repo root — the result of a script/test writing a ~/... path without expanding $HOME. Removed, with a /~/ .gitignore guard so it can't recur. (No code path recreates it today; verified.)

CONTRIBUTING.md:

  • Replace the machine-specific absolute link /Users/malpern/local-code/KeyPath/SECURITY.md with a repo-relative one.
  • Correct the stale "I Want To…" file pointers from the old flat Sources/KeyPath/* layout to the current modules. Each new path is verified to exist. ContentView and SystemStatusChecker no longer exist — pointed at their successors (App.swift + UI/, and SystemInspector.swift + WizardStateMachine.swift).

CLAUDE.md: Fix the note claiming Tests/KeyPathAppKitTests/ exists and is "NOT compiled" — that directory doesn't exist. Replaced with the four real, compiled test targets.

Scope / not included

The deeper CONTRIBUTING.md staleness — the architecture prose still naming ContentView/KanataManager, and the Sources/KeyPath/ directory tree — is intentionally left for a focused docs refresh rather than bundled into this hygiene pass, to keep the diff verifiable.

Note: the 24 MB stays in git history (this only stops future tracking); a history rewrite isn't worth it pre-1.0.

https://claude.ai/code/session_01Rso6kv5BgJrBCHxNWH4h7P


Generated by Claude Code

claude and others added 7 commits June 10, 2026 03:13
Introduce KanataDefcfg as the only place that renders the kanata
(defcfg ...) header, and route the four deterministic emitters through it:

- KanataConfigurationGenerator (primary rule-collection generator)
- ConfigurationService rule-based repair injection
- SaveCoordinator crash-loop minimal-safe fallback
- AppConfigGenerator include-file validation wrapper

Previously each built the header by hand and had drifted: danger-enable-cmd
and a consistent process-unmapped-keys value were present in some paths and
absent in others, so the root daemon's command-execution posture depended on
which code path last wrote the file. Named profiles (standard / minimalSafe /
validationWrapper / repairFallback) now encode the intentional differences in
one auditable place, and allowCommandActions is a single flag ready for a
future user-facing gate.

This is a byte-preserving extraction: render() reproduces the existing output
for every emitter (verified against GoldenConfigs/default.kbd and
home-row-mods.kbd). Adds KanataDefcfgTests pinning each profile's exact bytes.

The AI config generator (KanataConfigGenerator) still hand-builds its header
and is intentionally left for a follow-up, since changing it alters behavior.

Note: built/tested in a Linux container without a Swift toolchain; relying on
CI (golden + snapshot + new unit tests) to verify compilation and output.
KanataDefcfg uses only standard-library types; Foundation is not needed.
Addresses automated review feedback on #859.
Address non-blocking review feedback on #859 (output-neutral):
- render(): assert trailer begins with a newline when non-empty, and that
  managed-repeat delay/interval are both set or both nil — both are currently
  unreachable footguns, now guarded.
- standard(): requirePriorIdleMs is now Int? (nil = omit) instead of using a
  magic 0 sentinel at the factory boundary; the caller maps its 0 sentinel.
- Document that minimalSafe/validationWrapper render identically by design and
  that allowCommandActions:false omits danger-enable-cmd (kanata defaults off).
- Trim the redundant generator comment to keep only the non-obvious rationale.
- Add testMinimalSafeAndValidationWrapperShareOutputByDesign.

Rendered output is unchanged for every emitter (asserts hold for all inputs;
0->nil mapping preserves prior behavior). Golden/unit pins still apply.
Review noted the render() assert is debug-only, so it can't protect a release
daemon if a caller half-pairs managed-repeat delay/interval. Take them as a
single (delayMs, intervalMs)? tuple in KanataDefcfg.standard() so the only real
construction path cannot half-set them. Stored properties stay Int? to preserve
Equatable synthesis; the assert remains as a debug backstop for the internal
init. Output is unchanged (tuple maps to the same two optionals).
Audit quick wins (no code changes):

- Untrack 24 MB of committed build artifacts (coverage/, coverage-full/,
  search-index.json) and add .gitignore guards. These regenerate in CI and
  nothing references them.
- Remove the accidental literal '~/Library/Application Support/KeyPath/keypath.kbd'
  directory committed at the repo root (a script/test that didn't expand $HOME),
  and add a /~/  .gitignore guard so it can't recur.
- CONTRIBUTING.md: replace the absolute /Users/malpern/... SECURITY.md link with a
  repo-relative one, and correct the stale 'I Want To...' file pointers to the
  current module layout (Sources/KeyPath/* -> Sources/KeyPathAppKit/*, KeyPathCore,
  KeyPathInstallationWizard). ContentView/SystemStatusChecker no longer exist;
  point at their successors.
- CLAUDE.md: fix the stale note about a non-existent Tests/KeyPathAppKitTests/
  directory; list the four real, compiled test targets.

Remaining CONTRIBUTING staleness (architecture prose mentioning ContentView/
KanataManager, and the Sources/KeyPath/ directory tree) is left for a focused
docs refresh.
@malpern malpern enabled auto-merge (squash) June 10, 2026 04:00
@malpern malpern merged commit 3390dba into master Jun 10, 2026
5 checks passed
@malpern malpern deleted the claude/repo-audit-improvement-m3iae5 branch June 10, 2026 04:00
@claude

claude Bot commented Jun 10, 2026

Copy link
Copy Markdown

Code Review — PR #861: Repo hygiene: untrack generated artifacts, fix stale doc paths

TL;DR: Clean, well-scoped hygiene PR. All factual claims verified against the repo. No code changes, no risk. One minor suggestion.


Overview

This PR does exactly what it says: removes 24 MB of generated artifacts from tracking, deletes an accidental tilde-literal directory, and corrects two documentation files. No Swift source changes.


.gitignore

Good:

  • coverage/ and coverage-full/ are correctly unanchored — they match at any depth if CI ever writes them to a subdir.
  • /~/ is correctly root-anchored, which is the right scope for a guard against this specific accident.
  • Comments are useful, particularly the explanation of the tilde-expansion accident.

Minor suggestion: search-index.json is unanchored, so it silently ignores any file by that name at any directory depth. If it is always a root-level Jekyll artifact, /search-index.json would be more precise and safer. Low stakes either way — an unanchored rule just over-ignores.


CLAUDE.md

The fix is correct. Verified:

  • Tests/KeyPathAppKitTests/ does not exist in the repo.
  • All four listed targets (KeyPathTests, KeyPathSmokeTests, KeyPathSnapshotTests, KeyPathLayoutTracerTests) exist under Tests/.

The new phrasing is accurate and more useful to a contributor trying to run tests.


CONTRIBUTING.md

Every path change was verified against the current source tree:

Old path New path Verified
Sources/KeyPath/UI/RecordingCoordinator.swift Sources/KeyPathAppKit/UI/Pickers/RecordingCoordinator.swift yes
Sources/KeyPath/UI/ContentView.swift Sources/KeyPathAppKit/App.swift + UI/ yes
Sources/KeyPath/Services/KanataConfigGenerator.swift Sources/KeyPathAppKit/Infrastructure/Config/ yes
Sources/KeyPath/InstallationWizard/Core/SystemStatusChecker.swift Sources/KeyPathInstallationWizard/Core/SystemInspector.swift yes
Sources/KeyPath/Services/UserNotificationService.swift Sources/KeyPathAppKit/Services/UserNotificationService.swift yes
Sources/KeyPath/Core/KeyPathError.swift Sources/KeyPathCore/KeyPathError.swift yes
/Users/malpern/local-code/KeyPath/SECURITY.md [SECURITY.md](SECURITY.md) yes

Scoping the deeper CONTRIBUTING.md prose cleanup (architecture section still naming ContentView/KanataManager) to a follow-up PR is the right call — it makes this diff verifiable in isolation.


Deleted files

Removal of 8 generated files (coverage reports + JSON + search index + accidental directory) is appropriate. These regenerate in CI and were causing unnecessary repo bloat. The .gitignore guards prevent recurrence.


Verdict

Approve. The one actionable item is the search-index.json anchoring question — worth a quick look but not a blocker. Everything else is clean.

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