repo
stringlengths
5
53
pr_number
int32
1
321k
task_type
stringclasses
2 values
issue_text
stringlengths
0
81.2k
pr_title
stringlengths
1
319
pr_body
stringlengths
0
105k
base_sha
stringlengths
40
40
head_sha
stringlengths
40
40
gold_diff
stringlengths
0
202M
changed_files
listlengths
0
100
review_threads
listlengths
0
100
test_patch
stringlengths
0
23.4M
merged
bool
1 class
thingsboard/thingsboard
15,666
issue_to_patch
Queue Prefix Setting leads to orphaned/redundant Kafka Topics **Describe the bug** We have encountered a bug that occurs when the configuration for the TB_QUEUE_PREFIX parameter is changed. When creating new queues via the Sysadmin UI, topics are created twice and are not deleted when the configuration is changed. **...
Fixed queue prefix not applied in some cases causing orphaned topics
## Pull Request description https://github.com/thingsboard/thingsboard/issues/15642 ## General checklist - [x] You have reviewed the guidelines [document](https://docs.google.com/document/d/1wqcOafLx5hth8SAg4dqV_LV3un3m5WYR8RdTJ4MbbUM/edit?usp=sharing). - [ ] [Labels](https://docs.github.com/en/issues/using-l...
27d34eead04bf547d55b13371658134cf87a01b6
07464fe568e387736f49d263efc4d860c6b91987
diff --git a/application/src/main/java/org/thingsboard/server/service/entitiy/queue/DefaultTbQueueService.java b/application/src/main/java/org/thingsboard/server/service/entitiy/queue/DefaultTbQueueService.java index 87c1aaa707e..4e42b41dd2d 100644 --- a/application/src/main/java/org/thingsboard/server/service/entitiy/...
[ "application/src/main/java/org/thingsboard/server/service/entitiy/queue/DefaultTbQueueService.java", "application/src/test/java/org/thingsboard/server/service/entitiy/queue/DefaultTbQueueServiceTest.java" ]
[ { "comment": "Rename to `topic`. Who knows what buildTopicName does, why \"prefixed\"?", "path": "application/src/main/java/org/thingsboard/server/service/entitiy/queue/DefaultTbQueueService.java", "hunk": "@@ -173,9 +175,10 @@ public void updateQueuesByTenants(List<TenantId> tenantIds, TenantProfile ne...
diff --git a/application/src/test/java/org/thingsboard/server/service/entitiy/queue/DefaultTbQueueServiceTest.java b/application/src/test/java/org/thingsboard/server/service/entitiy/queue/DefaultTbQueueServiceTest.java new file mode 100644 index 00000000000..81cc325bdbc --- /dev/null +++ b/application/src/test/java/org...
true
thingsboard/thingsboard
15,665
issue_to_patch
[LTS 4.3] Fixed queue prefix not applied when creating Kafka topics (orphaned topics)
## Pull Request description https://github.com/thingsboard/thingsboard/issues/15642 ## General checklist - [x] You have reviewed the guidelines [document](https://docs.google.com/document/d/1wqcOafLx5hth8SAg4dqV_LV3un3m5WYR8RdTJ4MbbUM/edit?usp=sharing). - [ ] [Labels](https://docs.github.com/en/issues/using-l...
5cae39fd2a985726a643219b19d23506b2a676a7
721a2f0058130c50caa49df4d48cc0215c74ce04
diff --git a/application/src/main/java/org/thingsboard/server/service/entitiy/queue/DefaultTbQueueService.java b/application/src/main/java/org/thingsboard/server/service/entitiy/queue/DefaultTbQueueService.java index 87c1aaa707e..4e42b41dd2d 100644 --- a/application/src/main/java/org/thingsboard/server/service/entitiy/...
[ "application/src/main/java/org/thingsboard/server/service/entitiy/queue/DefaultTbQueueService.java", "application/src/test/java/org/thingsboard/server/service/entitiy/queue/DefaultTbQueueServiceTest.java" ]
[]
diff --git a/application/src/test/java/org/thingsboard/server/service/entitiy/queue/DefaultTbQueueServiceTest.java b/application/src/test/java/org/thingsboard/server/service/entitiy/queue/DefaultTbQueueServiceTest.java new file mode 100644 index 00000000000..81cc325bdbc --- /dev/null +++ b/application/src/test/java/org...
true
thingsboard/thingsboard
15,621
issue_to_patch
fix(cf): prevent integer overflow in calculated field SUM output
## Pull Request description CE PR: https://github.com/thingsboard/thingsboard/pull/15620 ## General checklist - [ ] You have reviewed the guidelines [document](https://docs.google.com/document/d/1wqcOafLx5hth8SAg4dqV_LV3un3m5WYR8RdTJ4MbbUM/edit?usp=sharing). - [ ] [Labels](https://docs.github.com/en/issues/us...
49902e09e61dee5e6b49326a8a091e74f8e6f335
497895b0917b3263d717bb2806a4521db7435ffb
diff --git a/application/src/main/java/org/thingsboard/server/service/cf/ctx/state/SimpleCalculatedFieldState.java b/application/src/main/java/org/thingsboard/server/service/cf/ctx/state/SimpleCalculatedFieldState.java index 7f21f8d2e79..a837b5ebde2 100644 --- a/application/src/main/java/org/thingsboard/server/service/...
[ "application/src/main/java/org/thingsboard/server/service/cf/ctx/state/SimpleCalculatedFieldState.java", "application/src/test/java/org/thingsboard/server/service/cf/ctx/state/SimpleCalculatedFieldStateTest.java", "common/util/src/main/java/org/thingsboard/common/util/NumberUtils.java", "common/util/src/test/...
[]
diff --git a/application/src/test/java/org/thingsboard/server/service/cf/ctx/state/SimpleCalculatedFieldStateTest.java b/application/src/test/java/org/thingsboard/server/service/cf/ctx/state/SimpleCalculatedFieldStateTest.java index 4454d41e6e7..35f637dc09f 100644 --- a/application/src/test/java/org/thingsboard/server/...
true
thingsboard/thingsboard
15,620
issue_to_patch
Prevented integer overflow in calculated field SUM output
`SimpleCalculatedFieldState` rounded the `double` result down to `int` via `NumberUtils.toInt` when "Decimals by default" was `0` (the UI default). `BigDecimal.intValue()` returns only the low-order 32 bits, so a SUM above ~2.1B wrapped to a negative number (e.g. `3,980,173,734` → `-314,793,562`). ### Changes...
91695e611f8e145ec6621df58a0428ce6d4f494a
6e0630adc12cdc45c5469d102e9d4b6bedb58633
diff --git a/application/src/main/java/org/thingsboard/server/service/cf/ctx/state/SimpleCalculatedFieldState.java b/application/src/main/java/org/thingsboard/server/service/cf/ctx/state/SimpleCalculatedFieldState.java index 0d018f5def4..e3f1e94bf40 100644 --- a/application/src/main/java/org/thingsboard/server/service/...
[ "application/src/main/java/org/thingsboard/server/service/cf/ctx/state/SimpleCalculatedFieldState.java", "application/src/test/java/org/thingsboard/server/service/cf/ctx/state/SimpleCalculatedFieldStateTest.java", "common/script/script-api/src/main/java/org/thingsboard/script/api/tbel/TbUtils.java", "common/s...
[]
diff --git a/application/src/test/java/org/thingsboard/server/service/cf/ctx/state/SimpleCalculatedFieldStateTest.java b/application/src/test/java/org/thingsboard/server/service/cf/ctx/state/SimpleCalculatedFieldStateTest.java index 0001566abd5..723161ad87c 100644 --- a/application/src/test/java/org/thingsboard/server/...
true
thingsboard/thingsboard
15,720
issue_to_patch
Merge rc into master
Automated cascade merge: rc → master (conflicts resolved)
9abbcdb40ac0e0dc80de468a8d9825a4b81b2260
36824d3556cc5c637bb7fa5c3e46ac73cdf1207d
diff --git a/application/src/main/java/org/thingsboard/server/controller/SystemInfoController.java b/application/src/main/java/org/thingsboard/server/controller/SystemInfoController.java index 9bcd756de04..e414efa6e79 100644 --- a/application/src/main/java/org/thingsboard/server/controller/SystemInfoController.java +++...
[ "application/src/main/java/org/thingsboard/server/controller/SystemInfoController.java", "common/data/src/main/java/org/thingsboard/server/common/data/SystemParams.java", "common/edge-api/src/main/proto/edge.proto", "common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/service/...
[]
diff --git a/common/transport/transport-api/src/test/java/org/thingsboard/server/common/transport/service/CertificateReloadManagerTest.java b/common/transport/transport-api/src/test/java/org/thingsboard/server/common/transport/service/CertificateReloadManagerTest.java index 6f78eaefaeb..8894937177e 100644 --- a/common/...
true
thingsboard/thingsboard
15,709
issue_to_patch
Bump Netty to 4.1.134.Final to fix MQTT decoder regression
## Summary Bumps `netty.version` from `4.1.133.Final` to `4.1.134.Final` to fix an MQTT decoder regression introduced by the CVE-2026-44248 fix in 4.1.133. ## Symptom After upgrading to 4.1.133, MQTT transport logs explode with errors like: ``` o.t.s.t.mqtt.MqttTransportHandler [nioEventLoopGroup-3-9] ERROR [..] Me...
767fdbef6daac57bef7eb71004be96f41fe2b05b
3eab08db8bd1c911ae2fdc814dbe21181313152f
diff --git a/pom.xml b/pom.xml index 4a8958ffa3e..396033c9153 100755 --- a/pom.xml +++ b/pom.xml @@ -69,7 +69,7 @@ <spring-boot-test.version>3.5.13</spring-boot-test.version> <commons-lang3.version>3.18.0</commons-lang3.version> <!-- to fix CVE-2025-48924. TODO: remove when fixed in spring-boot-depend...
[ "pom.xml" ]
[]
true
thingsboard/thingsboard
14,910
issue_to_patch
String limit for 300> characters on attribute entity table
https://github.com/thingsboard/thingsboard/issues/14834 ## Pull Request description Attribute table shows extremely large objects that make the UI tough to navigate. ~~Easy fix is to limit extremely large objects. Hardcoded to 300 at the moment. Only edited the attributes table but likely need this implemented for ...
f6250e1c90af02478bc3429e50e8cbbe29f6843f
d4125ca179bf567a570a52f0c1f7706cd3647f2d
diff --git a/ui-ngx/src/app/modules/home/components/attribute/attribute-table.component.html b/ui-ngx/src/app/modules/home/components/attribute/attribute-table.component.html index 9ac6ac1846a..0ed2207b7f1 100644 --- a/ui-ngx/src/app/modules/home/components/attribute/attribute-table.component.html +++ b/ui-ngx/src/app/...
[ "ui-ngx/src/app/modules/home/components/attribute/attribute-table.component.html", "ui-ngx/src/app/shared/pipe/tbJson.pipe.ts" ]
[ { "comment": "For code cleanliness, consider making this an argument for the tbJson pipe maxLength", "path": "ui-ngx/src/app/modules/home/components/attribute/attribute-table.component.html", "hunk": "@@ -184,7 +184,7 @@\n (click)=\"editAttribute($event, attribute)\">\n <...
true
thingsboard/thingsboard
15,690
issue_to_patch
feat(iot-hub): single-step install dialog with rule chain profile toggle (4.3)
Forward-port of #15689 to the 4.3 line.
dfd61e0c394673bfce2c1894c4c5c4d30082da69
3640bf6b733269eaeb2a26da92a98e1d8ab5e333
diff --git a/ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-install-dialog.component.html b/ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-install-dialog.component.html index 19a43fcb300..102a55ad5e8 100644 --- a/ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-install-dialog.component.html +++ b/...
[ "ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-install-dialog.component.html", "ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-install-dialog.component.ts", "ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-item-card.component.ts", "ui-ngx/src/assets/locale/locale.constant-en_US.json" ]
[]
true
thingsboard/thingsboard
15,689
issue_to_patch
feat(iot-hub): single-step install dialog with rule chain profile toggle
## Summary - For Calculated Fields and Rule Chains, the install dialog opens directly at the entity-selection form, skipping the prior "Install?" confirmation step. Items without a follow-up selection (Dashboard, Widget, Solution Template) keep their confirmation step. - Rule Chain installs now use a single "Set as...
de794f2a285c701cf95fb8cc58a05349c606fc0e
af1b888cf01a6b563fb9c100d230cb834be19270
diff --git a/ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-install-dialog.component.html b/ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-install-dialog.component.html index 19a43fcb300..102a55ad5e8 100644 --- a/ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-install-dialog.component.html +++ b/...
[ "ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-install-dialog.component.html", "ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-install-dialog.component.ts", "ui-ngx/src/assets/locale/locale.constant-en_US.json" ]
[]
true
thingsboard/thingsboard
15,692
issue_to_patch
refactor: extract validateMaxDashboardsPerTenant in DashboardDataValidator
## Summary - Extracted the dashboard entities-limit check from `DashboardDataValidator.validateCreate` into a new public method `validateMaxDashboardsPerTenant(TenantId)`. - Allows callers outside the validator (e.g. controllers that need to enforce the dashboard limit before constructing a `Dashboard`) to reuse the s...
0b2c7854f299bea318e331025b2ef99bbe05fd3d
a55f6bd3df23ca65f18a501d6362661c33898ce6
diff --git a/dao/src/main/java/org/thingsboard/server/dao/service/validator/DashboardDataValidator.java b/dao/src/main/java/org/thingsboard/server/dao/service/validator/DashboardDataValidator.java index 12c4c62f943..a953e07197f 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/service/validator/DashboardDataVal...
[ "dao/src/main/java/org/thingsboard/server/dao/service/validator/DashboardDataValidator.java", "dao/src/test/java/org/thingsboard/server/dao/service/validator/DashboardDataValidatorTest.java" ]
[]
diff --git a/dao/src/test/java/org/thingsboard/server/dao/service/validator/DashboardDataValidatorTest.java b/dao/src/test/java/org/thingsboard/server/dao/service/validator/DashboardDataValidatorTest.java index 3029027f37b..4b9038a8947 100644 --- a/dao/src/test/java/org/thingsboard/server/dao/service/validator/Dashboar...
true
thingsboard/thingsboard
15,691
issue_to_patch
[UI sorting] Fixed UI sorting to match backend strategy
## Pull Request description Fixed UI sorting to match backend strategy ## General checklist - [x] You have reviewed the guidelines [document](https://docs.google.com/document/d/1wqcOafLx5hth8SAg4dqV_LV3un3m5WYR8RdTJ4MbbUM/edit?usp=sharing). - [x] [Labels](https://docs.github.com/en/issues/using-labels-and-mil...
27d34eead04bf547d55b13371658134cf87a01b6
12daf918e5fead8eade775767fa98ce952334e17
diff --git a/application/src/main/java/org/thingsboard/server/controller/SystemInfoController.java b/application/src/main/java/org/thingsboard/server/controller/SystemInfoController.java index 61240d304e4..1f7a3ab5f6c 100644 --- a/application/src/main/java/org/thingsboard/server/controller/SystemInfoController.java +++...
[ "application/src/main/java/org/thingsboard/server/controller/SystemInfoController.java", "common/data/src/main/java/org/thingsboard/server/common/data/SystemParams.java", "ui-ngx/src/app/core/auth/auth.models.ts", "ui-ngx/src/app/core/auth/auth.reducer.ts", "ui-ngx/src/app/core/auth/auth.service.ts", "ui-...
[]
true
thingsboard/thingsboard
15,589
issue_to_patch
[lts-4.3] CertificateReloadManagerTest: force deterministic mtime bump instead of polling
## Pull Request description Put your PR description here instead of this sentence. ## General checklist - [ ] You have reviewed the guidelines [document](https://docs.google.com/document/d/1wqcOafLx5hth8SAg4dqV_LV3un3m5WYR8RdTJ4MbbUM/edit?usp=sharing). - [ ] [Labels](https://docs.github.com/en/issues/using...
a430c4ddee0f565822e6e941714bb76a0a4fecdd
27b863d8479c98a6205a26b55ae66269f97f40c9
diff --git a/common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/service/CertificateReloadManager.java b/common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/service/CertificateReloadManager.java index 63f2247abaf..82b7981f8fc 100644 --- a/common/transpor...
[ "common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/service/CertificateReloadManager.java", "common/transport/transport-api/src/test/java/org/thingsboard/server/common/transport/service/CertificateReloadManagerTest.java" ]
[]
diff --git a/common/transport/transport-api/src/test/java/org/thingsboard/server/common/transport/service/CertificateReloadManagerTest.java b/common/transport/transport-api/src/test/java/org/thingsboard/server/common/transport/service/CertificateReloadManagerTest.java index 6f78eaefaeb..8894937177e 100644 --- a/common/...
true
thingsboard/thingsboard
15,590
issue_to_patch
[lts-4.2] CertificateReloadManagerTest: force deterministic mtime bump instead of polling
…of polling ## Pull Request description Put your PR description here instead of this sentence. ## General checklist - [ ] You have reviewed the guidelines [document](https://docs.google.com/document/d/1wqcOafLx5hth8SAg4dqV_LV3un3m5WYR8RdTJ4MbbUM/edit?usp=sharing). - [ ] [Labels](https://docs.github.com/...
27d34eead04bf547d55b13371658134cf87a01b6
e998026de37a6ffeabda0fad519b6d69976205dd
diff --git a/common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/service/CertificateReloadManager.java b/common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/service/CertificateReloadManager.java index 63f2247abaf..82b7981f8fc 100644 --- a/common/transpor...
[ "common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/service/CertificateReloadManager.java", "common/transport/transport-api/src/test/java/org/thingsboard/server/common/transport/service/CertificateReloadManagerTest.java" ]
[]
diff --git a/common/transport/transport-api/src/test/java/org/thingsboard/server/common/transport/service/CertificateReloadManagerTest.java b/common/transport/transport-api/src/test/java/org/thingsboard/server/common/transport/service/CertificateReloadManagerTest.java index 6f78eaefaeb..8894937177e 100644 --- a/common/...
true
thingsboard/thingsboard
15,679
issue_to_patch
Fixed missing error notification on 429 requests response status
## Pull Request description Put your PR description here instead of this sentence. ## General checklist - [x] You have reviewed the guidelines [document](https://docs.google.com/document/d/1wqcOafLx5hth8SAg4dqV_LV3un3m5WYR8RdTJ4MbbUM/edit?usp=sharing). - [x] [Labels](https://docs.github.com/en/issues/using...
cf9846a58cf5c535a2df663f598dd998acb6bc46
e716ff2264e4b360152e6f8b3bd100dbdda600c7
diff --git a/ui-ngx/src/app/core/interceptors/global-http-interceptor.ts b/ui-ngx/src/app/core/interceptors/global-http-interceptor.ts index 69791908b3b..6b5fb3e9b34 100644 --- a/ui-ngx/src/app/core/interceptors/global-http-interceptor.ts +++ b/ui-ngx/src/app/core/interceptors/global-http-interceptor.ts @@ -116,6 +116,...
[ "ui-ngx/src/app/core/interceptors/global-http-interceptor.ts" ]
[]
true
thingsboard/thingsboard
15,675
issue_to_patch
Fix preview imgs in the solutions tab
## Pull Request description Fix preview imgs in the solutions tab. No conflicts on PE. ## General checklist - [ ] You have reviewed the guidelines [document](https://docs.google.com/document/d/1wqcOafLx5hth8SAg4dqV_LV3un3m5WYR8RdTJ4MbbUM/edit?usp=sharing). - [ ] [Labels](https://docs.github.com/en/issues/usi...
65db41b95c424ca03b994f0852b45a876f09f72c
ec7c1e68ab61be4d155f1014421b8f0b9b46fc1c
diff --git a/ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-item-card.component.ts b/ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-item-card.component.ts index 49e35741880..38c1e26dcf6 100644 --- a/ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-item-card.component.ts +++ b/ui-ngx/src/app/module...
[ "ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-item-card.component.ts" ]
[]
true
thingsboard/thingsboard
15,676
issue_to_patch
Merge rc into master
Automated cascade merge: rc → master
4386bbf2d7262f050006afeae4f725e9b96cc2ce
1d5c191196b958c1ba79ab3f6fcaac12950ff425
[ "application/src/test/java/org/thingsboard/server/client/ClientDocsExampleTest.java" ]
[]
diff --git a/application/src/test/java/org/thingsboard/server/client/ClientDocsExampleTest.java b/application/src/test/java/org/thingsboard/server/client/ClientDocsExampleTest.java new file mode 100644 index 00000000000..e75f3b29c06 --- /dev/null +++ b/application/src/test/java/org/thingsboard/server/client/ClientDocsE...
true
thingsboard/thingsboard
15,669
issue_to_patch
Tests for Java client doc examples
## Pull Request description Put your PR description here instead of this sentence. ## General checklist - [ ] You have reviewed the guidelines [document](https://docs.google.com/document/d/1wqcOafLx5hth8SAg4dqV_LV3un3m5WYR8RdTJ4MbbUM/edit?usp=sharing). - [ ] [Labels](https://docs.github.com/en/issues/using...
5cae39fd2a985726a643219b19d23506b2a676a7
fab591f1eaa182d8559b450342dc49adc3871dcd
[ "application/src/test/java/org/thingsboard/server/client/ClientDocsExampleTest.java" ]
[]
diff --git a/application/src/test/java/org/thingsboard/server/client/ClientDocsExampleTest.java b/application/src/test/java/org/thingsboard/server/client/ClientDocsExampleTest.java new file mode 100644 index 00000000000..e75f3b29c06 --- /dev/null +++ b/application/src/test/java/org/thingsboard/server/client/ClientDocsE...
true
thingsboard/thingsboard
15,667
issue_to_patch
Merge rc into master
Automated cascade merge: rc → master
4bb3b1aa52fe700a48e5f70cc7e11c60542ca667
773cc5c6df4f3dd2e1e33164ece96b6f734bf2a7
diff --git a/common/data/src/main/java/org/thingsboard/server/common/data/ai/dto/TbUserMessage.java b/common/data/src/main/java/org/thingsboard/server/common/data/ai/dto/TbUserMessage.java index e1f0b84a4dc..9e91adb2c0f 100644 --- a/common/data/src/main/java/org/thingsboard/server/common/data/ai/dto/TbUserMessage.java ...
[ "TEST_FAST.md", "application/src/test/java/org/thingsboard/server/controller/RuleChainControllerTest.java", "common/data/src/main/java/org/thingsboard/server/common/data/ai/dto/TbUserMessage.java", "common/data/src/main/java/org/thingsboard/server/common/data/query/AvailableEntityKeys.java", "common/data/sr...
[]
diff --git a/TEST_FAST.md b/TEST_FAST.md index eb2013c6019..fbea72db9cb 100644 --- a/TEST_FAST.md +++ b/TEST_FAST.md @@ -10,6 +10,7 @@ export SUREFIRE_JAVA_OPTS="-Xmx1200m -Xss256k -XX:+ExitOnOutOfMemoryError" mvn clean install -T6 -DskipTests -Dpkg.skip=true mvn test -pl='!application,!dao,!ui-ngx,!msa/js-executor...
true
thingsboard/thingsboard
15,664
issue_to_patch
Fixed CVE-2026-44728, CVE-2026-6322, CVE-2026-6321 and CVE-2026-45149
## Pull Request description Put your PR description here instead of this sentence. ## General checklist - [x] You have reviewed the guidelines [document](https://docs.google.com/document/d/1wqcOafLx5hth8SAg4dqV_LV3un3m5WYR8RdTJ4MbbUM/edit?usp=sharing). - [x] [Labels](https://docs.github.com/en/issues/using...
71379ece5aaec9d4bef0006e23dd2e8bb30d3a82
561d9dea5d6eeea3ca30b3462d7995875ec6ac21
diff --git a/ui-ngx/yarn.lock b/ui-ngx/yarn.lock index e9564f5279a..6b5f48283ba 100644 --- a/ui-ngx/yarn.lock +++ b/ui-ngx/yarn.lock @@ -987,14 +987,14 @@ "@babel/helper-plugin-utils" "^7.28.6" "@babel/plugin-transform-modules-systemjs@^7.27.1": - version "7.28.5" - resolved "https://registry.yarnpkg.com/@bab...
[ "ui-ngx/yarn.lock" ]
[]
true
thingsboard/thingsboard
15,657
issue_to_patch
Fixed re-render filters table rows after add, duplicate, or remove
## Pull Request description Put your PR description here instead of this sentence. ## General checklist - [x] You have reviewed the guidelines [document](https://docs.google.com/document/d/1wqcOafLx5hth8SAg4dqV_LV3un3m5WYR8RdTJ4MbbUM/edit?usp=sharing). - [x] [Labels](https://docs.github.com/en/issues/using...
79bb2b0a659dc26792d4c74b0f67e565b959688a
cbdec0fdc5c9a1425b8278d12e0785715c051fe4
diff --git a/ui-ngx/src/app/modules/home/components/filter/filters-dialog.component.html b/ui-ngx/src/app/modules/home/components/filter/filters-dialog.component.html index 452045d1641..0a1fd592756 100644 --- a/ui-ngx/src/app/modules/home/components/filter/filters-dialog.component.html +++ b/ui-ngx/src/app/modules/home...
[ "ui-ngx/src/app/modules/home/components/filter/filters-dialog.component.html", "ui-ngx/src/app/modules/home/components/filter/filters-dialog.component.ts" ]
[]
true
thingsboard/thingsboard
15,655
issue_to_patch
[OpenApi] Fixed openapi descriptions for arrays
## Pull Request description Fixed openapi descriptions for arrays ## General checklist - [x] You have reviewed the guidelines [document](https://docs.google.com/document/d/1wqcOafLx5hth8SAg4dqV_LV3un3m5WYR8RdTJ4MbbUM/edit?usp=sharing). - [x] [Labels](https://docs.github.com/en/issues/using-labels-and-mileston...
907595d9a1eeae74a3918c6c146068ffb85da04b
6079cbb1808a434cd2a757a87e6b981141a2874f
diff --git a/common/data/src/main/java/org/thingsboard/server/common/data/ai/dto/TbUserMessage.java b/common/data/src/main/java/org/thingsboard/server/common/data/ai/dto/TbUserMessage.java index e1f0b84a4dc..9e91adb2c0f 100644 --- a/common/data/src/main/java/org/thingsboard/server/common/data/ai/dto/TbUserMessage.java ...
[ "common/data/src/main/java/org/thingsboard/server/common/data/ai/dto/TbUserMessage.java", "common/data/src/main/java/org/thingsboard/server/common/data/query/AvailableEntityKeys.java", "common/data/src/main/java/org/thingsboard/server/common/data/query/AvailableEntityKeysV2.java", "common/data/src/main/java/o...
[]
true
thingsboard/thingsboard
15,650
issue_to_patch
Fixed CVE-2026-41284, CVE-2026-43512
## Summary Forward-merge of the embedded Tomcat 10.1.55 bump from `fix/cves-lts-4.2` into the `lts-4.3` line. Fixes the same 2 CVEs in `tomcat-embed-core`. No additional bumps were required on `lts-4.3` — the merge alone brought the override across. Source: TeamCity security scan https://builds.thingsboard.io/buildCo...
266c7b3ab1da1577e000350cdaf5d70f79358d10
cb07ebe25eb2be498891f96524f78e4fcc698a05
diff --git a/pom.xml b/pom.xml index 222888a6506..306879f4fab 100755 --- a/pom.xml +++ b/pom.xml @@ -71,6 +71,7 @@ <commons-lang3.version>3.18.0</commons-lang3.version> <!-- to fix CVE-2025-48924. TODO: remove when fixed in spring-boot-dependencies --> <postgresql.version>42.7.11</postgresql.version> ...
[ "pom.xml" ]
[]
true
thingsboard/thingsboard
15,649
issue_to_patch
Fixed CVE-2026-41284, CVE-2026-43512
## Summary Fixes 2 CVEs in the embedded Tomcat servlet container shipped via Spring Boot 3.5.14. Bumps `tomcat.version` from 10.1.54 (Spring Boot default) to 10.1.55 and adds explicit `dependencyManagement` overrides for `tomcat-embed-core`, `tomcat-embed-el`, and `tomcat-embed-websocket` before the `spring-boot-depen...
0d5191dfeff6fe651b428d408f75459b616cc6e0
bd0427e8756be9c6acca78516e1f5b5a4b8200fd
diff --git a/pom.xml b/pom.xml index 24f8f9e1c20..4a8958ffa3e 100755 --- a/pom.xml +++ b/pom.xml @@ -70,6 +70,7 @@ <commons-lang3.version>3.18.0</commons-lang3.version> <!-- to fix CVE-2025-48924. TODO: remove when fixed in spring-boot-dependencies --> <postgresql.version>42.7.11</postgresql.version> ...
[ "pom.xml" ]
[]
true
thoughtbot/factory_bot
1,819
issue_to_patch
Include Gemfile.lock in release preparation commit
## Summary The `bundle install` step in the prepare-release workflow updates `Gemfile.lock` to reflect the new gem version, but it wasn't being staged before the release commit. This left `Gemfile.lock` dirty, causing the release workflow to fail with: > There are files that need to be committed first. This PR fixes...
8b2d41a2f36b469ab6b6b51760b5750a8b683794
4f2101a51310ad367c1fc2f7d808b3f0791e69de
diff --git a/.github/workflows/prepare-release.yml b/.github/workflows/prepare-release.yml index c58233302..734213d55 100644 --- a/.github/workflows/prepare-release.yml +++ b/.github/workflows/prepare-release.yml @@ -51,7 +51,7 @@ jobs: git config user.name "github-actions[bot]" git config user.em...
[ ".github/workflows/prepare-release.yml", "Gemfile.lock" ]
[]
true
thoughtbot/factory_bot
1,818
issue_to_patch
Fix release workflow: add workflow_dispatch, environment, and .tool-versions
## Summary - Adds `workflow_dispatch` to the release workflow so a release can be triggered manually without needing to bump `lib/factory_bot/version.rb` - Runs the release job in the `release` GitHub Actions environment, enabling environment-scoped secrets and optional required reviewers - Adds a `.tool-versions` fil...
aaa92752603cdef017cd5fef3718ae81fb4858f9
915057121caccf6c643c7531f3f5a5b9c249cf83
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 48d235007..b07a6c01e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -59,8 +59,6 @@ jobs: steps: - uses: actions/checkout@v6 - uses: ruby/setup-ruby@v1 - with: - ruby-version: "3...
[ ".github/workflows/build.yml", ".github/workflows/prepare-release.yml", ".github/workflows/release.yml", ".tool-versions" ]
[]
true
thoughtbot/factory_bot
1,817
issue_to_patch
Release v6.6.0
Bumps version to `6.6.0` and updates the changelog with merged PRs since the last release.
c47758a56fa0f27c1a14a187723535415e9cf9d1
43177c5b5a2b856cf703c0d9ed8a75924418f5e0
diff --git a/NEWS.md b/NEWS.md index e4a8280b4..a0dd1268b 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,8 +1,18 @@ # News -## Unreleased +## 6.6.0 (May 4, 2026) * Feat: Added `factory_bot.before_run_factory` instrumentation event +* Add workflow to prepare a release PR by @neilvcarvalho in [#1816](https://github.com/t...
[ "NEWS.md", "lib/factory_bot/version.rb" ]
[]
true
thoughtbot/factory_bot
1,815
issue_to_patch
Add gem release workflow with GitHub release notes from changelog
## Summary - Adds a GitHub Actions workflow that triggers when `lib/factory_bot/version.rb` changes on `main` and publishes the gem to RubyGems.org - Uses RubyGems trusted publishing (OIDC) so no API key needs to be stored as a secret — compatible with the `rubygems_mfa_required` restriction in the gemspec - After the...
ab745254e38f62952b4efe6cf93891adbedfb1bb
5747bff9ebc70a3366727c51904b89c710c61bc9
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000..aa5e5b3ad --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,45 @@ +name: Release + +on: + push: + branches: [main] + paths: + - lib/factory_bot/version.rb + +jobs: + release: + nam...
[ ".github/workflows/release.yml", ".github/workflows/validate-changelog.yml" ]
[ { "comment": "The grep pattern is a regex and is not anchored after the version, so it can incorrectly pass when NEWS.md contains a different version that merely starts with the same prefix (e.g., checking for 6.5.6 would match a header like `## 6.5.6.1 (...)`). Consider using a fixed-string match and/or enforc...
true
thoughtbot/factory_bot
1,815
comment_to_fix
Add gem release workflow with GitHub release notes from changelog
`--notes "${{ steps.release_notes.outputs.notes }}"` is inserted into a bash script in double quotes, so any `"`, backticks, or `$()` sequences in NEWS.md can break quoting or trigger shell command substitution at runtime. Since NEWS.md is repo content, a malicious (or accidental) changelog entry could execute commands...
ab745254e38f62952b4efe6cf93891adbedfb1bb
5747bff9ebc70a3366727c51904b89c710c61bc9
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000..aa5e5b3ad --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,45 @@ +name: Release + +on: + push: + branches: [main] + paths: + - lib/factory_bot/version.rb + +jobs: + release: + nam...
[ ".github/workflows/release.yml" ]
[ { "comment": "`--notes \"${{ steps.release_notes.outputs.notes }}\"` is inserted into a bash script in double quotes, so any `\"`, backticks, or `$()` sequences in NEWS.md can break quoting or trigger shell command substitution at runtime. Since NEWS.md is repo content, a malicious (or accidental) changelog ent...
true
thoughtbot/factory_bot
1,815
comment_to_fix
Add gem release workflow with GitHub release notes from changelog
`grep -q "^## $VERSION"` treats `VERSION` as a regular expression, so dots and other regex metacharacters in the version (e.g., `6.5.6`) can match unintended headers. Use a fixed-string match (e.g., `grep -F`) or escape the version before building the pattern so the check is exact.
ab745254e38f62952b4efe6cf93891adbedfb1bb
5747bff9ebc70a3366727c51904b89c710c61bc9
diff --git a/.github/workflows/validate-changelog.yml b/.github/workflows/validate-changelog.yml new file mode 100644 index 000000000..c2e07ca14 --- /dev/null +++ b/.github/workflows/validate-changelog.yml @@ -0,0 +1,22 @@ +name: Validate changelog + +on: + pull_request: + paths: + - lib/factory_bot/version.rb...
[ ".github/workflows/validate-changelog.yml" ]
[ { "comment": "`grep -q \"^## $VERSION\"` treats `VERSION` as a regular expression, so dots and other regex metacharacters in the version (e.g., `6.5.6`) can match unintended headers. Use a fixed-string match (e.g., `grep -F`) or escape the version before building the pattern so the check is exact.\n", "path...
true
thoughtbot/factory_bot
1,815
comment_to_fix
Add gem release workflow with GitHub release notes from changelog
This workflow runs `ruby -e ...` without installing/choosing a Ruby version. On `ubuntu-latest` the preinstalled Ruby version is not guaranteed and can change, which can make this PR check flaky over time. Consider adding `ruby/setup-ruby@v1` (consistent with `.github/workflows/release.yml` and `build.yml`) before invo...
ab745254e38f62952b4efe6cf93891adbedfb1bb
5747bff9ebc70a3366727c51904b89c710c61bc9
diff --git a/.github/workflows/validate-changelog.yml b/.github/workflows/validate-changelog.yml new file mode 100644 index 000000000..c2e07ca14 --- /dev/null +++ b/.github/workflows/validate-changelog.yml @@ -0,0 +1,22 @@ +name: Validate changelog + +on: + pull_request: + paths: + - lib/factory_bot/version.rb...
[ ".github/workflows/validate-changelog.yml" ]
[ { "comment": "This workflow runs `ruby -e ...` without installing/choosing a Ruby version. On `ubuntu-latest` the preinstalled Ruby version is not guaranteed and can change, which can make this PR check flaky over time. Consider adding `ruby/setup-ruby@v1` (consistent with `.github/workflows/release.yml` and `b...
true
thoughtbot/factory_bot
1,815
comment_to_fix
Add gem release workflow with GitHub release notes from changelog
The `awk` header match `/^## $VERSION/` treats `VERSION` as a regex; version strings typically contain `.` which matches any character. This can cause the notes extraction to start at the wrong section if another header happens to match the regex. Pass the version via `-v` and do a fixed-string/prefix comparison (or es...
ab745254e38f62952b4efe6cf93891adbedfb1bb
5747bff9ebc70a3366727c51904b89c710c61bc9
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000..aa5e5b3ad --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,45 @@ +name: Release + +on: + push: + branches: [main] + paths: + - lib/factory_bot/version.rb + +jobs: + release: + nam...
[ ".github/workflows/release.yml" ]
[ { "comment": "The `awk` header match `/^## $VERSION/` treats `VERSION` as a regex; version strings typically contain `.` which matches any character. This can cause the notes extraction to start at the wrong section if another header happens to match the regex. Pass the version via `-v` and do a fixed-string/pr...
true
thoughtbot/factory_bot
1,815
comment_to_fix
Add gem release workflow with GitHub release notes from changelog
`gh release create` will create the tag if it doesn’t exist, but without specifying `--target` it may tag whatever commit is HEAD on the default branch at the time the command runs (which can advance during the workflow). Set `--target $GITHUB_SHA` (or `${{ github.sha }}`) so the release/tag is guaranteed to point at t...
ab745254e38f62952b4efe6cf93891adbedfb1bb
5747bff9ebc70a3366727c51904b89c710c61bc9
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000..aa5e5b3ad --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,45 @@ +name: Release + +on: + push: + branches: [main] + paths: + - lib/factory_bot/version.rb + +jobs: + release: + nam...
[ ".github/workflows/release.yml" ]
[ { "comment": "`gh release create` will create the tag if it doesn’t exist, but without specifying `--target` it may tag whatever commit is HEAD on the default branch at the time the command runs (which can advance during the workflow). Set `--target $GITHUB_SHA` (or `${{ github.sha }}`) so the release/tag is gu...
true
thoughtbot/factory_bot
1,816
issue_to_patch
Add workflow to prepare a release PR
## Summary Adds a manually-triggered workflow that automates the mechanical parts of preparing a release: - A maintainer picks `patch`, `minor`, or `major` from a dropdown in the GitHub Actions UI - Uses `gem-release`'s `gem bump` to update `lib/factory_bot/version.rb` - Collects all merged PRs since the last release...
ab745254e38f62952b4efe6cf93891adbedfb1bb
5d61d823583affbf4d5463a774527445cff791be
diff --git a/.github/workflows/prepare-release.yml b/.github/workflows/prepare-release.yml new file mode 100644 index 000000000..22e92a405 --- /dev/null +++ b/.github/workflows/prepare-release.yml @@ -0,0 +1,64 @@ +name: Prepare release + +on: + workflow_dispatch: + inputs: + bump: + description: Versio...
[ ".github/workflows/prepare-release.yml", "Rakefile", "tasks/release.rake" ]
[ { "comment": "The `## Unreleased` extraction/removal regex only matches when another `## ...` header follows. If `## Unreleased` is the last section in `NEWS.md`, it won’t be merged/removed. Consider extending the regex to also match end-of-file so this works regardless of section ordering.\n```suggestion\n ...
true
thoughtbot/factory_bot
1,814
issue_to_patch
Require MFA for gem pushes
This adds the `rubygems_mfa_required` metadata to the gemspec, requiring multi-factor authentication for privileged operations on RubyGems.org. This is a protection against supply chain attacks like the recent NPM Axios compromise: https://socket.dev/blog/axios-npm-package-compromised Reference: https://guides.rubyge...
26f3680fef187db7d61a9adbfc26062aeba98459
a55285e8993d04ae0d07fd7ef49e04a71ab5f234
diff --git a/factory_bot.gemspec b/factory_bot.gemspec index 75948e257..892e70af0 100644 --- a/factory_bot.gemspec +++ b/factory_bot.gemspec @@ -23,7 +23,8 @@ Gem::Specification.new do |s| s.homepage = "https://github.com/thoughtbot/factory_bot" s.metadata = { - "changelog_uri" => "https://github.com/thought...
[ "factory_bot.gemspec" ]
[]
true
thoughtbot/factory_bot
1,795
issue_to_patch
Add `factory_bot.before_factory_run` instrumentation event <!-- By contributing to this project, you agree to abide by the thoughtbot Code of Conduct: https://thoughtbot.com/open-source-code-of-conduct --> ### Problem this feature will solve <!-- A clear and concise description of what the problem is. Ex. When ...
Add `factory_bot.before_run_factory` instrumentation event
## Summary - Adds a new `factory_bot.before_run_factory` ActiveSupport::Notifications event that fires immediately before `run_factory` - Enables subscribers to build a factory call stack at runtime for debugging deeply nested association errors - Reuses the existing `instrumentation_payload` — no new payload construc...
d3d6b85319e00f55ac45af73a37f48e5950f22c0
071b61ddb4317f2ccf38db368a8b2504eead8825
diff --git a/GETTING_STARTED.md b/GETTING_STARTED.md index 56bcb62f6..10c061af7 100644 --- a/GETTING_STARTED.md +++ b/GETTING_STARTED.md @@ -2084,6 +2084,26 @@ config.after(:suite) do end ``` +You can also subscribe to `factory_bot.before_run_factory` to be notified +before a factory is run. This is useful for buil...
[ "GETTING_STARTED.md", "NEWS.md", "docs/src/activesupport-instrumentation/summary.md", "lib/factory_bot/factory_runner.rb", "spec/acceptance/activesupport_instrumentation_spec.rb" ]
[]
diff --git a/spec/acceptance/activesupport_instrumentation_spec.rb b/spec/acceptance/activesupport_instrumentation_spec.rb index ce9c1bc10..f4a76a5ab 100644 --- a/spec/acceptance/activesupport_instrumentation_spec.rb +++ b/spec/acceptance/activesupport_instrumentation_spec.rb @@ -79,6 +79,93 @@ def subscribed(callback,...
true
thoughtbot/factory_bot
1,579
issue_to_patch
DefinitionProxy#method_missing: Forward given block to #association
Replacement for the prematurely closed PR #1518 Why: ---- When defining an association the block-argument will be ignored when also providing a `factory`-key on the association definition. This behaviour might be unexpected, so we should raise an error that the passed block is unexpected/ignored.
d3d6b85319e00f55ac45af73a37f48e5950f22c0
dca8384ceae0f2e94010fb6129a8f942c1aa9616
diff --git a/lib/factory_bot/definition_proxy.rb b/lib/factory_bot/definition_proxy.rb index fc3d5dfc8..efa71b1e0 100644 --- a/lib/factory_bot/definition_proxy.rb +++ b/lib/factory_bot/definition_proxy.rb @@ -94,7 +94,7 @@ def method_missing(name, *args, &block) # rubocop:disable Style/MissingRespondTo if associ...
[ "lib/factory_bot/definition_proxy.rb", "spec/factory_bot/definition_proxy_spec.rb" ]
[]
diff --git a/spec/factory_bot/definition_proxy_spec.rb b/spec/factory_bot/definition_proxy_spec.rb index 8fe0ba257..c1e77c066 100644 --- a/spec/factory_bot/definition_proxy_spec.rb +++ b/spec/factory_bot/definition_proxy_spec.rb @@ -73,6 +73,19 @@ /'static_attributes_are_gone'.*'broken' factory.*Did you mean\? '...
true
thoughtbot/factory_bot
1,794
issue_to_patch
Remove CodeClimate badge from README
Remove CodeClimate badge from README
## Summary - Removes the CodeClimate badge from the README badge row - Removes the associated `[grade-image]` and `[grade]` reference link definitions Closes #1792
8a64d2938fd2269fb55c7e4794ca07cf045ad2f7
abf3c51c109a43f1c8b40905069f6423d3f54ec2
diff --git a/README.md b/README.md index 3dcd4ab1f..66930b3f0 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # factory_bot -[![Build Status][ci-image]][ci] [![Code Climate][grade-image]][grade] [![Gem Version][version-image]][version] +[![Build Status][ci-image]][ci] [![Gem Version][version-image]][version]...
[ "README.md" ]
[]
true
thoughtbot/factory_bot
1,793
issue_to_patch
Update CI matrix
Adds Rails 8.0x and Ruby 4. Removes some EOL Ruby and Rails 3.0 and Rails 6.1 https://endoflife.date/rails https://endoflife.date/ruby
5115775355323252da65f323f6c10b91f2130d48
553620ea2dcb3b23ac621d40ae029c56d8a6ef6b
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4a869937e..48d235007 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,26 +13,27 @@ jobs: ruby: - jruby-9.4 - truffleruby + - "4.0" - "3.4" - "3.3" ...
[ ".github/workflows/build.yml", "gemfiles/6.1.gemfile", "gemfiles/8.0.gemfile" ]
[]
true
thoughtbot/factory_bot
1,726
issue_to_patch
Execute `FactoryBot.lint!` in database transactions
Prior to this change `FactoryBot.lint!` execution can trigger sequential `FactoryBot.create` calls made within the same test (either Minitest `test` or RSpec `it` blocks). This can result in linting violations for records that have database-level uniqueness constraints. This commit introduces the private `Linter#...
77718280b807337c8e6f6e8bb9a8460a92aa5065
b7e1dd1013c8d467b513335cdfc955c872c5fd0d
diff --git a/NEWS.md b/NEWS.md index 4fa40a831..c81b62f81 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,9 @@ # News +## Unreleased + + * Changed: execute linting tests within ActiveRecord transactions when available + ## 6.5.0 (September 6, 2024) * fix: issue 1621 broken links in ref/factory.md by @elasticspo...
[ "NEWS.md", "lib/factory_bot/linter.rb", "spec/acceptance/lint_spec.rb" ]
[ { "comment": "This expectation raises a warning:\r\n\r\n> WARNING: Using `expect { }.not_to raise_error(SpecificErrorClass)` risks false positives, since literally any other error would cause the expectation to pass, including those raised by Ruby (e.g. `NoMethodError`, `NameError` and `ArgumentError`), meaning...
diff --git a/spec/acceptance/lint_spec.rb b/spec/acceptance/lint_spec.rb index 5a268454a..8ecbc6e31 100644 --- a/spec/acceptance/lint_spec.rb +++ b/spec/acceptance/lint_spec.rb @@ -26,6 +26,24 @@ }.to raise_error FactoryBot::InvalidFactoryError, error_message end + it "executes linting in an ActiveRecord::Ba...
true
thoughtbot/factory_bot
1,726
comment_to_fix
Execute `FactoryBot.lint!` in database transactions
This expectation raises a warning: > WARNING: Using `expect { }.not_to raise_error(SpecificErrorClass)` risks false positives, since literally any other error would cause the expectation to pass, including those raised by Ruby (e.g. `NoMethodError`, `NameError` and `ArgumentError`), meaning the code you are intendin...
77718280b807337c8e6f6e8bb9a8460a92aa5065
b7e1dd1013c8d467b513335cdfc955c872c5fd0d
diff --git a/spec/acceptance/lint_spec.rb b/spec/acceptance/lint_spec.rb index 5a268454a..8ecbc6e31 100644 --- a/spec/acceptance/lint_spec.rb +++ b/spec/acceptance/lint_spec.rb @@ -26,6 +26,24 @@ }.to raise_error FactoryBot::InvalidFactoryError, error_message end + it "executes linting in an ActiveRecord::Ba...
[ "spec/acceptance/lint_spec.rb" ]
[ { "comment": "This expectation raises a warning:\r\n\r\n> WARNING: Using `expect { }.not_to raise_error(SpecificErrorClass)` risks false positives, since literally any other error would cause the expectation to pass, including those raised by Ruby (e.g. `NoMethodError`, `NameError` and `ArgumentError`), meaning...
true
thoughtbot/factory_bot
1,791
issue_to_patch
Bump actions/checkout from 5 to 6
Bumps [actions/checkout](https://github.com/actions/checkout) from 5 to 6. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/actions/checkout/releases">actions/checkout's releases</a>.</em></p> <blockquote> <h2>v6.0.0</h2> <h2>What's Changed</h2> <ul> <li>Update README to includ...
27e97b40b72d68aab14b8b8ae75284aa3a134456
8f7ba662e5eabe1a3eed9f7273c7395937b602e4
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 66fbed14d..4a869937e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -43,7 +43,7 @@ jobs: BUNDLE_GEMFILE: gemfiles/${{ matrix.rails }}.gemfile steps: - - uses: actions/checkout@v5 + - uses:...
[ ".github/workflows/build.yml", ".github/workflows/docs.yml" ]
[]
true
thoughtbot/factory_bot
1,790
issue_to_patch
Ensure linting transactions don't interfere with ActiveRecord lifecycle
Our FactoryBot linting started failing for a factory despite evidence that the trait combination was producing a valid model in test. We eventually traced that down to the change made in #1726. Introducing a `ActiveRecord::Base.transaction` meant that the `after_commit` hooks of our model weren't running during linting...
a9884ff701872c2b8f1148cc8a34acac7694996b
a9741fe82eff6900100db7bb3e2f07f36dcc7d93
diff --git a/lib/factory_bot/linter.rb b/lib/factory_bot/linter.rb index a381d4493..f0bb9ae27 100644 --- a/lib/factory_bot/linter.rb +++ b/lib/factory_bot/linter.rb @@ -109,7 +109,7 @@ def error_message_type def in_transaction if defined?(ActiveRecord::Base) - ActiveRecord::Base.transaction do + ...
[ "lib/factory_bot/linter.rb", "spec/acceptance/lint_spec.rb" ]
[]
diff --git a/spec/acceptance/lint_spec.rb b/spec/acceptance/lint_spec.rb index 28930502c..5f40b35c6 100644 --- a/spec/acceptance/lint_spec.rb +++ b/spec/acceptance/lint_spec.rb @@ -44,6 +44,23 @@ expect { FactoryBot.lint }.to_not raise_error end + it "runs after_commit callbacks when linting in a ActiveRecor...
true
thoughtbot/factory_bot
1,789
issue_to_patch
removes @doodlingdev
It's been fun, but my joining on as codeowner seems to have been more aspirational than practical as other projects have always kept me busy.
a9884ff701872c2b8f1148cc8a34acac7694996b
665f08a51bccb712fefdba024a820e7db08af516
diff --git a/CODEOWNERS b/CODEOWNERS index 5afb7a377..0edf9c4c1 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -12,4 +12,4 @@ # This should make it easy to add new rules without breaking existing ones. # Global rule: -* @neilvcarvalho @doodlingdev @vburzynski +* @neilvcarvalho @vburzynski
[ "CODEOWNERS" ]
[]
true
thoughtbot/factory_bot
1,786
issue_to_patch
fix: update Gemfile.lock
78ac2f5094ab14a3d01ece6ae5edca589e1baf3f
68b020f7bff72d8d2e737547487a6c781d7d6bdd
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1585f206b..66fbed14d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -25,20 +25,17 @@ jobs: - "7.2" - main exclude: - - ruby: jruby-9.4 - rails: "7.1" - ...
[ ".github/workflows/build.yml", "Gemfile.lock" ]
[]
true
thoughtbot/factory_bot
1,785
issue_to_patch
build: Release v6.5.6
0dd35aef605536ae23bcc506bc00f2bc532dcbd3
0ac2493b46f6dd6cf4c863a558439f38f0316257
diff --git a/NEWS.md b/NEWS.md index c88f7284e..e0c365dca 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,23 @@ # News +## 6.5.6 (October 22, 2025) + +* Fix: Enforce association override precedence over trait foreign keys by @JinOketani in [#1768](https://github.com/thoughtbot/factory_bot/pull/1768) +* Build: Add ostr...
[ "NEWS.md", "RELEASING.md", "lib/factory_bot/version.rb" ]
[]
true
thoughtbot/factory_bot
1,768
issue_to_patch
Associations cannot override trait-defined ID attributes since v6.5.5 ### Description https://github.com/thoughtbot/factory_bot/pull/1709 introduces surprising behavior, particularly for Rails apps, where associations can no longer override traits that set those associations by ID. This is is particularly surprising ...
Fix association override precedence over trait foreign keys
Hello, this is my first contribution to factory_bot. While using it, I came across what seems to be an unexpected behavior, so I’d like to propose a fix. This PR fixes #1767 — since v6.5.5, associations cannot override trait-defined ID attributes. ## Background / Problem In 6.5.4, passing an association explicitly ...
60e4c8a8d1764f88da0cc76bbdf6129bb2d38d70
048132523a0b40a339d69905cfe46f8a4a93a3c3
diff --git a/lib/factory_bot/attribute_assigner.rb b/lib/factory_bot/attribute_assigner.rb index f3f0f14e4..05e3b1869 100644 --- a/lib/factory_bot/attribute_assigner.rb +++ b/lib/factory_bot/attribute_assigner.rb @@ -9,6 +9,7 @@ def initialize(evaluator, build_class, &instance_builder) @attribute_names_assigned ...
[ "lib/factory_bot/attribute_assigner.rb", "spec/acceptance/attribute_aliases_spec.rb" ]
[]
diff --git a/spec/acceptance/attribute_aliases_spec.rb b/spec/acceptance/attribute_aliases_spec.rb index 0338a3f4d..d24bfe734 100644 --- a/spec/acceptance/attribute_aliases_spec.rb +++ b/spec/acceptance/attribute_aliases_spec.rb @@ -272,5 +272,188 @@ expect(user.response).to eq "new response" expect(user....
true
thoughtbot/factory_bot
1,784
issue_to_patch
fix: revert removal of mutex_m
including `mutex_m` as a dependency is sometimes necessary <img width="670" height="186" alt="Screenshot 2025-10-15 at 8 06 52 PM" src="https://github.com/user-attachments/assets/03ec95c7-85ab-4975-aa96-d0f84427849f" /> ``` >> BUNDLE_GEMFILE=/Users/valerie/dev/thoughtbot/factory_bot/gemfiles/6.1.gemfile bundle e...
35533b8e11746838b965d8d73f00ce54eb7ec6eb
9cc55c53b6b85da3de7382733008fe831d464dd2
diff --git a/Gemfile.lock b/Gemfile.lock index 81d8f27cf..cf761c2b8 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -84,6 +84,7 @@ GEM mini_portile2 (2.8.8) minitest (5.26.0) multi_test (1.1.0) + mutex_m (0.3.0) ostruct (0.6.3) parallel (1.27.0) parser (3.3.9.0) @@ -172,6 +173,7 @@ DEPE...
[ "Gemfile.lock", "factory_bot.gemspec" ]
[]
true
thoughtbot/factory_bot
1,782
issue_to_patch
chore(Gemfile.lock): update gem versions and dependencies
Since only dev-dependencies are updated, I think it can be updated if CI passes.
516a709a2dd243c1516ba4b958a938055e5a8fe8
7e3799cccc5ffc05ea0953bf71a8a18059293708
diff --git a/Gemfile.lock b/Gemfile.lock index f12936b8f..1eaffa8b2 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -7,13 +7,13 @@ PATH GEM remote: https://rubygems.org/ specs: - activemodel (8.0.1) - activesupport (= 8.0.1) - activerecord (8.0.1) - activemodel (= 8.0.1) - activesupport (= 8...
[ "Gemfile.lock" ]
[]
true
thoughtbot/factory_bot
1,783
issue_to_patch
Fix some typos
516a709a2dd243c1516ba4b958a938055e5a8fe8
ec29cd071b6be69fb2e35a6397384790e809d0e5
diff --git a/NEWS.md b/NEWS.md index f4fae4a8f..c88f7284e 100644 --- a/NEWS.md +++ b/NEWS.md @@ -118,7 +118,7 @@ * Docs: re-write into mdBook (Mike Burns, Sara Jackson, Stefanni Brasil) * Docs: clarify that automatic trait definitions could introduce new linting errors (Lawrence Chou). * Internal: skip TruffleRuby o...
[ "NEWS.md", "docs/src/callbacks/callback_order.md", "docs/src/ref/add_attribute.md", "docs/src/sequences/generating.md", "spec/factory_bot/attribute_assignment_spec.rb" ]
[ { "comment": "SO META.", "path": "NEWS.md", "hunk": "@@ -118,7 +118,7 @@\n * Docs: re-write into mdBook (Mike Burns, Sara Jackson, Stefanni Brasil)\n * Docs: clarify that automatic trait definitions could introduce new linting errors (Lawrence Chou).\n * Internal: skip TruffleRuby on Rails 5.0, 5.1, 5.2...
diff --git a/spec/factory_bot/attribute_assignment_spec.rb b/spec/factory_bot/attribute_assignment_spec.rb index 754baba4e..29a8608da 100644 --- a/spec/factory_bot/attribute_assignment_spec.rb +++ b/spec/factory_bot/attribute_assignment_spec.rb @@ -1,5 +1,5 @@ describe "Attribute Assignment" do - it "sets the <attrib...
true
thoughtbot/factory_bot
1,781
issue_to_patch
chore(gemspec): remove unnecessary development dependencies (cucumber, mutex_m)
516a709a2dd243c1516ba4b958a938055e5a8fe8
dab669485f494300b2679332e69acace5095a684
diff --git a/Gemfile.lock b/Gemfile.lock index f12936b8f..0653ecf0f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -83,7 +83,6 @@ GEM mini_portile2 (2.8.8) minitest (5.25.4) multi_test (1.1.0) - mutex_m (0.3.0) ostruct (0.6.3) parallel (1.27.0) parser (3.3.9.0) @@ -170,9 +169,7 @@ DEPE...
[ "Gemfile.lock", "factory_bot.gemspec" ]
[]
true
thoughtbot/factory_bot
1,780
issue_to_patch
feat(build): add Ruby 3.4 to CI matrix
516a709a2dd243c1516ba4b958a938055e5a8fe8
943f2430af8276cfc1f7e7fd431ed8251676ddcb
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6d7ead79b..1585f206b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,6 +13,7 @@ jobs: ruby: - jruby-9.4 - truffleruby + - "3.4" - "3.3" - "3.2" ...
[ ".github/workflows/build.yml" ]
[]
true
thoughtbot/factory_bot
1,763
issue_to_patch
docs: update RELEASING.md
60e4c8a8d1764f88da0cc76bbdf6129bb2d38d70
ac96690333320f928b8869bcd614c83298a6fd5e
diff --git a/RELEASING.md b/RELEASING.md index ec6230455..d0c280678 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -5,23 +5,25 @@ 3. Run `bundle install` to ensure the `Gemfile.lock` file is up to date. 4. Update `NEWS.md` to reflect the changes since last release. A useful GitHub URL to compare the changes is: ...
[ "RELEASING.md" ]
[]
true
thoughtbot/factory_bot
1,779
issue_to_patch
Bump standard from v1.44.0 to v1.51.1
d1dfbb99a252fb00364ed1f916dd6f4ea4e3cfb2
1b23e4521c59dd41fd239f3325be85a3b3392864
diff --git a/Gemfile.lock b/Gemfile.lock index 1d6c260a5..f12936b8f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -36,7 +36,7 @@ GEM cucumber (>= 8.0, < 10.0) rspec-expectations (~> 3.4) thor (~> 1.0) - ast (2.4.2) + ast (2.4.3) base64 (0.2.0) benchmark (0.4.0) bigdecimal (3....
[ "Gemfile.lock", "lib/factory_bot/sequence.rb", "spec/acceptance/sequence_spec.rb" ]
[]
diff --git a/spec/acceptance/sequence_spec.rb b/spec/acceptance/sequence_spec.rb index 3a7fa77ec..35f84747a 100644 --- a/spec/acceptance/sequence_spec.rb +++ b/spec/acceptance/sequence_spec.rb @@ -1,5 +1,6 @@ describe "sequences" do include FactoryBot::Syntax::Methods + require "ostruct" # = On Success
true
thoughtbot/factory_bot
1,778
issue_to_patch
fix(gemspec): add ostruct as a development dependency
``` ❯ RUBYOPT=-W:deprecated bundle exec rspec /Users/ydah/factory_bot/spec/acceptance/sequence_spec.rb:3: warning: ostruct was loaded from the standard library, but will no longer be part of the default gems starting from Ruby 3.5.0. You can add ostruct to your Gemfile or gemspec to silence this warning. Randomiz...
8446cb6c5b39ea046d8ba180197aabc66adf62ed
18f992841511ba010dc6bad2df5453a61d1f2d03
diff --git a/Gemfile.lock b/Gemfile.lock index 530bd64c8..1d6c260a5 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -84,6 +84,7 @@ GEM minitest (5.25.4) multi_test (1.1.0) mutex_m (0.3.0) + ostruct (0.6.3) parallel (1.26.3) parser (3.3.7.0) ast (~> 2.4.1) @@ -168,6 +169,7 @@ DEPENDENC...
[ "Gemfile.lock", "factory_bot.gemspec" ]
[]
true
thoughtbot/factory_bot
1,777
issue_to_patch
Fix ruby syntax highlighting in yard docs
This fixes syntax highlighting for the Enum Traits section on rubydoc.info.
8446cb6c5b39ea046d8ba180197aabc66adf62ed
7f6e5af0f827c6ea5790ad77ccdacc4d320fd6ff
diff --git a/GETTING_STARTED.md b/GETTING_STARTED.md index 5e1fb0e7c..56bcb62f6 100644 --- a/GETTING_STARTED.md +++ b/GETTING_STARTED.md @@ -642,7 +642,7 @@ end Or inline using attributes from the factory: -```rb +```ruby factory :post do # ... author_last_name { "Writely" } @@ -1153,7 +1153,7 @@ When worki...
[ "GETTING_STARTED.md" ]
[]
true
thoughtbot/factory_bot
1,776
issue_to_patch
chore: tag slow specs
marks the slowest specs with `:slow` - use `bundle exec rspec --tag '~slow'` to skip slow tests - use `bundle exec rspec --profile` to see slowest tests - makes it possible to run the bulk of the test suite in roughly **1 second** as opposed to roughly **5 seconds** - namely `./spec/acceptance/sequence_setting_sp...
8446cb6c5b39ea046d8ba180197aabc66adf62ed
b9eff1e76163a20aaf742044279c2662d6319577
[ "spec/acceptance/activesupport_instrumentation_spec.rb", "spec/acceptance/sequence_setting_spec.rb" ]
[]
diff --git a/spec/acceptance/activesupport_instrumentation_spec.rb b/spec/acceptance/activesupport_instrumentation_spec.rb index 96f79d863..ce9c1bc10 100644 --- a/spec/acceptance/activesupport_instrumentation_spec.rb +++ b/spec/acceptance/activesupport_instrumentation_spec.rb @@ -47,7 +47,7 @@ def subscribed(callback, ...
true
thoughtbot/factory_bot
1,769
issue_to_patch
Update link to FactoryGirl upgrade guide
I noticed that the README currently has a broken link to the upgrade guide from FactoryGirl due to a change in how Github generates tag links. This PR fixes that link in the README.
d12d4374f13025540579d78ad234a1ceacba3259
2379b1f5218bc8f2a118aa201b64437fbb2cfac9
diff --git a/README.md b/README.md index 418ecf9a8..3dcd4ab1f 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ If you want to use factory_bot with Rails, see Interested in the history of the project name? You can find the history [here](https://github.com/thoughtbot/factory_bot/blob/main/NAME.md) -Transition...
[ "README.md" ]
[]
true
thoughtbot/factory_bot
1,770
issue_to_patch
Refactor factory calculator
This is a refactoring to remove the need to instantiate an instance of `StrategyCalculator` and use a more functional approach.
d12d4374f13025540579d78ad234a1ceacba3259
76c4a79a9d8164b441b4e2f6f1467a19b83803af
diff --git a/lib/factory_bot.rb b/lib/factory_bot.rb index de541d0e6..74a7fdc43 100644 --- a/lib/factory_bot.rb +++ b/lib/factory_bot.rb @@ -11,12 +11,7 @@ require "factory_bot/errors" require "factory_bot/factory_runner" require "factory_bot/strategy_syntax_method_registrar" -require "factory_bot/strategy_calculato...
[ "lib/factory_bot.rb", "lib/factory_bot/factory.rb", "lib/factory_bot/strategy.rb", "lib/factory_bot/strategy_calculator.rb", "spec/factory_bot/strategy_spec.rb" ]
[]
diff --git a/spec/factory_bot/strategy_calculator_spec.rb b/spec/factory_bot/strategy_spec.rb similarity index 66% rename from spec/factory_bot/strategy_calculator_spec.rb rename to spec/factory_bot/strategy_spec.rb index 108ee3da6..5ec4a53b1 100644 --- a/spec/factory_bot/strategy_calculator_spec.rb +++ b/spec/factory_...
true
thoughtbot/factory_bot
1,764
issue_to_patch
fix(yard): resolve yard doc warnings
Fixes warnings generated when generating the yard documentation: ``` ❯ be yard doc /Users/valerie/.asdf/installs/ruby/3.4.2/lib/ruby/gems/3.4.0/gems/yard-0.9.37/lib/yard/templates/helpers/markup_helper.rb:105: warning: rdoc was loaded from the standard library, but will no longer be part of the default gems starti...
60e4c8a8d1764f88da0cc76bbdf6129bb2d38d70
cb4f60a9bf35cd7ce9a112f823046320a4662923
diff --git a/.gitignore b/.gitignore index 98ce10a66..422b1add5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,14 +1,22 @@ +.bundle +.rubocop-https* +.yardoc +.zed *.swp +bin +coverage test.db -factory_girl-*.gem +tmp + +# yard +doc + +# gem builds factory_bot-*.gem +factory_girl-*.gem + +# mdBook generated output ...
[ ".gitignore", "GETTING_STARTED.md", "README.md", "lib/factory_bot/syntax/methods.rb" ]
[]
true
thoughtbot/factory_bot
1,765
issue_to_patch
Bump actions/checkout from 4 to 5
Bumps [actions/checkout](https://github.com/actions/checkout) from 4 to 5. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/actions/checkout/releases">actions/checkout's releases</a>.</em></p> <blockquote> <h2>v5.0.0</h2> <h2>What's Changed</h2> <ul> <li>Update actions checkout...
60e4c8a8d1764f88da0cc76bbdf6129bb2d38d70
dcecf3481f1e0aab7f06cbb3666cf138dc25bc90
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 772b66111..6d7ead79b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -45,7 +45,7 @@ jobs: BUNDLE_GEMFILE: gemfiles/${{ matrix.rails }}.gemfile steps: - - uses: actions/checkout@v4 + - uses:...
[ ".github/workflows/build.yml", ".github/workflows/docs.yml" ]
[]
true
thoughtbot/factory_bot
1,762
issue_to_patch
Build: release v6.5.5
- updates the `RELEASING.md` instructions - updates `NEWS.md` with line breaks to improve markdownlint linting issues - updates `NEWS.md` with the release notes for v6.5.5
48936d3e473d6eb7bb1d7fc869378c1ec1b02a5c
2f12a419ba56a97f85aaf44e4b6748e4e36fd5c3
diff --git a/Gemfile.lock b/Gemfile.lock index 7f64457be..530bd64c8 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - factory_bot (6.5.4) + factory_bot (6.5.5) activesupport (>= 6.1.0) GEM diff --git a/NEWS.md b/NEWS.md index 16e2050c6..f4fae4a8f 100644 --- a/NE...
[ "Gemfile.lock", "NEWS.md", "RELEASING.md", "lib/factory_bot/version.rb" ]
[]
true
thoughtbot/factory_bot
1,761
issue_to_patch
Allow the initial value of a sequence to be lazy loaded
## Allow the initial value of a sequence to be evaluated on first use Note: This is a re-implementation of the changes in https://github.com/thoughtbot/factory_bot/pull/1674 to remove the need to use a `lazy` kwarg. In order to be able to use factory_bot to generate seeds for a database where the database might n...
f14a63ea91de7b51adc00232a8448824ba762c07
844edcfdc7aa38dd9e50e58a6785fd75ae469386
diff --git a/docs/src/sequences/initial-value.md b/docs/src/sequences/initial-value.md index 323d5a76a..180ee07fd 100644 --- a/docs/src/sequences/initial-value.md +++ b/docs/src/sequences/initial-value.md @@ -8,3 +8,11 @@ factory :user do sequence(:email, 1000) { |n| "person#{n}@example.com" } end ``` + +The initi...
[ "docs/src/sequences/initial-value.md", "lib/factory_bot/sequence.rb", "spec/acceptance/sequence_setting_spec.rb", "spec/acceptance/sequence_spec.rb", "spec/factory_bot/sequence_spec.rb" ]
[ { "comment": "**suggestion:** It could be beneficial to expand this to include any callable object.\r\n\r\nThis could be done by checking `initial_value.responds_to?(:call)`. Rails does this in various places such as the implementation for `scope` in ActiveRecord (https://github.com/rails/rails/blob/ac18a8b9d36...
diff --git a/spec/acceptance/sequence_setting_spec.rb b/spec/acceptance/sequence_setting_spec.rb index 42de4e181..58a604a91 100644 --- a/spec/acceptance/sequence_setting_spec.rb +++ b/spec/acceptance/sequence_setting_spec.rb @@ -72,6 +72,16 @@ expect(generate_list(:jet_pilot, :dob, 3).last).to eq Date.parse("2...
true
thoughtbot/factory_bot
1,669
issue_to_patch
Update docs to require full namespace
FactoryBot throws an error when defining factories that refer to classes within modules in non-Rails applications. FactoryBot will work, but the class used by the factory must be explicitly stated in the full namespace. Address #1459
f14a63ea91de7b51adc00232a8448824ba762c07
f6a8ceb90ad110e12a19db4b635150b5a489cc12
diff --git a/GETTING_STARTED.md b/GETTING_STARTED.md index 330993110..6fb1d0b4b 100644 --- a/GETTING_STARTED.md +++ b/GETTING_STARTED.md @@ -219,6 +219,26 @@ It is also possible to explicitly specify the class: factory :admin, class: "User" ``` +Explicit specification of the class, _with the full namespace_, is nec...
[ "GETTING_STARTED.md" ]
[]
true
thoughtbot/factory_bot
1,760
issue_to_patch
Support for callback before(:build) ### Problem this feature will solve I want to disable our `Bullet` gem when FactoryBot is building instances and creating records, because I don't care about n+1 problems inside my test setup. The problem is, that there seems to be no callback called `before(:build)`. I had a ...
Add support for before build callback
(originally from @mohammednasser-32 - I couldn't push modifications to your branch, so I'm creating a new one with your original commits and my new ones) Fixes #1633 Supersedes #1639 add support for `before(:build)` callback as requested in the issue Tested the changes by adding the local gem to a project ![...
6b67f18f02f61836f6e64f997b9e0c86fd9ff050
7629f1f0267f7affb589e96fb770a750f8a08f3e
diff --git a/docs/src/callbacks/callback_order.md b/docs/src/callbacks/callback_order.md index 2090e00af..fbbd8feb6 100644 --- a/docs/src/callbacks/callback_order.md +++ b/docs/src/callbacks/callback_order.md @@ -17,29 +17,35 @@ FactoryBot.define do factory :user do before(:all) { puts "User before(:all)" } ...
[ "docs/src/callbacks/callback_order.md", "docs/src/callbacks/default-callbacks.md", "docs/src/callbacks/summary.md", "lib/factory_bot/strategy/build.rb", "lib/factory_bot/strategy/create.rb", "spec/acceptance/callbacks_spec.rb" ]
[ { "comment": "Added only to the strategies that also trigger `after_build`, skipping `build_stubbed` (debatable) and `attributes_for`", "path": "lib/factory_bot/strategy/build.rb", "hunk": "@@ -6,6 +6,8 @@ def association(runner)\n end\n \n def result(evaluation)\n+ evaluation.notify(...
diff --git a/spec/acceptance/callbacks_spec.rb b/spec/acceptance/callbacks_spec.rb index 1891fe49e..16b970fda 100644 --- a/spec/acceptance/callbacks_spec.rb +++ b/spec/acceptance/callbacks_spec.rb @@ -71,6 +71,7 @@ FactoryBot.define do before(:all) { TestLog << "global before-all called" } ...
true
thoughtbot/factory_bot
1,712
issue_to_patch
Traits that imply other ones can cause double running of callbacks <!-- By contributing to this project, you agree to abide by the thoughtbot Code of Conduct: https://thoughtbot.com/open-source-code-of-conduct --> ### Description When i make a trait B that implies A and build with B and A traits the after(:buil...
BugFix: Ensure callbacks only run once per instance.
Fixes: #1703 CallbacksObserver refactored to ignore an individual callback that has already been run on the given instance. **EXAMPLE** ```ruby factory :user do name { "Jane" } trait :trait_a do trait_b end trait :trait_b do after(:build) { |user| user.name += " Doe" } end end ...
8e625143d8f7d0b24378b2a47fabae88c3d0fdf9
0f9057586bd413732df1e75edf80299d98f2f463
diff --git a/lib/factory_bot/callbacks_observer.rb b/lib/factory_bot/callbacks_observer.rb index 20c1b06c4..8bdc1893b 100644 --- a/lib/factory_bot/callbacks_observer.rb +++ b/lib/factory_bot/callbacks_observer.rb @@ -4,11 +4,15 @@ class CallbacksObserver def initialize(callbacks, evaluator) @callbacks = cal...
[ "lib/factory_bot/callbacks_observer.rb", "spec/acceptance/callbacks_spec.rb" ]
[]
diff --git a/spec/acceptance/callbacks_spec.rb b/spec/acceptance/callbacks_spec.rb index 3c9befc9b..1891fe49e 100644 --- a/spec/acceptance/callbacks_spec.rb +++ b/spec/acceptance/callbacks_spec.rb @@ -16,6 +16,15 @@ after(:stub) { |user| user.last_name = "Double-Stubby" } after(:build) { |user| us...
true
thoughtbot/factory_bot
1,709
issue_to_patch
Confusion around aliases for `{attribute}` and `{attribute}_id` We have had several issues over the years related to `FactoryBot.aliases`: #522 #734 #851 #989 #1096 #1138, #1417. In most of these issues people do not realize that `factory_bot` assumes`{attribute}_id` will be the foreign key of an `{attribute}` `Active...
BugFix: '<attribute>' and '<attribute>_id' conflict.
Fixes: #1680 Fixes: #1142 Addresses: #1708 When a factory has both \<attribute\> and \<attribute\>_id, each one is considered an alias for the other and are not assigned correctly. This request eliminates this issue by checking if the override is an existing attribute name, before matching against an ali...
89d60e09b4c1df34c20ccc6c5d845225b019abc6
44eace596bc666f0098f0cb45e1d81db87d1db6c
diff --git a/lib/factory_bot/attribute_assigner.rb b/lib/factory_bot/attribute_assigner.rb index 51ab72365..f3f0f14e4 100644 --- a/lib/factory_bot/attribute_assigner.rb +++ b/lib/factory_bot/attribute_assigner.rb @@ -72,7 +72,7 @@ def attribute_names_to_assign non_ignored_attribute_names + override_na...
[ "lib/factory_bot/attribute_assigner.rb", "spec/acceptance/aliases_spec.rb", "spec/acceptance/attribute_aliases_spec.rb", "spec/factory_bot/attribute_assignment_spec.rb" ]
[ { "comment": "use `attribute_names`? side note: just lost a number of hours on the bug this PR will solve 😢 , thank you for working to fix it! 🎉 ", "path": "lib/factory_bot/attribute_assigner.rb", "hunk": "@@ -91,22 +91,39 @@ def override_names\n @evaluator.__override_names__\n end\n \n+ ...
diff --git a/spec/acceptance/aliases_spec.rb b/spec/acceptance/aliases_spec.rb deleted file mode 100644 index edb7a9782..000000000 --- a/spec/acceptance/aliases_spec.rb +++ /dev/null @@ -1,17 +0,0 @@ -describe "aliases and overrides" do - before do - FactoryBot.aliases << [/one/, "two"] - - define_model("User", ...
true
thoughtbot/factory_bot
1,731
issue_to_patch
Small update to "verbose linting" spec to allow for Ruby 3.4 backtrace changes
Update for testing in Ruby 3.4 - file: spec/acceptance/lint_spec.rb:188 THE PROBLEM THIS FIXES Ruby 3.4 backtrace locations now include both the object and method names in the format: "<object_name>#<method_name>. So a backtrace location with "...`save!`" in ruby 3.3, now becomes "... 'InvalidThing#sa...
a2df3a320a75e0cf73af455573282359eebb1934
575d1e6281c4913d1b3be0dce06f34fe94e1a0b9
[ "spec/acceptance/lint_spec.rb" ]
[]
diff --git a/spec/acceptance/lint_spec.rb b/spec/acceptance/lint_spec.rb index 8ecbc6e31..28930502c 100644 --- a/spec/acceptance/lint_spec.rb +++ b/spec/acceptance/lint_spec.rb @@ -211,7 +211,7 @@ def save! FactoryBot.lint(verbose: true) }.to raise_error( FactoryBot::InvalidFactoryError, - ...
true
thoughtbot/factory_bot
1,713
issue_to_patch
BugFix: Random test failure when tracking compilation time
## Summary When running the full test suite, it would randomly fail an activesupport_instrumentation test. On re-running the suite several times, everything would pass. #### Test: - "tracks proper time of compiling the factory" #### Source: - acceptance/activesupport_instrumentation_spec.rb:99 ## The Pro...
59b7188c7ed156433bd6ed1cd61da4be2966bd11
7add9dad66bf059df162b3570018afcb9aea7183
[ "spec/acceptance/activesupport_instrumentation_spec.rb" ]
[ { "comment": "A minimal change here: since `payload` is now used, it shouldn't be preceded with an underscore:\r\n```suggestion\r\n callback = ->(_name, start, finish, _id, payload) {\r\n time_to_execute[payload[:name]] = (finish - start)\r\n```", "path": "spec/acceptance/activesupport_instrumentati...
diff --git a/spec/acceptance/activesupport_instrumentation_spec.rb b/spec/acceptance/activesupport_instrumentation_spec.rb index edc215378..96f79d863 100644 --- a/spec/acceptance/activesupport_instrumentation_spec.rb +++ b/spec/acceptance/activesupport_instrumentation_spec.rb @@ -97,13 +97,15 @@ def subscribed(callback...
true
thoughtbot/factory_bot
1,713
comment_to_fix
BugFix: Random test failure when tracking compilation time
A minimal change here: since `payload` is now used, it shouldn't be preceded with an underscore: ```suggestion callback = ->(_name, start, finish, _id, payload) { time_to_execute[payload[:name]] = (finish - start) ```
59b7188c7ed156433bd6ed1cd61da4be2966bd11
7add9dad66bf059df162b3570018afcb9aea7183
diff --git a/spec/acceptance/activesupport_instrumentation_spec.rb b/spec/acceptance/activesupport_instrumentation_spec.rb index edc215378..96f79d863 100644 --- a/spec/acceptance/activesupport_instrumentation_spec.rb +++ b/spec/acceptance/activesupport_instrumentation_spec.rb @@ -97,13 +97,15 @@ def subscribed(callback...
[ "spec/acceptance/activesupport_instrumentation_spec.rb" ]
[ { "comment": "A minimal change here: since `payload` is now used, it shouldn't be preceded with an underscore:\r\n```suggestion\r\n callback = ->(_name, start, finish, _id, payload) {\r\n time_to_execute[payload[:name]] = (finish - start)\r\n```", "path": "spec/acceptance/activesupport_instrumentati...
true
thoughtbot/factory_bot
1,739
issue_to_patch
Child inheriting parent trait that has sequence will start over <!-- By contributing to this project, you agree to abide by the thoughtbot Code of Conduct: https://thoughtbot.com/open-source-code-of-conduct --> ### Description After [this change](https://github.com/thoughtbot/factory_bot/pull/1717), children factori...
BUGFIX: Refactored sequences to ensure cloned traits use parent sequences.
Fixes: #1738 THE ISSUE ----------- Child factories clone parent traits to ensure they are executes in the correct context. This means that they are also registering a new version of the parent's sequence. THE SOLUTION ---------------- When registering a child sequence, check if it's already registere...
38a4ab4e8e40ea2b9338052e4204b7988a524797
7dc008d9d672bdd03eb074a10b9d6f7f607edc54
diff --git a/lib/factory_bot/definition_proxy.rb b/lib/factory_bot/definition_proxy.rb index a27c33f2c..7ff970a32 100644 --- a/lib/factory_bot/definition_proxy.rb +++ b/lib/factory_bot/definition_proxy.rb @@ -120,9 +120,9 @@ def method_missing(name, *args, &block) # rubocop:disable Style/MissingRespondTo # # ...
[ "lib/factory_bot/definition_proxy.rb", "lib/factory_bot/sequence.rb", "spec/acceptance/sequence_context_spec.rb" ]
[ { "comment": "```suggestion\r\n # If the sequence has already been registered by a parent, return that one,\r\n```", "path": "lib/factory_bot/definition_proxy.rb", "hunk": "@@ -252,5 +259,19 @@ def __declare_attribute__(name, block)\n def __valid_association_options?(options)\n options.resp...
diff --git a/spec/acceptance/sequence_context_spec.rb b/spec/acceptance/sequence_context_spec.rb index f5f6e3fff..4641d6008 100644 --- a/spec/acceptance/sequence_context_spec.rb +++ b/spec/acceptance/sequence_context_spec.rb @@ -47,4 +47,107 @@ def awesome end expect(FactoryBot.build(:sequence_referencing_att...
true
thoughtbot/factory_bot
1,752
issue_to_patch
Undocumented breaking change in 6.5.3 for attributes named `definition` as of 6.5.3, model attributes named `definition` are no longer populated ```ruby definition do 'foo' end ``` changing this to (or downgrading to 6.5.2) fixes it: ```ruby add_attribute(:definition) do 'foo' end ```
FactoryBot::DefinitionProxy: remove `definition` `attr_reader`
Fixes: #1751 A new `attr_reader :definition` was added to FactoryBot::DefinitionProxy. When trying to set an instance attribute named `:definition` using `:method_missing`, it's targeting the proxy `:definition` rather than creating an attribute, leading to an exception I've removed the `:instance` method and...
bc18385ec129220a6eb4e5900544aec1eb62d3cf
5ba71d65142066aefcaa099cbe5ca7a238f67398
diff --git a/lib/factory_bot/definition_proxy.rb b/lib/factory_bot/definition_proxy.rb index 9add4efd5..fc3d5dfc8 100644 --- a/lib/factory_bot/definition_proxy.rb +++ b/lib/factory_bot/definition_proxy.rb @@ -21,7 +21,7 @@ class DefinitionProxy delegate :before, :after, :callback, to: :@definition - attr_re...
[ "lib/factory_bot/definition_proxy.rb", "spec/acceptance/defining_methods_inside_a_factory_spec.rb" ]
[]
diff --git a/spec/acceptance/defining_methods_inside_a_factory_spec.rb b/spec/acceptance/defining_methods_inside_a_factory_spec.rb index f7e19bf3f..6c3a93e17 100644 --- a/spec/acceptance/defining_methods_inside_a_factory_spec.rb +++ b/spec/acceptance/defining_methods_inside_a_factory_spec.rb @@ -17,4 +17,19 @@ def gene...
true
thoughtbot/factory_bot
1,755
issue_to_patch
Developer Console Feature
Developer helper to quickly open an IRB console with the gem code already loaded: `bin/console` It also has a built-in `reload!` method that will reload a fresh copy of the files. There is no change to any gem code. - the `reload!` method is define in `.irb` - the console is configured and launched from `bin...
95bbb98c713e4ceab42a0d55ec7315c36735f774
6b0516c484d1e4d388e03dab016df3a130346fab
diff --git a/.irbrc b/.irbrc new file mode 100644 index 000000000..0ab7ad30a --- /dev/null +++ b/.irbrc @@ -0,0 +1,12 @@ +def reload! + # Undefine FactoryBot so we can reload constants and fresh code + Object.send(:remove_const, :FactoryBot) if Object.const_defined?(:FactoryBot) + + # Remove all files from the 'load...
[ ".irbrc", "bin/console", "bin/setup" ]
[ { "comment": "You can simplify removal of matching features by using delete_if, e.g., `$LOADED_FEATURES.delete_if { |path| path.include?(\"factory_bot\") }`.\n```suggestion\n $LOADED_FEATURES.delete_if { |path| path.match?(/factory_bot/) }\n```", "path": ".irbrc", "hunk": "@@ -0,0 +1,14 @@\n+def reload...
true
thoughtbot/factory_bot
1,755
comment_to_fix
Developer Console Feature
You can simplify removal of matching features by using delete_if, e.g., `$LOADED_FEATURES.delete_if { |path| path.include?("factory_bot") }`. ```suggestion $LOADED_FEATURES.delete_if { |path| path.match?(/factory_bot/) } ```
95bbb98c713e4ceab42a0d55ec7315c36735f774
6b0516c484d1e4d388e03dab016df3a130346fab
diff --git a/.irbrc b/.irbrc new file mode 100644 index 000000000..0ab7ad30a --- /dev/null +++ b/.irbrc @@ -0,0 +1,12 @@ +def reload! + # Undefine FactoryBot so we can reload constants and fresh code + Object.send(:remove_const, :FactoryBot) if Object.const_defined?(:FactoryBot) + + # Remove all files from the 'load...
[ ".irbrc" ]
[ { "comment": "You can simplify removal of matching features by using delete_if, e.g., `$LOADED_FEATURES.delete_if { |path| path.include?(\"factory_bot\") }`.\n```suggestion\n $LOADED_FEATURES.delete_if { |path| path.match?(/factory_bot/) }\n```", "path": ".irbrc", "hunk": "@@ -0,0 +1,14 @@\n+def reload...
true
thoughtbot/factory_bot
1,755
comment_to_fix
Developer Console Feature
Wrap the `require` in a begin/rescue block to surface any load errors and provide a clear message if reloading fails. ```suggestion begin require "factory_bot" puts "\nfactory_bot reloaded!\n\n" rescue LoadError => e puts "\nFailed to reload factory_bot: #{e.message}\n\n" false end ```
95bbb98c713e4ceab42a0d55ec7315c36735f774
6b0516c484d1e4d388e03dab016df3a130346fab
diff --git a/.irbrc b/.irbrc new file mode 100644 index 000000000..0ab7ad30a --- /dev/null +++ b/.irbrc @@ -0,0 +1,12 @@ +def reload! + # Undefine FactoryBot so we can reload constants and fresh code + Object.send(:remove_const, :FactoryBot) if Object.const_defined?(:FactoryBot) + + # Remove all files from the 'load...
[ ".irbrc" ]
[ { "comment": "Wrap the `require` in a begin/rescue block to surface any load errors and provide a clear message if reloading fails.\n```suggestion\n begin\n require \"factory_bot\"\n puts \"\\nfactory_bot reloaded!\\n\\n\"\n rescue LoadError => e\n puts \"\\nFailed to reload factory_bot: #{e.message}...
true
thoughtbot/factory_bot
1,755
comment_to_fix
Developer Console Feature
[nitpick] Consider lowercasing 'Constants' for consistency and clarity in the comment. ```suggestion # Undefine FactoryBot so we can reload constants and fresh code ```
95bbb98c713e4ceab42a0d55ec7315c36735f774
6b0516c484d1e4d388e03dab016df3a130346fab
diff --git a/.irbrc b/.irbrc new file mode 100644 index 000000000..0ab7ad30a --- /dev/null +++ b/.irbrc @@ -0,0 +1,12 @@ +def reload! + # Undefine FactoryBot so we can reload constants and fresh code + Object.send(:remove_const, :FactoryBot) if Object.const_defined?(:FactoryBot) + + # Remove all files from the 'load...
[ ".irbrc" ]
[ { "comment": "[nitpick] Consider lowercasing 'Constants' for consistency and clarity in the comment.\n```suggestion\n # Undefine FactoryBot so we can reload constants and fresh code\n```", "path": ".irbrc", "hunk": "@@ -0,0 +1,14 @@\n+def reload!\n+ # Undefine FactoryBot so we can reload Constants and...
true
thoughtbot/factory_bot
1,740
issue_to_patch
Make strategy used easier to detect in callbacks <!-- By contributing to this project, you agree to abide by the thoughtbot Code of Conduct: https://thoughtbot.com/open-source-code-of-conduct --> ### Problem this feature will solve Like many, I use the same factory with multiple strategies, based on the individ...
FEATURE: Before(:all) and after(:all) callbacks added
Fixes: #1694 Continues: #1695 ## SUMMARY Continuing on from #1695 it was decided that `before(:all)` and `after(:all)` callbacks would provide a solution, without exposing context internals. ## FEATURE Both callbacks are defined in the usual way, and operate through the normal callback process. `befor...
5f9e369c980f11ef3bfbce989739b3b1b3332da3
53adee8c4c13a9d4ce81f1a4a4e8d361a2fe5d75
diff --git a/docs/src/SUMMARY.md b/docs/src/SUMMARY.md index bed30d120..d117245e7 100644 --- a/docs/src/SUMMARY.md +++ b/docs/src/SUMMARY.md @@ -81,6 +81,7 @@ - [Multiple callbacks](callbacks/multiple-callbacks.md) - [Global callbacks](callbacks/global-callbacks.md) - [Symbol#to_proc](callbacks/symbol-to_proc....
[ "docs/src/SUMMARY.md", "docs/src/callbacks/callback_order.md", "docs/src/callbacks/summary.md", "docs/src/ref/hooks.md", "lib/factory_bot/factory.rb", "spec/acceptance/callbacks_spec.rb", "spec/factory_bot/definition_proxy_spec.rb", "spec/support/containers/test_log.rb" ]
[ { "comment": "Suggestion: if one goal of these callbacks is to disable and then re-enable certain global side effects (like sending emails or other model callbacks), then it might make sense to put this in an `ensure` block, so that it will trigger even if `strategy.result(...)` raises an exception. Without an ...
diff --git a/spec/acceptance/callbacks_spec.rb b/spec/acceptance/callbacks_spec.rb index 57d2471aa..3c9befc9b 100644 --- a/spec/acceptance/callbacks_spec.rb +++ b/spec/acceptance/callbacks_spec.rb @@ -1,48 +1,244 @@ describe "callbacks" do before do define_model("User", first_name: :string, last_name: :string)...
true
thoughtbot/factory_bot
1,740
comment_to_fix
FEATURE: Before(:all) and after(:all) callbacks added
**suggestion:** What do you think about presenting the list of callbacks in the (rough) order in which they would occur? ```suggestion `before_all`, `after_build`, `before_create`, `after_create`, `after_stub`, and `after_all`. ```
5f9e369c980f11ef3bfbce989739b3b1b3332da3
53adee8c4c13a9d4ce81f1a4a4e8d361a2fe5d75
diff --git a/docs/src/ref/hooks.md b/docs/src/ref/hooks.md index 9ef68274d..29ad14bd2 100644 --- a/docs/src/ref/hooks.md +++ b/docs/src/ref/hooks.md @@ -13,7 +13,7 @@ factory. Within a `FactoryBot.define` block, they are global to all factories. The `callback` method allows you to hook into any factory\_bot callback...
[ "docs/src/ref/hooks.md" ]
[ { "comment": "**suggestion:** What do you think about presenting the list of callbacks in the (rough) order in which they would occur?\r\n\r\n```suggestion\r\n`before_all`, `after_build`, `before_create`, `after_create`, `after_stub`, and `after_all`.\r\n```", "path": "docs/src/ref/hooks.md", "hunk": "@...
true
thoughtbot/factory_bot
1,740
comment_to_fix
FEATURE: Before(:all) and after(:all) callbacks added
**nit:** Remove duplicate blank line
5f9e369c980f11ef3bfbce989739b3b1b3332da3
53adee8c4c13a9d4ce81f1a4a4e8d361a2fe5d75
diff --git a/docs/src/callbacks/summary.md b/docs/src/callbacks/summary.md index a810d7b39..e49b26ba6 100644 --- a/docs/src/callbacks/summary.md +++ b/docs/src/callbacks/summary.md @@ -1,19 +1,42 @@ # Callbacks -factory\_bot makes four callbacks available: +factory\_bot makes six callbacks available: -* after(:bui...
[ "docs/src/callbacks/summary.md" ]
[ { "comment": "**nit:** Remove duplicate blank line", "path": "docs/src/callbacks/summary.md", "hunk": "@@ -1,19 +1,44 @@\n # Callbacks\n \n-factory\\_bot makes four callbacks available:\n+factory\\_bot makes six callbacks available:\n \n-* after(:build) - called after a factory is built (via `Factor...
true
thoughtbot/factory_bot
1,740
comment_to_fix
FEATURE: Before(:all) and after(:all) callbacks added
**thought:** I like how your phrasing calls out that these callbacks are invoked when the factory is generating an object. The original phrasing could be misinterpreted to mean something is happening to the factory rather than to the object the factory is constructing. - I think this could be applied to the existin...
5f9e369c980f11ef3bfbce989739b3b1b3332da3
53adee8c4c13a9d4ce81f1a4a4e8d361a2fe5d75
diff --git a/docs/src/callbacks/summary.md b/docs/src/callbacks/summary.md index a810d7b39..e49b26ba6 100644 --- a/docs/src/callbacks/summary.md +++ b/docs/src/callbacks/summary.md @@ -1,19 +1,42 @@ # Callbacks -factory\_bot makes four callbacks available: +factory\_bot makes six callbacks available: -* after(:bui...
[ "docs/src/callbacks/summary.md" ]
[ { "comment": "**thought:** I like how your phrasing calls out that these callbacks are invoked when the factory is generating an object. The original phrasing could be misinterpreted to mean something is happening to the factory rather than to the object the factory is constructing.\r\n\r\n- I think this could...
true
thoughtbot/factory_bot
1,740
comment_to_fix
FEATURE: Before(:all) and after(:all) callbacks added
**nit:** Remove trailing punctuation ```suggestion ## Examples ```
5f9e369c980f11ef3bfbce989739b3b1b3332da3
53adee8c4c13a9d4ce81f1a4a4e8d361a2fe5d75
diff --git a/docs/src/callbacks/summary.md b/docs/src/callbacks/summary.md index a810d7b39..e49b26ba6 100644 --- a/docs/src/callbacks/summary.md +++ b/docs/src/callbacks/summary.md @@ -1,19 +1,42 @@ # Callbacks -factory\_bot makes four callbacks available: +factory\_bot makes six callbacks available: -* after(:bui...
[ "docs/src/callbacks/summary.md" ]
[ { "comment": "**nit:** Remove trailing punctuation\r\n\r\n```suggestion\r\n## Examples\r\n```", "path": "docs/src/callbacks/summary.md", "hunk": "@@ -1,19 +1,44 @@\n # Callbacks\n \n-factory\\_bot makes four callbacks available:\n+factory\\_bot makes six callbacks available:\n \n-* after(:build) - cal...
true
thoughtbot/factory_bot
1,740
comment_to_fix
FEATURE: Before(:all) and after(:all) callbacks added
**nit:** Remove trailing punctuation ```suggestion ### Calling an object's own method after building ```
5f9e369c980f11ef3bfbce989739b3b1b3332da3
53adee8c4c13a9d4ce81f1a4a4e8d361a2fe5d75
diff --git a/docs/src/callbacks/summary.md b/docs/src/callbacks/summary.md index a810d7b39..e49b26ba6 100644 --- a/docs/src/callbacks/summary.md +++ b/docs/src/callbacks/summary.md @@ -1,19 +1,42 @@ # Callbacks -factory\_bot makes four callbacks available: +factory\_bot makes six callbacks available: -* after(:bui...
[ "docs/src/callbacks/summary.md" ]
[ { "comment": "**nit:** Remove trailing punctuation\r\n\r\n```suggestion\r\n### Calling an object's own method after building\r\n```", "path": "docs/src/callbacks/summary.md", "hunk": "@@ -1,19 +1,44 @@\n # Callbacks\n \n-factory\\_bot makes four callbacks available:\n+factory\\_bot makes six callbacks a...
true
thoughtbot/factory_bot
1,740
comment_to_fix
FEATURE: Before(:all) and after(:all) callbacks added
**suggestion:** Move the `require` to the top of the file
5f9e369c980f11ef3bfbce989739b3b1b3332da3
53adee8c4c13a9d4ce81f1a4a4e8d361a2fe5d75
diff --git a/spec/support/containers/test_log.rb b/spec/support/containers/test_log.rb new file mode 100644 index 000000000..19a03a24e --- /dev/null +++ b/spec/support/containers/test_log.rb @@ -0,0 +1,27 @@ +require "forwardable" + +## +# Designed for tests to log output for later evaluation +# +module TestLog + clas...
[ "spec/support/containers/test_log.rb" ]
[ { "comment": "**suggestion:** Move the `require` to the top of the file", "path": "spec/support/containers/test_log.rb", "hunk": "@@ -0,0 +1,26 @@\n+##\n+# Designed for tests to log output for later evaluation\n+#\n+module TestLog\n+ class << self\n+ require \"forwardable\"", "resolving_sha": "5...
true
thoughtbot/factory_bot
1,759
issue_to_patch
add vburzynski as codeowner
936f7676fe3c30b63a0fa9a706ff74b99dd42302
1f5858d5e4a99c31f667b9074b5daa6cbe1c5729
diff --git a/CODEOWNERS b/CODEOWNERS index a2b6f08d7..5afb7a377 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -12,4 +12,4 @@ # This should make it easy to add new rules without breaking existing ones. # Global rule: -* @neilvcarvalho @doodlingdev +* @neilvcarvalho @doodlingdev @vburzynski
[ "CODEOWNERS" ]
[]
true
thoughtbot/factory_bot
1,757
issue_to_patch
Cleanup Active Support core extensions
Reviewing the Active Support usage, I noticed two `require` calls that are unnecessary: We don't use the `Hash#except!` method defined on `active_support/core_ext/hash/except.rb`, nor the `Hash#with_indifferent_access` defined on `active_support/hash_with_indifferent_access.rb`. We _do_ use the `HashWithIndiffere...
28af653d5ef658a85ffcb369ea4cc523c0f5838e
8569c8ebb3a8d3f222e63e57d3d463755115027b
diff --git a/lib/factory_bot/evaluator.rb b/lib/factory_bot/evaluator.rb index 31692d0c4..11ab1b8ec 100644 --- a/lib/factory_bot/evaluator.rb +++ b/lib/factory_bot/evaluator.rb @@ -1,4 +1,3 @@ -require "active_support/core_ext/hash/except" require "active_support/core_ext/class/attribute" module FactoryBot diff --g...
[ "lib/factory_bot/evaluator.rb", "lib/factory_bot/registry.rb" ]
[]
true
thoughtbot/factory_bot
1,756
issue_to_patch
`#generate` method is throwing an error when used inside of a factory definition when `FactoryBot::Syntax::Methods` is included <!-- By contributing to this project, you agree to abide by the thoughtbot Code of Conduct: https://thoughtbot.com/open-source-code-of-conduct --> ### Description When `include FactoryBot::...
BugFix: standardise parity on :increment_sequence
Fixes: #1754 The issue was `.increment_sequence` within `FactoryBot::Evaluator` was un-defining, then replacing, the `.increment_sequence` method included from `FactoryBot::Syntax::Methods`, but there was a parity miss-match. - Refactored :increment_sequence in both modules to remove the URI requirement. - Upda...
343824fd32bbb2030274eea3a5d9eb54c077c2f3
dcbdd254906dbbd8dfb64dcbbfa2d5c2648eec79
diff --git a/lib/factory_bot/evaluator.rb b/lib/factory_bot/evaluator.rb index 7a4b82e7e..31692d0c4 100644 --- a/lib/factory_bot/evaluator.rb +++ b/lib/factory_bot/evaluator.rb @@ -51,8 +51,15 @@ def __override_names__ @overrides.keys end - def increment_sequence(sequence) - sequence.next(self) + ...
[ "lib/factory_bot/evaluator.rb", "lib/factory_bot/syntax/methods.rb", "spec/acceptance/sequence_context_spec.rb" ]
[]
diff --git a/spec/acceptance/sequence_context_spec.rb b/spec/acceptance/sequence_context_spec.rb index bf7f88445..12fe581fb 100644 --- a/spec/acceptance/sequence_context_spec.rb +++ b/spec/acceptance/sequence_context_spec.rb @@ -1,4 +1,6 @@ -describe "sequences are evaluated in the correct context" do +describe "sequen...
true
thoughtbot/factory_bot
1,753
issue_to_patch
Bump to 6.5.4 [ci skip]
931283f09e752cefc36017473d32e7dac842c0ea
16213eef8da0116a3d637b2aa7bea4a1060788b8
diff --git a/Gemfile.lock b/Gemfile.lock index b9acb02e8..7f64457be 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - factory_bot (6.5.3) + factory_bot (6.5.4) activesupport (>= 6.1.0) GEM diff --git a/NEWS.md b/NEWS.md index f0dd99128..16e2050c6 100644 --- a/NE...
[ "Gemfile.lock", "NEWS.md", "lib/factory_bot/version.rb" ]
[]
true
thoughtbot/factory_bot
1,750
issue_to_patch
Bump to 6.5.3 [ci skip]
0abe26c81a8c78c0214494e5d399cc856b95d8bb
1124a27e96e72c0a592487974dc53f104853ad2c
diff --git a/Gemfile.lock b/Gemfile.lock index db20bede0..b9acb02e8 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - factory_bot (6.5.2) + factory_bot (6.5.3) activesupport (>= 6.1.0) GEM diff --git a/NEWS.md b/NEWS.md index 9952d2eb2..f0dd99128 100644 --- a/NE...
[ "Gemfile.lock", "NEWS.md", "lib/factory_bot/version.rb" ]
[]
true
thoughtbot/factory_bot
1,742
issue_to_patch
Factory Sequence: bug-fix + new methods for setting, generating and rewinding
## Summary I found an odd bug when inheriting sequences that don't have a block. With no block to compare, determining if it was an inherited sequence was problematic. The solution was to give each sequence it's own unique reference (URI). Once this was in place, it became an easy process to expand `:generate`,...
e35980dc72787b52569e199a4ed87ccc86b19bba
ef07e6bf6343914e24c7d4c95ab65658ee7335c7
diff --git a/.gitignore b/.gitignore index a70245afd..98ce10a66 100644 --- a/.gitignore +++ b/.gitignore @@ -9,5 +9,6 @@ coverage tmp bin .rubocop-https* +.zed gemfiles/*.lock diff --git a/docs/src/SUMMARY.md b/docs/src/SUMMARY.md index bed30d120..ec7d4081a 100644 --- a/docs/src/SUMMARY.md +++ b/docs/src/SUMMARY....
[ ".gitignore", "docs/src/SUMMARY.md", "docs/src/sequences/factory-sequences.md", "docs/src/sequences/generating.md", "docs/src/sequences/rewinding.md", "docs/src/sequences/sequence-uris.md", "docs/src/sequences/setting-the-value.md", "lib/factory_bot.rb", "lib/factory_bot/definition.rb", "lib/facto...
[ { "comment": "```suggestion\r\n- An unlimited sequence, such as a character `sequence(:unlimited,'a')` will timeout if not found within the default maximum search time of three seconds.\r\n```", "path": "docs/src/sequences/setting-the-value.md", "hunk": "@@ -0,0 +1,55 @@\n+# Setting the value\n+\n+When ...
diff --git a/spec/acceptance/sequence_context_spec.rb b/spec/acceptance/sequence_context_spec.rb index 4641d6008..bf7f88445 100644 --- a/spec/acceptance/sequence_context_spec.rb +++ b/spec/acceptance/sequence_context_spec.rb @@ -1,7 +1,7 @@ describe "sequences are evaluated in the correct context" do before do ...
true
thoughtbot/factory_bot
1,742
comment_to_fix
Factory Sequence: bug-fix + new methods for setting, generating and rewinding
```suggestion - An unlimited sequence, such as a character `sequence(:unlimited,'a')` will timeout if not found within the default maximum search time of three seconds. ```
e35980dc72787b52569e199a4ed87ccc86b19bba
ef07e6bf6343914e24c7d4c95ab65658ee7335c7
diff --git a/docs/src/sequences/setting-the-value.md b/docs/src/sequences/setting-the-value.md new file mode 100644 index 000000000..ff4f1055e --- /dev/null +++ b/docs/src/sequences/setting-the-value.md @@ -0,0 +1,55 @@ +# Setting the value + +When testing or working in the console, being able to set the sequence to a ...
[ "docs/src/sequences/setting-the-value.md" ]
[ { "comment": "```suggestion\r\n- An unlimited sequence, such as a character `sequence(:unlimited,'a')` will timeout if not found within the default maximum search time of three seconds.\r\n```", "path": "docs/src/sequences/setting-the-value.md", "hunk": "@@ -0,0 +1,55 @@\n+# Setting the value\n+\n+When ...
true
thoughtbot/factory_bot
1,742
comment_to_fix
Factory Sequence: bug-fix + new methods for setting, generating and rewinding
What do you think about renaming `uri_mgr` as `uri_manager`?
e35980dc72787b52569e199a4ed87ccc86b19bba
ef07e6bf6343914e24c7d4c95ab65658ee7335c7
diff --git a/lib/factory_bot/definition.rb b/lib/factory_bot/definition.rb index a9d5fe5c1..b393882a3 100644 --- a/lib/factory_bot/definition.rb +++ b/lib/factory_bot/definition.rb @@ -1,11 +1,12 @@ module FactoryBot # @api private class Definition - attr_reader :defined_traits, :declarations, :name, :registe...
[ "lib/factory_bot/definition.rb" ]
[ { "comment": "What do you think about renaming `uri_mgr` as `uri_manager`?", "path": "lib/factory_bot/definition.rb", "hunk": "@@ -1,11 +1,12 @@\n module FactoryBot\n # @api private\n class Definition\n- attr_reader :defined_traits, :declarations, :name, :registered_enums\n+ attr_reader :defin...
true
thoughtbot/factory_bot
1,742
comment_to_fix
Factory Sequence: bug-fix + new methods for setting, generating and rewinding
`FactoryBot::Internal` is marked as `@api private`, so the documentation won't be shown. I was reading a few PRs to understand its history, and it was introduced on https://github.com/thoughtbot/factory_bot/pull/1262, and `rewind_sequences` was moved there on https://github.com/thoughtbot/factory_bot/pull/1291. `Fac...
e35980dc72787b52569e199a4ed87ccc86b19bba
ef07e6bf6343914e24c7d4c95ab65658ee7335c7
diff --git a/lib/factory_bot/internal.rb b/lib/factory_bot/internal.rb index 1d158aab7..77230cbf6 100644 --- a/lib/factory_bot/internal.rb +++ b/lib/factory_bot/internal.rb @@ -26,6 +26,7 @@ def reset_configuration def register_inline_sequence(sequence) inline_sequences.push(sequence) + sequenc...
[ "lib/factory_bot/internal.rb" ]
[ { "comment": "`FactoryBot::Internal` is marked as `@api private`, so the documentation won't be shown. I was reading a few PRs to understand its history, and it was introduced on https://github.com/thoughtbot/factory_bot/pull/1262, and `rewind_sequences` was moved there on https://github.com/thoughtbot/factory_...
true
thoughtbot/factory_bot
1,742
comment_to_fix
Factory Sequence: bug-fix + new methods for setting, generating and rewinding
nit: I think we should avoid abbreviations like _val_ unless they're commonly referenced as those abbreviations, such as URI or enum.
e35980dc72787b52569e199a4ed87ccc86b19bba
ef07e6bf6343914e24c7d4c95ab65658ee7335c7
diff --git a/lib/factory_bot/sequence.rb b/lib/factory_bot/sequence.rb index 55c06dfeb..6011ebc64 100644 --- a/lib/factory_bot/sequence.rb +++ b/lib/factory_bot/sequence.rb @@ -1,17 +1,33 @@ +require "timeout" + module FactoryBot # Sequences are defined using sequence within a FactoryBot.define block. # Sequence...
[ "lib/factory_bot/sequence.rb" ]
[ { "comment": "nit: I think we should avoid abbreviations like _val_ unless they're commonly referenced as those abbreviations, such as URI or enum.", "path": "lib/factory_bot/sequence.rb", "hunk": "@@ -34,15 +89,34 @@ def names\n [@name] + @aliases\n end\n \n+ def has_name?(test_name)\n+ ...
true
thoughtbot/factory_bot
1,742
comment_to_fix
Factory Sequence: bug-fix + new methods for setting, generating and rewinding
Typo here ```suggestion reset_original_value(original_value) fail_value_not_found(val) end def reset_original_value(original_value) ```
e35980dc72787b52569e199a4ed87ccc86b19bba
ef07e6bf6343914e24c7d4c95ab65658ee7335c7
diff --git a/lib/factory_bot/sequence.rb b/lib/factory_bot/sequence.rb index 55c06dfeb..6011ebc64 100644 --- a/lib/factory_bot/sequence.rb +++ b/lib/factory_bot/sequence.rb @@ -1,17 +1,33 @@ +require "timeout" + module FactoryBot # Sequences are defined using sequence within a FactoryBot.define block. # Sequence...
[ "lib/factory_bot/sequence.rb" ]
[ { "comment": "Typo here\r\n```suggestion\r\n reset_original_value(original_value)\r\n fail_value_not_found(val)\r\n end\r\n\r\n def reset_original_value(original_value)\r\n```", "path": "lib/factory_bot/sequence.rb", "hunk": "@@ -59,6 +133,58 @@ def increment_value\n @value.next\n ...
true
thoughtbot/factory_bot
1,742
comment_to_fix
Factory Sequence: bug-fix + new methods for setting, generating and rewinding
nit: We should use `do/end` for multiline blocks, and `{ }` for single line blocks ```suggestion until @value.peek == original_value { increment_value } ```
e35980dc72787b52569e199a4ed87ccc86b19bba
ef07e6bf6343914e24c7d4c95ab65658ee7335c7
diff --git a/lib/factory_bot/sequence.rb b/lib/factory_bot/sequence.rb index 55c06dfeb..6011ebc64 100644 --- a/lib/factory_bot/sequence.rb +++ b/lib/factory_bot/sequence.rb @@ -1,17 +1,33 @@ +require "timeout" + module FactoryBot # Sequences are defined using sequence within a FactoryBot.define block. # Sequence...
[ "lib/factory_bot/sequence.rb" ]
[ { "comment": "nit: We should use `do/end` for multiline blocks, and `{ }` for single line blocks\r\n```suggestion\r\n until @value.peek == original_value { increment_value }\r\n```", "path": "lib/factory_bot/sequence.rb", "hunk": "@@ -59,6 +133,58 @@ def increment_value\n @value.next\n en...
true
thoughtbot/factory_bot
1,742
comment_to_fix
Factory Sequence: bug-fix + new methods for setting, generating and rewinding
We have a couple of configurations using `mattr_accessor`. Why not add a new configuration that way, instead of using ENVs? Someone could configure it with ENVs if they need, then.
e35980dc72787b52569e199a4ed87ccc86b19bba
ef07e6bf6343914e24c7d4c95ab65658ee7335c7
diff --git a/docs/src/sequences/setting-the-value.md b/docs/src/sequences/setting-the-value.md new file mode 100644 index 000000000..ff4f1055e --- /dev/null +++ b/docs/src/sequences/setting-the-value.md @@ -0,0 +1,55 @@ +# Setting the value + +When testing or working in the console, being able to set the sequence to a ...
[ "docs/src/sequences/setting-the-value.md" ]
[ { "comment": "We have a couple of configurations using `mattr_accessor`. Why not add a new configuration that way, instead of using ENVs? Someone could configure it with ENVs if they need, then.", "path": "docs/src/sequences/setting-the-value.md", "hunk": "@@ -0,0 +1,55 @@\n+# Setting the value\n+\n+Whe...
true
thoughtbot/factory_bot
1,742
comment_to_fix
Factory Sequence: bug-fix + new methods for setting, generating and rewinding
Thoughts on making this module `@api private`? It seems really internal
e35980dc72787b52569e199a4ed87ccc86b19bba
ef07e6bf6343914e24c7d4c95ab65658ee7335c7
diff --git a/lib/factory_bot/uri_manager.rb b/lib/factory_bot/uri_manager.rb new file mode 100644 index 000000000..2ec09d5a5 --- /dev/null +++ b/lib/factory_bot/uri_manager.rb @@ -0,0 +1,63 @@ +module FactoryBot + # @api private + class UriManager + attr_reader :endpoints, :paths, :uri_list + + delegate :size, ...
[ "lib/factory_bot/uri_manager.rb" ]
[ { "comment": "Thoughts on making this module `@api private`? It seems really internal", "path": "lib/factory_bot/uri_manager.rb", "hunk": "@@ -0,0 +1,79 @@\n+module FactoryBot\n+ class UriManager", "resolving_sha": "ef07e6bf6343914e24c7d4c95ab65658ee7335c7", "resolving_diff": "diff --git a/lib/...
true
thoughtbot/factory_bot
1,742
comment_to_fix
Factory Sequence: bug-fix + new methods for setting, generating and rewinding
I'd rather not have organizational comments, such as `# Class methods` or `# Private`. We don't use them in other classes or other projects. If we want to enforce some code organization, I believe there are built-in Rubocop cops for that. What do you think?
e35980dc72787b52569e199a4ed87ccc86b19bba
ef07e6bf6343914e24c7d4c95ab65658ee7335c7
diff --git a/lib/factory_bot/uri_manager.rb b/lib/factory_bot/uri_manager.rb new file mode 100644 index 000000000..2ec09d5a5 --- /dev/null +++ b/lib/factory_bot/uri_manager.rb @@ -0,0 +1,63 @@ +module FactoryBot + # @api private + class UriManager + attr_reader :endpoints, :paths, :uri_list + + delegate :size, ...
[ "lib/factory_bot/uri_manager.rb" ]
[ { "comment": "I'd rather not have organizational comments, such as `# Class methods` or `# Private`. We don't use them in other classes or other projects. If we want to enforce some code organization, I believe there are built-in Rubocop cops for that. What do you think?", "path": "lib/factory_bot/uri_manag...
true
thoughtbot/factory_bot
1,742
comment_to_fix
Factory Sequence: bug-fix + new methods for setting, generating and rewinding
I believe this (and others) could be better read and more correct semantically as `context`
e35980dc72787b52569e199a4ed87ccc86b19bba
ef07e6bf6343914e24c7d4c95ab65658ee7335c7
diff --git a/spec/acceptance/sequence_spec.rb b/spec/acceptance/sequence_spec.rb index c8bfbbec1..3a7b60a76 100644 --- a/spec/acceptance/sequence_spec.rb +++ b/spec/acceptance/sequence_spec.rb @@ -1,72 +1,166 @@ describe "sequences" do include FactoryBot::Syntax::Methods + require "ostruct" - it "generates seve...
[ "spec/acceptance/sequence_spec.rb" ]
[ { "comment": "I believe this (and others) could be better read and more correct semantically as `context`", "path": "spec/acceptance/sequence_spec.rb", "hunk": "@@ -1,72 +1,166 @@\n describe \"sequences\" do\n include FactoryBot::Syntax::Methods\n+ require \"ostruct\"\n \n- it \"generates several va...
true
thoughtbot/factory_bot
1,742
comment_to_fix
Factory Sequence: bug-fix + new methods for setting, generating and rewinding
There are some `it "it` that could be quickly fixed with a search and replace, hehe
e35980dc72787b52569e199a4ed87ccc86b19bba
ef07e6bf6343914e24c7d4c95ab65658ee7335c7
diff --git a/spec/acceptance/sequence_spec.rb b/spec/acceptance/sequence_spec.rb index c8bfbbec1..3a7b60a76 100644 --- a/spec/acceptance/sequence_spec.rb +++ b/spec/acceptance/sequence_spec.rb @@ -1,72 +1,166 @@ describe "sequences" do include FactoryBot::Syntax::Methods + require "ostruct" - it "generates seve...
[ "spec/acceptance/sequence_spec.rb" ]
[ { "comment": "There are some `it \"it` that could be quickly fixed with a search and replace, hehe", "path": "spec/acceptance/sequence_spec.rb", "hunk": "@@ -1,72 +1,166 @@\n describe \"sequences\" do\n include FactoryBot::Syntax::Methods\n+ require \"ostruct\"\n \n- it \"generates several values in...
true
thoughtbot/factory_bot
1,742
comment_to_fix
Factory Sequence: bug-fix + new methods for setting, generating and rewinding
Although it reads nicely with the RSpec `--documentation` flag is used, as test code it doesn't read as nicely. I don't want it to be too big of a lift, so I can rearrange that after merging (yay LLMs typing faster than I can 😁 )
e35980dc72787b52569e199a4ed87ccc86b19bba
ef07e6bf6343914e24c7d4c95ab65658ee7335c7
diff --git a/spec/acceptance/sequence_setting_spec.rb b/spec/acceptance/sequence_setting_spec.rb new file mode 100644 index 000000000..42de4e181 --- /dev/null +++ b/spec/acceptance/sequence_setting_spec.rb @@ -0,0 +1,352 @@ +describe "FactoryBot.set_sequence" do + include FactoryBot::Syntax::Methods + + describe "on ...
[ "spec/acceptance/sequence_setting_spec.rb" ]
[ { "comment": "Although it reads nicely with the RSpec `--documentation` flag is used, as test code it doesn't read as nicely. I don't want it to be too big of a lift, so I can rearrange that after merging (yay LLMs typing faster than I can 😁 )", "path": "spec/acceptance/sequence_setting_spec.rb", "hunk...
true