Commit graph

9 commits

Author SHA1 Message Date
ecuthiell
6748ef650c
build: make repository text EOL deterministic (#5319)
* build: make repository text EOL deterministic

Apply one repository-wide LF policy to detected text so Windows checkout settings cannot turn ordinary Go source or future text formats into CRLF. Preserve concise rationale for LF-sensitive hook templates, embedded Markdown, migration hashes, and generated-doc comparisons; keep the tracked JPEG explicitly binary and remove redundant path selectors.

Exercise a real isolated Git checkout with core.autocrlf=true through a narrow test package. Bind the existing required Ubuntu, macOS, and Windows matrix to exact expected GOOS values, fail closed on missing or wrong host identity and skipped or zero EOL coverage, and preserve the original doc-freshness command as a separate step.

Resolve and positively identify one canonical Git executable, reuse it under a curated environment with repo-local hooks, and protect the workflow topology with regression tests. Bind the required aggregate to startup-clean absolute Linux Bash and uname identities, require the exact POSIX checkout workspace, and re-enter privileged profile-free Bash with exec so ambient functions or startup state cannot turn a gate failure into success.

Exercise the aggregate shell boundary in subprocess regressions with hostile exported source and exit functions, poisoned startup options, paired clean and failing fixtures, wrong-host falsification, and invalid-workspace cases.

Agent-Signature: codex-gpt-5-unknown-reasoning on behalf of Ewen Cuthiell

* build: split CI-gate hardening from EOL policy

Remove the profile-free CI-gate host-binding chain and its structural and subprocess tests from PR #5319 so the final diff matches the accepted repository EOL motivation. Preserve the required three-host EOL policy lane and its CI Gate propagation. The merge-gate hardening will be reconstructed from current main under its own threat model and review vehicle.

Agent-Signature: codex-gpt-5-unknown-reasoning on behalf of Ewen Cuthiell
2026-08-10 20:48:09 -07:00
ecuthiell
04f3c2fc4c
fix(docs): pin generated CLI artifacts to LF (#4965) (#4966)
The freshness gate byte-compares committed files with an LF-only scratch tree. System core.autocrlf materializes the same blobs as CRLF on Windows, so an unchanged checkout fails as stale.

Pin only the three generator-owned surfaces. Their committed blobs are already LF, so this changes checkout policy without content normalization churn.

Agent-Signature: codex-tui-gpt-5.6-sol-ultra on behalf of Ewen Cuthiell
2026-07-23 18:24:58 -07:00
Steve Yegge
6a1e7af9b9 fix(audit): sand down the P3 sharp edges from the June 9-11 audit (bd-578h9.17)
Eight of the nineteen roll-up items were safe, self-contained fixes:

- dolt: autoResolveConflictsAfterCLIPull pins a single connection and
  resets @@dolt_allow_commit_conflicts before releasing it (discarding
  the conn if the reset fails) so the session variable no longer leaks
  into the pool (item 4)
- issueops: mergeAffectedSets propagates context cancellation instead of
  degrading to a full recompute on a dead context (item 6)
- .gitattributes: migration SQL pinned to LF so CRLF checkouts hash
  identically to release builds (item 8)
- schema: remote-migrate gate message warns that re-cloning discards
  unpushed local work and says how to save it first (item 13)
- dberrors: ancestor-PK table extraction regex is now case-insensitive,
  matching the lowercased detector; add unit tests (item 14)
- hygiene lint: flag UUID_SHORT() and migration-time CURRENT_TIMESTAMP
  (DEFAULT / ON UPDATE attribute positions excluded); run the check on
  direct pushes to main, not just PRs (item 16)
- embeddeddolt: TestSchemaAfterInit asserts dependencies.id has no
  DEFAULT, proving 0050's prepared DROP DEFAULT applies via dolt sql and
  settling the 0051-variant premise question (item 17)
- doctor dep-keys: failed repairs are counted and summarized as FAILED
  instead of Fixed, and the Dolt commit stages only the repaired tables
  instead of -Am sweeping the whole working set (item 19)

Remaining items are accepted with dispositions recorded on the issue.
Also gofmt cycles.go (left unformatted by the round-3 commit).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-11 19:54:21 -04:00
seanmartinsmith
3fa0e23032
fix(setup): prevent doubled BEGIN/END markers from CRLF embedded template (#3553)
When bd is built from a Windows checkout (default core.autocrlf=true),
//go:embed reads CRLF bytes from the working tree for
internal/templates/agents/defaults/beads-section.md. templateBody()'s
LF-only TrimPrefix/TrimSuffix then failed to strip the legacy markers
inside the embedded body, so RenderSection wrapped them with fresh
markers — producing two nested BEGIN/END pairs in any AGENTS.md
written by bd setup mux/claude/etc.

bd setup mux --remove only stripped the outer pair (find-first
semantics), leaving a stray <!-- END BEADS INTEGRATION --> in the
user's file. TestRemoveMuxProjectRemovesBothLayers caught this on
Windows.

Two complementary fixes:

1. Pin internal/templates/agents/defaults/*.md to eol=lf in
   .gitattributes. Embedded templates are shipped data, not
   user-edited text, and should never carry CRLF.
2. Normalize CRLF→LF in templateBody() before stripping markers.
   Defensive against future templates added without a gitattributes
   pin.

Adds TestRenderSectionFullSingleMarkers as a direct regression guard
(asserts exactly one BEGIN and one END in RenderSection output).

Fixes #3552
2026-04-27 13:41:45 -07:00
beads/crew/elinor
9dfac4f405 fix: remove JSONL gitignore rules, merge driver, and issues tracking check (bd-9ni.6)
Remove JSONL merge driver from .gitattributes, JSONL artifact patterns
from .gitignore files, deprecated SyncMode constants (git-portable,
belt-and-suspenders), CheckIssuesTracking doctor check, and JSONL lock/
sync_base patterns from GitignoreTemplate and requiredPatterns.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 21:50:17 -08:00
Marco Del Pin
718a5e2c25
fix: normalize CRLF line endings in git hook files (#1917)
On Windows and WSL with NTFS-mounted repos, `bd hooks install` can
write hook files with CRLF line endings. This causes git to fail with:
    /usr/bin/env: 'sh\r': No such file or directory
Two sources of CRLF contamination:
1. Embedded hook templates may have CRLF when built on Windows/NTFS
   (go:embed captures files as-is from disk)
2. The prepare-commit-msg template already contained CRLF
Fix:
- Normalize embedded hook content with strings.ReplaceAll("\r\n", "\n")
  before writing to disk in both hooks.go and init_git_hooks.go
- Add .gitattributes rules to enforce LF for shell scripts and hook
  templates regardless of platform
2026-02-20 09:22:21 -08:00
matt wilkie
1f8a6bf84e
fix(autoimport): auto-correct deleted status to tombstone for JSONL compatibility (#1231)
* fix(autoimport): auto-correct deleted status to tombstone for JSONL compatibility (GH#1223)

This fix addresses the 'Stuck in sync diversion loop' issue where v0.48.0
encountered validation errors during JSONL import. The issue occurs when
JSONL files from older versions have issues with status='deleted' but the
current code expects status='tombstone' for deleted issues.

Changes:
- Add migration logic in parseJSONL to auto-correct 'deleted' status to 'tombstone'
- Ensure tombstones always have deleted_at timestamp set
- Add debug logging for both migration operations
- Prevents users from being stuck in sync divergence when upgrading

Fixes GH#1223: Stuck in sync diversion loop

* fix(autoimport): comprehensively fix corrupted deleted_at on non-tombstone issues (GH#1223)

The initial fix for GH#1223 only caught issues with status='deleted', but the real
data in the wild had issues with status='closed' (or other statuses) but also
had deleted_at set, which violates the validation rule.

Changes:
- Add broader migration logic: any non-tombstone issue with deleted_at should become tombstone
- Apply fix in all three JSONL parsing locations:
  - internal/autoimport/autoimport.go (parseJSONL for auto-import)
  - cmd/bd/import.go (import command)
  - cmd/bd/daemon_sync.go (daemon sync helper)
- Add comprehensive test case for corrupted closed issues with deleted_at
- Fixes the 'non-tombstone issues cannot have deleted_at timestamp' validation error
  during fresh bd init or import

Fixes GH#1223: Stuck in sync diversion loop

* Add merge driver comment to .gitattributes

* fix: properly clean up .gitattributes during bd admin reset

Fixes GH#1223 - Stuck in sync diversion loop

The removeGitattributesEntry() function was not properly cleaning up
beads-related entries from .gitattributes. It only removed lines
containing "merge=beads" but left behind:
- The comment line "# Use bd merge for beads JSONL files"
- Empty lines following removed entries

This caused .gitattributes to remain in a modified state after
bd admin reset --force, triggering sync divergence warning loop.

The fix now:
- Skips lines containing "merge=beads" (existing behavior)
- Skips beads-related comment lines
- Skips empty lines that follow removed beads entries
- Properly cleans up file so it's either empty (and gets deleted)
  or contains only non-beads content

---------

Co-authored-by: Amp <amp@example.com>
2026-01-21 21:50:38 -08:00
Steve Yegge
ff3352ab23 bd-6xd: Standardize on issues.jsonl as canonical filename
- Change default JSONL filename from beads.jsonl to issues.jsonl
- Add bd doctor check and fix to auto-migrate legacy beads.jsonl configs
- Update FindJSONLPath to prefer issues.jsonl over beads.jsonl
- Add CheckLegacyJSONLConfig and CheckLegacyJSONLFilename checks
- Add LegacyJSONLConfig fix to rename files and update config
- Update .gitattributes to reference issues.jsonl
- Fix tests to expect new canonical filename
- Add bd-6xd to v0.25.1 release notes

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-26 22:02:59 -08:00
Steve Yegge
eb30e94220 Configure beads merge driver for intelligent JSONL merging 2025-11-06 19:42:32 -08:00