← Back to Pull requests

add: read DeviceInfo from String #450

Closed
Logiase closed this pull request without merging on Aug 19, 2020 02:05 UTC
View on GitHub
Logiase Logiase commented on Jul 19, 2020 04:02 UTC
Author

添加从 符合DeviceInfoData规范的Json字符串 获取 DeviceInfo 的方法

以方便打包DeviceInfo或从网络获取

Diff: 32 lines (+32 / -0) across 3 files Reviewer: mzdluo123 Review duration: 44523m
All Vouch review confidence checks passed
Residual risk 0.05 = Change Risk (0.27) × (1 − Review Confidence (0.80)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.27 · 32 lines diff across 3 files
0.27
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.71 · 3 substantive comment(s)
0.71
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 50%
79%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size diff_size
0.209
Real PR Conversation Timeline
8 items
Him188 Him188 commented on Jul 19, 2020 04:17 UTC
Reviewer

感谢你的想法,但我并不赞同这个修改。

stringBased 有歧义,因 JSON 只是一种表示方法。
我个人倾向的做法是添加一个重载 fileBasedDeviceInfo(file: InputStream)

Logiase Logiase commented on Jul 19, 2020 13:44 UTC
Author

感谢你的想法,但我并不赞同这个修改。

> stringBased 有歧义,因 JSON 只是一种表示方法。

我个人倾向的做法是添加一个重载 fileBasedDeviceInfo(file: InputStream)

光从目前来看是没有太大歧义的(现在的DeviceInfo好像只有json一种格式)
InputStream的应用场景相较于json字符串还是小了一点,而且也有可能出现某些问题,如流中断等,另外相较于json字符串没法更有效的判断是否符合格式
:wink:

Him188 Him188 commented on Jul 21, 2020 20:05 UTC
Contributor

确实,目前接受的 file 参数也总是以 JSON 格式读取。
是否应该接受 String 参数还需要讨论。

mzdluo123 mzdluo123 approved these changes on Jul 22, 2020 04:01 UTC
Approved Reviewer

我觉得可以添加接受String参数

Karlatemp Karlatemp commented on Jul 31, 2020 01:46 UTC
Contributor

个人意见比起接受String还不如接受Reader参数支持更多

Karlatemp Karlatemp requested changes on Jul 31, 2020 06:13 UTC
Changes Requested Reviewer

不赞同此处检查, 当json不符合规范的时候应该直接抛出一个解析错误, 也就是直接parse, 数据时候正确应该由调用者自行保证, 能避免出现奇怪的问题.
关于检查可以检查是否为空, 为空的时候将创建一个新的, 否则直接parse. 不进行过多处理

Him188 Him188 commented on Jul 31, 2020 12:33 UTC
Reviewer

我倾向于添加 public fun loadDeviceInfoJson(json: String) (见上一个 commit)

Reviewers
Assignees
Logiase Logiase
Labels
risk: low confidence: 79.8% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 26.8% (LOW) · Higher = larger blast radius
26.8%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 79.8% · Lower = rushed or shallow review
79.8%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 5.4% · Safe to merge
5.4%
Repository