Skip to content

Add WebHarbor reset and smoke verification script - #47

Open
Lxr-max wants to merge 1 commit into
aiming-lab:mainfrom
Lxr-max:add-reset-smoke-check
Open

Add WebHarbor reset and smoke verification script#47
Lxr-max wants to merge 1 commit into
aiming-lab:mainfrom
Lxr-max:add-reset-smoke-check

Conversation

@Lxr-max

@Lxr-max Lxr-max commented Jun 4, 2026

Copy link
Copy Markdown

Summary

  • adds scripts/check_reset_smoke.py to verify WebHarbor control-plane resets, per-site homepage smoke checks, and local runtime-vs-seed DB MD5 parity
  • adds scripts/test_check_reset_smoke.py with standard-library coverage for MD5 checks, site filtering, strict mode, JSON output, and local HTTP reset/homepage behavior
  • adds a short README usage section for the new reset/smoke checker

Why this helps WebHarbor review

  • gives contributors and reviewers a single repo-level command to sanity-check /reset/<site> behavior
  • makes it easier to spot broken homepages and missing/dirty local DB state before opening a website PR
  • supports both Docker-backed runs and local dry-runs where DB files may be missing or the control server is offline

CLI usage

python scripts/check_reset_smoke.py --site amazon
python scripts/check_reset_smoke.py --control-url http://localhost:8101
python scripts/check_reset_smoke.py --base-host localhost
python scripts/check_reset_smoke.py --timeout 10
python scripts/check_reset_smoke.py --json
python scripts/check_reset_smoke.py --strict

Checks included

  • site discovery from websyn_start.sh and control_server.py
  • control server health check via GET /health
  • per-site POST /reset/<site> checks, or optional --reset-all
  • homepage smoke checks via the registered site port
  • local instance/*.db vs instance_seed/*.db MD5 comparison when visible
  • graceful skip/warning behavior when local DB files are not available

Test commands and results

  • py -m py_compile scripts/check_reset_smoke.py
  • py -m py_compile scripts/test_check_reset_smoke.py
  • py scripts/test_check_reset_smoke.py ✅ (7 tests passed)
  • py scripts/check_reset_smoke.py --help
  • py scripts/check_reset_smoke.py --json --site amazon --timeout 0.5 ✅ output is valid JSON; on a machine without a running control server it reports clear connection/timeout failures instead of crashing

Notes about running with/without Docker

  • with Docker or a local WebHarbor control server running, the script performs live reset and homepage checks
  • without Docker or without the control server, the script still runs and reports clear reset/homepage connection failures
  • when local sites/<site>/instance/*.db and sites/<site>/instance_seed/*.db are not present, MD5 checks are reported as skipped warnings rather than fatal errors by default

Notes

  • this is not a website contribution
  • no HF assets are involved
  • .assets-revision was not modified
  • no existing site implementation was changed

Known limitations

  • live reset checks intentionally depend on a running local control server and may fail with clear connection errors when none is available
  • MD5 comparison only runs when the relevant DB files are locally visible from the current checkout

QiushiSun added a commit to QiushiSun/WebHarbor that referenced this pull request Jul 26, 2026
fetch_assets.sh otherwise resolves a revision that predates the paired
assets PR, and websyn_start.sh copies instance_seed to instance for every
site under set -e — so a missing directory aborts the whole entrypoint and
no site comes up, not just this one.

Verified from a clean clone of this branch: fetch_assets.sh, build.sh, and
a container on 41000-41016 give /health ok with 17/17 alive and every port
200, with the seed DB byte-identical after POST /reset/google_finance.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@jackjin1997

Copy link
Copy Markdown
Contributor

Claiming this for a reviewer-owned continuation. I will preserve @Lxr-max's original commit and attribution, and audit scripts/check_reset_smoke.py against current main: site/port discovery against the real websyn_start.sh and control_server.py registries, control-plane /health, per-site /reset/<site> and /reset-all behavior, homepage smoke, runtime-vs-seed DB parity semantics, CLI/exit-code/JSON contract, malformed-input handling, and the bundled tests — exercised against a real built container, not only fixtures.

This is repository tooling rather than a new mirror, so site UI fidelity, task runs, and Hugging Face asset checks are not applicable. I will link a separate Draft Review: PR here before maintainer handoff, and I will not merge either PR.

@jackjin1997

Copy link
Copy Markdown
Contributor

Draft reviewer PR opened: #108Review: WebHarbor reset and smoke verification script (#47, original by @Lxr-max). @Lxr-max's commit is preserved there; the reviewer changes sit on top.

Summary of what the review found and fixed, verified against a live control plane:

  • the DB parity check hashed <repo>/sites/<site>/{instance,instance_seed}, but the control plane resets /opt/WebSyn/<site>/instance inside the deployment (COPY sites/ /opt/WebSyn/). With the environment stopped it still reported "runtime DB matches seed DB"; with the deployment verified clean, a row added to the local checkout produced a failing "differs from seed DB after reset". On a fresh clone the check was skipped for all 24 sites. Now there is --docker-container / --db-root, every result reports the source it hashed, and no parity verdict is reported without a reset to attribute it to.
  • registry drift, a missing websyn_start.sh, unparseable SITES and a BASE_PORT mismatch escaped as tracebacks; they are structured findings now.
  • --strict failed a correct environment because absent local instance/ warned; the README's own --strict example therefore failed on the documented Docker workflow.
  • a failed --reset-all was counted once per registered site.

The registry discovery, HTTP reset/health/homepage checks and the structured handling of unknown sites and ambiguous DB pairs were already correct and are unchanged. #108 stays in draft until an independent blind review of the frozen scenario runs comes back; I will not merge either PR.

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