Skip to content

chore: add missing altimate_change markers for upgrade indicator#338

Merged
anandgupta42 merged 2 commits intomainfrom
chore/add-missing-altimate-change-markers
Mar 20, 2026
Merged

chore: add missing altimate_change markers for upgrade indicator#338
anandgupta42 merged 2 commits intomainfrom
chore/add-missing-altimate-change-markers

Conversation

@anandgupta42
Copy link
Contributor

@anandgupta42 anandgupta42 commented Mar 20, 2026

What does this PR do?

Adds missing altimate_change markers to upstream-shared files that were modified by the upgrade indicator feature (#175). Without these markers, the custom UpgradeIndicator imports and usages would be silently overwritten during the next upstream merge.

Files fixed:

  • packages/opencode/src/cli/cmd/tui/routes/home.tsx — import + JSX usage
  • packages/opencode/src/cli/cmd/tui/routes/session/footer.tsx — import + JSX usage

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Issue for this PR

Closes #337

How did you verify your code works?

  • bunx turbo typecheck — all 5 packages pass
  • bun test — all 214 related tests pass
  • bun run script/upstream/analyze.ts — all marker blocks properly closed (143 blocks, 40 files)

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • New and existing tests pass locally with my changes

Summary by CodeRabbit

  • New Features
    • Added an upgrade indicator to the home screen and session footer to display version info.
  • Tests
    • Added comprehensive tests covering marker/diff parsing edge cases to reduce false positives.
  • Chores
    • CI updated to run marker checks more consistently across events.
  • Refactor
    • Improved diff/marker parsing and adjusted CLI entry behavior for safer imports.

Wrap `UpgradeIndicator` imports and JSX usages in `home.tsx` and
`session/footer.tsx` with `altimate_change` markers so they survive
upstream merges.

Closes #337

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

@claude claude bot left a comment

Choose a reason for hiding this comment

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

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review to trigger a review.

@coderabbitai
Copy link

coderabbitai bot commented Mar 20, 2026

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

Adds UpgradeIndicator rendering to two TUI footer routes, extracts and exposes diff parsing via parseDiffForMarkerWarnings, adds comprehensive tests for marker parsing, and updates CI marker-guard job to run marker parser tests and adjust marker-check branching logic.

Changes

Cohort / File(s) Summary
TUI Footer Routes
packages/opencode/src/cli/cmd/tui/routes/home.tsx, packages/opencode/src/cli/cmd/tui/routes/session/footer.tsx
Imported and rendered UpgradeIndicator in footer areas (home and session) to show upgrade/version info.
Marker parser & tests
script/upstream/analyze.ts, script/upstream/analyze.test.ts
Extracted diff parsing into exported parseDiffForMarkerWarnings(file, diffOutput), adjusted marker-state logic (reset per hunk, ignore removed lines, track markers from context lines, only warn on added lines), guarded CLI entry with if (import.meta.main), and added extensive Bun tests covering parsing edge cases and real-world examples.
CI workflow
.github/workflows/ci.yml
Changed marker-guard job to always run for workflow events, added a step to run bun test for marker parser tests, and updated marker-check branching to handle push vs non-push events and zero-SHA initial commits.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Poem

🐰 A nibble of code beneath the moon,
Markers kept tidy, changes sang a tune,
Footers now watching for upgrades bright,
Tests hop along to keep markers right. 🥕

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title directly addresses the main objective: adding missing altimate_change markers to protect upgrade indicator code during upstream merges.
Description check ✅ Passed The description covers all required template sections: summary of changes, verification testing, and completion checklist with appropriate detail.
Linked Issues check ✅ Passed The PR successfully addresses issue #337 by adding altimate_change markers to both home.tsx and session/footer.tsx files to protect UpgradeIndicator code from being overwritten during upstream merges.
Out of Scope Changes check ✅ Passed The PR includes necessary enhancements to the marker detection system (.github/workflows/ci.yml, script/upstream/analyze.ts, script/upstream/analyze.test.ts) that directly support the core objective of protecting custom code with markers.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/add-missing-altimate-change-markers

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.

Two root causes allowed `altimate_change` marker leaks to go undetected:

1. **Context-line state bug** — `checkFileForMarkers` only processed
   marker keywords on added (`+`) lines, ignoring context (` `) lines.
   When existing markers appeared as context lines adjacent to new code,
   `inMarkerBlock` was never set, causing false negatives.

2. **CI gap** — marker guard only ran on PRs, not on push-to-main.
   Individual PRs could pass while the combined state of `main` had gaps.

Fixes:
- Track marker state from both added and context lines in diff parser
- Reset `inMarkerBlock` at hunk boundaries to prevent cross-hunk leaks
- Extract `parseDiffForMarkerWarnings` as testable pure function
- Add `import.meta.main` guard so tests don't trigger CLI side effects
- Extend CI marker-guard to run on push-to-main with zero-SHA guard
- Add `bun test` step in CI for marker parser unit tests
- 21 unit tests covering regression cases and real-world scenarios

Reviewed by 6 models: Claude, GPT 5.2 Codex, Gemini 3.1 Pro,
Kimi K2.5, MiniMax M2.5, GLM-5.

Closes #337

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@anandgupta42 anandgupta42 merged commit 096008a into main Mar 20, 2026
10 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add missing altimate_change markers for upgrade indicator

1 participant