Skip to content

docs(architecture): audit Model access slice under #3522 - #4711

Open
bytelazy wants to merge 1 commit into
apache:mainfrom
bytelazy:docs/audit-model-access-slice
Open

bytelazy wants to merge 1 commit into
apache:mainfrom
bytelazy:docs/audit-model-access-slice

Conversation

@bytelazy

@bytelazy bytelazy commented Sep 4, 2026

Copy link
Copy Markdown

Summary

Audits the Model access subsystem slice under #3522 — the two documents listed there were read against current main and either corrected or confirmed accurate.

  • docs/architecture/openai-responses-incremental-transport.md — verified accurate, no change. Every cited symbol (ModelAdapter, endLane, previous_response_id, prompt_cache_key, the sdk.response.messages contrast) still exists with the semantics the document describes.
  • docs/model-metadata-firstscreen-optimization.md — the optimization it proposes has been implemented. The renderer startup path no longer statically imports model-metadata; OnboardingHero no longer imports RECOMMENDED_PROVIDER_TYPES at runtime; PROVIDER_REGISTRY is now reached only from lazy Settings paths — matching the document's desired outcome. The document was being read as an open proposal when its acceptance criteria are met, so it is moved to docs/archive/ with an Archived: banner so it is read as the historical design record.

The move is a git rename (history preserved); the only content change is the two-line banner. docs/archive/** is out of scope for #3522's audit, but moving a now-implemented proposal into the archive is the audit conclusion for this document, not an edit to an existing archive entry.

Refs #3522

Verification

  • Confirmed no script, test, or other document references model-metadata-firstscreen-optimization by path, so the move breaks no links (checked scripts/, .github/, all *.md/*.ts/*.mjs).
  • Ran node --test scripts/source-legal-inventory.test.mjs (the test that reads docs/): 5/5 pass.
  • Confirmed the cited symbols in the accurate document still exist via grep against packages/runtime/src.
  • Git recognizes the operation as a rename (R), so blame/history is preserved.

Not run: the repo's full lint/typecheck (a full npm ci does not complete from this network). The change is docs-only and confined to docs/; no code or test is touched.

AI use

  • Generative tooling made a substantive contribution

Tool(s) and scope: Claude Code — audited both documents against current code, implemented the archive move and banner, and authored the commit. The commit carries a Generated-by: Claude (Claude Code) trailer.

Checklist

  • Tests cover the change and fail without it
  • Lint, format, typecheck and the affected suites pass locally

(Both unchecked: this is a docs-only change with no test surface; the relevant source-legal-inventory test passes as noted under Verification.)

Does this PR entail a change in behavior?

  • Yes — described under Summary above
  • No

@github-actions github-actions Bot added the effort/XS Under 10 readable lines label Sep 4, 2026

@Astro-Han Astro-Han 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 current head 953a003492cd92fa09ad8f1021cbef07eff125a2 (OPEN). One P2 below — the banner's "implemented, archivable" conclusion does not hold. Note: this is the same first-screen dependency chain flagged on PR #4794; the two should be handled together so the wording stays consistent.

P2 — two of the banner's three factual claims fail, so "implemented, archivable" fails

The move itself is clean (pure git rename, 96% similarity, history preserved, +2 lines). Claim (b) holds: onboarding-hero.tsx:27 is import type only, runtime uses the local FIRST_RUN_PROVIDER_TYPES constant. But (a) and (c) fail — a fully static chain still reaches provider-registry on the first screen: main.tsx:22 → app.tsx:23 → app-shell.tsx:170 → app-shell-overlays.tsx:30 → app-shell-command-actions.ts:36 → command-palette-commands.ts:50 → isRetiredProvider from @maka/core/provider-registry. All six hops are static imports (the dynamic import at app-shell-overlays.tsx:42 leads to settings/settings-modal, a different path, not this chain) — and past provider-registry the dependency is a value dependency, not shakeable side effects.

What I could not judge

Whether the team wants the doc archived with corrected claims vs kept live is a maintainer call.


Automated review notice: This comment was posted by an automated review agent operated by Astro-Han. It is not an independent human review and does not replace one.

简体中文

评审结论来自自动化审查流程;发布者没有读这份 diff,核的是当前 head 有没有漂移。当前 head 是 953a003,未关闭。一条 P2:横幅三条事实有两条不成立,和 #4794 是同一条依赖链,建议两处一起处理。修好再合。

@Astro-Han Astro-Han 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.

Two corrections to my review above. The P2 itself stands unchanged; both corrections concern how it was stated.

Scope of the evidence. The review omitted a limitation that materially bounds the finding: no build was run and no bundle output was measured. The dependency chain reported above is static import-graph analysis, not byte-level evidence that the first-screen chunk contains the models.dev metadata. Producing that evidence would require a build followed by inspection of the emitted chunk, which was not done. One supporting detail that was checked and does belong in the record: packages/core/package.json declares "sideEffects": false, so a bundler is permitted to drop unused module-scope code — but that does not rescue this chain, because isRetiredProvider has a genuine value dependency on PROVIDER_REGISTRY (provider-registry.ts:1685 → providerDefaultsOf at :1644-1648), which in turn is constructed from the generated models.dev tables imported at :20-24. Tree shaking removes what is unused; it cannot remove a constant that is used.

Merge posture. The Simplified Chinese block ended with wording that amounted to "fix before merging". That was not the reviewer's conclusion and it contradicts the English body of the same comment. This review does not gate the merge. The finding is that the banner's claims (a) and (c) do not hold, and the choice of remedy belongs to the maintainer. Two options were offered: withdraw the archive, keep the document under docs/, and record this surviving chain in its current-state section; or break the chain in code first — for example by extracting the small retirement predicate that isRetiredProvider needs out of provider-registry, so the first screen does not pull in the whole model-metadata table for one boolean — and archive afterwards.


Automated review notice: This comment was posted by an automated review agent operated by Astro-Han. It is not an independent human review and does not replace one.

简体中文

两处更正,P2 结论本身不变,更正的是表述。

其一,上一条漏了一项限定:没有跑构建、没有测量产物体积,那条依赖链是静态引用图分析,不是「首屏 chunk 确实含 models.dev 元数据」的字节级证据。

其二,上一条中文块结尾的「修好再合」不是本次评审的结论,且与同一条评论的英文正文矛盾。本评审不设合并门禁。 结论是横幅的 (a)(c) 两条事实不成立,采取哪种补救由维护者决定;已给出的两个方案是撤回归档并在文档现状小节记录这条残留链路,或先在代码里断链后再归档。

Audit the two Model access documents against current main:

- openai-responses-incremental-transport.md: verified accurate as written.
  Every cited symbol (ModelAdapter, endLane, previous_response_id,
  prompt_cache_key, the sdk.response.messages contrast) still exists with the
  semantics the document describes. No change.
- model-metadata-firstscreen-optimization.md: partially implemented, not
  archivable. Verified done: OnboardingHero no longer imports
  RECOMMENDED_PROVIDER_TYPES at runtime. Not done: a static import chain still
  reaches provider-registry from the first screen (main.tsx -> app.tsx ->
  app-shell.tsx -> app-shell-overlays.tsx -> app-shell-command-actions.ts ->
  command-palette-commands.ts -> isRetiredProvider -> providerDefaultsOf ->
  PROVIDER_REGISTRY, built from the generated models.dev tables). Add an audit
  note recording this surviving chain so the document is not mistaken for an
  implemented proposal; keep it live under docs/ rather than archiving it.

Address review on apache#4711: the original 'implemented, archivable' banner was
wrong — two of its three factual claims fail. A static import chain still
reaches provider-registry from the first screen via command-palette-commands'
isRetiredProvider value import, which tree-shaking cannot drop because
PROVIDER_REGISTRY is a used constant.

Refs apache#3522

Generated-by: Claude (Claude Code)
@bytelazy
bytelazy force-pushed the docs/audit-model-access-slice branch from 953a003 to e260c89 Compare September 7, 2026 02:22
@bytelazy

bytelazy commented Sep 7, 2026

Copy link
Copy Markdown
Author

Thanks for the P2 — verified, and you're right.

I traced the chain you flagged and it holds: main.tsx → app.tsx → app-shell.tsx:169 (AppShellOverlays) → app-shell-overlays.tsx:30 → app-shell-command-actions.ts:36 → command-palette-commands.ts:50 (value import of isRetiredProvider) → providerDefaultsOf → PROVIDER_REGISTRY ← model-metadata.generated.js (provider-registry.ts:24). PROVIDER_REGISTRY is a used constant, so tree-shaking can't drop it. My original banner's claims (a) and (c) were wrong; I had only grepped direct imports of model-metadata and missed the transitive chain through command-palette-commands.

Updated the PR: dropped the archive move, kept the document live under docs/, and replaced the banner with an audit note that records the surviving chain (what's done, what's not, and why it isn't archivable yet). The doc itself is otherwise unchanged, so the diff is now +2 lines on one file.

Left the code-break-the-chain option (extracting isRetiredProvider's predicate out of provider-registry) for a separate change — that's a code fix, not a docs audit. The note names it as the follow-up that would let this document eventually be archived.

bytelazy added a commit to bytelazy/maka that referenced this pull request Sep 8, 2026
…gistry

`isRetiredProvider` lived in `provider-registry.ts`, which is built from the
generated models.dev tables. The Desktop first screen imported it through
`command-palette-commands.ts`, so the whole model-metadata snapshot stayed
on the static startup path — the surviving chain flagged in the
`docs/model-metadata-firstscreen-optimization.md` audit under apache#4711.

Extract the predicate into a new metadata-free module,
`packages/core/src/provider-retirement.ts`, backed by a small
`RETIRED_PROVIDER_TYPES` list. Its only `provider-registry` import is
`import type`, erased at build time, so importing it no longer pulls the
generated tables. Re-point the startup-path importer
(`command-palette-commands.ts`) and the two `defaults.retired` readers
(`model-catalog.ts`, `provider-auth.ts`) at the new module, and drop the
`retired` flag from `ProviderDefaults` and the `claude-subscription` entry.

The provider-catalog contract test now pins `RETIRED_PROVIDER_TYPES` as the
source of truth and asserts `isRetiredProvider` agrees with it, so a name
that is retired but not registered (or vice versa) fails there rather than
at send time. A focused unit test covers the predicate's purity contract.

Static import-graph trace from `apps/desktop/src/renderer/main.tsx`: the
`AppShellOverlays → … → command-palette-commands → provider-registry` chain
no longer reaches `provider-registry` (0 chains); the separate
`ui → maka-uri → settings → onboarding → llm-connections → provider-registry`
chain remains and is recorded as open in the doc's audit note — that is the
`buildChatModelChoices`/`modelMenuGroups` seam the "Desired outcome" section
already names, not the chain this change targets.

No build was run and no bundle output was measured; the verification here is
static import-graph analysis plus the contract/unit tests.

Generated-by: Claude (claude-opus-4-8)

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

Re-reviewed exact head e260c897c4023b51aed0113c4f9e8276e75195cb. No P0-P3 findings. The single-file change now accurately records the optimization as only partially implemented and keeps the document live instead of archiving it. I independently followed the current static renderer chain from main.tsx through AppShellOverlays and command-palette-commands.ts to the value import of isRetiredProvider, then through providerDefaultsOf to the used PROVIDER_REGISTRY constructed from generated models.dev metadata. I also confirmed that OnboardingHero uses the local FIRST_RUN_PROVIDER_TYPES value and imports only connection/provider types from Core. The OpenAI Responses transport symbols cited by the PR remain present with the documented ownership shape.\n\nVerification: scripts/source-legal-inventory.test.mjs passed 5/5 under Node 24, git diff --check passed, and the exact head merges cleanly with current main (42fa4d070504e672173c46dd75f7fcabb88789f5). GitHub exposes no hosted check runs for this head. I did not build or inspect the emitted renderer bundle, so the conclusion is limited to the static dependency graph rather than measured bundle bytes.\n\n> Automated review notice: This comment was posted by an automated review agent operated by hqhq1025. It is not an independent human review and does not replace one.

bytelazy added a commit to bytelazy/maka that referenced this pull request Sep 14, 2026
…gistry

`isRetiredProvider` lived in `provider-registry.ts`, which is built from the
generated models.dev tables. The Desktop first screen imported it through
`command-palette-commands.ts`, so the whole model-metadata snapshot stayed
on the static startup path — the surviving chain flagged in the
`docs/model-metadata-firstscreen-optimization.md` audit under apache#4711.

Extract the predicate into a new metadata-free module,
`packages/core/src/provider-retirement.ts`, backed by a small
`RETIRED_PROVIDER_TYPES` list. Its only `provider-registry` import is
`import type`, erased at build time, so importing it no longer pulls the
generated tables. Re-point the startup-path importer
(`command-palette-commands.ts`) and the two `defaults.retired` readers
(`model-catalog.ts`, `provider-auth.ts`) at the new module, and drop the
`retired` flag from `ProviderDefaults` and the `claude-subscription` entry.

The provider-catalog contract test now pins `RETIRED_PROVIDER_TYPES` as the
source of truth and asserts `isRetiredProvider` agrees with it, so a name
that is retired but not registered (or vice versa) fails there rather than
at send time. A focused unit test covers the predicate's purity contract.

Static import-graph trace from `apps/desktop/src/renderer/main.tsx`: the
`AppShellOverlays → … → command-palette-commands → provider-registry` chain
no longer reaches `provider-registry` (0 chains); the separate
`ui → maka-uri → settings → onboarding → llm-connections → provider-registry`
chain remains and is recorded as open in the doc's audit note — that is the
`buildChatModelChoices`/`modelMenuGroups` seam the "Desired outcome" section
already names, not the chain this change targets.

No build was run and no bundle output was measured; the verification here is
static import-graph analysis plus the contract/unit tests.

Generated-by: Claude (claude-opus-4-8)
bytelazy added a commit to bytelazy/maka that referenced this pull request Sep 22, 2026
…gistry

`isRetiredProvider` lived in `provider-registry.ts`, which is built from the
generated models.dev tables. The Desktop first screen imported it through
`command-palette-commands.ts`, so the whole model-metadata snapshot stayed
on the static startup path — the surviving chain flagged in the
`docs/model-metadata-firstscreen-optimization.md` audit under apache#4711.

Extract the predicate into a new metadata-free module,
`packages/core/src/provider-retirement.ts`, backed by a small
`RETIRED_PROVIDER_TYPES` list. Its only `provider-registry` import is
`import type`, erased at build time, so importing it no longer pulls the
generated tables. Re-point the startup-path importer
(`command-palette-commands.ts`) and the two `defaults.retired` readers
(`model-catalog.ts`, `provider-auth.ts`) at the new module, and drop the
`retired` flag from `ProviderDefaults` and the `claude-subscription` entry.

The provider-catalog contract test now pins `RETIRED_PROVIDER_TYPES` as the
source of truth and asserts `isRetiredProvider` agrees with it, so a name
that is retired but not registered (or vice versa) fails there rather than
at send time. A focused unit test covers the predicate's purity contract.

Static import-graph trace from `apps/desktop/src/renderer/main.tsx`: the
`AppShellOverlays → … → command-palette-commands → provider-registry` chain
no longer reaches `provider-registry` (0 chains); the separate
`ui → maka-uri → settings → onboarding → llm-connections → provider-registry`
chain remains and is recorded as open in the doc's audit note — that is the
`buildChatModelChoices`/`modelMenuGroups` seam the "Desired outcome" section
already names, not the chain this change targets.

No build was run and no bundle output was measured; the verification here is
static import-graph analysis plus the contract/unit tests.

Generated-by: Claude (claude-opus-4-8)
bytelazy added a commit to bytelazy/maka that referenced this pull request Sep 28, 2026
…gistry

`isRetiredProvider` lived in `provider-registry.ts`, which is built from the
generated models.dev tables. The Desktop first screen imported it through
`command-palette-commands.ts`, so the whole model-metadata snapshot stayed
on the static startup path — the surviving chain flagged in the
`docs/model-metadata-firstscreen-optimization.md` audit under apache#4711.

Extract the predicate into a new metadata-free module,
`packages/core/src/provider-retirement.ts`, backed by a small
`RETIRED_PROVIDER_TYPES` list. Its only `provider-registry` import is
`import type`, erased at build time, so importing it no longer pulls the
generated tables. Re-point the startup-path importer
(`command-palette-commands.ts`) and the two `defaults.retired` readers
(`model-catalog.ts`, `provider-auth.ts`) at the new module, and drop the
`retired` flag from `ProviderDefaults` and the `claude-subscription` entry.

The provider-catalog contract test now pins `RETIRED_PROVIDER_TYPES` as the
source of truth and asserts `isRetiredProvider` agrees with it, so a name
that is retired but not registered (or vice versa) fails there rather than
at send time. A focused unit test covers the predicate's purity contract.

Static import-graph trace from `apps/desktop/src/renderer/main.tsx`: the
`AppShellOverlays → … → command-palette-commands → provider-registry` chain
no longer reaches `provider-registry` (0 chains); the separate
`ui → maka-uri → settings → onboarding → llm-connections → provider-registry`
chain remains and is recorded as open in the doc's audit note — that is the
`buildChatModelChoices`/`modelMenuGroups` seam the "Desired outcome" section
already names, not the chain this change targets.

No build was run and no bundle output was measured; the verification here is
static import-graph analysis plus the contract/unit tests.

Generated-by: Claude (claude-opus-4-8)

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

Automated review notice: This comment was posted by an automated review agent operated by me2seeks make. It is not an independent human review and does not replace one.

Summary

Docs-only audit note recording that the first-screen optimization is only partially implemented: the renderer's import chain command-palette-commands.ts:50 still value-imports isRetiredProvider from @maka/core/provider-registry, reaching the generated PROVIDER_REGISTRY constant (provider-registry.ts:1625), which tree-shaking cannot drop. I verified both ends of that claim against the worktree — the value import exists and the registry is a used constant constructed from the models.dev tables, so the note's "not done" assessment is accurate, as is its proposed seam (extract the small retirement predicate out of provider-registry). Honest, precise audit text with no code change.

Findings

No material findings. The doc's own suggestion (extracting the retirement predicate) is the right next step and correctly identified as the minimal break in the chain.

Verdict

merge-ready — accurate audit note; content-only change.

@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown

This pull request has had no new commits for 30 days and has been marked stale. It will be closed in 7 days unless a new commit is pushed.

Comments do not reset this timer: only a new commit does. If the pull request is intentionally long-lived, a maintainer can apply the pinned label.

@github-actions github-actions Bot added the stale No qualifying activity within the lifecycle policy window label Oct 7, 2026
@bytelazy

bytelazy commented Oct 8, 2026

Copy link
Copy Markdown
Author

Main already records the surviving command-palette → provider-registry dependency in the audit added by #4794 (5ded98e8). This PR now appears redundant; #5018 is the separate, still-open code change to cut that dependency. Could a committer confirm whether #4711 should be closed as superseded?

Automated update via Claude on behalf of the contributor.

bytelazy added a commit to bytelazy/maka that referenced this pull request Oct 8, 2026
…gistry

`isRetiredProvider` lived in `provider-registry.ts`, which is built from the
generated models.dev tables. The Desktop first screen imported it through
`command-palette-commands.ts`, so the whole model-metadata snapshot stayed
on the static startup path — the surviving chain flagged in the
`docs/model-metadata-firstscreen-optimization.md` audit under apache#4711.

Extract the predicate into a new metadata-free module,
`packages/core/src/provider-retirement.ts`, backed by a small
`RETIRED_PROVIDER_TYPES` list. Its only `provider-registry` import is
`import type`, erased at build time, so importing it no longer pulls the
generated tables. Re-point the startup-path importer
(`command-palette-commands.ts`) and the two `defaults.retired` readers
(`model-catalog.ts`, `provider-auth.ts`) at the new module, and drop the
`retired` flag from `ProviderDefaults` and the `claude-subscription` entry.

The provider-catalog contract test now pins `RETIRED_PROVIDER_TYPES` as the
source of truth and asserts `isRetiredProvider` agrees with it, so a name
that is retired but not registered (or vice versa) fails there rather than
at send time. A focused unit test covers the predicate's purity contract.

Static import-graph trace from `apps/desktop/src/renderer/main.tsx`: the
`AppShellOverlays → … → command-palette-commands → provider-registry` chain
no longer reaches `provider-registry` (0 chains); the separate
`ui → maka-uri → settings → onboarding → llm-connections → provider-registry`
chain remains and is recorded as open in the doc's audit note — that is the
`buildChatModelChoices`/`modelMenuGroups` seam the "Desired outcome" section
already names, not the chain this change targets.

No build was run and no bundle output was measured; the verification here is
static import-graph analysis plus the contract/unit tests.

Generated-by: Claude (claude-opus-4-8)
bytelazy added a commit to bytelazy/maka that referenced this pull request Oct 12, 2026
…gistry

`isRetiredProvider` lived in `provider-registry.ts`, which is built from the
generated models.dev tables. The Desktop first screen imported it through
`command-palette-commands.ts`, so the whole model-metadata snapshot stayed
on the static startup path — the surviving chain flagged in the
`docs/model-metadata-firstscreen-optimization.md` audit under apache#4711.

Extract the predicate into a new metadata-free module,
`packages/core/src/provider-retirement.ts`, backed by a small
`RETIRED_PROVIDER_TYPES` list. Its only `provider-registry` import is
`import type`, erased at build time, so importing it no longer pulls the
generated tables. Re-point the startup-path importer
(`command-palette-commands.ts`) and the two `defaults.retired` readers
(`model-catalog.ts`, `provider-auth.ts`) at the new module, and drop the
`retired` flag from `ProviderDefaults` and the `claude-subscription` entry.

The provider-catalog contract test now pins `RETIRED_PROVIDER_TYPES` as the
source of truth and asserts `isRetiredProvider` agrees with it, so a name
that is retired but not registered (or vice versa) fails there rather than
at send time. A focused unit test covers the predicate's purity contract.

Static import-graph trace from `apps/desktop/src/renderer/main.tsx`: the
`AppShellOverlays → … → command-palette-commands → provider-registry` chain
no longer reaches `provider-registry` (0 chains); the separate
`ui → maka-uri → settings → onboarding → llm-connections → provider-registry`
chain remains and is recorded as open in the doc's audit note — that is the
`buildChatModelChoices`/`modelMenuGroups` seam the "Desired outcome" section
already names, not the chain this change targets.

No build was run and no bundle output was measured; the verification here is
static import-graph analysis plus the contract/unit tests.

Generated-by: Claude (claude-opus-4-8)

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

effort/XS Under 10 readable lines stale No qualifying activity within the lifecycle policy window

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants