Skip to content

Phase 4: fix contract drift (getCurrentUser, version prefix) (#899) - #939

Merged
neuromechanist merged 2 commits into
feature/issue-896-epic-arch-hardeningfrom
feature/issue-899-phase4-drift
Jul 6, 2026
Merged

neuromechanist merged 2 commits into
feature/issue-896-epic-arch-hardeningfrom
feature/issue-899-phase4-drift

Conversation

@neuromechanist

Copy link
Copy Markdown
Contributor

Summary

Applies the #898 contract to the known live drift.

  • getCurrentUser() now unwraps the nested {user, token} envelope (.user) and validates against userMeResponseSchema. It previously declared flat UserInfo and request<UserInfo>'d the envelope, so every field (.username, .role, .orcid, ...) was undefined at runtime — silently writing undefined over stored account config on auth status --refresh and disabling the upload ORCID auto-match. Consumers coerce nullable username/github_username -> undefined.
  • Catalog latest_version is emitted in the canonical vX.Y.Z tag form (withCanonicalLatestVersion) at the list/fallback/detail responses — matching the data plane and what hallu-sync's archives/<v>.zip URLs need. Fixes the website vv1.0.0 double-prefix (companion coercion: Fix vv1.0.0: coerce dataset version prefix website#145, deploy-order-safe).

Scope notes

Test plan

Closes #899. Part of epic #896.

Epic #896 Phase 4 (#899). Applies the #898 contract to the known drift.
- getCurrentUser() unwraps the {user, token} envelope (.user) and validates
  against userMeResponseSchema. It previously declared flat UserInfo and read
  the envelope top level, so every field was undefined at runtime -- silently
  writing undefined over stored account config on 'auth status --refresh' and
  disabling the upload ORCID auto-match. Consumers coerce nullable username/
  github_username -> undefined for config.
- Catalog latest_version is emitted in the canonical vX.Y.Z tag form
  (withCanonicalLatestVersion) at the list/fallback/detail responses, matching
  the data plane + what hallu-sync's archives/<v>.zip URLs need. Fixes the
  website vv1.0.0 double-prefix (website PR nemarOrg/website#145 coerces too).
- file_size (#895): the compute is already annex-aware (getDatasetS3Stats sums
  real S3 object sizes); the ~36B symptom is stale legacy folded rows -> fixed
  by an operational reindex backfill at finalize, no code change.
- /datasets/:id parity (#864) is backend-complete (#853); website backfillSearchHit
  removal tracked separately.
@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown

📦 Package Preview

Your package is ready to test!

bun install -g nemar-cli@PR939

Version: 0.8.76-PR939.509665e
Commit: 509665e


🤖 Updated on each push.

- Live contract test now asserts the RAW catalog latest_version is the
  canonical tag via the non-coercing strictVersionTagSchema, so a dropped
  withCanonicalLatestVersion call site fails CI (the coercing envelope schema
  couldn't catch that).
- Added a getCurrentUser() live-integration test that calls the function and
  asserts flat access (config dir is isolated by setup.ts).
- Removed the now-dead UserInfo interface and a redundant cast at the detail
  return.
- Cross-repo: nemarDatasets/.github#61 normalizes the Hallu zarr-queue version
  comparison so #899's tagged latest_version doesn't re-drain the queue.
@neuromechanist

Copy link
Copy Markdown
Contributor Author

Review (sonnet) — findings addressed in 08a6a01

  • [important] the live test couldn't catch a wiring regression (the envelope schema coerces bare->tag). Added a RAW-value assertion with the non-coercing strictVersionTagSchema, so a dropped withCanonicalLatestVersion call site now fails CI.
  • [important, cross-repo] the Hallu zarr-queue reconcile() would have re-drained the whole queue (full Zarr rebuild) when latest_version flips to tagged. Fixed in zarr queue: normalize version comparison (bare vs vX.Y.Z) nemarDatasets/.github#61 (normalize both sides of the version comparison); deploy that before Phase 4: Fix known contract drift — file_size (#895), getCurrentUser, /datasets/:id parity (#864) #899 reaches prod.
  • [moderate] added a getCurrentUser() live test (calls the function, asserts flat access; setup.ts isolates the config dir).
  • [moderate] hallu-sync one-time redundant sync is expected/acceptable (same read-time normalization rationale).
  • [suggestions] removed dead UserInfo + redundant cast.
  • Reviewer confirmed clean: getCurrentUser blast radius (only 2 real call sites, all fields present/nullable on ContractUser), withCanonicalLatestVersion idempotent/non-mutating/applied at all 3 sites, file_size already annex-aware (backfill-only).

@neuromechanist
neuromechanist merged commit 019e8ed into feature/issue-896-epic-arch-hardening Jul 6, 2026
1 check passed
@neuromechanist
neuromechanist deleted the feature/issue-899-phase4-drift branch July 6, 2026 23:26

This branch was previously deployed

1 inactive deployment
npm — 08a6a012 Deployed Jul 6, 2026 by neuromechanist via publish #1701
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant