Repository navigation
Tests: every server module in one layer; one serve helper and one config - #48
Merged
Merged
Conversation
…fig for every fixture Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Bobowski
added a commit
that referenced
this pull request
Nov 2, 2026
…is a dataclass (#54) ## Intent Write each rule of a deploy once: the image of a plan, the Dockerfile path, the compose files, and the status of an exit code. Source: the user, in the Yard audit. It replaces #49, which GitHub closed when the base branch of #49 was deleted. #48 is merged. ## Found - `apps._ready_repo`, `apps._ready_source`, and `compose.saved_project` each built the image and the Dockerfile path with their own copy of the rules: `split('@')[0]@<digest>` two times, `compose:<rev[7:19]>` two times, and the `yard:` Dockerfile rule two times. `compose.project` took eight arguments, and the callers worked out the checkout themselves. - `apps._apply` and `status.deploy_record` each turned an exit code into a status and an error text: 0 ok, 3 reverted, any other code failed. - `status.deploy_record` returned a plain dict. The API and `apps._join` read it by string keys. - `test_check_repo_debounces` failed at random on `main`. Since #47, each check runs `podman ps`. That call can take longer than the 50 ms window of the test. ## Changed - `compose.project(config, app, plan)` takes the plan (`Deployed`). It picks the checkout (the clone for a repo app, the app folder otherwise), the image (`compose.plan_image`), the Dockerfile, and the files. `Project` carries `image`. `saved_project` only checks that the files are still there, then calls `project`. - `status.deploy_status(code)` and `status.deploy_error(code, previous)` hold the exit-code rule. `_apply` and `deploy_record` use them. - `status.Record` is the deploy record. `Row.deploy` and `Page.deploy` hold a `Record`. The JSON shapes do not change: `asdict` writes the same keys, and the deploy route still adds `port` on `ok`. - The debounce test uses a 0.5 s window. I did not add a separate `Source` type. When `compose.project` owns the rules, the string checks that remain are each in one place. ## Not done Nothing ## Proof ``` $ just check ... 500 passed in 60.45s ``` `tests/server/test_compose.py` checks the image and the Dockerfile of each kind through the new `project`. `test_check_repo_debounces` passed 5 runs in a row. ## Questions None 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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.
Intent
Fix two test defects and share the test fixtures. Source: the user asked for an audit of Yard and then for every finding to be done. This is the first pull request of that series.
Found
tests/test_layers.pylistedbindsas a service, butapp/server/binds.pyis gone.siteswas in no layer, andsourcesanddetect/were in no layer. Thus an adapter could importsitesand no test failed.tests/server/test_journal.pycopied the env setup oftests/conftest.pybut did not setYARD_JOURNAL_SOCKET. On a Linux runner,journal.sendin those tests wrote to/run/systemd/journal/socket.test_doctor_flags_a_missing_journalbuilt aConfigwith the same gap.Config(...)by hand. Four Podman fakes in the doctor and status tests did the same thing in four ways.parse_porttest intest_apps.pybehind a wrapper, three "the removed command or route is gone" tests, and an ssh deduction test that repeatstest_remote_repo_spellings.Changed
tests/test_layers.py: the sets name every server module. The new testtest_every_server_module_has_one_layerfails when a module is in no layer or in two layers. A module indetect/counts asdetect.tests/conftest.py: oneserve(tmp_path, monkeypatch, journalctl=..., journal_dir=...)context manager starts the production bootstrap. It always sets the journal socket intotmp_path. Theyardfixture and the four journal fixtures use it.tests/server/conftest.py:make_config(tmp_path, **overrides)andmake_yard(tmp_path, **overrides)takeConfigfield names (skip_deploy=False, notskip=False).FakePodman(answers, default)answers by command prefix, anddead_podman()refuses every command.test_parse_porttotest_podman.py.I kept the specific Podman fakes in
test_apps.py. They model a deploy container that changes state, and a table of prefixes does not fit that.Not done
FakeApifortests/cli/test_main.py. It comes with the CLI HTTP change in a later pull request, because those tests patchcli._api_try.Proof
test_every_server_module_has_one_layerpasses. With the old sets it fails onsitesandsources.Questions
None
🤖 Generated with Claude Code