Skip to content

[S19] devops : worktree + poetry guardrails v2#132

Merged
Doogie201 merged 4 commits intomainfrom
sprint/S19-worktree-poetry-guardrails-v2
Feb 25, 2026
Merged

[S19] devops : worktree + poetry guardrails v2#132
Doogie201 merged 4 commits intomainfrom
sprint/S19-worktree-poetry-guardrails-v2

Conversation

@Doogie201
Copy link
Owner

Sprint S19 — Worktree + Poetry Guardrails v2

Sprint ID: S19-worktree-poetry-guardrails-v2
Objective: Make diagnose work from any git worktree by capturing invocation context (cwd/interpreter/env), replacing raw tracebacks with a controlled message + one canonical fix path, and ensuring dev setup is idempotent and offline-friendly.

Whitelist + Budgets

File Before After Net New Budget Within
dashboard/src/engine/worktreeContext.ts 0 40 +40 (new)
dashboard/src/engine/nlxErrorSanitizer.ts 0 64 +64 (new)
dashboard/src/engine/nlxService.ts 129 144 +15 120
dashboard/src/engine/__tests__/worktreeContext.test.ts 0 52 +52 (new)
dashboard/src/engine/__tests__/nlxErrorSanitizer.test.ts 0 94 +94 (new)
scripts/dev-setup.sh 34 63 +29 120

All files within whitelist: dashboard/src/**, scripts/**, docs/**.

Acceptance Tests

  • AT-S19-01 — Worktree context detection: detectWorktreeContext() returns deterministic {cwd, gitTopLevel, isWorktree, interpreterPath, nlxAvailable} via DI shell mock.
  • AT-S19-02 — Traceback suppression: sanitizeNlxError() returns controlled message with canonical fix (bash scripts/dev-setup.sh); no raw stack frames leak.
  • AT-S19-03 — Dev-setup idempotent + offline: scripts/dev-setup.sh detects worktree, supports --offline, exits 0 on repeated runs.
  • AT-S19-04 — Error context attached: sanitized error includes WorktreeContext with isWorktree, interpreterPath, nlxAvailable.

Evidence

docs/sprints/S19/evidence/:

  • gates.json — test: 195/42, lint: clean, build: ○ Static
  • at-s19-01-worktree-context.json
  • at-s19-02-traceback-suppression.json
  • at-s19-03-dev-setup.json
  • at-s19-04-error-context.json

Traceback Patterns (suppressed)

Traceback (most recent call last)
File "...", line N
ModuleNotFoundError:
ImportError:
FileNotFoundError:.*poetry
No module named

Gates

Gate Result
Test 195 passed (42 files)
Lint clean
Build ○ (Static)

Notes

  • No new endpoints/routes/command IDs
  • No new dependencies
  • No new network calls
  • ShellCheck: passes locally; pre-commit Docker hook skipped due to known worktree volume mount issue

🤖 Generated with Claude Code

Add worktree context detection, Python traceback suppression with
canonical fix path, and dev-setup.sh hardening for offline/worktree use.

- worktreeContext.ts: DI-testable git worktree/interpreter detection
- nlxErrorSanitizer.ts: replaces raw tracebacks with controlled message
  + "bash scripts/dev-setup.sh" canonical remediation
- nlxService.ts: wires sanitizer into toResponse() for missing_nlx
  and traceback-containing nonzero_exit errors
- dev-setup.sh: worktree detection, --offline flag, context logging
- 13 new tests (195 total, 42 files)

AT-S19-01: worktree context detection (DI fixture proof)
AT-S19-02: traceback suppression (no raw stack frames leak)
AT-S19-03: dev-setup idempotent + offline-friendly
AT-S19-04: error context attached to sanitized result

Co-Authored-By: Claude <noreply@anthropic.com>
@Doogie201 Doogie201 added risk:high High risk sprint:S19 Sprint S19 area:devx Developer experience type:devops DevOps evidence:required Evidence required labels Feb 24, 2026
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

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: 295469644b

ℹ️ 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".

@codecov
Copy link

codecov bot commented Feb 24, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Doogie201 and others added 3 commits February 25, 2026 07:30
Durable evidence for all 7 required preflight commands:
- git fetch --all --prune --tags
- git worktree list --porcelain
- git rev-parse --show-toplevel
- git rev-parse --is-inside-work-tree
- git rev-parse --abbrev-ref HEAD
- git status --porcelain=v1 --branch
- git branch -vv

Co-Authored-By: Claude <noreply@anthropic.com>
- New receipt: primary-worktree.json with all 8 required commands
  from ~/Projects/NextLevelApex (now on main, synced)
- Updated worktree-list.json to reflect corrected primary worktree
  state (main @ 339338f, no longer stale S06 branch)

Co-Authored-By: Claude <noreply@anthropic.com>
detectWorktreeContext() compared git-common-dir and git-dir outputs
as raw strings. When invoked from a subdirectory, git may return
these in different formats (relative ".git" vs absolute
"/path/to/project/.git"), causing a false isWorktree=true.

Fix: normalizeGitPath() resolves both paths to absolute form via
path.resolve() + fs.realpathSync (with path.normalize fallback),
then compares the normalized results.

New test: verifies no false worktree when relative and absolute
paths resolve to the same .git directory.

Co-Authored-By: Claude <noreply@anthropic.com>
@Doogie201 Doogie201 merged commit 414eba9 into main Feb 25, 2026
6 checks passed
@Doogie201 Doogie201 deleted the sprint/S19-worktree-poetry-guardrails-v2 branch February 25, 2026 15:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:devx Developer experience evidence:required Evidence required risk:high High risk sprint:S19 Sprint S19 type:devops DevOps

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant