Skip to content

feat(engram): add DataDirRef type, location suggestions, and presenter helpers#484

Closed
tonyblu331 wants to merge 2 commits into
Gentleman-Programming:mainfrom
tonyblu331:feat/engram-domain-types
Closed

feat(engram): add DataDirRef type, location suggestions, and presenter helpers#484
tonyblu331 wants to merge 2 commits into
Gentleman-Programming:mainfrom
tonyblu331:feat/engram-domain-types

Conversation

@tonyblu331
Copy link
Copy Markdown
Contributor

@tonyblu331 tonyblu331 commented May 9, 2026

Summary Introduces the foundational types and location-discovery layer for Engram data-directory management (issue #346, PR B1 of B1+B2+B3): - DataDirRef — future-proof path type with Resolve(homeDir), plus DefaultDir and DBPath helpers - SuggestLocations — ordered, deduplicated candidate list with free-space labels; returns []Location with IsCurrent flag - Platform-specific volume discovery — Statfs on Unix, GetDiskFreeSpaceEx on Windows via syscall.NewLazyDLL - FormatDirLine / FormatSpaceWarning — presenter helpers for TUI display (no Bubbletea dep) Bug fixed: IsCurrent was incorrectly set on the default location when a custom dir was active. ## Changes | File | Type | Lines | |------|------|-------| | internal/components/engram/env.go + env_test.go | New | +76 | | internal/components/engram/locations.go + test + platform files | New | +239 | | internal/components/engram/presenter.go | New | +25 | | Total | | +340 / budget: 400 ✅ | ## Test plan - [x] go test ./internal/components/engram/... -run "TestDataDirRef|TestDefault|TestDBPath|TestSuggest|TestBuildLabel" — 10 tests, all pass - [x] go build ./... — clean build - [x] Full repo go test ./... — ✅ Pass (CI) - [x] E2E cd e2e && ./docker-test.sh (ubuntu / arch / fedora) — ✅ Pass (CI) ## PR Chain — Closes #346 | # | PR | Lines | |---|----|-------| | A | #465 | 152 ✅ | | B1 | this PR | 340 ✅ | | B2 | #485 | 171 ✅ | | B3 | #486 | 370 ✅ | | C | #487 | 33 ✅ | | D1 | #488 | 282 ✅ | | D2 | #489 | 340 ✅ | --- ## CI status (GitHub Actions) Checks: https://github.com/Gentleman-Programming/gentle-ai/pull/484/checks | Gate | Status | |------|--------| | Unit Tests (go test ./...) | ✅ Pass | | E2E Tests (ubuntu / arch / fedora) | ✅ Pass | | Issue reference (Closes #346) + status:approved | ✅ Pass | | PR cognitive load vs main | ⚠️ May fail while #465 is unmerged — GitHub diffs the full stack vs main; this PR’s own diff is ≤400 lines ✅ | | Exactly one type:* label | ⚠️ Maintainer applies | bash go test ./... cd e2e && ./docker-test.sh 🤖 Generated with Claude Code


Chain Context (SDD - stacked PRs targeting main)

Field Value
Chain Engram data-directory (#346)
Strategy Stacked branches; each PR opens vs main - upstream typically has no intermediate GitHub base branches, so merge #465 .. #489 in order; branch ancestry carries predecessor commits.
Tracker PR none (feature-branch tracker not used).
This PR #484
Base Gentleman-Programming/gentle-ai main
Cognitive load (GitHub vs main) +492/-0 = 492 changed lines
CI budget (400-line gate) EXCEEDS 400 vs main (additions + deletions). CI requires maintainer-applied size:exception, OR retarget this PR to the previous branch once those bases exist upstream so GitHub shows only the slice diff.

The Summary / Changes tables above describe the scoped review unit for this numbered PR. GitHub diff vs main is cumulative while every PR still targets main, so totals grow down-chain even though each PR narrative stays slice-focused.

Merge-order diagram

main -> PR #465 -> [THIS] PR #484 -> PR #485 -> PR #486 -> PR #487 -> PR #488 -> PR #489

Autonomy

  • Single numbered deliverable (Summary).
  • Line totals above match GitHub Files changed aggregation vs main for this PR head.

@tonyblu331
Copy link
Copy Markdown
Contributor Author

👋 Maintainer request: could you please add the `type:feature` label?

Also a note on the size check: this PR is part of a 7-PR chain (A → B1 → B2 → B3 → C → D1 → D2). Because all PRs target `main`, the cognitive-load check counts accumulated diff until each predecessor merges. The per-PR line counts are:

PR Own lines
A #465 152 ✅
B1 #484 340 ✅
B2 #485 171 ✅
B3 #486 370 ✅
C #487 33 ✅
D1 #488 282 ✅
D2 #489 340 ✅

Each PR's check will turn green as soon as its predecessor merges. All seven are independently within the 400-line budget.

tonyblu331 added 2 commits May 9, 2026 19:06
Adds internal/storage package with:
- FormatBytes: human-readable sizes using 1024-based units (B/KiB/MiB/GiB)
- AvailableBytes: platform-gated disk space check (syscall.Statfs on Unix,
  GetDiskFreeSpaceExW on Windows)

No Engram coupling. Used by the upcoming data-directory domain layer.
…r helpers

Introduces the foundational types and location-discovery layer for
Engram data-directory management (issue Gentleman-Programming#346, PR B1 of B1+B2+B3):

- DataDirRef: future-proof path type with Resolve(homeDir), DefaultDir, DBPath helpers
- SuggestLocations: ordered candidate list with deduplication and free-space labels
- Platform-specific volume discovery (Statfs on Unix, GetDiskFreeSpaceEx on Windows)
- FormatDirLine / FormatSpaceWarning presenter helpers (no Bubbletea dep)

10 unit tests cover all location and label behaviours.
Depends on PR A (feat/storage-utils).
@tonyblu331 tonyblu331 force-pushed the feat/engram-domain-types branch from 3dce34c to 14f8e4c Compare May 9, 2026 12:08
@tonyblu331
Copy link
Copy Markdown
Contributor Author

Superseded by the ≤400 LOC chain (no \size:exception).

This draft exceeded the 400-line review budget vs \main.

@tonyblu331 tonyblu331 closed this May 9, 2026
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.

First-class Engram data-directory selection and migration in install/TUI flows

1 participant