Skip to content

Rebuild transactional generation and typed CLI - #36

Open
lynnswap wants to merge 21 commits into
codex/rewrite-review-basefrom
codex/phk-generation-cli
Open

Rebuild transactional generation and typed CLI#36
lynnswap wants to merge 21 commits into
codex/rewrite-review-basefrom
codex/phk-generation-cli

Conversation

@lynnswap

@lynnswap lynnswap commented Aug 9, 2026

Copy link
Copy Markdown
Owner

Purpose

Make generation resumable and crash-safe through one durable state owner, immutable publication, and a typed command workflow.

Changes

  • Replace manual command handling with ArgumentParser-backed parsing, validated input, interactive navigation, and rendering components.
  • Replace JSON state and mutable artifact publication with a GRDB-backed GenerationStore, generation leases, durable publication intent, immutable generations, atomic pointer switching, and deterministic recovery.
  • Derive the generation lease, SQLite store, immutable generations, and current pointer from one canonical output base so artifact and lock ownership cannot diverge.
  • Bind reusable target completion to the publishing run and committed generation marker, and keep aborted-generation discard retryable until cleanup succeeds.
  • Present incompatible saved state as an explicit Restart/Back decision and combine simultaneous state and artifact legacy migrations into one typed fresh-start confirmation.
  • Bind resume compatibility to executable identities, selected SwiftPM inputs and dependency closure, toolchain and SDK context, and the helper binaries actually used.
  • Serialize plan fingerprints with canonical length-prefixed fields so valid paths and environment values cannot alias through delimiters.
  • Build helpers with resolved dependencies and materialize validated binaries into stable content-addressed locations before generation.
  • Persist the resolved simulator runtime build when an iOS command uses an implicit runtime root or an explicit root equivalent to the selected runtime, while keeping custom source roots authoritative.

Testing

  • Targeted generation, artifact-publisher, target-discovery, and CLI suites.
  • Final-stack swift test (310 tests in 32 suites).
  • iOS Simulator cross-builds for PrivateHeaderKitCore and PrivateHeaderKitCoreTests.
  • git diff --check.

@lynnswap lynnswap changed the title codex/phk generation cli Rebuild transactional generation and typed CLI Aug 9, 2026
@lynnswap
lynnswap marked this pull request as ready for review August 9, 2026 21:59

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: de59ede947

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread Sources/PrivateHeaderKitCLI/PrivateHeaderKitCommand.swift
Comment thread Sources/PrivateHeaderKitCLI/PrivateHeaderKitCommand.swift Outdated
Comment thread Sources/PrivateHeaderKitCLI/PrivateHeaderKitInteractive.swift Outdated
Comment thread Sources/PrivateHeaderKitCore/PrivateHeaderGenerationStore.swift
Comment thread Sources/PrivateHeaderKitCore/PrivateHeaderGenerationStore.swift
@lynnswap
lynnswap force-pushed the codex/phk-generation-cli branch from de59ede to 502d3af Compare August 10, 2026 06:25

@lynnswap lynnswap left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🎉

Reviewed commit: 502d3af6b3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Treat permission-denied System/Library subtrees as unavailable discovery sources while preserving strict failures for known target contents. Follow directory symlinks for eligibility and enumeration without changing their logical target identities.
Treat SwiftPM-reported bin directories as the source of truth for helper identity, and isolate simulator cross-builds in a triple-scoped scratch path. Resolve the helper plan before interactive resume decisions while deferring compilation until generation is confirmed.
Centralize the stable SwiftPM simulator scratch convention so CLI and installer builds cannot drift.
Derive resume compatibility from the loaded CLI, selected SwiftPM inputs, pinned clean dependency checkouts, toolchain metadata, and helper artifacts. Materialize verified helpers into content-addressed paths so later builds cannot silently change the executable used by a resumed run.
Prepare target discovery from one validated shared-cache inventory, reuse that cohort for resume decisions, and revalidate it before durable or publication mutation. Pin every raw dump to the prepared UUID and include the inventory schema, UUID, and canonical path digest in plan fingerprint v2.
Centralize portable ownership validation in ArtifactPublisher so target, opaque, draft, legacy, and persisted-marker paths share one invariant. Preflight the complete removal and copy mutation plan before changing a draft, while preserving exact opaque claims.
Model destination checks from the recorded ownership and actual draft inventory after all planned removals. This keeps file-directory transitions and same-owner portable renames independent of host volume lookup behavior while preserving zero-mutation preflight.
Keep actual directory entries byte-exact inside the prospective namespace. Canonical equivalence is now limited to matching the first observed directory with a prefix proven by recorded artifact ownership.
@lynnswap
lynnswap force-pushed the codex/phk-generation-cli branch from 502d3af to 346128d Compare August 10, 2026 23:10

@lynnswap lynnswap left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Swish!

Reviewed commit: 346128dd46

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

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