Skip to content

refactor!: restore package layering in src - #2244

Open
jackie-cqz wants to merge 11 commits into
oceanbase:masterfrom
jackie-cqz:fix/src-layering
Open

jackie-cqz wants to merge 11 commits into
oceanbase:masterfrom
jackie-cqz:fix/src-layering

Conversation

@jackie-cqz

@jackie-cqz jackie-cqz commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Which issue or RFC does this PR close?

No tracking issue. This follows up on the Artifact Processing Supervisor
(RFC 1515, #1523),
which replaced the APScheduler path removed here.

Rationale for this change

A static import scan of src/powercontext (module-level, deferred, and TYPE_CHECKING imports) found lower layers
importing upper ones:

Edge Imports before After
builtin → server 23 (16 deferred into function bodies) 1 (annotation-only TYPE_CHECKING)
builtin → client 1 0
server → cli 3 0
service → cli 3 0

The deferred imports hid a cross-layer cycle: server/processing_security.py imported the runtime composition root at
module level while the runtime imported it back inside functions. Separately, the in-process APScheduler activation
path stayed in the runtime after #1523 removed its only caller.

What changes are included in this PR?

Three commits that can be reviewed one at a time:

  1. refactor(runtime): remove the legacy APScheduler scheduling path

    • Delete builtin/runtime/scheduler.py, BuiltinRuntime.start_scheduler, ScheduledSourceProcessor,
      ScheduledExperienceProcessor, the access-scoped scheduled runners in server/factory.py, and the Scope
      enumeration helpers that only fed them, together with their tests.
    • scheduler_path on open_builtin_runtime and create_server_app is deprecated: it is ignored and emits a
      DeprecationWarning. powercontext.paths.default_scheduler_path is removed.
    • APScheduler stays a dependency because cron bindings parse expressions with CronTrigger.
    • In-repository callers (98 keyword arguments across tests, examples, and scripts) and docs no longer pass or
      describe the scheduler sidecar.
  2. refactor(authz)!: move access control into the built-in runtime

    • powercontext.server.authz → powercontext.builtin.authz. It already depended only on Core and built-in
      persistence.
    • Processing-child security (WorkerSecuritySpec, WorkerSecurity, open_worker_security) moves to
      builtin/authz/worker.py. build_worker_security stays in server/processing_security.py because it reads
      ServerSettings.
    • DreamAuthorization (builtin/authz/dream.py) holds the recorded-principal checks processing children need. The
      Server's DreamAccess subclass adds the request-principal Review checks and request IDs.
    • The powercontext code command moves to powercontext.cli.code; the entry point is updated and the command is
      unchanged.
  3. refactor: move shared helpers out of the cli and client packages

    • powercontext.cli.env_file → powercontext.env_file (standard library only).
    • powercontext.cli.inference_notice → powercontext.server.inference_notice.
    • Credential redaction primitives → powercontext.redaction; powercontext.client.capture keeps capture-event
      rendering and uses them.
  4. Merge branch 'master' (seven merges): resolves conflicts with the reusable database upgrade framework
    (feat(migrations): complete the reusable database upgrade framework #2168), durable owner recovery (feat(authz): recover external owner writes from durable intents #2187), dedicated database provisioning (feat(storage): provision dedicated seekdb and oceanbase databases #2031), and the managed plugin
    framework (feat(artifact): add managed plugin framework and some example #2246), plus the v1.5.0 release preparation (chore(release): prepare v1.5.0 and refresh product screenshots #2395) and ownership migration when enabling
    enforcement (fix(access): support ownership migration when enabling enforcement #2304)

    • Keeps upstream's deployment_runner(settings, ...) and server/database_migration.py. The framework needs the
      full Server settings, so the access-control move no longer narrows that signature. This leaves one
      annotation-only (TYPE_CHECKING) builtin → server import, in
      builtin/persistence/migrations/deployment.py.
    • Points the upgrade release gate's MANAGED_INPUTS and its tests at src/powercontext/builtin/authz.
      managed_digest skips a missing directory silently, so without this the gate would have stopped covering
      access control.
    • Places feat(authz): recover external owner writes from durable intents #2187's new owner_recovery.py under builtin/authz and rewrites its imports, server/app.py,
      server/factory.py, and the new owner-recovery tests for the new package path. The only code from that PR in
      the scheduled-runner helpers this PR deletes was the owner-recovery session threaded through them; with no
      caller left, the helpers stay deleted.
    • For feat(storage): provision dedicated seekdb and oceanbase databases #2031: keeps both import sets in server/cli.py, takes the new test setup in
      tests/test_atomic_memory_migration_cli.py, and follows the moves into code that arrived with the merge: the
      new source_management gateway and the agent-tool-recovery evaluation server import access control from
      builtin.authz, tests/test_cli.py imports and patches the code command at powercontext.cli.code, and
      the two scheduler_path arguments added upstream are dropped.
    • Updates release/upgrade-support.json: the persistence digest, plus one rationale sentence in the existing
      style, kept alongside the rationale upstream added. The generated table and index DDL for all 75 persistence
      and access tables, including pc_access_owner_recovery, pc_source_write_plugins, and the plugin framework's
      tables, is identical to master on the SQLite and MySQL dialects, so no table layout or migration encoding
      changes. This is a maintainer-owned declaration; please confirm the wording.
    • For feat(artifact): add managed plugin framework and some example #2246 and the 36 other commits in the latest merge: upstream edited server/authz/profiles.py and
      service.py after this branch had moved them, and git applied those edits to builtin/authz. The new
      plugin-framework modules under builtin/runtime and their tests import access control from builtin.authz
      and the worker-side security from builtin.authz.worker, so the framework adds no new builtin → server
      import. Three follow-ups the merge needed: the perf_counter import that the first commit removed is
      restored because PreparedContext receipts (feat(context): add bounded PreparedContext receipts #2258) use it, two new tests (fix(tests): initialize native Code Server storage before seeding #2348) stop passing the removed
      scheduler argument to the harness helpers, and the CI change-selection test uses the new path of
      owner_recovery.py, which classifies the same way. ty found the two helper callers; a search for the
      scheduler_path= keyword could not, because they pass it positionally.
    • For the fifth merge (9c8f061c, 28 commits: the v1.5.0 release preparation (chore(release): prepare v1.5.0 and refresh product screenshots #2395), the Rust PowerContext
      Gateway executor (feat(gateway): add Rust PowerContext Gateway executor #2307) and its conversation-scoped injection (feat(gateway): inject prepared context into Responses requests #2400, fix(gateway): prepare once per user message within a conversation and replay it #2416, feat(gateway): inject by default in combined deployments for host conversations #2417), historical Server upgrade
      paths (fix(migrations): support historical Server upgrade paths #2394), and the final request and response privacy checks with their input-encoding evaluation (feat(inference): enforce final request and response privacy checks #2311)):
      the only textual conflict was release/upgrade-support.json,
      where upstream raised the target to 1.5.0 and extended the rationale for the historical upgrade paths. This PR
      keeps that text, re-appends its own sentence, and recomputes the digest; the gate passes. Six files added
      upstream still used moved or removed names: the input-encoding evaluation runner
      (evaluation/performance/input_encoding/runner.py) and four new tests passed scheduler_path, and three new
      tests imported from powercontext.server.authz. The runner's _open_runtime helper drops its scheduler_path
      parameter and the tests import from powercontext.builtin.authz; nothing else needed editing.
    • For the sixth merge (1190dcbb, 75 commits: ownership migration when enabling enforcement (fix(access): support ownership migration when enabling enforcement #2304), Source
      evidence declarations (feat(memory): persist versioned Source evidence and neutral Atomic Memory projection #2004), and Desktop Linux diagnostics (feat(desktop):add Linux disgnostics integration #2343)): fix(access): support ownership migration when enabling enforcement #2304 added
      server/authz/keys.py, which git placed at builtin/authz/keys.py by rename detection, and
      server/ownership.py, and it edited WorkerSecurity in server/processing_security.py, which this branch had
      split. The class lives in builtin/authz/worker.py, so the three bounded idempotency keys are applied there and
      processing_security.py keeps only build_worker_security. In server/app.py, factory.py, and cli.py the
      branch's builtin.authz imports are kept, plus bounded_idempotency_key and OwnerRecovery, which the new code
      uses; _scheduled_access_runners stays deleted. release/upgrade-support.json takes upstream's text for the new
      v1_5_0_002 and v1_5_0_003 revisions, re-appends this PR's sentence, and recomputes the digest. A new
      static_scope_bootstrap_would_grant method and the new ownership tests imported server.authz, and 18 calls in
      tests/e2e/test_access_ownership_migration.py plus two other tests passed scheduler_path; all are updated.
    • Upstream also raised the code-seekdb job timeout from 30 to 60 minutes in this range. The two
      code-seekdb (…, 0) failures on the previous head were that job hitting the 30-minute limit in the unified
      migrations step, and the same limit cancelled code-seekdb (3.11, 0) on master.
    • For the seventh merge (2853ed98, 2 commits: the website SEO and Markdown export changes (feat(website): improve SEO, Markdown exports, and community links #2454) and the
      OpenCode setting that turns prompt-time recall off (feat(opencode): add a setting that turns prompt-time recall off #2455)): textually clean. Neither commit touches src/, so
      nothing needed to follow the moves.
  5. test(release): import the access-control types the installed release ships

    • The upgrade acceptance runs tests/release_upgrades/authorization_fixture.py under each installed release's
      own interpreter, before and after migration. The path rewrite in commit 2 made it import
      powercontext.builtin.authz, which PowerContext 1.3.0 does not have, so every 1.3.0 case failed with
      ModuleNotFoundError before migration started. The fixture now chooses the package with
      importlib.util.find_spec, and both the source and target authorization checks are unchanged.

Reverse edges that remain and are out of scope: server → service (5 imports in database_migration.py, where
db-migrate stops the personal service before migrating, and in the newer database_admission.py), and one
core → builtin import in artifacts/indexes.py that #2246 introduced and this PR does not touch.

Are there any user-facing changes?

For Python SDK and embedding users, yes. There are no HTTP, MCP, CLI, configuration, or persisted-format changes.

  • Breaking: import access-control types from powercontext.builtin.authz instead of powercontext.server.authz.
    No alias is provided, because aliasing the old package path would load its submodules a second time and break
    isinstance checks. Jupyter tutorial 13 is updated.
  • Breaking: powercontext.cli.env_file is now powercontext.env_file. default_scheduler_path and the
    ScheduledSourceProcessor / ScheduledExperienceProcessor exports are removed. known_secret_values and the
    sensitive-key constants are imported from powercontext.redaction; render_capture_event is unchanged.
  • Deprecated: the scheduler_path keyword on open_builtin_runtime and create_server_app.
  • Docs: the core protocol and remote-access development guides, the interfaces guide, and a status note in RFC 0019
    are updated in both locales.

How was this change tested?

  • After the latest merge of master (c9c9448b): uv run python -m pytest -n auto --doctest-modules gives 9179
    passed, 934 skipped, 17 failed. Fourteen of the failures also occur on an unmodified checkout of master
    (1190dcbb) in my environment; I ran those three files there and the failure sets are identical. They are in
    tests/test_source_management.py (9), tests/e2e/test_source_collect.py (3), and
    tests/e2e/test_source_deployment.py (2). I did not classify all 14 on master; the full run on this branch shows
    Source background processes currently require Linux (this machine is macOS) in 9 of them. The other three are
    test_candidate_replay_sqlite[rename], test_chunked_http_error_body_respects_the_absolute_budget, and
    test_large_changes_response_obeys_elapsed_and_byte_budgets. I ran the full suite while other checks shared the
    machine (it took 36 minutes where the previous run took 12), and two of the three are named for elapsed-time
    budgets. All three pass when their files are run alone, both on this branch and on master (92 passed, 6 skipped each).
  • After the seventh merge (a3ee50dd) I did not rerun the full suite, because the two commits change no Python under
    src/. I ran the tests for the files they touch (integration manifest and guidance, blog site, OpenCode, CI scope,
    remote-access docs: 247 passed, 7 skipped) and tests/e2e/test_zcode_service_chain.py three times (2 passed each time).
  • Every component of make check passes on a3ee50dd when run separately: version-check, pinned workflow actions,
    integration-manifest-check, integration-guidance-check, upgrade-policy-check, uv lock --locked, all 11
    prek hooks, and ty check for the package (no diagnostics) and for the Pydantic AI integration. I ran them one by
    one because make check itself stopped on a network error while prek fetched its hook repositories on my machine.
  • test_enforced_mode_cannot_silently_start_without_authentication_or_provider depended on validation inside the
    removed scheduled runners. It now checks the background-principal guard through build_worker_security with a
    runnable family, and checks that a schedule with no runnable family is still rejected at startup.
  • DDL equivalence: the table and index DDL generated from the persistence and access metadata (75 tables) is
    byte-identical between master and this branch on the SQLite and MySQL dialects.
  • Added tests: scheduler_path is ignored with a DeprecationWarning and creates no sidecar, for both
    open_builtin_runtime and create_server_app.
  • Each of the three original commits, before the merge: ruff, ty check, and focused tests (369, 419, and 590 passed). The second commit's batch
    also reported fixture 'migration_backend' not found for one e2e test; the same pytest arguments produce the same
    error on master, and the test passes alone and in the full run.
  • Every moved or new module imports cleanly as the first import in a fresh interpreter. builtin/authz/dream.py keeps
    annotation-only imports under TYPE_CHECKING so it does not trigger the existing
    builtin.dream.service ↔ builtin.runtime import cycle.
  • Upgrade fixtures (commit 5): with the published 1.3.0 wheel and a wheel built from this branch, each installed in
    its own venv and run with python -I, the previous authorization_fixture.py reproduces the CI error under 1.3.0
    and the new one imports under both. processing_fixture.py and upgrade_database_probe.py also import under
    both.
  • Not run: make notebooks-test, real-service e2e (--run-real-e2e), tox across Python versions, and the
    installed-artifact upgrade acceptance matrix (upgrade-release.yml). The harness requires Linux process
    ownership and cannot run on macOS, so the migration and target-side phases are checked only by CI; only the
    policy check was run locally.

AI usage statement

Built with Claude Code. Claude Opus 5.5 did the analysis, implementation, tests, and commit split. Claude Sonnet 5.5
performed the initial read-only repository exploration through subagents, resolved the merge conflicts, and updated
this description. Changes were validated with the commands listed above.

🤖 Generated with Claude Code

jackie-cqz and others added 3 commits October 26, 2026 15:00
The Artifact Processing Supervisor replaced in-process APScheduler activation
in oceanbase#1523, which also removed the only `start_scheduler` call. The scheduler
module, `BuiltinRuntime.start_scheduler`, the scheduled Source and Experience
processors, the access-scoped runners the Server factory built for them, and
the Scope enumeration helpers that only fed them were left without production
callers.

Remove that path and its tests. APScheduler stays a dependency because cron
bindings still parse expressions with `CronTrigger`.

`scheduler_path` on `open_builtin_runtime` and `create_server_app` is now
deprecated: it is ignored and emits a DeprecationWarning. The
`default_scheduler_path` helper and the `ScheduledSourceProcessor` and
`ScheduledExperienceProcessor` exports are removed. In-repository callers,
examples, and docs no longer pass or describe the scheduler sidecar.

The enforced-mode startup test now checks the background-principal guard
through the supervisor's worker security, where it applies, and separately
checks that a schedule without a runnable family is rejected at startup.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The built-in runtime imported `powercontext.server.authz` in 23 places, and
`server.processing_security` imported the runtime composition root while the
runtime lazily imported it back. Access control depends only on Core and
built-in persistence, so it belongs below the Server.

- Move `powercontext.server.authz` to `powercontext.builtin.authz`.
- Split processing security: the child-side `WorkerSecuritySpec`,
  `WorkerSecurity`, and `open_worker_security` move to
  `powercontext.builtin.authz.worker`; `build_worker_security`, which reads
  `ServerSettings`, stays in `powercontext.server.processing_security`.
- Split Dream access: `DreamAuthorization` in
  `powercontext.builtin.authz.dream` checks recorded Dream principals for
  processing children; the Server's `DreamAccess` subclass adds the
  request-principal Review checks and request IDs.
- `deployment_runner` takes the database configuration instead of
  `ServerSettings`.
- Move the `powercontext code` command to `powercontext.cli.code`.

The built-in package no longer imports `powercontext.server`.

BREAKING CHANGE: import access-control types from `powercontext.builtin.authz`
instead of `powercontext.server.authz`. No compatibility alias is provided,
because aliasing the old package path would load its submodules twice and
break `isinstance` checks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Server and the personal service imported `powercontext.cli.env_file`
and `powercontext.cli.inference_notice`, and the built-in runtime imported
redaction helpers from `powercontext.client.capture`.

- Move the standard-library environment-file loader to
  `powercontext.env_file`.
- Move the inference capability notice to
  `powercontext.server.inference_notice`; the `cli` and `service` commands
  already depend on the Server package.
- Move the credential redaction primitives to `powercontext.redaction`.
  `powercontext.client.capture` keeps capture-event rendering and uses them.

Import `powercontext.env_file` instead of `powercontext.cli.env_file`, and
`known_secret_values` and the sensitive-key constants from
`powercontext.redaction`. `render_capture_event` is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings October 26, 2026 07:05

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@jackie-cqz

Copy link
Copy Markdown
Contributor Author

The only failing check is tests (3.12, e2e). The failure is in tests/e2e/test_zcode_service_chain.py::test_zcode_source_is_processed_and_recalled_in_a_new_session: the ZCode scope script that the test runs exits with {"status":"failed","code":"timeout"} (job log).

This looks like a flaky test rather than something this PR introduced:

  • The same test failed on unrelated PRs, for example run 40270843221 and run 40270828704, which are dependabot GitHub Actions bumps.
  • tests (3.11, e2e), tests (3.13, e2e) and tests (3.14, e2e) all pass on this PR.
  • The test passes locally (3 of 3 runs).

Could a maintainer please re-run the failed job? I don't have permission to re-run it myself.

Resolve conflicts with the reusable database upgrade framework (oceanbase#2168):

- Keep upstream's `deployment_runner(settings, ...)` and
  `server/database_migration.py`. The framework needs the full Server
  settings, so the narrower signature introduced with the access-control move
  no longer applies. The only remaining `builtin` -> `server` import is
  annotation-only (`TYPE_CHECKING`).
- Adopt upstream's reworked startup tests, and drop `scheduler_path` from them
  and from the tests the framework added.
- Point the upgrade release gate's managed inputs and its tests at
  `src/powercontext/builtin/authz`, so access control stays under the
  persistence compatibility review instead of silently leaving it.
- Update the persistence digest and append a rationale sentence. The generated
  table and index DDL for all 59 tables is identical to master on the SQLite
  and MySQL dialects.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings October 26, 2026 10:29

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@AlexStocks AlexStocks added the 1.5.0 v1.5.0 release tracking label Oct 27, 2026

@hireview001 hireview001 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.

  • Resolve merge conflicts with the target branch.

Resolve conflicts with durable owner recovery (oceanbase#2187), which added
`server/authz/owner_recovery.py` while this branch moved `server/authz` to
`builtin/authz`.

- Place `owner_recovery.py` under `builtin/authz` and point its imports, the
  Server's `app.py` and `factory.py`, and the new owner-recovery tests at the
  new package path.
- Keep the scheduled-runner helpers deleted: the owner-recovery change only
  threaded its session through `_scheduled_access_runners`, which no longer
  has a caller.
- Drop `scheduler_path` from the call sites upstream added, and update the new
  `ops` and release-upgrade fixtures for the moved `env_file` and `authz`
  modules.
- Merge the upgrade-support rationale with upstream's owner-recovery text and
  update the persistence digest. The generated table and index DDL for all 63
  tables, including `pc_access_owner_recovery`, is identical to master on the
  SQLite and MySQL dialects.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings October 28, 2026 08:45

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@hireview001 hireview001 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.


import httpx

from powercontext.builtin.authz import PrincipalRef

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.

[P2] Preserve historical-release imports in the upgrade fixture

historical() runs this fixture with the source release's isolated interpreter, but PowerContext 1.3.0 has no powercontext.builtin.authz, so the new import aborts upgrade acceptance before migration begins. Select the appropriate import for each installed release so both source and target authorization checks remain executable.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Confirmed on 42f8bcc6. The uploaded SQLite upgrade evidence contains source-authorization.log with ModuleNotFoundError: No module named 'powercontext.builtin.authz' at this line (failing job). I also checked an actual installed PowerContext 1.3.0 interpreter: powercontext.server.authz.PrincipalRef imports successfully, while powercontext.builtin.authz does not.

This is a regression in the shared source/target acceptance fixture: historical() calls verify_authorization(case, "source", ...) before any migration. Please select the authorization import supported by the installed release, retain the target-side check, and rerun the required automatic upgrade matrix. The current gate failure cannot establish whether the migration itself works.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@jackie-cqz This remains unresolved on the current head, 42f8bcc6; no fix commit has been pushed since the previous review. The 1.3.0 upgrade jobs and the upgrade release gate are still failing. Please make this shared fixture import the authorization types supported by each installed release, keep both source and target authorization checks, and rerun the required automatic upgrade matrix before merging.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@jackie-cqz Following up on the unresolved P2: the head is still 42f8bcc6, and the required 1.3.0 upgrade acceptance and release gate remain failed. Please push the release-compatible import fix, preserve authorization verification for both source and target installations, and rerun the required upgrade matrix. Could you provide an update on the fix and its expected timing?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks, and sorry for the delay. The root cause is confirmed, and the fix is pushed in a60ef4f.

Cause. I rewrote this import with a repo-wide path replacement and did not account for the fact that this script runs under each installed release's own interpreter. All ten failing cases fail identically at source-authorization.log (No module named 'powercontext.builtin.authz'); I checked the uploaded evidence of each. The unit tests never execute this script, which is why it slipped through.

Fix. The fixture now picks the package with importlib.util.find_spec("powercontext.builtin.authz") and otherwise uses powercontext.server.authz. I used find_spec rather than a try/except so that a broken built-in package still fails loudly on the target side instead of silently falling back. Both the source and the target authorization checks are unchanged.

What I verified locally, using the published 1.3.0 wheel and a wheel built from 42f8bcc, each in its own venv, running the scripts with python -I:

Script 1.3.0 target wheel
previous authorization_fixture.py ModuleNotFoundError (reproduces the CI error) imports
fixed authorization_fixture.py imports (server.authz) imports (builtin.authz)
processing_fixture.py, upgrade_database_probe.py import import

What I could not verify. The acceptance harness requires Linux process ownership, so I could not run the full matrix on my machine. The migration and target-side phases have therefore not executed on this PR yet, and I am not claiming they pass.

Timing. The branch also needs a merge with master (it currently conflicts, so CI will not start on it). My connection to GitHub is too unreliable at the moment to fetch master. I will merge it and push as soon as the connection recovers, and then follow the required automatic upgrade matrix in CI.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Update: the branch is merged with current master (241398a) and pushed, so the conflict is gone and GitHub reports the PR as mergeable again. CI has started on this head, which includes the required 1.3.0 upgrade matrix running against the fixed fixture (a60ef4f).

Those runs are the first time the migration and target-side phases execute on this PR, because the source-side failure used to stop every case before migration began. I could not run that matrix locally, so I do not know yet whether it passes; if it shows anything beyond the import problem, I will deal with it separately.

The merge also pulled in two new upstream files that used the old authz path (source_management/gateway.py and the agent-tool-recovery evaluation server) and a monkeypatch target for the code command; I updated those as well.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

修复已在 head 241398a9 闭合,复核证据:

  1. a60ef4fc 把 PrincipalRef 的导入改为按 importlib.util.find_spec("powercontext.builtin.authz") 选择包。核对 1.3.0 实际产物(powercontext-1.3.0-py3-none-any.whl):其中只有 powercontext/server/authz/* 共 9 个文件,powercontext/builtin/authz 不存在,且 server/authz/__init__.py 导出 PrincipalRef ⇒ 历史解释器下回落到 server.authz;目标解释器下走 builtin.authz。source 侧与 target 侧的授权检查都保留,用 find_spec 而不是 try/except 也让 builtin 包损坏时照样报错,不会静默回退。

  2. 本次新增的合并提交(head 已是 a60ef4fc + master 0c1dfc28 的合并)重新核对过解析:git merge-tree --write-tree 显示 3 个文件需要人工处理——release/upgrade-support.json、src/powercontext/server/cli.py、tests/test_atomic_memory_migration_cli.py。逐个对照两侧:master 的 v1_4_1_005/v1_4_1_006 rationale 段完整保留,PR 的 builtin.authz / powercontext.env_file / server.inference_notice 导入迁移生效,两边内容都是并集而不是某一侧被覆盖;release/upgrade-support.json 的 persistence_sha256 按 209 个 MANAGED_INPUTS 文件复算为 e096057b0f2d3ebcbdc3009948d34797179ae2cbda5320c41de3a3d3d3aa4fb8,与声明一致。全树 powercontext.* 导入 0 处不可解析,无冲突标记残留。

尚未覆盖:本 head 的 19 个 check 目前仍 pending(quality、tests (*)、Acceptance (oceanbase) 均未完成),所以「1.3.0 升级验收在 CI 上全绿」仍没有 CI 证据,上面第 1 点只是对修复逻辑与 1.3.0 产物布局的源码级核对。

…ships

The upgrade acceptance runs `authorization_fixture.py` under each installed
release's own interpreter, before and after migration. It imported
`PrincipalRef` from `powercontext.builtin.authz`, which exists only in the
target wheel. PowerContext 1.3.0 keeps access control in
`powercontext.server.authz`, so the source-side check failed with
`ModuleNotFoundError` before any migration ran, failing every 1.3.0 case.

Select the package with `importlib.util.find_spec` instead of a try/except, so
a broken built-in package still fails loudly on the target side instead of
silently falling back to the old path. Both the source and the target
authorization checks stay in place.

Checked against the published 1.3.0 wheel and the freshly built target wheel
under `python -I`: the previous fixture reproduces the CI error under 1.3.0,
and this one imports under both. The other two scripts run under historical
interpreters (`processing_fixture.py`, `upgrade_database_probe.py`) import
under both as well.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings October 30, 2026 16:35

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@jackie-cqz
jackie-cqz requested review from hidb4ai and hireview001 and a balanced review from Copilot October 30, 2026 16:40

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

Resolve conflicts with the dedicated database provisioning work (oceanbase#2031) and
the other 48 commits that landed since the previous merge.

- `server/cli.py`: keep both import sets, the relocated `builtin.authz`
  imports and the new database bootstrap errors.
- `tests/test_atomic_memory_migration_cli.py`: take the new test setup and
  import access control from `powercontext.builtin.authz`.
- `release/upgrade-support.json`: keep the rationale added upstream, append the
  sentence about this branch's code-organization changes, and recompute the
  persistence digest. The generated table and index DDL for all 64 tables,
  including the new `pc_source_write_plugins`, is identical to master on the
  SQLite and MySQL dialects.

Follow the moves into code that arrived with the merge:

- The new `source_management` gateway and the agent-tool-recovery evaluation
  server import access control from `powercontext.builtin.authz`.
- `tests/test_cli.py` imports and patches the code command at
  `powercontext.cli.code`.
- Drop `scheduler_path` from the two call sites added upstream.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@jackie-cqz
jackie-cqz requested a review from frf12 as a code owner October 30, 2026 17:12
Copilot AI balanced review requested due to automatic review settings October 30, 2026 17:12

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@hireview001 hireview001 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.

@jackie-cqz

Copy link
Copy Markdown
Contributor Author

CI status on 241398a: the 1.3.0 upgrade matrix now passes in full (all 12 cases plus "Verify the selected upgrade matrix"), so the fixture fix in a60ef4f worked. The six checks still failing are not caused by this PR; master is red on the same checks since 0c1dfc28:

Failing here Same on master 0c1dfc2 Cause
quality yes ty reports 3 SeekDBGraphStore(...) calls in tests/builtin/test_code_publication.py (lines 311, 493, 541) that miss the required database argument
tests (3.11 / 3.12 / 3.13 / 3.14, unit) yes the same 6 tests fail on all four versions: 3 TypeError: SeekDBGraphStore.__init__() missing ... 'database' and 3 TypeError: managed.<locals>.run() got an unexpected keyword argument 'allow_missing_database'
Recall effort (OceanBase) yes (e2e-harness.yml, which was green on every push before 0c1dfc28) fails on the same 3 ty diagnostics before reaching its own tests

Both causes are semantic conflicts between merged PRs, not conflicts in this one:

I confirmed the unit failures by running the same five test files on an unmodified checkout of master at 0c1dfc28: the failure sets were identical. I have not changed those tests here, so this refactor does not carry unrelated fixes; they look like a small follow-up for the authors of #2096 and #2031. Once master is green, I will merge it into this branch and re-check.

@hireview001 hireview001 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.

Resolve conflicts with the managed plugin framework (oceanbase#2246) and the 36 other
commits that landed since the previous merge, including PreparedContext
receipts (oceanbase#2258) and the consolidated CI (oceanbase#2285).

- `server/authz/profiles.py` and `service.py` were edited upstream
  (`register_custom_artifact_access_family`, `prepare_resource`) after this
  branch moved the package. The edits apply to `builtin/authz` unchanged apart
  from the docstring and import-order edits already made here.
- `server/app.py`, `server/factory.py`: keep the relocated `builtin.authz`
  imports and add only the names the new upstream code references.
- Restructured upstream tests (`harness.py`, `test_lexical_admission.py`,
  `test_local_dashboard_access.py`, `test_unified_lexical_search.py`): take the
  upstream version and drop `scheduler_path` again.
- `release/upgrade-support.json`: keep the rationale added upstream, append the
  sentence about this branch's code-organization changes, and recompute the
  persistence digest. The generated table and index DDL for all 72 tables is
  identical to master on the SQLite and MySQL dialects.

Follow the moves into code that arrived with the merge:

- The plugin framework's `builtin/runtime` modules import access control from
  `powercontext.builtin.authz` and the worker-side security from
  `powercontext.builtin.authz.worker`, so no new `builtin` -> `server` import
  is introduced.
- Restore the `perf_counter` import in `builtin/runtime/application.py`; the
  receipt code uses it.
- Drop the extra `scheduler` argument from the two harness helpers' new callers
  (`test_native_code_fixture.py`, `test_real_experience_skill_baseline.py`).
- Point the CI change-selection test at `builtin/authz/owner_recovery.py`,
  which classifies the same way as the previous path.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings November 1, 2026 12:37

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@jackie-cqz
jackie-cqz requested review from hireview001 and a balanced review from Copilot November 1, 2026 14:24

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@hidb4ai hidb4ai removed the 1.5.0 v1.5.0 release tracking label Nov 2, 2026
Resolve the conflict with the v1.5.0 release preparation (oceanbase#2395) and the 27
other commits that landed since the previous merge, including the Rust
PowerContext Gateway executor (oceanbase#2307) and historical Server upgrade paths
(oceanbase#2394).

- `release/upgrade-support.json`: keep the target version and the rationale
  added upstream, append the sentence about this branch's code-organization
  changes, and recompute the persistence digest. The generated table and index
  DDL for all 72 tables is identical to master on the SQLite and MySQL
  dialects.

Follow the moves into code that arrived with the merge:

- `evaluation/performance/input_encoding/runner.py`: `_open_runtime` no longer
  takes a `scheduler_path`, and its callers stop passing one.
- Four new input-encoding and context-protection tests stop passing
  `scheduler_path` to `open_builtin_runtime` and `create_server_app`.
- Three new tests import access control from `powercontext.builtin.authz`.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings November 3, 2026 03:20

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@AlexStocks AlexStocks added the 1.5.1 v1.5.1 release tracking label Nov 3, 2026

@hidb4ai hidb4ai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Reviewed 1e487049 against 9c8f061c. The historical-release authorization import regression is fixed, and the required 1.3.0 upgrade matrix and Upgrade release gate pass. I found no remaining PR-introduced blocking defect; the database table/index definitions and HTTP/MCP operation contracts are unchanged.

The CI result is still red because the Python 3.11 and 3.14 code-seekdb shard-0 jobs exceeded their 30-minute job limit; the same shards also time out on master. @jackie-cqz Please obtain successful completion of these checks before merging. This approval does not certify those unfinished shards.

@hidb4ai

hidb4ai commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

@jackie-cqz The head is still 1e487049, and my approval for that commit remains valid. The required CI gate is still blocked by the cancelled code-seekdb Python 3.11 shard 0 and Python 3.14 shard 0. Both exceeded their 30-minute job limit, as noted in the approval.

Please obtain successful completion of these shards and the aggregate CI gate before merging. The historical-release authorization import issue is fixed; this follow-up concerns the remaining CI completion requirement.

Resolve conflicts with ownership migration when enabling enforcement (oceanbase#2304),
Source evidence declarations (oceanbase#2004), and the 13 other commits that landed
since the previous merge.

- `server/authz/keys.py` is new upstream; it lands in `builtin/authz/keys.py`
  and `builtin/authz/__init__.py` exports `bounded_idempotency_key` and
  `IDEMPOTENCY_KEY_LIMIT` from there.
- `server/processing_security.py` keeps only `build_worker_security`. The
  upstream change to `WorkerSecurity` (bounded idempotency keys) is applied to
  `builtin/authz/worker.py`, where this branch moved that class.
- `server/app.py`, `server/factory.py`, `server/cli.py`: keep the relocated
  `builtin.authz` imports and add only the names the new upstream code uses
  (`bounded_idempotency_key`, `OwnerRecovery`). `_scheduled_access_runners`
  stays deleted; its only upstream change was the bounded key.
- `release/upgrade-support.json`: keep the rationale added upstream for the
  v1_5_0_002 and v1_5_0_003 revisions, append the sentence about this branch's
  code-organization changes, and recompute the persistence digest. The
  generated table and index DDL for all 75 tables is identical to master on
  the SQLite and MySQL dialects.

Follow the moves into code that arrived with the merge:

- `server/ownership.py`, `builtin/authz/service.py` (new
  `static_scope_bootstrap_would_grant`), and the new ownership-migration,
  artifact-plugin, and access-control tests import access control from
  `powercontext.builtin.authz`.
- The new ownership-migration, Atomic Memory evidence, and Source evidence
  tests stop passing the removed `scheduler_path` argument.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings November 4, 2026 07:40

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@Alanxtl Alanxtl 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

@hidb4ai

hidb4ai commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

@jackie-cqz I reviewed the new head c9c9448b against 1190dcbb. The remaining gate failure has changed: Python 3.13 E2E fails in test_zcode_source_is_processed_and_recalled_in_a_new_session[True] because the scope script's bind operation returns code: timeout; Python 3.14 E2E is then cancelled by matrix fail-fast. Upgrade acceptance was selected but skipped because it depends on the test result, so Upgrade release gate fails without executing the migration matrix.

I found no new demonstrated code defect in the refactor. Local replay hit startup/flush timing limits on both head and base, so it does not establish that this PR caused the CI timeout. Please obtain a successful E2E run and complete the selected automatic upgrade matrix for this head before merging. The passing upgrade evidence and my previous approval for 1e487049 do not qualify the new artifact's unfinished acceptance.

Bring in the two commits that landed since the previous merge: the website
SEO and Markdown export changes (oceanbase#2454) and the OpenCode setting that turns
prompt-time recall off (oceanbase#2455). The merge is textually clean. Neither commit
touches `src/`, so nothing needed to follow the access-control, scheduler, or
helper moves.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings November 4, 2026 11:22

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

This branch has not been deployed

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

Labels

1.5.1 v1.5.1 release tracking

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants