Skip to content

feat(0.25.0): doctor advisory + repair backfill for Development Philosophy section (BRO-1409)#72

Merged
broomva merged 3 commits into
mainfrom
feat/philosophy-backfill
Jun 5, 2026
Merged

feat(0.25.0): doctor advisory + repair backfill for Development Philosophy section (BRO-1409)#72
broomva merged 3 commits into
mainfrom
feat/philosophy-backfill

Conversation

@broomva
Copy link
Copy Markdown
Owner

@broomva broomva commented Jun 5, 2026

What

Closes the follow-up gap from #71 (0.24.0). The scaffold is idempotent-never-overwrite, so newly-templated content never reaches existing workspaces — the Development Philosophy section only shipped to new installs. This makes bstack doctor surface it and bstack repair backfill it.

Closes BRO-1409.

Changes

  • scripts/doctor.sh — §4b advisory: if AGENTS.md lacks ## Development Philosophy, print an [info] nudge → bstack repair. Informational only — a pre-0.24.0 workspace legitimately lacks it; not a GAP, never fails --strict (mirrors §12 Pillars / §13 dogfood).
  • scripts/repair.shbackfill_philosophy_section(): extracts the section verbatim from the template (heading → ## Bstack Core Automation Primitives anchor, exclusive) via files only (no shell interpolation of content — backticks/quotes/pipes survive) and inserts it before the target's own anchor in AGENTS.md + CLAUDE.md. Runs before the "fully bstack-compliant" early-exit (same pattern as the existing hook merge, because the advisory is not a GAP). Idempotent + insert-only; skips with a warning if the anchor is absent (never guesses).
  • tests/philosophy-backfill.test.sh — 13 assertions.
  • references/new-workspace-flow.md — §4b + backfill documented.

Dep-chain

  • Upstream: assets/templates/{AGENTS,CLAUDE}.md.template (extraction source).
  • Downstream: CI doctor runs --quiet and no workflow runs doctor --strict, so the advisory can't fail CI. Primitive count unchanged (20).

Verification (P11)

  • New test: 13/13 pass (backfill into pre-0.24.0 workspace; section positioned before anchor; content extracted verbatim; idempotent on re-run; --dry-run writes nothing; missing-anchor skip; doctor advisory present/absent + not-a-GAP).
  • Regression: repair-merge-hooks.test.sh 5/5, template_lockstep.test.sh pass.
  • shellcheck: zero new warnings (3 pre-existing SC2034 unrelated). bash -n clean.

Follow-up (this session)

After merge, run bstack repair against ~/broomva itself to backfill the section there.

🤖 Generated with Claude Code

…sophy section (BRO-1409)

Closes the gap from 0.24.0: idempotent-never-overwrite means newly-templated
*content* never reaches existing workspaces, so the Development Philosophy
section only shipped to new installs.

- doctor.sh §4b: informational advisory when AGENTS.md lacks the section.
  Not a GAP, never fails --strict (mirrors §12 Pillars / §13 dogfood).
- repair.sh backfill_philosophy_section(): extracts the section verbatim from
  the template (files only, no shell interpolation of content) and inserts it
  before the target's '## Bstack Core Automation Primitives' anchor in both
  AGENTS.md + CLAUDE.md. Runs before the compliance early-exit (like the hook
  merge). Idempotent + insert-only; skips with a warning if anchor absent.
- tests/philosophy-backfill.test.sh: 13 assertions (backfill, position,
  content integrity, idempotency, --dry-run, missing-anchor, doctor advisory).
- new-workspace-flow.md documents §4b + backfill. Primitive count unchanged (20).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@linear
Copy link
Copy Markdown

linear Bot commented Jun 5, 2026

BRO-1409

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 5, 2026

Warning

Review limit reached

@broomva, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 13 minutes and 27 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 9bfb35f8-5f61-413b-9fd0-4024fc3af1b5

📥 Commits

Reviewing files that changed from the base of the PR and between 4513547 and bca3480.

📒 Files selected for processing (6)
  • CHANGELOG.md
  • VERSION
  • references/new-workspace-flow.md
  • scripts/doctor.sh
  • scripts/repair.sh
  • tests/philosophy-backfill.test.sh
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/philosophy-backfill

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Carlos D. Escobar-Valbuena and others added 2 commits June 5, 2026 10:45
…ant match, verify-after-insert, pipefail SIGPIPE fix

Cross-review (Codex, Strata A) BLOCKed 6/10. All four findings real:
- extractor now guards the TEMPLATE anchor too (else awk runs heading→EOF).
- probe/inserter predicate unified + CRLF/trailing-space tolerant; verify the
  section actually landed before reporting [fix] (no silent false success).
- mktemp/awk/mv now status-checked + temp files cleaned on every failure path.
- test now actually runs 'doctor --strict' and asserts the advisory changes
  neither the GAP total nor the strict exit code (differential with/without).
- root-cause of the AGENTS-only failure during hardening: 'tr | grep -q' under
  'set -o pipefail' fails spuriously (grep -q SIGPIPEs tr on large files);
  grep the file directly — [[:space:]]*$ already absorbs trailing CR.
Test: 17/17 (adds CRLF + differential-strict cases).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Codex round-2 residual (finding 3): the tr|awk extraction was unchecked under
set -o pipefail. Now wrapped in 'if ! ...; then skip+cleanup'. SIGPIPE-safe
(awk drains all of tr); content checks still catch partial/empty writes.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@broomva
Copy link
Copy Markdown
Owner Author

broomva commented Jun 5, 2026

P20 Cross-Review verdict: ✅ PASS (9/10)

Strata A — true cross-vendor (Codex gpt-5.4), 2 fix rounds. The gate caught four real silent-failure bugs in the backfill (it would have lied about success or over-copied), plus surfaced a pipefail/SIGPIPE bug introduced while hardening:

Round Score Findings → resolution
1 6/10 BLOCK (1) extractor didn't guard the template anchor (awk could run heading→EOF) · (2) grep -qF probe vs awk $0==anchor mismatch → CRLF/trailing-space silent no-op + false [fix] · (3) no error-check/cleanup after mktemp/awk/mv · (4) test never actually ran --strict
2 7/10 BLOCK (1)(2)(4) resolved; (3) extraction pipeline still unchecked under pipefail
3 9/10 PASS extraction pipeline status-checked; "stays narrowly scoped and avoids abstraction creep"

Hardening added: template-anchor guard, CRLF/trailing-space-tolerant matching, verify-after-insert (never report [fix] unless the section actually landed), full error/cleanup on every failure path, and a fix for a tr | grep -q SIGPIPE-under-pipefail bug. Test grew 13→17 assertions (CRLF regression + differential --strict exit-code/GAP-total check).

@broomva broomva merged commit e3c2257 into main Jun 5, 2026
6 checks passed
@broomva broomva deleted the feat/philosophy-backfill branch June 5, 2026 15:52
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