Skip to content

ADFA-934: Build output timestamp - #1586

Open
dara-abijo-adfa wants to merge 19 commits into
stagefrom
ADFA-934-build-output-timestamp
Open

ADFA-934: Build output timestamp#1586
dara-abijo-adfa wants to merge 19 commits into
stagefrom
ADFA-934-build-output-timestamp

Conversation

@dara-abijo-adfa

Copy link
Copy Markdown
Contributor

Add time stamps, time deltas, and line numbers to the Build Output

@claude claude 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.

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.

Tip: disable this comment in your organization's Code Review settings.

@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough
  • Add timestamps, elapsed-time deltas, and line numbers to Build Output.
  • Add view options for toggling timestamps, deltas, and line numbers.
  • Add filtering that respects the selected display options.
  • Add build output formatting and filter test coverage.
  • Add output view options to the editor bottom sheet.
  • Add localized labels, accessibility text, tooltip metadata, and the tuning icon.
  • Improve stale-write protection during output clearing, filtering, and editor updates.
  • Risk: flushToEditor() can append output twice on the immediate layout-complete path.
  • Risk: The expanded output action layout now uses horizontal scrolling, which may affect action discoverability on smaller screens.

Walkthrough

Build output now shows timestamp and delta prefixes on streamed lines, computed in EditorBuildEventListener and formatted by BuildOutputViewModel. BuildOutputFragment adds a view-options popup for toggling line numbers, timestamps, and deltas, plus generation counters to guard against stale editor writes. EditorBottomSheet gains a view-options action button.

Changes

Build output controls

Layer / File(s) Summary
Display formatting and filtering contract
app/src/main/java/com/itsaky/androidide/viewmodel/BuildOutputViewModel.kt, app/src/test/java/com/itsaky/androidide/viewmodel/BuildOutputFilterTest.kt
BuildOutputViewModel adds showTimestamps, showDeltas, and showLineNumbers state flows, plus formatLinePrefix and formatLineForDisplay companion methods. filterLines accepts display toggles and matches queries against rendered text. Tests cover prefix stripping, toggle combinations, and newline handling.
Timed build output formatting
app/src/main/java/com/itsaky/androidide/handlers/EditorBuildEventListener.kt
EditorBuildEventListener tracks build/output timestamps, formats non-blank lines with elapsed-time prefixes through formatOutput, resets timers on build preparation, and renames the activity accessor from _activity to activityOrNull.
Fragment rendering, generation safety, and filter chips
app/src/main/java/com/itsaky/androidide/fragments/output/BuildOutputFragment.kt, app/src/main/java/com/itsaky/androidide/fragments/output/LogFilterBarController.kt, resources/src/main/res/values/strings.xml
BuildOutputFragment adds session/editor generation counters that invalidate stale writes during clears and filtered renders, applies visibility settings during restoration and live rendering, and updates the gutter divider on line-number toggles. LogFilterBarController now sets visibility on individual level chips. New filter-option string resources are added.
View-options popup and bottom-sheet integration
app/src/main/java/com/itsaky/androidide/fragments/output/ViewOptionsOutputFragment.kt, app/src/main/java/com/itsaky/androidide/fragments/output/BuildOutputFragment.kt, app/src/main/java/com/itsaky/androidide/ui/EditorBottomSheet.kt, app/src/main/res/drawable/ic_tune.xml, app/src/main/res/layout/layout_editor_bottom_sheet.xml, idetooltips/.../TooltipTag.kt, resources/src/main/res/values/strings.xml
A new ViewOptionsOutputFragment interface defines showViewOptions(anchorView: View). BuildOutputFragment implements it with a popup for line-number, timestamp, and delta toggles. EditorBottomSheet wires a new view-options action button, visible only for expanded view-options-capable fragments, backed by the ic_tune drawable, an updated bottom-sheet layout, a new tooltip tag, and an accessibility string.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant EditorBuildEventListener
  participant BuildOutputViewModel
  participant BuildOutputFragment
  participant EditorBottomSheet

  EditorBuildEventListener->>EditorBuildEventListener: Reset build timers on prepareBuild
  EditorBuildEventListener->>BuildOutputViewModel: Format output line with timing prefix
  BuildOutputViewModel-->>EditorBuildEventListener: Return prefixed line
  EditorBuildEventListener->>BuildOutputFragment: Append prefixed output to session

  EditorBottomSheet->>BuildOutputFragment: Invoke showViewOptions on click
  BuildOutputFragment->>BuildOutputFragment: Display popup with checkbox toggles
  BuildOutputFragment->>BuildOutputViewModel: Update showTimestamps / showDeltas / showLineNumbers
  BuildOutputViewModel-->>BuildOutputFragment: Emit updated visibility state
  BuildOutputFragment->>BuildOutputViewModel: filterLines with current toggles
  BuildOutputViewModel-->>BuildOutputFragment: Return visible text
  BuildOutputFragment->>BuildOutputFragment: Render text if editor generation is current
Loading

Possibly related PRs

Suggested reviewers: itsaky-adfa, jomen-adfa, daniel-adfa

Poem

A rabbit taps the build log's beat,
Timestamps hop on tiny feet.
Toggle switches, tune icon bright,
Deltas ticking left to right.
No stale line sneaks past my guard—
Generation counters stand on ward. 🐇⏱️

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title identifies the Build Output timestamp change, which is a major part of the changeset.
Description check ✅ Passed The description accurately summarizes the added timestamps, time deltas, and line numbers in Build Output.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ 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 ADFA-934-build-output-timestamp

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🧹 Nitpick comments (2)
app/src/main/java/com/itsaky/androidide/handlers/EditorBuildEventListener.kt (1)

183-197: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Consider adding unit test coverage for the new timing/formatting logic.

formatOutput contains non-trivial timing math (total/step deltas, blank-line/trailing-newline preservation) but no accompanying test file was included in this PR. As per coding guidelines, new/changed non-UI logic should target at least 50% line and branch coverage.

Based on learnings and coding guidelines: "Use unit tests for non-UI logic, cover error and edge paths, and target at least 50% line and branch coverage for new or changed non-UI code." Want me to draft a JUnit test class for formatOutput/resetBuildTimers?

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@app/src/main/java/com/itsaky/androidide/handlers/EditorBuildEventListener.kt`
around lines 183 - 197, Add unit tests for the non-UI formatting logic in
formatOutput and timer behavior in resetBuildTimers. Cover total and step timing
prefixes, multi-line output, blank lines, inputs with and without trailing
newlines, and timer reset behavior, targeting at least 50% line and branch
coverage.

Source: Coding guidelines

app/src/main/java/com/itsaky/androidide/fragments/output/LogFilterBarController.kt (1)

69-92: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Consider wiring long-press tooltip help for the new toggle chips.

The three new chips (line numbers, timestamps, deltas) are new interactive elements with no evident long-press help wiring (e.g. via the TooltipTag-based mechanism used elsewhere, such as editor?.tag = TooltipTag.PROJECT_BUILD_OUTPUT in BuildOutputFragment.kt).

Based on coding guidelines: "New interactive elements and screens must provide long-press contextual help through idetooltips and the three-tier tooltip system." Please confirm whether an existing mechanism (not shown in this diff) already covers these chips, or whether tooltip tagging should be added here.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@app/src/main/java/com/itsaky/androidide/fragments/output/LogFilterBarController.kt`
around lines 69 - 92, Verify whether chipLineNumbers, chipTimestamps, and
chipDeltas already receive long-press help through an existing tooltip
mechanism; if not, add the appropriate TooltipTag-based three-tier tooltip
wiring for each chip in the controller’s setup flow, using distinct contextual
tags and preserving the existing visibility, checked-state, and listener
behavior.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@app/src/main/java/com/itsaky/androidide/fragments/output/BuildOutputFragment.kt`:
- Around line 88-99: Separate the generation used for session-file persistence
from editorContentGeneration. Add a persistence generation that is incremented
only by clearOutput(), capture and propagate both generations through
processLogs and flushToEditor, and use the persistence generation to gate
buildOutputViewModel.append(text) while retaining editorContentGeneration for
visible appendBatch calls. Ensure filter and display-toggle re-renders cannot
discard drained output.

In
`@app/src/main/java/com/itsaky/androidide/handlers/EditorBuildEventListener.kt`:
- Around line 79-104: Update prepareBuild and onProgressEvent to capture the
result of checkActivity(...) in a local activity instance and return when it is
null, then use that captured instance throughout each method instead of
re-reading the throwing activity accessor. Preserve the existing build-status,
timer, output, and progress behavior while eliminating the
time-of-check/time-of-use race.
- Around line 45-46: Update build elapsed-time tracking in
EditorBuildEventListener to use SystemClock.elapsedRealtime() for
buildStartTimeMs, lastOutputTimeMs, and all totalDeltaMs/stepDeltaMs
calculations, including the referenced later sections. Preserve
System.currentTimeMillis()/Instant only for displayed wall-clock timestamps,
ensuring duration values remain monotonic and non-negative.

In `@app/src/main/java/com/itsaky/androidide/viewmodel/BuildOutputViewModel.kt`:
- Around line 202-227: Update PREFIX_TIME_FORMAT used by formatLinePrefix to
apply an explicit ASCII DecimalStyle, ensuring the [HH:mm:ss.SSS] timestamp
always emits ASCII digits regardless of the device locale. Do not rely solely on
Locale.US; preserve the existing timestamp pattern and formatting behavior.

---

Nitpick comments:
In
`@app/src/main/java/com/itsaky/androidide/fragments/output/LogFilterBarController.kt`:
- Around line 69-92: Verify whether chipLineNumbers, chipTimestamps, and
chipDeltas already receive long-press help through an existing tooltip
mechanism; if not, add the appropriate TooltipTag-based three-tier tooltip
wiring for each chip in the controller’s setup flow, using distinct contextual
tags and preserving the existing visibility, checked-state, and listener
behavior.

In
`@app/src/main/java/com/itsaky/androidide/handlers/EditorBuildEventListener.kt`:
- Around line 183-197: Add unit tests for the non-UI formatting logic in
formatOutput and timer behavior in resetBuildTimers. Cover total and step timing
prefixes, multi-line output, blank lines, inputs with and without trailing
newlines, and timer reset behavior, targeting at least 50% line and branch
coverage.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: d78f0844-2eb6-4697-a35e-eed2f14c5974

📥 Commits

Reviewing files that changed from the base of the PR and between 60a9b77 and 3dc82ea.

📒 Files selected for processing (7)
  • app/src/main/java/com/itsaky/androidide/fragments/output/BuildOutputFragment.kt
  • app/src/main/java/com/itsaky/androidide/fragments/output/LogFilterBarController.kt
  • app/src/main/java/com/itsaky/androidide/handlers/EditorBuildEventListener.kt
  • app/src/main/java/com/itsaky/androidide/viewmodel/BuildOutputViewModel.kt
  • app/src/main/res/layout/layout_log_filter_bar.xml
  • app/src/test/java/com/itsaky/androidide/viewmodel/BuildOutputFilterTest.kt
  • resources/src/main/res/values/strings.xml

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
app/src/main/java/com/itsaky/androidide/viewmodel/BuildOutputViewModel.kt (1)

249-251: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Remove the complete trailing line separator before splitting.

lineSequence() treats CRLF as one separator, but filterLines() only strips a final \n. When content ends with \r\n, no separator remains to trigger the existing blank-line drop, so filterLines() can append an extra blank line for that line ending. Strip \r\n before stripping isolated \n or \r, and add a CRLF regression test.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@app/src/main/java/com/itsaky/androidide/viewmodel/BuildOutputViewModel.kt`
around lines 249 - 251, Update the body preparation near `filterLines()` to
remove one complete trailing CRLF separator before handling isolated trailing
`\n` or `\r`, preserving the existing blank-line behavior for newline-terminated
content. Add a regression test covering CRLF-terminated input and verifying that
`filterLines()` does not append an extra blank line.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@app/src/main/java/com/itsaky/androidide/viewmodel/BuildOutputViewModel.kt`:
- Around line 249-251: Update the body preparation near `filterLines()` to
remove one complete trailing CRLF separator before handling isolated trailing
`\n` or `\r`, preserving the existing blank-line behavior for newline-terminated
content. Add a regression test covering CRLF-terminated input and verifying that
`filterLines()` does not append an extra blank line.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 6bbaad46-d8b5-4303-a44e-e821f4a61c9d

📥 Commits

Reviewing files that changed from the base of the PR and between 895601e and 8e499ff.

📒 Files selected for processing (6)
  • app/src/main/java/com/itsaky/androidide/fragments/output/BuildOutputFragment.kt
  • app/src/main/java/com/itsaky/androidide/fragments/output/LogFilterBarController.kt
  • app/src/main/java/com/itsaky/androidide/handlers/EditorBuildEventListener.kt
  • app/src/main/java/com/itsaky/androidide/viewmodel/BuildOutputViewModel.kt
  • app/src/test/java/com/itsaky/androidide/viewmodel/BuildOutputFilterTest.kt
  • resources/src/main/res/values/strings.xml
🚧 Files skipped from review as they are similar to previous changes (5)
  • resources/src/main/res/values/strings.xml
  • app/src/main/java/com/itsaky/androidide/handlers/EditorBuildEventListener.kt
  • app/src/main/java/com/itsaky/androidide/fragments/output/LogFilterBarController.kt
  • app/src/test/java/com/itsaky/androidide/viewmodel/BuildOutputFilterTest.kt
  • app/src/main/java/com/itsaky/androidide/fragments/output/BuildOutputFragment.kt

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@app/src/main/res/drawable/ic_tune.xml`:
- Around line 1-11: Move the drawable resource represented by ic_tune.xml from
the app module into the resources module’s drawable directory, then remove the
original app-module copy. Preserve the vector contents and resource name so
existing consumers continue resolving it through the resources module.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 579ef83a-41df-4837-860e-dfbd8739fcfe

📥 Commits

Reviewing files that changed from the base of the PR and between 8e499ff and 48f4aca.

📒 Files selected for processing (8)
  • app/src/main/java/com/itsaky/androidide/fragments/output/BuildOutputFragment.kt
  • app/src/main/java/com/itsaky/androidide/fragments/output/LogFilterBarController.kt
  • app/src/main/java/com/itsaky/androidide/fragments/output/ViewOptionsOutputFragment.kt
  • app/src/main/java/com/itsaky/androidide/ui/EditorBottomSheet.kt
  • app/src/main/res/drawable/ic_tune.xml
  • app/src/main/res/layout/layout_editor_bottom_sheet.xml
  • idetooltips/src/main/java/com/itsaky/androidide/idetooltips/TooltipTag.kt
  • resources/src/main/res/values/strings.xml
🚧 Files skipped from review as they are similar to previous changes (2)
  • resources/src/main/res/values/strings.xml
  • app/src/main/java/com/itsaky/androidide/fragments/output/BuildOutputFragment.kt

Comment on lines +1 to +11
<vector
xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M3,17v2h6v-2H3zM3,5v2h10V5H3zM13,21v-2h8v-2h-8v-2h-2v6H13zM7,9v2H3v2h4v2h2V9H7zM21,13v-2H11v2H21zM15,9h2V7h4V5h-4V3h-2V9z" />
</vector>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Move ic_tune.xml to the resources module.

Place this drawable in resources/src/main/res/drawable/ and remove the app-module copy. The app module already consumes resources from that module. Based on learnings: drawable resources should reside in resources/src/main/res/drawable/.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@app/src/main/res/drawable/ic_tune.xml` around lines 1 - 11, Move the drawable
resource represented by ic_tune.xml from the app module into the resources
module’s drawable directory, then remove the original app-module copy. Preserve
the vector contents and resource name so existing consumers continue resolving
it through the resources module.

Source: Learnings

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.

3 participants