Skip to content

refactor(apps): group artifact storage under apps.storage - #493

Open
zengchuang-hw wants to merge 2 commits into
InferMatrixLab:mainfrom
zengchuang-hw:codex/apps-490-storage
Open

zengchuang-hw wants to merge 2 commits into
InferMatrixLab:mainfrom
zengchuang-hw:codex/apps-490-storage

Conversation

@zengchuang-hw

@zengchuang-hw zengchuang-hw commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Governing Issue and delivery slice

Refs #490
Refs #371

The flat Apps artifact modules made storage ownership and dependency direction hard to follow. This first storage slice puts the four unchanged implementations in inferrsi.apps.storage, migrates API/provider/view/delivery callers, and preserves the registered old public imports.

  • Accepted scope and delegation come from Dong1017's design acceptance and the Apps owner's instruction to start storage after confirmation.
  • Acting implementer is Codex under the Apps owner's account. Independent implementation review remains pending.

Changed artifacts and evidence

Requirement Actual change Verification
Storage ownership storage/{archive,artifact_reader,result,evidence_layout}.py, import-free initializer, canonical consumers and current docs Compared all four implementation bodies with the base; no behavior edits
Explicit compatibility Four static re-export modules with literal __all__; docs/apps-module-migrations.json records only these four migrations Mapping-driven shape, export identity, active-consumer and pickle tests
Dependency direction and import behavior Storage cannot reach current or future handoff implementations Transitive import graph plus direct and indirect negative cases; cold-import guards, audit-event probes and warning checks
Existing records Persistent namespace strings, schema versions, fixed references and retired root modules retain their behavior Apps output/publication/replay, assessment, result-delivery and Harness sealing regressions; old instance pickle and new canonical pickle assertions
Distribution compatibility Installed checker verifies canonical and old exports/pickles sdist-built wheel installed into a fresh environment outside the checkout; all 930 packaged resource digests match the checkout

Checks and dependencies

Local environment was Windows with Python 3.12. The broad local regression and package/plugin checks below assessed the first implementation, 3a9f9b62; production code is unchanged by the subsequent test-only review correction.

  • ruff check src tests tools and git diff --check passed.
  • All tests/test_apps_*.py, Harness generation sealing, module boundaries, target import gate, isolation policy, evidence paths, repository-pack facade and result-delivery checks produced 418 passed, 330 subtests passed, 1 failed, 2 skipped.
  • The failure is test_result_delivery.py::test_progress_uses_committed_control_and_a_fixed_clock. Windows raises PermissionError during the nested nonblocking file lock, while the caller catches BlockingIOError. The identical failure was reproduced from an unmodified archive of base 8aba657da79e8ed9f6e6fbb33437e9d9fdd8f1c7. It remains a baseline limitation; no skip or weakened assertion was added.
  • The two skips require Playwright, which is unavailable locally. Existing ready-lane browser checks remain unchanged.
  • Codex plugin suite, WorkSwarm native/shared launcher and both DSH entry tests produced 55 passed, with one existing tar extraction deprecation warning. These cover isolated runtime/resources, dashboard export and comparison/report paths.
  • Fresh non-editable installation from the sdist-built wheel passed python -I check_installed.py, including canonical/shim identity and legacy pickle loading.
  • Review follow-up f4f9a53d excludes generic aliases from class/function definition-origin assertions and adds a regression simulating inspect.isclass returning true for ResourceReader. All 12 migration tests, Ruff and diff checks passed again. Object identity remains checked for every export, including the alias.
  • The initial ready run passed installed-package (Python 3.10/3.11), Linux full-check (3.11), dashboard-browser and Windows/macOS host compatibility. Current-head CI is rerunning after the test-only correction; no workflow lanes or thresholds changed.
  • Protected Knowledge paths are unchanged; the knowledge authorship status should be Not applicable.

Remaining work and Issue closure

Handoff, workflows, integrations and integrated acceptance remain in #490. Handoff needs the Harness interface owner's review of the #475 sealing path. Shim retirement requires its own reviewed removal PR and version decision.

This is one implementation slice, not whole-Issue completion. Goal acceptance remains with the #371 Apps owner and affected interface owners. Please review this revision independently before integration.

Signed-off-by: zengchuang <zengchuang3@huawei.com>
Agent-assisted-by: Codex (author)
Dong1017
Dong1017 previously approved these changes Nov 18, 2026

@Dong1017 Dong1017 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

PR review verdict — PASS
Reviewed base 8aba657 and head 3a9f9b6 (full diff, first review). pr/prior-reviews.md shows no formal reviews, no Approve on this head and no outstanding CHANGES_REQUESTED. This is the first independent review on this head. Author is zengchuang-hw. Dong-bot (authorized delegate) is not the author.

Verified from the diff

  • The four moves are byte-identical. The git blob hashes of the old and new files match:

    • apps/archive.py 6ca423a4 → apps/storage/archive.py 6ca423a4
    • apps/artifact_reader.py e07ac63a → apps/storage/artifact_reader.py e07ac63a
    • apps/result.py 23b3eebb → apps/storage/result.py 23b3eebb
    • apps/evidence_layout.py 8510920e → apps/storage/evidence_layout.py 8510920e

    There are no behavior changes in the storage code. The relative imports inside the moved modules (.result, .archive) still resolve within storage/, and I found no import cycle.

  • The old modules are explicit-export shims. Each is a docstring, an explicit from .storage.X import (...) and __all__.

    • The exports match docs/apps-output.md and docs/apps-module-migrations.json, with no * and no aliasing.
    • Old pickle references to inferrsi.apps.archive.RunOutput, functions and so on resolve to the same objects.
    • New pickles name the canonical modules.
    • Private helpers (_logical_path, _check_ref, _selected_verdict, _RECORD_OBSERVATIONS) are intentionally not re-exported. The in-tree consumers (api, bridge, candidate_provider, delivery/*, views/attempt) are repointed to apps.storage.*, and the docs say private-helper patches must target the canonical module.
  • Tests are repointed. Imports and patch targets move to apps.storage. The new tests/test_apps_module_migrations.py covers:

    • shim AST shape and export identity
    • old and new pickle round-trips, including a legacy RunOutput instance
    • a consumer registry against the JSON inventory
    • no direct or transitive storage → handoff edge, with a back-edge negative case
    • an import-free initializer, no I/O in module bodies, and cold imports that load no handoff or heavy modules

    tests/check_installed.py also checks both import paths against the installed package.

  • Docs are consistent with the code. architecture.md, module-layout.md, operations.md, apps-output.md, current-design.md and the contracts/evidence.py docstring all name apps.storage.*. The retired root inferrsi.evidence_paths stays unaliased.

  • Shim removal is not slipped in. It is explicitly deferred to a separate reviewed PR.

Not verified here (non-blocking)

  • I did not run the test suite or see CI results. The consumer-registry test and the cold-import test depend on repo-wide state (every importer of the old names, and the harness package initializer staying light). Please confirm CI is green before merge.
  • I could not check the governing issue wording for #371/#490. The docs now say #371 "owns" the Apps composition and #490 is an "accepted directory follow-up", where they previously said "proposal / not accepted". The maintainers should confirm that status change is accurate.
  • On Python 3.10, inspect.isclass(ResourceReader) can be True for a collections.abc.Callable[...] alias. test_shim_is_an_explicit_export_of_the_same_objects would then assert value.__module__ == canonical and fail, because the alias's __module__ is collections.abc. Please confirm the supported Python floor (3.11+ avoids this). The check_installed.py loop already guards on __module__.

This is one approving vote only. The ruleset still requires two eligible approvals before merge.


Posted by Dong-bot, an automated agent acting on behalf of @Dong1017 (always-on-bot, model claude-sonnet-5-5).

@Dong1017 Dong1017 added area:harness Harness module: profile, A/B loop, quality gates, evidence reports kind:task Bounded delivery task with a delegated slice labels Nov 18, 2026
Signed-off-by: zengchuang <zengchuang3@huawei.com>
Agent-assisted-by: Codex (author)

Copy link
Copy Markdown
Contributor Author

@Dong1017 感谢检视。两点已处理并补充依据。

  1. task: 按职责整理 Apps 子模块目录(handoff / storage / workflows / integrations) #490 已按你在 设计接受记录 中的明确 Accepted 更新状态,该记录也已链接在 PR 正文。Apps 负责人授权方案确认后定稿并启动 storage,本 PR 是该授权下的首个实施切片;task: 按职责整理 Apps 子模块目录(handoff / storage / workflows / integrations) #490 与 task: Apps 应用层详细设计与迁移计划(CLI / Python / Plugin) #371 均保持打开。
  2. 保持项目现有的 Python >=3.10。已提交 f4f9a53d,通过 typing.get_origin 识别泛型别名,仅对实际函数和类定义校验 canonical __module__。ResourceReader 仍参与新旧对象身份校验。另加用例模拟 inspect.isclass(ResourceReader) 为真的情况,12 项迁移测试、Ruff 和 diff 检查均通过。生产实现未变。

初版 CI 的安装包、Linux Python 3.11 全量、浏览器和 Windows/macOS 宿主检查已通过,更新后按现有 CI 重跑。请你和 @david6666666 复核当前提交;满足检视条件时请在当前 head 提交首行 LGTM 的 Approve。仍需两份独立有效审批和 CI 通过后才能合入。

@Dong1017 Dong1017 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

PR review verdict — PASS
Reviewed base 8aba657 and head f4f9a53. This is an incremental re-review of 3a9f9b6..f4f9a53.

State

  • My earlier PASS on 3a9f9b62 was dismissed when this head was pushed. It is not an Approve on the current head.
  • There is no outstanding CHANGES_REQUESTED and no other formal review on this head.
  • That review verified the four storage moves as byte-identical. The git blob hashes of the old and new files matched. It also verified that the old modules are explicit re-export shims.

Follow-up in f4f9a53d

  • Both points from my earlier review are addressed in the PR thread and body:
    • The project keeps Python >=3.10.
    • The test now uses typing.get_origin to exclude generic aliases such as ResourceReader from the class/function __module__ definition-origin assertions. It still checks object identity for every export, including the alias.
    • A new regression simulates inspect.isclass(ResourceReader) returning true. The author reports all 12 migration tests, Ruff and git diff --check passing.
  • The author states the follow-up is test-only and production code is unchanged since 3a9f9b62.
  • The scope is consistent with the accepted design on #490. This PR is a storage slice that refs #490 and #371 without closing them. Handoff, workflows and integrations remain open.
  • The remaining test_result_delivery.py::test_progress_uses_committed_control_and_a_fixed_clock failure is documented. It is a Windows PermissionError vs BlockingIOError limitation, reproduced on an unmodified archive of base 8aba657. No assertion was weakened.

Not verified here

  • I did not read the f4f9a53d delta line by line, and I did not run any tests.
  • I did not independently confirm that production files are unchanged since 3a9f9b62.
  • Current-head CI is still rerunning according to the author. Merge should wait for it to go green.
  • This is one approval. The ruleset still requires two independent valid approvals, and the Harness interface owner's #475 sealing review is still needed for the later handoff slice.

Optional follow-up, not blocking: before merge, confirm that the CI rerun's installed-package lanes (Python 3.10/3.11) pass on this head.


Posted by Dong-bot, an automated agent acting on behalf of @Dong1017 (always-on-bot, model claude-sonnet-5-5).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:harness Harness module: profile, A/B loop, quality gates, evidence reports kind:task Bounded delivery task with a delegated slice

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants