Skip to content

[PM-29673] Improved pre-polutated data on the FlightRecorder logs#6616

Open
aj-rosado wants to merge 2 commits intomainfrom
PM-29673/flight-recorder-export-header-info
Open

[PM-29673] Improved pre-polutated data on the FlightRecorder logs#6616
aj-rosado wants to merge 2 commits intomainfrom
PM-29673/flight-recorder-export-header-info

Conversation

@aj-rosado
Copy link
Contributor

🎟️ Tracking

https://bitwarden.atlassian.net/browse/PM-29673

📔 Objective

Added more info to the header of the FlightRecorder logs, making it more similar to the info displayed on the About's copy version.
Moved BuildInfoManagerExtensions.kt from UI to Core

@aj-rosado aj-rosado requested review from a team and david-livefront as code owners March 5, 2026 12:16
@github-actions github-actions bot added app:password-manager Bitwarden Password Manager app context app:authenticator Bitwarden Authenticator app context labels Mar 5, 2026
@codecov
Copy link

codecov bot commented Mar 5, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.96%. Comparing base (d0dc420) to head (fc71ec2).
⚠️ Report is 5 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6616      +/-   ##
==========================================
+ Coverage   85.89%   85.96%   +0.07%     
==========================================
  Files         803      801       -2     
  Lines       57198    57329     +131     
  Branches     8270     8307      +37     
==========================================
+ Hits        49130    49284     +154     
+ Misses       5195     5162      -33     
- Partials     2873     2883      +10     
Flag Coverage Δ
app-data 17.53% <ø> (-0.01%) ⬇️
app-ui-auth-tools 20.88% <ø> (-0.07%) ⬇️
app-ui-platform 15.07% <ø> (-0.05%) ⬇️
app-ui-vault 25.79% <ø> (-0.08%) ⬇️
authenticator 6.66% <ø> (+0.20%) ⬆️
lib-core-network-bridge 4.28% <ø> (-0.02%) ⬇️
lib-data-ui 0.93% <ø> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 5, 2026

Logo
Checkmarx One – Scan Summary & Details2e93045c-57a8-41c9-a869-48939aa0358a


Fixed Issues (1) Great job! The following issues were fixed in this Pull Request
Severity Issue Source File / Package
MEDIUM Use_of_Hardcoded_Password /app/src/test/kotlin/com/x8bit/bitwarden/data/platform/manager/sdk/repository/SdkCipherRepositoryTest.kt: 205

serverData?.version?.let { append(" $it") }
serverData?.environment?.cloudRegion?.let { append(" @ $it") }
}
.toString()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we define all this stuff outside of the BufferedWriter

@aj-rosado aj-rosado added the t:feature Change Type - Feature Development label Mar 5, 2026
.append("\uD83C\uDF29 Server:")
.apply {
serverData?.server?.name?.let { append(" $it") }
?: append(" Bitwarden Cloud")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we simplify this:

val serverInfo = StringBuilder()
    .append("\uD83C\uDF29 Server:")
    .append(" ${serverData?.server?.name ?: "Bitwarden Cloud"}")
    .apply {
        serverData?.version?.let { append(" $it") }
        serverData?.environment?.cloudRegion?.let { append(" @ $it") }
    }
    .toString()

bw.append(serverInfo)
bw.newLine()
bw.append("Fingerprint: ${Build.FINGERPRINT}")
bw.newLine()
Copy link
Collaborator

Choose a reason for hiding this comment

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

I noticed that there is a new appendLine api. What do you think of this?

            if (!logFile.exists()) {
                logFile.createNewFile()

                val ciInfo = buildInfoManager.ciBuildInfo?.takeIf { it.isNotBlank() }
                val serverData = serverConfigRepository.serverConfigStateFlow.value?.serverData
                val serverInfo = StringBuilder()
                    .append(serverData?.server?.name ?: "Bitwarden Cloud")
                    .apply {
                        serverData?.version?.let { append(" $it") }
                        serverData?.environment?.cloudRegion?.let { append(" @ $it") }
                    }
                    .toString()
                val startTime = Instant
                    .ofEpochMilli(data.startTimeMs)
                    .toFormattedPattern(pattern = LOG_TIME_PATTERN, clock = clock)
                // Upon creating the new file, we pre-populate it with basic data
                BufferedWriter(FileWriter(logFile, true)).use { bw ->
                    bw.appendLine("Bitwarden Android - ${buildInfoManager.applicationName}")
                    bw.appendLine("Log Start Time: $startTime")
                    bw.appendLine("Log Duration: ${data.durationMs.milliseconds}")
                    bw.appendLine("App Version: ${buildInfoManager.versionData}")
                    bw.appendLine("Build: ${buildInfoManager.buildAndFlavor}")
                    bw.appendLine("SDK Version: \uD83E\uDD80 ${buildInfoManager.sdkData}")
                    ciInfo.let { bw.appendLine("CI Build Info: $it") }
                    bw.appendLine("Device: ${buildInfoManager.deviceData}")
                    bw.appendLine("\uD83C\uDF29 Server: $serverInfo")
                    bw.appendLine("Fingerprint: ${Build.FINGERPRINT}")
                }
            }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app:authenticator Bitwarden Authenticator app context app:password-manager Bitwarden Password Manager app context t:feature Change Type - Feature Development

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants