Skip to content

A shallow clone leaves a cited commit unchecked - #86

Merged
pauldambra merged 6 commits into
mainfrom
posthog/shallow-clone-cited-commits
Oct 10, 2026
Merged

pauldambra merged 6 commits into
mainfrom
posthog/shallow-clone-cited-commits

Conversation

@pauldambra

@pauldambra pauldambra commented Oct 9, 2026 •

Copy link
Copy Markdown
Member

🤖 This PR was written by a robot (Claude, via PostHog Desktop) for @pauldambra.

Why

In a shallow clone, the Stop hook said that correct commit citations in practice files were "no commit in this repository". A hosted agent sandbox clones at depth 1, so every older commit looks missing. In ops-platform, all the cited commits exist on GitHub.

What

  • missingCommits now asks git if the clone is shallow. It asks only when some cited commit is missing. In a shallow clone, a commit that is not there is not reported, because the clone depth may have cut it off.

  • A full clone still reports a commit that does not exist. The workflow that ci install writes fetches full history, so CI still catches a wrong citation.

  • coherence defect --introduced <sha> had the same problem: in a shallow clone it refused any older commit. The check now lives in one place, src/journal/commits.ts, and both the practice check and defect --introduced use it.

  • In a shallow clone, a hash that names a file or tree the clone holds, or more than one object, is still reported, because it is no commit at any depth.

  • New invariant in Spec.spec.md and parameterized tests in practice.test.ts and defects.test.ts, and a new invariant in Journal.spec.md.

  • Bumps the version to 1.7.1. When this merges, the Release workflow publishes 1.7.1 to npm.

Checks

  • On the depth-1 ops-platform clone, spec --check gave 12 "no commit" problems before this change and 0 after.
  • typecheck, spec:check and lexicon:check pass.
  • practice.test.ts and defects.test.ts pass.
  • Both new invariants were refuted with coherence refute (each break made its test go red), restored, and found green by run, batched and alone. Both read as invariant.

🤖 Generated with Claude Code

Created with PostHog Desktop

A practice's cited commit was a problem whenever git cat-file said
missing. In a depth-1 clone, such as a hosted agent sandbox, every older
commit is missing, so Stop reported correct citations as "no commit in
this repository". When some cited commit is missing, git is now asked
if the clone is shallow; if it is, the citations are left unchecked. A
full clone, as the workflow ci install writes fetches, still catches a
wrong one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Generated-By: PostHog Desktop
Task-Id: b53cdddb-2e4d-43d2-97ec-a3b067257f29
@pauldambra pauldambra self-assigned this Oct 9, 2026
@posthog

posthog Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

🦔 PostHog Review (standard) reviewed this pull request

Nothing worth raising.

@pauldambra
pauldambra marked this pull request as ready for review October 9, 2026 22:20
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-09T22:23:14.502937Z 00f1d8d Draft marked ready
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@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: 00f1d8d0f0

ℹ️ 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 src/spec/practices.ts Outdated

@pauldambra pauldambra left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Note

🤖 Automated comment by QA Swarm — not written by a human

QA Swarm review complete. See inline comments.

Comment thread src/spec/practices.ts Outdated
Comment thread src/spec/Spec.spec.md

pauldambra commented Oct 9, 2026 •

Copy link
Copy Markdown
Member Author

Note

🤖 Automated comment by QA Swarm — not written by a human

Multi-perspective review: router (cheap-first pass) + delegated lenses (qa-team, paul-reviewer, xp-reviewer, security-audit, engineering-systems-thinking as warranted)

Verdict: ✅ APPROVE (round 3 @ ae1534c)

Moving the shallow-aware check into src/journal/commits.ts keeps the old behaviour of defect --introduced in a full clone, outside a git checkout, and for an ambiguous short hash. It also fixes the same shallow-clone problem there.

Key findings

  • ⚪ NIT src/spec/practices.ts:111: double blank line left after the helpers moved out.

Reviewer summaries

Reviewer Assessment
🧭 router (sonnet) Danger LOW, confidence HIGH, no delegation. Checked the old and new git calls against real git. Unit tests not run in the sandbox; CI ran them on ae1534c and all 16 checks passed.
Previous rounds (2)

round 1 @ 00f1d8d — 💬 APPROVE WITH NITS: shallow fallback hid provable wrong citations (fixed in c3ad7bb); refuted: line missing (left for a human).
round 2 @ c3ad7bb — ✅ APPROVE: no new findings.


Automated by QA Swarm — not a human review

The shallow fallback left every commit citation unchecked once one was
missing. But a hash that names a file or a tree the clone holds, or
several objects, is no commit at any depth. In a shallow clone, the
missing citations are now asked of git again without ^{commit}, and only
those that name nothing here stay unchecked.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Generated-By: PostHog Desktop
Task-Id: b53cdddb-2e4d-43d2-97ec-a3b067257f29
defect --introduced asked git cat-file -e <sha>^{commit}, so in a
depth-1 clone it refused any older commit as "no commit by that name",
the same blind spot the practice citation check had. The shallow-aware
check moves from spec/practices.ts to journal/commits.ts, and both the
practice check and defect --introduced use it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Generated-By: PostHog Desktop
Task-Id: b53cdddb-2e4d-43d2-97ec-a3b067257f29

@pauldambra pauldambra left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Note

🤖 Automated comment by QA Swarm — not written by a human

QA Swarm review complete. See inline comments.

Comment thread src/spec/practices.ts
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Generated-By: PostHog Desktop
Task-Id: b53cdddb-2e4d-43d2-97ec-a3b067257f29
…by via

The parameterized tests gave each case its own name, so no test was
named by the via: lines, and run and refute selected nothing. Each loop
now sits in a describe block named by its via.

Both invariants were then refuted with the break staged, restored byte
for byte, and run green batched and alone; the run store records it.
The alone run used NODE_OPTIONS=--test-reporter=tap, because Node 24
prints "ℹ pass" by default and the config's testMatch reads "# pass".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Generated-By: PostHog Desktop
Task-Id: b53cdddb-2e4d-43d2-97ec-a3b067257f29
A shallow clone no longer reads a correct commit citation as no commit: practice citations and defect --introduced ask git whether the clone is shallow, and there report only a hash that names some other object, or several (#86).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Generated-By: PostHog Desktop
Task-Id: b53cdddb-2e4d-43d2-97ec-a3b067257f29
@pauldambra
pauldambra merged commit a73b33a into main Oct 10, 2026
16 checks passed
@pauldambra
pauldambra deleted the posthog/shallow-clone-cited-commits branch October 10, 2026 10:16
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