lplalbert commented on PR #391: URL: https://github.com/apache/hugegraph-ai/pull/391#issuecomment-6789358437
**Independent verification at `d97afa1` + four findings from a cross-platform check** ## Reproduction (Linux) Environment: Ubuntu 22.04 x86_64, Python 3.12.13 (uv-managed), SQLite/aiosqlite, single process. Ran the regression suites for the eight reviewed fixes plus the historical-replay fix: `tests/test_outbox_receipts.py tests/test_outbox_lifespan.py tests/test_derivation_retry.py tests/test_documents_ingest.py tests/test_documents_tasks.py tests/test_documents_binder.py tests/test_stores.py tests/test_auth_identity.py tests/test_auth_rbac.py` **Result: 104 passed, 2 skipped (the two `ONTOGENY_PG_DSN`-gated tests in `test_outbox_receipts.py`), 0 failed** (390s). This reproduces the reported validation for this scope, including the cross-store document-ID and concurrent-scan regressions from `bef3b92` and the historical-replay coverage from `d97afa1`. Not covered here: the `ONTOGENY_PG_DSN` tests (no PostgreSQL in this environment — the "12 outbox/lifespan tests on PostgreSQL 16" remain unreproduced by me), the frontend tests, deployment, and the combined-suite scale. The same nine files were also run on Windows 10 (zh-CN, Python 3.12) to check platform assumptions. That surfaced the findings below. One further Windows failure, `test_credential_symlink_is_not_followed`, is an environment limitation (symlink creation needs privilege there), not product behavior. ## Finding 1 — `os.fchmod` makes admin bootstrap fail on Windows (Important) `ontogeny/server/ontogeny/auth/service.py:81` (new in this stack): `_write_bootstrap_password` calls `os.fchmod`, which does not exist on Windows. With the secure default (`ONTOGENY_ADMIN_PASSWORD` unset), bootstrap raises `AttributeError: module 'os' has no attribute 'fchmod'` and the admin account is never created. Evidence (same nine files, Windows 10 zh-CN): `50 passed, 2 skipped, 9 failed, 45 errors`. 52 of the 54 non-passing results trace to this one line (45 fixture errors + 7 test failures) — including the cross-store document-ID and concurrent-scan regressions, which fail before reaching their assertions. With `ONTOGENY_ADMIN_PASSWORD` set (bypassing the file path): `96 passed, 2 skipped, 6 failed, 2 errors`; four of the remainder deliberately exercise the credential-file path and hit `fchmod` again. The `except BaseException: path.unlink(missing_ok=True)` cleanup does work — no credential file is left behind — so the defect is availability, not leakage. Suggested fix: gate the call (`if os.name == "posix": os.fchmod(...)`) and note in the docstring that Windows stdlib cannot enforce `0o600` (on POSIX the `os.open` mode is umask-masked and `fchmod` is what makes the bits exact — that intent should stay). If Windows is explicitly out of scope for the server, an actionable error at bootstrap would still beat an `AttributeError` from stdlib internals. ## Finding 2 — `upload` reports OS-native relative paths while the scan pipeline uses POSIX (Important) `documents/engine.py:1652` builds the `written` list with `str(target.relative_to(root))`, so on Windows the response contains `supplier-notes\initech.md`. The scan/identity pipeline normalizes the same value to POSIX (`documents/corpus.py:101`, `path.relative_to(base).as_posix()`), and `test_upload_then_ingest` asserts the POSIX form (`assert out["written"] == ["supplier-notes/initech.md"]`, failing at `tests/test_documents_ingest.py:427` on Windows). Same concept, two representations across boundaries of one feature. Suggested fix: `written.append(target.relative_to(root).as_posix())`, matching the corpus scan. ## Finding 3 — locale-dependent text IO in tests (Minor) Several tests read/write files without `encoding=`. On a non-UTF-8 default locale (observed: Windows zh-CN/GBK) this raises `UnicodeDecodeError` on non-ASCII content. Two failures observed: `tests/test_documents_tasks.py:229` (agent YAML) and `tests/test_documents_ingest.py:669` (shipped note file). Product code passes `encoding="utf-8"` consistently; ~50 bare `read_text()`/`write_text()` sites remain under `tests/`. Adding `encoding="utf-8"` there is cheap and matches the boundary discipline in `server/`. ## Note — the occasional `aiosqlite` event-loop-closed warnings (hypothesis, not confirmed) I saw this warning class once (3× `PytestUnhandledThreadExceptionWarning: RuntimeError: Event loop is closed`) but could not reproduce it on demand (a repeat of the same set: zero warnings; a script that drops a `doc_context` engine after its loop closes: clean). Source-derived observation: `tests/doc_fixtures.py::doc_context` yields its `ServiceContext` without teardown while `tests/conftest.py::client` ends with `await sc.engine.dispose()`; `ServiceContext` has no shutdown method at all. Unifying teardown there is cheap, but I could not confirm it removes the warnings — flagging as a hypothesis, not a verified fix. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
