Skip to content

No automated check exists; add a POSIX-sh compile-and-connect script #14

Description

@dmccoystephenson

Problem

This repository has no automated check of any kind — no test framework, no build system, no CI workflow, and no script that compiles the tree. The closest thing to a test is Message.main (Message.java:79-89), which round-trips process=square,number=10, and prints both strings without asserting anything, leaving the comparison to a human.

Any change to Protocol, Message, or either end of the socket can therefore break the program with nothing to contradict it.

Proposed change

A single POSIX sh script at the repository root that:

  1. Compiles every .java file under src/ and fails on any error or warning.
  2. Runs SimpleServer.Message and checks the round-trip output.
  3. Starts ServerApp, drives the real protocol over a real socket, and checks the responses for a valid square, a non-numeric number, and an unrecognised process.

Constraints that keep this proportionate to a 484-line teaching exercise:

  • One file, POSIX sh, no framework and no dependency beyond the JDK, nc, and the shell. Adding Maven, Gradle, or JUnit is a separate decision belonging to the repository owner.
  • Characterisation, not correction. Each case must assert what the code does today. Where writing a case reveals a bug, the bug gets its own issue and a separate change — the case is not used to smuggle in a fix.
  • The script must skip cleanly rather than fail when no JDK is present: probing for javac and exiting 0 with a printed SKIP: no JDK keeps a local run and a future CI job behaving identically.
  • Every invocation that opens a socket must be wrapped in timeout, and the server must be killed afterward. A server that fails to bind is expected to spin without bound, and a client against a server that never closes the connection will hang.

Note for whoever implements this

The script cannot be written responsibly without running it. A JDK, a JRE, and nc all need to be available to whoever picks this up.


This issue was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener).

drafted by Claude on behalf of Daniel Stephenson

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions