Conversation
…n permissions Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
zsculac
left a comment
There was a problem hiding this comment.
I found 3 release-confidence issues that look worth fixing before merging.
- Package-lock enforcement misses normal dependency version bumps
- In
.github/workflows/check-package-lock.yml, the detector only flags dependency-related changes when added diff lines contain keys like"dependencies","devDependencies", etc. That means changing a version inside an existing dependency block, such asaxios: ^1.8.0 -> ^1.9.0, does not setpackage_json_changed=true. - Result: the workflow can skip both the
package-lock.jsonupdate check andnpm ci --dry-run, so a stale lockfile can merge with a false green signal. - Files:
.github/workflows/check-package-lock.ymllines 46-47, 74-98. - Fix direction: run lockfile validation whenever
package.jsonchanges, or make the diff detection understand edits within dependency sections rather than only added section headers.
- Active publish coverage now treats a returned UAL as terminal success without checking the real publish operation
- In
test/bdd/steps/api/publish.mjs, the step resolves status toCOMPLETEDwheneverresult.UALexists, andI wait for latest Publish to finalizereturns immediately on that synthesized status instead of polling/publish/{operationId}to a terminal state. - This is paired with
test/utilities/dkg-client-helper.mjsforcingminimumNumberOfFinalizationConfirmations: 0, so the test is intentionally allowing an earlier exit condition than before. - Result: a publish flow can return a UAL after early acks / intermediate progress, but the underlying node publish operation can still be non-terminal or fail later; the current active scenarios would still pass.
- Files:
test/bdd/steps/api/publish.mjslines 35-47 and 92-106,test/utilities/dkg-client-helper.mjslines 14-20,test/bdd/features/publish.featurelines 11-27. - Fix direction: if an
operationIdexists, keep polling the node publish operation toCOMPLETED/FAILEDfor release-gating tests instead of inferring success fromUALalone.
- Publish/update negative-path scenarios were weakened from specific validation checks to generic failure checks
- The direct-call steps in
test/bdd/steps/api/publish.mjsandtest/bdd/steps/api/update.mjsnow catch any HTTP error and collapse it tostatus: FAILED, and the feature files assert onlyFAILED. - Previously these scenarios were verifying a specific validation-path error (
ValidateAssetError). - Result: unrelated regressions like a 500, auth failure, routing bug, or other server-side crash can now satisfy the scenario and appear green, which weakens CI signal quality on negative-path validation behavior.
- Files:
test/bdd/steps/api/publish.mjslines 64-78,test/bdd/steps/api/update.mjslines 20-34,test/bdd/steps/common.mjslines 321-339,test/bdd/features/publish-errors.featureline 12,test/bdd/features/update-errors.featureline 12. - Fix direction: preserve and assert the expected error type or status code for these scenarios rather than treating any failure mode as acceptable.
I did not flag style/refactor issues. These are the places where the refactor appears to make green CI prove less than it used to.
1. Package-lock: validate lockfile whenever package.json changes, not just when dependency section headers are added. Catches version bumps within existing dependency blocks. 2. Publish polling: always poll the node operation API when an operationId exists instead of short-circuiting on UAL presence. Verifies the operation actually reached terminal state on the node. 3. Negative-path tests: restore polling step and specific error type assertions (ValidateAssetError) instead of generic FAILED check. Prevents unrelated failures (500s, auth errors) from satisfying the scenario with a false green. Made-with: Cursor
There was a problem hiding this comment.
I couldn’t perform the PR review because the workspace sandbox failed on every command invocation (bwrap: loopback: Failed RTM_NEWADDR: Operation not permitted), so pr-diff.patch was not readable in this session. No findings are reported because I could not inspect the diff content.
Remove the naive "was lockfile also modified in the diff" check. npm ci --dry-run is the proper validator — it fails when deps are out of sync and passes cleanly for script-only changes. Made-with: Cursor
There was a problem hiding this comment.
I could not perform the PR review because the execution environment blocked all file reads (bwrap: loopback: Failed RTM_NEWADDR: Operation not permitted), so pr-diff.patch was inaccessible. Without the diff content, I can’t produce valid line-anchored findings introduced by this PR. Share the patch content directly and I will return a full severity-ordered review in the required format.
There was a problem hiding this comment.
I couldn’t perform the PR review because I was unable to read pr-diff.patch in this environment; every shell/file access attempt failed with bwrap: loopback: Failed RTM_NEWADDR: Operation not permitted. Please share the diff content directly (or restore workspace read access), and I will return a proper severity-ordered review with line-anchored inline comments in the required JSON format.
There was a problem hiding this comment.
I couldn’t perform the PR review because the execution environment blocked all file reads (bwrap: loopback: Failed RTM_NEWADDR: Operation not permitted), so pr-diff.patch could not be inspected. Without the diff contents, I can’t produce valid line-anchored findings scoped to this PR. Please provide the patch text (or fix sandbox access) and I can return a full severity-ranked review immediately.
There was a problem hiding this comment.
This PR makes a large BDD test-infra refactor and CI reshaping, but it introduces one blocker around destructive Redis cleanup. The new node/bootstrap orchestration is more structured, yet a few safety checks were weakened, which can increase local test flakiness and make failures harder to diagnose. Maintainability is mixed overall: readability improved in several step files, but reliability guardrails regressed in key setup/teardown paths.
| // Each node uses a per-node queue name (command-executor-node0, etc.); without | ||
| // flushing, old job schedulers and pending jobs survive across scenarios. | ||
| try { | ||
| execSync('redis-cli FLUSHALL', { stdio: 'ignore' }); |
There was a problem hiding this comment.
🔴 Bug: redis-cli FLUSHALL wipes every database in the local Redis instance, which can destroy non-test data when developers run BDD locally. Scope this cleanup to a dedicated test DB (FLUSHDB on selected DB index) or delete only the test queue keys by prefix.
| break; | ||
| } | ||
| if (attempt === maxAttempts) { | ||
| this.logger.log( |
There was a problem hiding this comment.
🟡 Issue: This step logs a warning and continues even when shard sync never reaches the expected peer count, so I wait for nodes to sync and mark active can pass in an unsynced state and reintroduce flakiness. Fail the step on the final attempt instead of proceeding.
|
|
||
| for (const port of [rpcPort, networkPort]) { | ||
| try { | ||
| execSync(`npx kill-port --port ${port}`, { stdio: 'ignore' }); |
There was a problem hiding this comment.
🟡 Issue: Killing randomly selected ports can terminate unrelated local processes. Replace this with explicit free-port probing/reservation (or only kill PIDs started by this test harness).
| // Expected in small test networks — suppress silently. | ||
| return; | ||
| } | ||
| console.error(`[test-node] Unhandled rejection: ${msg}`); |
There was a problem hiding this comment.
🟡 Issue: Unknown unhandled rejections are only logged and then execution continues, which can hide real node failures and leave tests running in a corrupted state. Re-throw or process.exit(1) for non-whitelisted error codes.
| Scenario: Publish a knowledge asset directly on the node | ||
| Given I setup 1 nodes | ||
| And I wait for 5 seconds | ||
| @publish-error |
There was a problem hiding this comment.
🟡 Issue: New singular error tags (@publish-error, same pattern in @update-error/@get-error) drift from existing npm scripts that filter on plural tags (@publish-errors, etc.), so targeted suites won’t run. Align feature tags with script filters or update the scripts to match.
The invalid publish/update requests are rejected at the HTTP routing level (404) before reaching the operation pipeline, so the error type is HTTP_404, not ValidateAssetError. Made-with: Cursor
There was a problem hiding this comment.
This PR significantly refactors BDD orchestration and CI, but it introduces blocker-level risks in the test harness. The new setup can wipe unrelated local Redis data and can mask real node failures by swallowing unexpected unhandled rejections in child processes. It also weakens test signal by allowing shard-sync timeouts to continue and by lowering signature requirements so publish can pass without real peer replication. Maintainability improved in structure, but reliability and coverage confidence are reduced by these changes.
| // Each node uses a per-node queue name (command-executor-node0, etc.); without | ||
| // flushing, old job schedulers and pending jobs survive across scenarios. | ||
| try { | ||
| execSync('redis-cli FLUSHALL', { stdio: 'ignore' }); |
There was a problem hiding this comment.
🔴 Bug: redis-cli FLUSHALL clears every Redis DB on localhost, which can delete unrelated local data outside this test suite. Use an isolated Redis DB/index for tests and FLUSHDB (or delete only this suite’s key prefixes).
| // Expected in small test networks — suppress silently. | ||
| return; | ||
| } | ||
| console.error(`[test-node] Unhandled rejection: ${msg}`); |
There was a problem hiding this comment.
🔴 Bug: After adding an unhandledRejection listener, unknown rejections are only logged and no longer fail the child process, so tests can pass while the node is in a bad state. Re-throw or process.exit(1) for non-whitelisted errors.
| break; | ||
| } | ||
| if (attempt === maxAttempts) { | ||
| this.logger.log( |
There was a problem hiding this comment.
🟡 Issue: This step only logs when shard sync times out and continues execution, which makes later publish/get checks flaky and non-deterministic. Fail fast here (assert.fail/throw) when maxAttempts is reached.
| // publish arrives. Setting this to 1 ensures the publishing node itself (always in | ||
| // its own shard) satisfies the requirement. | ||
| for (const blockchain of Object.values(this.state.localBlockchains)) { | ||
| await blockchain.setParametersStorageParams({ minimumRequiredSignatures: 1 }); |
There was a problem hiding this comment.
🟡 Issue: Forcing minimumRequiredSignatures to 1 lets publish succeed without actual replication peers, so these BDD scenarios stop validating network replication behavior. Keep this at least 2 for multi-node scenarios or scope the override to tests that explicitly need it.
| Scenario: Publish a knowledge asset directly on the node | ||
| Given I setup 1 nodes | ||
| And I wait for 5 seconds | ||
| @publish-error |
There was a problem hiding this comment.
🟡 Issue: The new singular tag (@publish-error) is inconsistent with existing npm scripts that target plural tags (@publish-errors), so targeted suites won’t run. Align tags/scripts consistently (same pattern also appears in get-errors.feature and update-errors.feature).
Refcatored BDD tests and added package-lock check