| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
There was a problem hiding this comment.
Warning
Temporary-write failures can abort initialization, cross-filesystem moves can lose diagnostics, and the new check does not validate failed SARIF export.
5 open findingsPersists pre-database diagnostics on disk so they can be included in failed SARIF output.
Changes:
| File | Description |
|---|---|
| src/diagnostics.ts | Implements temporary persistence and database relocation. |
| src/init-action.ts | Flushes and logs temporary diagnostics. |
| src/init-action-post-helper.ts | Supplies temporary diagnostics during failed SARIF generation. |
| src/codeql.ts | Adds --diagnostic-dir support. |
| src/diagnostics.test.ts | Tests temporary persistence and flushing. |
| src/setup-codeql.test.ts | Provides temporary-directory test setup. |
| src/config/db-config.test.ts | Provides temporary-directory test setup. |
| pr-checks/diagnostics-without-db.ts | Checks for the expected diagnostic file. |
| pr-checks/checks/diagnostics-without-db.yml | Defines the new PR check. |
| lib/entry-points.js | Generated bundle; excluded from review. |
| .github/workflows/__diagnostics-without-db.yml | Generated workflow; excluded from review. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Sorry, something went wrong.
There was a problem hiding this comment.
The focused diagnostic-persistence changes have unit and integration coverage, with no unresolved blocking findings.
1 open issue 2 files not reviewedReview effort: Balanced
Sorry, something went wrong.
There was a problem hiding this comment.
Thanks for addressing my comments, just a couple of final things before we merge this.
Sorry, something went wrong.
| if (language !== undefined) { | ||
| return path.resolve(basePath, language, "diagnostic", "codeql-action"); | ||
| } | ||
| return basePath; |
There was a problem hiding this comment.
I think this has introduced a new issue: language-specific diagnostics which are created after the config is initialized, but before the DB is created, now don't get picked up because they live in ${tempDiagnosticsRootDir}/${language}/diagnostic/codeql-action, but init-post passes --diagnostic-dir=${tempDiagnosticsRootDir}/diagnostic/codeql-action.
We could modify init post to pass --diagnostic-dir=${tempDiagnosticsRootDir}. It might also be good to add a regression test.
Sorry, something went wrong.
There was a problem hiding this comment.
Cross-step persistence and CLI export need human validation, particularly the uncovered database-initialization failure path that skips failed-SARIF generation.
2 open issuesReview effort: Max
Sorry, something went wrong.
| return; | ||
| } finally { | ||
| logUnwrittenDiagnostics(); | ||
| logTemporaryDiagnostics(actionState); |
There was a problem hiding this comment.
I think we can leave this for follow up.
Sorry, something went wrong.
| return; | ||
| } finally { | ||
| logUnwrittenDiagnostics(); | ||
| logTemporaryDiagnostics(actionState); |
There was a problem hiding this comment.
I think we can leave this for follow up.
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Diagnostics are typically written to the database cluster and are then included in the SARIF that is generated by the CLI. However, in the CodeQL Action we may produce diagnostics before the database cluster is initialised. To work around this, we have so far relied on tracking diagnostics in memory that were created before the database cluster is ready. After the cluster is initialised, those diagnostics are then flushed to disk. However, this represents a problem if the database cluster is never successfully initialised.
This PR changes this so that diagnostics are written directly to a temporary directory on disk if the database cluster is not yet ready. They are then moved to the database cluster once it is initialised. If the cluster is never initialised, then we point the CLI at the temporary directory on disk using a --diagnostic-dir argument. The CLI will then pick up any diagnostics that are still in that location and include them in the failed SARIF.
Risk assessment
For internal use only. Please select the risk level of this change:
Which use cases does this change impact?
Workflow types:
Products:
Environments:
How did/will you validate this change?
If something goes wrong after this change is released, what are the mitigation and rollback strategies?
How will you know if something goes wrong after this change is released?
Are there any special considerations for merging or releasing this change?
Merge / deployment checklist