Repository navigation
[O2B-1631] Allow users to link logs to simulation passes - #2251
Merged
Merged
Conversation
Add the log_simulation_passes join table (migration, table model and repository) and the Log <-> SimulationPass many-to-many associations, plus a seeder linking some logs to simulation passes.
…e API
POST /api/logs now accepts a `simulationPasses` list of names. Names are
resolved in a single query (an error lists every unknown name), the links
are stored when the log is created, and the created log and GET
/api/logs/:id return its simulation passes as { id, name }.
createLog and LogService.create take a new simulationPassNames argument.
Includes service, use case and API tests.
Add a "Simulation passes" field (comma separated names) to the log creation page, sent as `simulationPasses[]`. Replying to a log pre-fills it with the simulation passes of the parent log. Includes UI tests.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #2251 +/- ##
==========================================
+ Coverage 46.35% 46.49% +0.13%
==========================================
Files 1047 1051 +4
Lines 17268 17341 +73
Branches 3140 3156 +16
==========================================
+ Hits 8004 8062 +58
- Misses 9264 9279 +15 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
🟡 Changes recommended
Collection responses omit saved associations, and the log display does not render them.
2 open issues
What changed in this PR
Adds simulation-pass associations to logs, extending the existing data-pass linking workflow.
Changes:
- Adds database storage, associations, and adapters.
- Extends log creation, individual retrieval, and reply inheritance.
- Adds service, API, and browser tests.
| File | Description |
|---|---|
| test/public/logs/create.test.js | Tests form inheritance and creation. |
| test/lib/usecases/log/CreateLogUseCase.test.js | Tests linking and unknown names. |
| test/lib/server/services/simulationPasses/index.js | Registers lookup tests. |
| test/lib/server/services/simulationPasses/getAllSimulationPassesByNameOrFail.test.js | Tests simulation-pass lookup. |
| test/lib/server/services/log/LogService.test.js | Tests service-level linking. |
| test/api/logs.test.js | Tests creation and individual retrieval. |
| lib/usecases/log/GetLogUseCase.js | Loads simulation-pass associations. |
| lib/usecases/log/CreateLogUseCase.js | Deduplicates and forwards pass names. |
| lib/server/services/simulationPasses/getAllSimulationPassesByNameOrFail.js | Resolves names and rejects missing passes. |
| lib/server/services/run/RunService.js | Adjusts positional creation arguments. |
| lib/server/services/run/logEntriesCreation/logSpecificRunTag.js | Preserves transaction argument placement. |
| lib/server/services/run/logEntriesCreation/logRunQualityChange.js | Preserves transaction argument placement. |
| lib/server/services/run/logEntriesCreation/logCalibrationStatusChange.js | Preserves transaction argument placement. |
| lib/server/services/log/LogService.js | Accepts and retrieves linked passes. |
| lib/server/services/log/createLog.js | Persists simulation-pass links. |
| lib/public/views/Logs/Create/LogReplyModel.js | Inherits parent simulation passes. |
| lib/public/views/Logs/Create/LogCreationModel.js | Stores and submits pass names. |
| lib/public/views/Logs/Create/logCreationComponent.js | Adds simulation-pass input. |
| lib/domain/entities/Log.js | Documents linked passes. |
| lib/domain/dtos/CreateLogDto.js | Validates simulation-pass arrays. |
| lib/database/tables/logsimulationpasses.js | Defines the junction model. |
| lib/database/tables/index.js | Registers the junction model. |
| lib/database/seeders/20240125141300-log-simulation-passes.js | Seeds example associations. |
| lib/database/repositories/LogSimulationPassesRepository.js | Inserts association records. |
| lib/database/repositories/index.js | Exports the new repository. |
| lib/database/models/typedefs/SequelizeLog.js | Documents the database association. |
| lib/database/models/simulationPass.js | Associates passes with logs. |
| lib/database/models/log.js | Associates logs with passes. |
| lib/database/migrations/v1/20261019100000-create-log-simulation-passes.js | Creates the junction table. |
| lib/database/adapters/SimulationPassAdapter.js | Adds minimal pass serialization. |
| lib/database/adapters/LogAdapter.js | Serializes linked simulation passes. |
| lib/database/adapters/index.js | Wires the simulation-pass adapter. |
Review effort: Balanced
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

I have a JIRA ticket
Notable changes for users:
Notable changes for developers:
Changes made to the database: