Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
---
pr_number: 4047
title: "test(B-0156): co-located tests for check-tick-history-shard-schema.ts (9 tests)"
author: "AceHack"
state: "MERGED"
created_at: "2026-05-17T08:01:10Z"
merged_at: "2026-05-17T08:04:32Z"
closed_at: "2026-05-17T08:04:32Z"
head_ref: "otto-bg/b0156-schema-test-2026-05-17"
base_ref: "main"
archived_at: "2026-05-17T10:19:26Z"
archive_tool: "tools/pr-preservation/archive-pr.ts"
---

# PR #4047: test(B-0156): co-located tests for check-tick-history-shard-schema.ts (9 tests)

## PR description

## Summary

Smallest bounded slice of B-0156 — addresses acceptance criterion 2 ("each
TS sibling has at least one bun test covering its primary entry path") for
the Phase 2 schema port at `tools/hygiene/check-tick-history-shard-schema.ts`.
The `.sh` original was retired in PR #1986; the `.ts` had no co-located test.

## What

- `tools/hygiene/check-tick-history-shard-schema.ts`: export `scanOne` and
`ScanResult` (2-line change; no behavior change).
- `tools/hygiene/check-tick-history-shard-schema.test.ts`: 9 cases
- 3 acceptance paths: `HHMMZ.md`, `HHMMZ-<hex>.md`, `HH:MM:SSZ` col1
- 6 violation paths: bad filename, col1 date/time mismatches,
insufficient pipes, empty file, col1 format error
- Dynamic-import pattern so `REPO_ROOT` is set to a tmpdir before module
load; captures + restores prior `REPO_ROOT` to keep env clean across
the broader `bun test` run.

## Why

The B-0156 row's audit shows all 6 non-install `.sh` files now have
working `.ts` siblings (Phase 5 sweep done), but criterion 2 (test
coverage) was unverified for the 3 hygiene ports. The schema port is
the smallest (~5KB) and has the most testable surface (per-shard
validator returning structured `ScanResult`). This PR ships exactly
one bounded step toward closing B-0156.

## Checks

- `bun test tools/hygiene/check-tick-history-shard-schema.test.ts`:
**9/9 pass**
- `bun test tools/hygiene/`: **181/181 pass** (no regression — and
the env-restore in `afterAll` actually unblocked the broader suite
by avoiding `REPO_ROOT` pollution)
- `bun tools/hygiene/check-tick-history-shard-schema.ts`: production
CLI runs unchanged; pre-existing repo shard violations preserved

## B-0156 status after this PR

The row's audit baseline (3 remaining `.sh` files) is now stale — the
re-verification command in the row's self-test section shows zero
remaining non-install `.sh` files without `.ts` siblings. After this
PR, two `.ts` ports remain without co-located tests
(`snapshot-github-settings.ts`, `check-github-settings-drift.ts`); both
are candidates for follow-on slices.

## Test plan

- [x] Tests pass standalone
- [x] Tests pass in broader hygiene suite
- [x] Production CLI unaffected
- [x] Pushed claim branch before write work (otto-bg/b0156-schema-test-2026-05-17)
- [x] Isolated worktree (`.claude/worktrees/agile-doodling-iverson`); did not touch root checkout
- [x] Branch guard verified pre-commit
- [x] `git ls-tree HEAD` = 53 entries (no commit-tree corruption)

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

## Reviews

### COMMENTED — @copilot-pull-request-reviewer (2026-05-17T08:06:24Z)

## Pull request overview

Adds co-located Bun tests for the tick-history shard schema checker and exports the validator seam needed by those tests.

**Changes:**
- Exports `ScanResult` and `scanOne` from the shard schema checker.
- Adds 9 Bun tests covering valid shards and common schema violations.
- Uses a temporary `REPO_ROOT` fixture to avoid touching the real repository.

### Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

| File | Description |
| ---- | ----------- |
| `tools/hygiene/check-tick-history-shard-schema.ts` | Exposes the per-shard scanner and result type for testing. |
| `tools/hygiene/check-tick-history-shard-schema.test.ts` | Adds co-located tests for accepted and rejected shard schema cases. |

## Review threads

### Thread 1: tools/hygiene/check-tick-history-shard-schema.test.ts:47 (unresolved)

**@copilot-pull-request-reviewer** (2026-05-17T08:06:23Z):

This test suite does not exercise the documented `HHMMSSZ-<hex>.md` filename form even though the validator and shard README list it as one of the accepted schemas. A regression in that branch of the filename parser would still pass this new coverage, so add an acceptance case for the seconds+hash form.

### Thread 2: tools/hygiene/check-tick-history-shard-schema.test.ts:24 (unresolved)

**@copilot-pull-request-reviewer** (2026-05-17T08:06:24Z):

Importing the module while `REPO_ROOT` points at the temp directory permanently caches the module-level `ROOT` for this test process; after `afterAll` deletes the temp tree, any later import of this checker in the same Bun test process would reuse a stale/deleted root. Prefer a lazy/parameterized root seam for `scanOne` so tests don't have to mutate global env before module load.
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
---
pr_number: 4048
title: "memory(otto-cli): isolated-worktree workflow worked example under zeta-expected-branch race-window caveat"
author: "AceHack"
state: "MERGED"
created_at: "2026-05-17T08:21:33Z"
merged_at: "2026-05-17T08:29:00Z"
closed_at: "2026-05-17T08:29:00Z"
head_ref: "otto/worked-example-isolated-worktree-workflow-2026-05-17"
base_ref: "main"
archived_at: "2026-05-17T10:19:25Z"
archive_tool: "tools/pr-preservation/archive-pr.ts"
---

# PR #4048: memory(otto-cli): isolated-worktree workflow worked example under zeta-expected-branch race-window caveat

## PR description

## Summary

Ships the worked-example memo for the new `zeta-expected-branch.md` race-window-caveat section that landed mid-task during the PR #4046 session arc.

The memo was authored at 2026-05-17T07:50Z but did not make PR #4046's commit batch (chronological gap — PR #4046 had been opened earlier; isolated worktree was already in commit state). Ships now as a 1-file follow-up.

## What's inside

Worked-example documentation of Steps 0-6:

0. Switch primary back (off the new branch I'd attempted to use)
1. Create isolated worktree at `/private/tmp/zeta-b0611-substrate-0740z`
2. Copy 10 substrate files from primary
3. Regenerate `docs/BACKLOG.md`
4. Single-Bash-call: add explicit-paths + branch-guard + commit + ls-tree-verify
5. Push (background) + verify remote
6. PR creation deferred under pure-git tier (rate-limit exhausted) → executed in subsequent tick

Empirical anchors captured:

- Worktree-add succeeded first try; B-0530 race did not fire
- ls-tree count 53 post-commit matches `origin/main` — no canary corruption per `codeql-no-source-on-docs-only-pr-is-broken-commit-canary.md`
- Branch-guard passed in same Bash call as commit (race window minimized to within one Bash subprocess)
- This PR is itself a second iteration of the workflow — proves the pattern is repeatable

## Test plan

- [ ] No file content changes outside the single memory file
- [ ] markdownlint passes (memo follows MD format conventions)
- [ ] No broken relative paths (memo cites rules + PRs without depth issues)

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

## Reviews

### COMMENTED — @chatgpt-codex-connector (2026-05-17T08:22:49Z)


### 💡 Codex Review

Here are some automated review suggestions for this pull request.

**Reviewed commit:** `4048c9c04a`


<details> <summary>ℹ️ About Codex in GitHub</summary>
<br/>

[Your team has set up Codex to review pull requests in this repo](https://chatgpt.com/codex/cloud/settings/general). 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".

</details>

### COMMENTED — @copilot-pull-request-reviewer (2026-05-17T08:24:08Z)

## Pull request overview

Adds a single memory memo documenting a worked example of the isolated-worktree commit workflow after the `zeta-expected-branch` race-window caveat.

**Changes:**
- Adds a feedback memory file with YAML frontmatter.
- Documents Steps 0–6 of the isolated-worktree workflow.
- Captures empirical anchors and related rule links.

## Review threads

### Thread 1: memory/feedback_otto_cli_isolated_worktree_workflow_worked_example_zeta_expected_branch_race_window_caveat_aaron_authorized_commit_2026_05_17.md:84 (resolved)

**@chatgpt-codex-connector** (2026-05-17T08:22:49Z):

**<sub><sub>![P2 Badge](https://img.shields.io/badge/P2-yellow?style=flat)</sub></sub> Replace quoted wildcards in cp example**

The worked-example command uses quoted globs (`cp "$PRIMARY/docs/backlog/P2/B-0611-*.md" ...` and `cp "$PRIMARY/memory/feedback_otto_cli_lior_active_*.md" ...`), which prevents shell expansion and makes `cp` look for literal `*` filenames. In a normal Bash environment this causes the copy step to fail, so anyone replaying this memo cannot reproduce the documented “10 files copied” outcome unless they manually rewrite the command.

Useful? React with 👍 / 👎.

### Thread 2: memory/feedback_otto_cli_isolated_worktree_workflow_worked_example_zeta_expected_branch_race_window_caveat_aaron_authorized_commit_2026_05_17.md:85 (resolved)

**@copilot-pull-request-reviewer** (2026-05-17T08:24:07Z):

P1: This worked-example snippet is not executable as written: the `*` is inside double quotes, so the shell passes it literally to `cp` instead of expanding it. It also contradicts the surrounding “explicit cp per file (no glob)” claim. Replace these with the actual literal file paths, or mark the commands as abbreviated placeholders rather than a runnable copy recipe.

### Thread 3: memory/feedback_otto_cli_isolated_worktree_workflow_worked_example_zeta_expected_branch_race_window_caveat_aaron_authorized_commit_2026_05_17.md:115 (resolved)

**@copilot-pull-request-reviewer** (2026-05-17T08:24:08Z):

P1: The placeholder comment breaks the shell command chain if this snippet is copied: `#` comments out the trailing `&& \`, so `git status`, the branch guard, and the commit no longer depend on `git add` succeeding. Since this section documents the single-Bash-call guard discipline, use literal paths here or move the abbreviation outside the runnable command block.
Loading