Skip to content

docs(self-packaging #50): architecture / decisions / security / CLI#60

Merged
jrosskopf merged 1 commit into
mainfrom
feature/gh-50-self-packaging-docs
May 22, 2026
Merged

docs(self-packaging #50): architecture / decisions / security / CLI#60
jrosskopf merged 1 commit into
mainfrom
feature/gh-50-self-packaging-docs

Conversation

@jrosskopf
Copy link
Copy Markdown
Contributor

Part of epic #40. Stacked on #59 -> #58 -> #57 -> #56 -> #55 -> #54 -> #53 -> #52 -> #51.

Summary

Captures the rationale, mechanism, and operational surface of
self-packaging (#41-#49) where operators and future maintainers will
actually look.

File What's added
docs/spec/ARCHITECTURE.md "Self-Packaging (optional)" component table; "Self-Packaging Bootstrap" data-flow trace
docs/spec/DESIGN_DECISIONS.md New §9 with four sub-decisions: ZIP-append, IFileProvider reuse, embed:// scheme, macOS reserved-segment. Each lists Decision / Rationale / Why-not / Tradeoffs
docs/spec/components/security.md "Secrets and the bundle" section with the two enforcement mechanisms; best-practices item 8; pack.cpp added to source-files table
docs/CLI_REFERENCE.md §3 "Self-Packaging Subcommands" (pack / info / unpack + macOS); TOC + section numbers updated; env-var table grows FLAPI_CONFIG, FLAPI_LOG_LEVEL, SOURCE_DATE_EPOCH, CODESIGN_IDENTITY
AGENTS.md (target of CLAUDE.md symlink) New "6. Self-Packaging" entry under Core Concepts

Notable bits

DESIGN_DECISIONS.md §9 is the load-bearing document. Six months
from now, when someone asks why ZIP and not 7z, why IFileProvider
reuse and not extract-to-tmpdir, why embed:// is its own filesystem
and not a code-path forced through IFileProvider, why macOS gets a
different layout -- this section answers all four with the spike's
catches encoded inline.

security.md "Secrets and the bundle" says explicitly: if a
bundled binary contains a password, it is a secret. The single
artifact value disappears the moment the artifact is sensitive. Lists
the two mechanisms that keep it that way (pack-time deny list + the
env-var contract).

CLI_REFERENCE §3 is one operator's-view-of-the-feature place. Has
shell-able examples (`scp flapi-prod user@host` etc.), the secret
deny list, the reproducibility recipe, and the macOS notarisation
flow including the `--macos-append` escape hatch with its
"Not notarisable" warning.

What's NOT in this PR

Closes #50. Closes the epic #40. Stacked on #59.

@jrosskopf jrosskopf changed the base branch from feature/gh-49-ci-cross-platform to main May 22, 2026 18:44
Part of #40. Closes #50.

Captures the rationale, mechanism, and operational surface of
self-packaging (#41-#49) in the locations operators and future
maintainers actually look.

- docs/spec/ARCHITECTURE.md
    * New "Self-Packaging (optional)" subsection under Key Components,
      naming archive_io / selfpath / bundle_locator / macho_bundle /
      EmbeddedArchiveFileProvider / EmbeddedFileSystem / pack with
      file paths.
    * New "Self-Packaging Bootstrap" data-flow block that traces the
      sequence from main() through detectAndRegisterEmbeddedBundle
      to FileProviderFactory dispatch to RegisterEmbeddedFileSystem.

- docs/spec/DESIGN_DECISIONS.md
    * New §9 "Self-Packaging via Appended ZIP" with four sub-decisions:
        9a. ZIP appended after the executable -- why-not tar / 7z /
            custom container; the `bytes_in_last_block(1)` spike gotcha.
        9b. Reuse IFileProvider -- why-not extract-to-tmpdir.
        9c. embed:// DuckDB FileSystem -- why-not force everything
            through IFileProvider (streaming); the Glob / SeekPosition
            spike-runtime catch.
        9d. macOS reserved-segment + re-codesign -- why-not append-and-
            ad-hoc-sign (notarisation).
    * Each item lists Decision / Rationale / Why-not alternatives /
      Tradeoffs, matching the file's existing structure.
    * Summary updated to add "Deployability" as the sixth design goal
      that §9 serves.

- docs/spec/components/security.md
    * New "Secrets and the bundle" section covering the two enforcement
      mechanisms (pack-time deny list and runtime env-var contract).
      Lists every credential env var with its scope.
    * Cross-reference to DESIGN_DECISIONS §9 and CONFIG_REFERENCE §1.4.
    * Best-practices list grows an 8th item ("never bundle secrets")
      with a forward pointer to the section.
    * Source-files table grows `src/pack.cpp (IsSecretExcluded)`.

- docs/CLI_REFERENCE.md
    * New "## 3. Self-Packaging Subcommands" section with full
      reference for `pack`, `info`, `unpack`, plus a macOS subsection
      covering the reserved-segment + codesign flow and the
      --macos-append legacy escape hatch.
    * Sections 4-7 renumbered (Environment Variables / Usage
      Examples / Signal Handling / Exit Codes); TOC updated to match.
    * Environment-variables table grows FLAPI_CONFIG, FLAPI_LOG_LEVEL,
      SOURCE_DATE_EPOCH, CODESIGN_IDENTITY entries.

- AGENTS.md (target of the CLAUDE.md symlink)
    * New "6. Self-Packaging" entry under Core Concepts -- short
      operator-style overview, command examples, mechanism, secrets
      invariant, reproducibility note. Forward links to DESIGN_DECISIONS
      §9 and CLI_REFERENCE §3 for depth.
@jrosskopf jrosskopf force-pushed the feature/gh-50-self-packaging-docs branch from dcdbbae to d19d226 Compare May 22, 2026 22:47
@jrosskopf jrosskopf marked this pull request as ready for review May 22, 2026 23:33
@jrosskopf jrosskopf merged commit a9ddc41 into main May 22, 2026
21 checks passed
@jrosskopf jrosskopf deleted the feature/gh-50-self-packaging-docs branch May 22, 2026 23:33
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.

Self-packaging #10: Documentation (CLI, architecture, design, security)

1 participant