What changed, and why it matters
This commit cleans up a merge conflict in the Stack Wallet app. It adds a new optional database column to store the raw order status text from a third-party shopping service (ShopInBit), updates the generated database code, and fixes a small logic bug where an order status could be set to null. There is no obvious security vulnerability here; it looks like a routine data-model and bug-fix cleanup after merging two branches.
No security action required. Review the orphaned code in `shopinbit_order_model.dart` to ensure the file still compiles after the stray `static ... fromIsarTicket(...)` line was removed, and verify the new `statusRaw` field is handled safely when rendered in the UI.
Security signals we found
Null-guard added to status update logic, reducing risk of unintended null assignment
New nullable database column for raw third-party API status strings
Generated ORM code updated consistently with schema change
Stray method signature removed, possibly leaving syntax error in source file
Evidence from the diff
The diff adds a nullable statusRaw text column to the ShopInBitTickets Drift table and regenerates shared_database.g.dart to include the column in companions, filters, mappings, and JSON serialization. In shopinbit_orders_service.dart, the service now assigns model.statusRaw = statusResp.value!.stateRaw and only updates model.status when newStatus is non-null. In shopinbit_order_model.dart, a stray static ShopInBitOrderModel fromIsarTicket(ShopInBitTicket ticket) { line is removed, leaving the method body orphaned/invalid Dart unless the surrounding file already had matching braces. The change is defensive (null guard) and additive (raw status preservation).
Changed components
lib/db/drift/shared_db/tables/shopin_bit_tickets.dartlib/db/drift/shared_db/shared_database.g.dartlib/models/shopinbit/shopinbit_order_model.dartlib/services/shopinbit/shopinbit_orders_service.dartInspect captured patch +71 / −2
diff --git a/lib/db/drift/shared_db/shared_database.g.dart b/lib/db/drift/shared_db/shared_database.g.dart
index 24a3c83..28c4c39 100644
--- a/lib/db/drift/shared_db/shared_database.g.dart
+++ b/lib/db/drift/shared_db/shared_database.g.dart
@@ -538,6 +538,17 @@ class $ShopInBitTicketsTable extends ShopInBitTickets
).withConverter<ShopInBitOrderStatus>(
$ShopInBitTicketsTable.$converterstatus,
);
+ static const VerificationMeta _statusRawMeta = const VerificationMeta(
+ 'statusRaw',
+ );
+ @override
+ late final GeneratedColumn<String> statusRaw = GeneratedColumn<String>(
+ 'status_raw',
+ aliasedName,
+ true,
+ type: DriftSqlType.string,
+ requiredDuringInsert: false,
+ );
static const VerificationMeta _requestDescriptionMeta =
const VerificationMeta('requestDescription');
@override
@@ -762,6 +773,7 @@ class $ShopInBitTicketsTable extends ShopInBitTickets
displayName,
category,
status,
+ statusRaw,
requestDescription,
deliveryCountry,
offerProductName,
@@ -813,6 +825,12 @@ class $ShopInBitTicketsTable extends ShopInBitTickets
} else if (isInserting) {
context.missing(_displayNameMeta);
}
+ if (data.containsKey('status_raw')) {
+ context.handle(
+ _statusRawMeta,
+ statusRaw.isAcceptableOrUnknown(data['status_raw']!, _statusRawMeta),
+ );
+ }
if (data.containsKey('request_description')) {
context.handle(
_requestDescriptionMeta,
@@ -1020,6 +1038,10 @@ class $ShopInBitTicketsTable extends ShopInBitTickets
data['${effectivePrefix}status'],
)!,
),
+ statusRaw: attachedDatabase.typeMapping.read(
+ DriftSqlType.string,
+ data['${effectivePrefix}status_raw'],
+ ),
requestDescription: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}request_description'],
@@ -1121,6 +1143,7 @@ class ShopInBitTicket extends DataClass implements Insertable<ShopInBitTicket> {
final String displayName;
final ShopInBitCategory category;
final ShopInBitOrderStatus status;
+ final String? statusRaw;
final String requestDescription;
final String deliveryCountry;
final String? offerProductName;
@@ -1145,6 +1168,7 @@ class ShopInBitTicket extends DataClass implements Insertable<ShopInBitTicket> {
required this.displayName,
required this.category,
required this.status,
+ this.statusRaw,
required this.requestDescription,
required this.deliveryCountry,
this.offerProductName,
@@ -1180,6 +1204,9 @@ class ShopInBitTicket extends DataClass implements Insertable<ShopInBitTicket> {
$ShopInBitTicketsTable.$converterstatus.toSql(status),
);
}
+ if (!nullToAbsent || statusRaw != null) {
+ map['status_raw'] = Variable<String>(statusRaw);
+ }
map['request_description'] = Variable<String>(requestDescription);
map['delivery_country'] = Variable<String>(deliveryCountry);
if (!nullToAbsent || offerProductName != null) {
@@ -1228,6 +1255,9 @@ class ShopInBitTicket extends DataClass implements Insertable<ShopInBitTicket> {
displayName: Value(displayName),
category: Value(category),
status: Value(status),
+ statusRaw: statusRaw == null && nullToAbsent
+ ? const Value.absent()
+ : Value(statusRaw),
requestDescription: Value(requestDescription),
deliveryCountry: Value(deliveryCountry),
offerProductName: offerProductName == null && nullToAbsent
@@ -1278,6 +1308,7 @@ class ShopInBitTicket extends DataClass implements Insertable<ShopInBitTicket> {
status: $ShopInBitTicketsTable.$converterstatus.fromJson(
serializer.fromJson<int>(json['status']),
),
+ statusRaw: serializer.fromJson<String?>(json['statusRaw']),
requestDescription: serializer.fromJson<String>(
json['requestDescription'],
),
@@ -1323,6 +1354,7 @@ class ShopInBitTicket extends DataClass implements Insertable<ShopInBitTicket> {
'status': serializer.toJson<int>(
$ShopInBitTicketsTable.$converterstatus.toJson(status),
),
+ 'statusRaw': serializer.toJson<String?>(statusRaw),
'requestDescription': serializer.toJson<String>(requestDescription),
'deliveryCountry': serializer.toJson<String>(deliveryCountry),
'offerProductName': serializer.toJson<String?>(offerProductName),
@@ -1356,6 +1388,7 @@ class ShopInBitTicket extends DataClass implements Insertable<ShopInBitTicket> {
String? displayName,
ShopInBitCategory? category,
ShopInBitOrderStatus? status,
+ Value<String?> statusRaw = const Value.absent(),
String? requestDescription,
String? deliveryCountry,
Value<String?> offerProductName = const Value.absent(),
@@ -1380,6 +1413,7 @@ class ShopInBitTicket extends DataClass implements Insertable<ShopInBitTicket> {
displayName: displayName ?? this.displayName,
category: category ?? this.category,
status: status ?? this.status,
+ statusRaw: statusRaw.present ? statusRaw.value : this.statusRaw,
requestDescription: requestDescription ?? this.requestDescription,
deliveryCountry: deliveryCountry ?? this.deliveryCountry,
offerProductName: offerProductName.present
@@ -1420,6 +1454,7 @@ class ShopInBitTicket extends DataClass implements Insertable<ShopInBitTicket> {
: this.displayName,
category: data.category.present ? data.category.value : this.category,
status: data.status.present ? data.status.value : this.status,
+ statusRaw: data.statusRaw.present ? data.statusRaw.value : this.statusRaw,
requestDescription: data.requestDescription.present
? data.requestDescription.value
: this.requestDescription,
@@ -1483,6 +1518,7 @@ class ShopInBitTicket extends DataClass implements Insertable<ShopInBitTicket> {
..write('displayName: $displayName, ')
..write('category: $category, ')
..write('status: $status, ')
+ ..write('statusRaw: $statusRaw, ')
..write('requestDescription: $requestDescription, ')
..write('deliveryCountry: $deliveryCountry, ')
..write('offerProductName: $offerProductName, ')
@@ -1512,6 +1548,7 @@ class ShopInBitTicket extends DataClass implements Insertable<ShopInBitTicket> {
displayName,
category,
status,
+ statusRaw,
requestDescription,
deliveryCountry,
offerProductName,
@@ -1540,6 +1577,7 @@ class ShopInBitTicket extends DataClass implements Insertable<ShopInBitTicket> {
other.displayName == this.displayName &&
other.category == this.category &&
other.status == this.status &&
+ other.statusRaw == this.statusRaw &&
other.requestDescription == this.requestDescription &&
other.deliveryCountry == this.deliveryCountry &&
other.offerProductName == this.offerProductName &&
@@ -1566,6 +1604,7 @@ class ShopInBitTicketsCompanion extends UpdateCompanion<ShopInBitTicket> {
final Value<String> displayName;
final Value<ShopInBitCategory> category;
final Value<ShopInBitOrderStatus> status;
+ final Value<String?> statusRaw;
final Value<String> requestDescription;
final Value<String> deliveryCountry;
final Value<String?> offerProductName;
@@ -1591,6 +1630,7 @@ class ShopInBitTicketsCompanion extends UpdateCompanion<ShopInBitTicket> {
this.displayName = const Value.absent(),
this.category = const Value.absent(),
this.status = const Value.absent(),
+ this.statusRaw = const Value.absent(),
this.requestDescription = const Value.absent(),
this.deliveryCountry = const Value.absent(),
this.offerProductName = const Value.absent(),
@@ -1617,6 +1657,7 @@ class ShopInBitTicketsCompanion extends UpdateCompanion<ShopInBitTicket> {
required String displayName,
required ShopInBitCategory category,
required ShopInBitOrderStatus status,
+ this.statusRaw = const Value.absent(),
required String requestDescription,
required String deliveryCountry,
this.offerProductName = const Value.absent(),
@@ -1658,6 +1699,7 @@ class ShopInBitTicketsCompanion extends UpdateCompanion<ShopInBitTicket> {
Expression<String>? displayName,
Expression<int>? category,
Expression<int>? status,
+ Expression<String>? statusRaw,
Expression<String>? requestDescription,
Expression<String>? deliveryCountry,
Expression<String>? offerProductName,
@@ -1684,6 +1726,7 @@ class ShopInBitTicketsCompanion extends UpdateCompanion<ShopInBitTicket> {
if (displayName != null) 'display_name': displayName,
if (category != null) 'category': category,
if (status != null) 'status': status,
+ if (statusRaw != null) 'status_raw': statusRaw,
if (requestDescription != null) 'request_description': requestDescription,
if (deliveryCountry != null) 'delivery_country': deliveryCountry,
if (offerProductName != null) 'offer_product_name': offerProductName,
@@ -1717,6 +1760,7 @@ class ShopInBitTicketsCompanion extends UpdateCompanion<ShopInBitTicket> {
Value<String>? displayName,
Value<ShopInBitCategory>? category,
Value<ShopInBitOrderStatus>? status,
+ Value<String?>? statusRaw,
Value<String>? requestDescription,
Value<String>? deliveryCountry,
Value<String?>? offerProductName,
@@ -1743,6 +1787,7 @@ class ShopInBitTicketsCompanion extends UpdateCompanion<ShopInBitTicket> {
displayName: displayName ?? this.displayName,
category: category ?? this.category,
status: status ?? this.status,
+ statusRaw: statusRaw ?? this.statusRaw,
requestDescription: requestDescription ?? this.requestDescription,
deliveryCountry: deliveryCountry ?? this.deliveryCountry,
offerProductName: offerProductName ?? this.offerProductName,
@@ -1786,6 +1831,9 @@ class ShopInBitTicketsCompanion extends UpdateCompanion<ShopInBitTicket> {
$ShopInBitTicketsTable.$converterstatus.toSql(status.value),
);
}
+ if (statusRaw.present) {
+ map['status_raw'] = Variable<String>(statusRaw.value);
+ }
if (requestDescription.present) {
map['request_description'] = Variable<String>(requestDescription.value);
}
@@ -1864,6 +1912,7 @@ class ShopInBitTicketsCompanion extends UpdateCompanion<ShopInBitTicket> {
..write('displayName: $displayName, ')
..write('category: $category, ')
..write('status: $status, ')
+ ..write('statusRaw: $statusRaw, ')
..write('requestDescription: $requestDescription, ')
..write('deliveryCountry: $deliveryCountry, ')
..write('offerProductName: $offerProductName, ')
@@ -2230,6 +2279,7 @@ typedef $$ShopInBitTicketsTableCreateCompanionBuilder =
required String displayName,
required ShopInBitCategory category,
required ShopInBitOrderStatus status,
+ Value<String?> statusRaw,
required String requestDescription,
required String deliveryCountry,
Value<String?> offerProductName,
@@ -2257,6 +2307,7 @@ typedef $$ShopInBitTicketsTableUpdateCompanionBuilder =
Value<String> displayName,
Value<ShopInBitCategory> category,
Value<ShopInBitOrderStatus> status,
+ Value<String?> statusRaw,
Value<String> requestDescription,
Value<String> deliveryCountry,
Value<String?> offerProductName,
@@ -2314,6 +2365,11 @@ class $$ShopInBitTicketsTableFilterComposer
builder: (column) => ColumnWithTypeConverterFilters(column),
);
+ ColumnFilters<String> get statusRaw => $composableBuilder(
+ column: $table.statusRaw,
+ builder: (column) => ColumnFilters(column),
+ );
+
ColumnFilters<String> get requestDescription => $composableBuilder(
column: $table.requestDescription,
builder: (column) => ColumnFilters(column),
@@ -2444,6 +2500,11 @@ class $$ShopInBitTicketsTableOrderingComposer
builder: (column) => ColumnOrderings(column),
);
+ ColumnOrderings<String> get statusRaw => $composableBuilder(
+ column: $table.statusRaw,
+ builder: (column) => ColumnOrderings(column),
+ );
+
ColumnOrderings<String> get requestDescription => $composableBuilder(
column: $table.requestDescription,
builder: (column) => ColumnOrderings(column),
@@ -2563,6 +2624,9 @@ class $$ShopInBitTicketsTableAnnotationComposer
GeneratedColumnWithTypeConverter<ShopInBitOrderStatus, int> get status =>
$composableBuilder(column: $table.status, builder: (column) => column);
+ GeneratedColumn<String> get statusRaw =>
+ $composableBuilder(column: $table.statusRaw, builder: (column) => column);
+
GeneratedColumn<String> get requestDescription => $composableBuilder(
column: $table.requestDescription,
builder: (column) => column,
@@ -2697,6 +2761,7 @@ class $$ShopInBitTicketsTableTableManager
Value<String> displayName = const Value.absent(),
Value<ShopInBitCategory> category = const Value.absent(),
Value<ShopInBitOrderStatus> status = const Value.absent(),
+ Value<String?> statusRaw = const Value.absent(),
Value<String> requestDescription = const Value.absent(),
Value<String> deliveryCountry = const Value.absent(),
Value<String?> offerProductName = const Value.absent(),
@@ -2723,6 +2788,7 @@ class $$ShopInBitTicketsTableTableManager
displayName: displayName,
category: category,
status: status,
+ statusRaw: statusRaw,
requestDescription: requestDescription,
deliveryCountry: deliveryCountry,
offerProductName: offerProductName,
@@ -2750,6 +2816,7 @@ class $$ShopInBitTicketsTableTableManager
required String displayName,
required ShopInBitCategory category,
required ShopInBitOrderStatus status,
+ Value<String?> statusRaw = const Value.absent(),
required String requestDescription,
required String deliveryCountry,
Value<String?> offerProductName = const Value.absent(),
@@ -2775,6 +2842,7 @@ class $$ShopInBitTicketsTableTableManager
displayName: displayName,
category: category,
status: status,
+ statusRaw: statusRaw,
requestDescription: requestDescription,
deliveryCountry: deliveryCountry,
offerProductName: offerProductName,
diff --git a/lib/db/drift/shared_db/tables/shopin_bit_tickets.dart b/lib/db/drift/shared_db/tables/shopin_bit_tickets.dart
index b8afcc9..450053a 100644
--- a/lib/db/drift/shared_db/tables/shopin_bit_tickets.dart
+++ b/lib/db/drift/shared_db/tables/shopin_bit_tickets.dart
@@ -12,6 +12,7 @@ class ShopInBitTickets extends Table {
IntColumn get category => intEnum<ShopInBitCategory>()();
IntColumn get status => intEnum<ShopInBitOrderStatus>()();
+ TextColumn get statusRaw => text().nullable()();
TextColumn get requestDescription => text()();
TextColumn get deliveryCountry => text()();
diff --git a/lib/models/shopinbit/shopinbit_order_model.dart b/lib/models/shopinbit/shopinbit_order_model.dart
index 3b314eb..14b5304 100644
--- a/lib/models/shopinbit/shopinbit_order_model.dart
+++ b/lib/models/shopinbit/shopinbit_order_model.dart
@@ -324,7 +324,6 @@ class ShopInBitOrderModel extends ChangeNotifier {
)
.toList();
- static ShopInBitOrderModel fromIsarTicket(ShopInBitTicket ticket) {
return ShopInBitOrderModel()
.._displayName = ticket.displayName
.._category = ticket.category
diff --git a/lib/services/shopinbit/shopinbit_orders_service.dart b/lib/services/shopinbit/shopinbit_orders_service.dart
index 8651b4a..204bb25 100644
--- a/lib/services/shopinbit/shopinbit_orders_service.dart
+++ b/lib/services/shopinbit/shopinbit_orders_service.dart
@@ -82,7 +82,8 @@ class ShopInBitOrdersService extends ChangeNotifier {
final newStatus = ShopInBitOrderModel.statusFromTicketState(
statusResp.value!.state,
);
- if (model.status != newStatus) {
+ model.statusRaw = statusResp.value!.stateRaw;
+ if (model.status != newStatus && newStatus != null) {
model.status = newStatus;
changed = true;
}
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.