Skip to content

feat(learning): the 8 base validators for the roadmap engine#59

Merged
Derssa merged 1 commit into
mainfrom
feat/learning-base-validators
Jul 15, 2026
Merged

feat(learning): the 8 base validators for the roadmap engine#59
Derssa merged 1 commit into
mainfrom
feat/learning-base-validators

Conversation

@OthmaneZ05

Copy link
Copy Markdown
Collaborator

Summary of Changes

Implements the 7 remaining validator types for the learning/roadmap validation engine — table_exists, redis_key_exists, mongo_collection_exists, edge_exists, lb_upstreams, port_denied, asg_replicas — alongside the existing container_running. Roadmap steps can now check real Postgres/Redis/Mongo state, network connectivity, and ASG replica counts, not just container liveness.

Design choices, in short:

  • DB validators (table_exists, redis_key_exists, mongo_collection_exists) go through containerProvider's executePsqlCommand/executeRedisCommand/executeMongoCommand, using the same query idiom already used by the Postgres/Redis/Mongo explorers.
  • edge_exists/port_denied reuse NetworkService's security-group rule expansion (computeSemanticRules, now exposed publicly) instead of re-deriving connectivity from raw security groups — this is the same logic that drives real iptables enforcement, so a validator's verdict always matches what's actually applied.
  • asg_replicas/lb_upstreams read directly off ContainerInfo.asgId/isAsgInstance, no new dependency needed.
  • A shared resolveRunningContainer/resolveSourceAndTarget helper keeps node targeting, type checks, and pedagogical fail messages (observed vs. expected, plain language, no raw Docker ids) consistent across all 7 validators.
  • Docker-not-ready responses from Postgres/Redis/Mongo are treated as a pedagogical fail ("still starting up, try again"), not an infrastructure error — only a genuinely unreachable Docker daemon propagates as error.

Types of Changes

  • New feature / node type addition
  • Bug fix (non-breaking change resolving an issue)
  • Refactoring / structural cleanup
  • Documentation update

Verification & Testing

Automated Checks

  • Run npm run lint successfully with no errors
  • Run npm run build successfully with no compilation errors
  • Run npm test successfully (all tests pass — 206 tests, 25 suites)

Manual Verification

Ran the backend against real Docker and exercised container_running, table_exists, edge_exists and port_denied in both pass and fail against real containers, using the existing example roadmap (roadmaps/example-first-architecture.json), which already targets 4 of these 8 types:

  • Created/started a real ubuntu node → container_running flips fail → pass.
  • Created a real Postgres node, ran CREATE TABLE users (...) through it → table_exists flips fail → pass, including the "database still starting up" pedagogical message before Postgres was ready.
  • Applied a real network config with a security-group rule → edge_exists flips fail → pass; widened the rule to all ports → port_denied flips pass → fail, matching the real enforcement policy.
  • Cleaned up the demo project/containers afterwards.

Checklist

  • My code follows the repository's code style and lint standards
  • I have updated the documentation or instructions if necessary
  • All unit and integration tests are passing

Implements the 7 remaining validator types (table_exists, redis_key_exists,
mongo_collection_exists, edge_exists, lb_upstreams, port_denied,
asg_replicas) alongside the existing container_running, so roadmap steps
can check real Postgres/Redis/Mongo state, network connectivity and ASG
replica counts, not just container liveness.

Reuses existing infrastructure rather than duplicating it: DB validators go
through containerProvider's exec* commands (same idiom as the explorers),
edge_exists/port_denied reuse NetworkService's security-group rule
expansion (now exposed publicly) instead of re-deriving connectivity, and
asg_replicas/lb_upstreams read directly off ContainerInfo's asgId/isAsgInstance
fields. A shared resolveRunningContainer/resolveSourceAndTarget helper keeps
node targeting and pedagogical fail messages consistent across validators.

Each validator ships with pass/fail/degraded-case unit tests, and the
existing example roadmap already exercises 4 of them end to end.
@OthmaneZ05
OthmaneZ05 requested a review from Derssa as a code owner July 15, 2026 03:11
@Derssa
Derssa merged commit c056c82 into main Jul 15, 2026
2 checks passed
@Derssa
Derssa deleted the feat/learning-base-validators branch July 15, 2026 03:39
OthmaneZ05 added a commit that referenced this pull request Jul 18, 2026
Implements the 7 remaining validator types (table_exists, redis_key_exists,
mongo_collection_exists, edge_exists, lb_upstreams, port_denied,
asg_replicas) alongside the existing container_running, so roadmap steps
can check real Postgres/Redis/Mongo state, network connectivity and ASG
replica counts, not just container liveness.

Reuses existing infrastructure rather than duplicating it: DB validators go
through containerProvider's exec* commands (same idiom as the explorers),
edge_exists/port_denied reuse NetworkService's security-group rule
expansion (now exposed publicly) instead of re-deriving connectivity, and
asg_replicas/lb_upstreams read directly off ContainerInfo's asgId/isAsgInstance
fields. A shared resolveRunningContainer/resolveSourceAndTarget helper keeps
node targeting and pedagogical fail messages consistent across validators.

Each validator ships with pass/fail/degraded-case unit tests, and the
existing example roadmap already exercises 4 of them end to end.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants