Skip to content

Audit finalization: Track A hardening + Track B features, presentation-tested share, durable pre-commit gate - #44

Merged
Babayosa merged 3 commits into
mainfrom
audit-a-plus-2026-07
Jul 2, 2026
Merged

Audit finalization: Track A hardening + Track B features, presentation-tested share, durable pre-commit gate#44
Babayosa merged 3 commits into
mainfrom
audit-a-plus-2026-07

Conversation

@Babayosa

@Babayosa Babayosa commented Jul 2, 2026

Copy link
Copy Markdown
Owner

Summary

Finalizes the multi-dimensional codebase audit of Caloura to an A+ bar. Three commits (squash on merge):

  1. Audit sprint (f01c2a8) — Track A hardening across 24 findings (crash vectors, state-machine/flag recovery, error surfacing) plus Track B features: PII auto-detect default, screenshot-history cap, native share flow.
  2. Toolchain lesson (7101440) — records the git-hook SDKROOT poisoning root-cause (documentation only).
  3. A+ finalization (a9f5ef2) — closes the last caveat and hardens the local gate (details below).

What's in the finalization commit

  • Presentation-level share test (CaptureSharePickerPresentationTests): drives the app's resolved share items through the real NSSharingServicePicker(items:) the overlay uses and asserts an enabled, titled standardShareMenuItem. Covers both branches — file-URL (saved capture + history item) and NSImage (unsaved capture). CaptureShareItemsTests only checked item shape; this proves they are an actionable share payload. Deterministic and headless-safe (no windowserver dependency, no deprecated API).
  • Durable, CI-matching pre-commit gate: the gate is now version-controlled at .githooks/pre-commit (was untracked in .git/hooks, lost on any fresh clone) and runs swiftlint --quiet --strict per staged file so default-warning rules (e.g. line-length) fail locally exactly as they fail CI. Activation documented in the README.
  • Project regen: project.pbxproj regenerated with the pinned xcodegen 2.45.4 to include the new test (additive; drift gate stays green).
  • Docs: CLAUDE.md points TCC/cursor/overlay/stateful-flag work at the swift-macos-integration skill; tasks/ records the full-confidence phase and two new lessons.

Verification

The entire CI pipeline was reproduced locally and is green on this tree:

Gate Result
swift build
swiftlint --quiet --strict (project-wide) ✓ 0 violations
swift test ✓ 820 tests, 0 failures
python3 -m unittest (release tooling)
xcodebuild test (unit + system, CODE_SIGNING_ALLOWED=NO) TEST SUCCEEDED, 0 failures
coverage gate (8 floors) ✓ passed
xcodegen drift (git diff --exit-code) ✓ 0 diff

All 4 isKeyWindow system tests pass under a detached xcodebuild run. CI is the authoritative confirmation this PR gates.

🤖 Generated with Claude Code

https://claude.ai/code/session_0173csq1QXWXzzMQExDmzdjC

Babayosa and others added 3 commits July 2, 2026 09:32
… default, history cap, native share)

Branch audit-a-plus-2026-07. Closes the Track A code-review findings, adds three
Track B features, and fixes the local XcodeGen pinning drift.

Track A (24 findings, 11 medium + 13 low) — correctness/crash-vector, concurrency,
DRY, and release-readiness fixes across the capture pipeline, overlays, cursor
state, and tooling. Highlights:
- Extracted shared MetricSampleWindow (bounded ring buffer + nearest-rank
  percentile) used by every recorder; removed the duplicated private copies.
- Drift gate: ci.yml + release_ready.sh regenerate the project with the PINNED
  XcodeGen (2.45.4) then `git diff --exit-code` the 3 xcodegen-owned files;
  scripts/install_xcodegen.sh is the single pinned-installer source of truth.
- Removed the dead custom URL-scheme handler (caloura://) + its tests — it
  bypassed OS routing and never worked. Deleted the no-op entitlements file
  (non-sandboxed Developer-ID build; app-sandbox=false was already implied) and
  the Brewfile (superseded by install_xcodegen.sh).

Track B:
- B1: autoDetectPII now defaults ON. Detect-only (surfaces a PII badge + a manual
  redact action); it does NOT auto-redact. Strictly on the deferred enrichment
  path, so no capture-path latency. On-device, no PII egress, no raw-PII logging.
- B2: history item cap is configurable (100/200/500/Unlimited). Unlimited =
  Int.max sentinel with no overflow/allocation path. Lowering the cap prunes
  items + embeddings + preview/PII side-state (on-disk PNGs intentionally kept).
- B3: native macOS Share Sheet. Overflow-menu "Share" presents an
  NSSharingServicePicker anchored to the overlay panel (saved capture -> file URL,
  unsaved -> NSImage); the history grid gains a file-existence-guarded ShareLink.
  Picker + delegate are retained for the menu's lifetime; a shareGeneration guard
  rejects a superseded share's completion callback; dismiss() fully resets share
  state and logs when a hover is suppressed mid-share so a stuck flag is visible.

pbxproj/scheme regenerated with pinned XcodeGen 2.45.4 (objectVersion 77, scheme
parallelizable="NO"); output verified idempotent + machine-independent.

Verification: xcodebuild build SUCCEEDED; swift test 817 passed / 8 skipped / 0
failures; swiftlint clean; drift gate proven idempotent.

CAVEATS (not resolved in this commit):
- The full `xcodebuild test` suite shows 5 assertion failures across 4
  CalouraSystemTests methods, all from `isKeyWindow` reading 0 when the CLI test
  host isn't frontmost. Proven environmental via git (key-window code unchanged),
  expected green on CI but NOT yet observed on this un-pushed branch.
- The B3 share picker was unit-tested at the item-resolution seam only; the live
  NSSharingServicePicker presentation was NOT launched/clicked in a running app.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0173csq1QXWXzzMQExDmzdjC
…ode update)

Documents the toolchain obstacle hit while landing the audit commit: Apple's
/usr/bin/git shim injects a CommandLineTools SDKROOT (Swift 6.4) into hook
subprocesses that mismatches the selected Xcode compiler (6.2.3) after a partial
macOS-27 toolchain update, so the pre-commit `swift build` fails while the same
build passes in-shell. Fix applied to .git/hooks/pre-commit (unset SDKROOT +
pin DEVELOPER_DIR); the .git/ hook itself is untracked so only the lesson is
committed here.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0173csq1QXWXzzMQExDmzdjC
…e-commit gate

Closes the last audit caveat and hardens the local gate to predict CI.

- B3: add CaptureSharePickerPresentationTests — drives the app's resolved
  share items through the real NSSharingServicePicker(items:) the overlay
  uses and asserts an enabled, titled standardShareMenuItem, covering both
  the file-URL branch (saved capture + history item) and the NSImage branch
  (unsaved capture). CaptureShareItemsTests only checked item shape; this
  proves they are an actionable share payload. Deterministic and headless-safe
  (no windowserver dependency, no deprecated sharingServices(forItems:)).
- Track the pre-commit gate at .githooks/pre-commit (was untracked in
  .git/hooks — lost on any fresh clone, and it carried the SDKROOT toolchain
  fix). Run swiftlint --quiet --strict per staged file so line-length and
  other default-warning rules fail here the same way they fail CI. Activation
  (git config core.hooksPath .githooks) documented in README.
- Regenerate project.pbxproj with the pinned xcodegen 2.45.4 to include the
  new test (4 additive lines; regeneration is deterministic, so CI's drift
  gate stays green).
- Docs: CLAUDE.md points TCC/cursor/overlay/stateful-flag work at the
  swift-macos-integration skill; tasks/todo.md + tasks/lessons.md record the
  full-confidence phase, the hook-strictness lesson, and the isKeyWindow
  refinement.

Verified: the entire CI pipeline reproduced locally green on this tree —
swift build, swiftlint --strict (0 violations), swift test (820, 0 failures),
python unittest, xcodebuild test unit+system (TEST SUCCEEDED, 0 failures),
and the 8 coverage floors. All 4 isKeyWindow system tests pass under a
detached xcodebuild run.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0173csq1QXWXzzMQExDmzdjC
@Babayosa
Babayosa merged commit 0d32913 into main Jul 2, 2026
1 check passed
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