Finish the declaration collapse: three shapes left, and a false rule that survives in two comments #181
Labels
No labels
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
lz/agent-nexus#181
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Follow-ups deliberately left out of #180 to keep that diff surgical. Each is pre-existing duplication rather than something that PR orphaned.
1.
SessionKindis still written twice — and it is now load-bearinglib/server/db/schema.ts:19and inline atlib/api/types.ts:141. It is the parameter type ofsessionBasePath, the helper #180 introduced, so it is the one shape that got more important while staying duplicated.Contrast
WORKER_STATUSES/SESSION_STATUSES(types.ts:11,17), which the repo already derives from one array and whichschema.tsaliases. Low risk today — the dangerous direction is caught, sincetoDTOassignsrow.kindinto the DTO — but this is the shape a finishing pass should take first.2.
PreviewStatus/PreviewSource/PreviewSchemedb/schema.ts:99-101andapi/types.ts:168-170. Same asymmetry:rowToDTOassigns schema→canonical, so widening the schema union fails to compile, but the reverse is unguarded. One-line fix — import them inschema.tsalongside the three siblings already imported there.3. The false rule, in two places
Both of these state a constraint that does not exist:
lib/api/mcp-dto-parity.test.ts:7-10— "neither can import the other ($lib/api/typesis reachable from the browser,$serveris not)"lib/server/db/schema.ts:2-3— "Server-only modules can import a client-safe type, not vice versa"Both halves are false. #180 demonstrates server → client-safe five times over (
sessions/attention.ts,workers/service.ts,sessions/service.ts,previews/service.ts,terminal/upgrade.ts), and the reverse was already shipped on main: eleven client modules and.sveltecomponentsimport typefrom$lib/server/artifacts/types, which is whyArtifactDTOis declared once while everything else is declared twice.The accurate rule is narrower: a runtime value from
$lib/servercannot reach client code, butimport typeis erased before Vite's illegal-import check sees it, and server → client-safe is unrestricted in both forms.Do not delete
mcp-dto-parity.test.ts. Unlike the two parity tests #180 removed, its duplication is live and the two declarations are structurally unrelated, so the mutual-assignability assertion still fails on real drift. Only the stated reason is wrong. Fix both docblocks together — fixing one would leave the other looking authoritative.Once the comments are accurate, whether
McpStatusDTO/CimdClientDTOstay duplicated becomes a live choice rather than an assumed constraint.4.
app.cssis the last unguarded rename anchor for the attention vocabularysessionMark's return value is used directly as a CSS class name (app.css:318,323,361,.status-dot.needs-you). A rename that correctly updatesworker/plugins/nexus/hooks/hooks.jsonand the four typecheck-red literal sites inlib/attention.tsstill leaves that rule dead, and the needs-you ping silently stops animating.Pre-existing — the parity test #180 deleted never checked CSS either — but it is now the only anchor nothing checks. A cheap guard: assert that every member of
ATTENTION_STATESappears as a.status-dot.<state>selector inapp.css.Not in scope
The
MountSpec/ token-scope /McpStatusDTOduplication that AGENTS.md facts #22 and #24 name as deliberate stays deliberate. This issue is about making the stated reasons true, not about collapsing those.lz referenced this issue2026-09-18 10:26:53 +02:00