fix(learning): harden validators against false passes on network and DB checks#67
Merged
Merged
Conversation
Derssa
approved these changes
Jul 17, 2026
OthmaneZ05
added a commit
that referenced
this pull request
Jul 18, 2026
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.
Summary of Changes
Several learning-engine validators could report a false ✓ — the worst failure mode for an auto-graded roadmap. This PR hardens them and rebuilds their tests on realistic security-group configs:
port_denied: no longer passes on a project with no applied network config (or when either node sits outside a subnet) — in that state nothing is enforced and containers talk freely on the shared bridge, so the check now fails with a pedagogical message telling the learner to place the nodes in subnets first.edge_exists/port_denied: DENY rules are now honored with the same first-match-wins semantics as the Network Simulator and the real iptables enforcement (shared helpers invalidators/shared.ts). An early DENY blocks the port even when a broader ALLOW sits below it.table_exists: requires the probe query to output exactly1— psql WARNING noise merged into the output no longer counts as proof.redis_key_exists: redis-cli server errors ((error) LOADING …,(error) NOAUTH …) are treated as not-ready instead of "a key exists".asg_replicas: resolves its node through the shared type-checked resolver (a same-named non-ASG node no longer passes withcount: 0) and rejects negative/fractionalcountas invalid params.edge_exists/port_deniedunit tests no longer inject hand-built semantic rules (the self-confirming seam that hid these bugs) — they derive rules from realistic configs (default deny-all-inbound/allow-all-outbound security group per node, learner rules prepended) through the realNetworkService.computeSemanticRules. The integration fixture now uses the same realistic security groups and covers the default-SG and DENY-shadow scenarios.docs/roadmap-format.mddocuments the connectivity semantics and the newport_deniedbehavior.Types of Changes
Verification & Testing
Automated Checks
npm run lintsuccessfully with no errorsnpm run buildsuccessfully with no compilation errorsnpm testsuccessfully (all tests pass)Manual Verification
Ran the integration suite (
npm run test:integration) against a real Docker daemon 3 consecutive times, all green — it exercises every touched validator pass and fail against real containers, including the new scenarios: default security group only (edge_exists fails, port_denied passes), a DENY rule shadowing a broader ALLOW (edge_exists fails / port_denied passes on the denied port, edge_exists passes on another port), and a node outside any subnet (port_denied fails). Also verified the ASG type-check by the fixture itself: the previous fixture created the ASG boundary as a plain ubuntu node and the hardened validator correctly rejected it until the fixture used a realautoscalinggroupnode.Checklist