Skip to content

OpenConceptLab/ocl_issues#3067 | The AutoMatch dialog shows the target repository loading or failed, and why Submit waits - #136

Merged
snyaggarwal merged 10 commits into
mainfrom
issues#3067
Nov 24, 2026
Merged

snyaggarwal merged 10 commits into
mainfrom
issues#3067

Conversation

@paynejd

@paynejd paynejd commented Nov 24, 2026 •

Copy link
Copy Markdown
Member

closes OpenConceptLab/ocl_issues#3067

What it does

While a project's target version loads, the AutoMatch dialog now says so, and says why Submit is waiting.

  • Loading: a progress indicator where the repository chip goes, and "Loading the target repository..." beside the disabled Submit (announced to screen readers and linked to Submit).
  • Failed: "Couldn't load." in the error colour where the chip goes, with Try again, which repeats the read that failed without leaving the page (so a new project's unsaved draft is kept).
  • Loaded: the chip and an enabled Submit, as today. The chip's row keeps the chip's height in every state, and the loading reason stays on one line, so nothing moves when the version arrives (checked at 900px and at 360px in English and Brazilian Portuguese).
  • Submit waits for both reads AutoMatch needs: the repository and its versions.
  • A rate-limited read (429) ends as failed at once instead of loading forever; the app shows its countdown, and Try again waits until it ends.
  • A failed repository read falls back to the saved rows' repository only when that is the project's own target.
  • Row-level Refresh, load more and filters say the target repository isn't loaded instead of throwing.

MapProject.jsx tracks both reads (repoStatus, versionsStatus), each with a latest-read-only guard, and passes the dialog one state from getTargetRepoState (loading, failed, loaded or none). APIService.get() resolves a failed read rather than rejecting, so the reads use raw mode and are judged by their reply's shape (getVersionsFromResponse).

The latest-read guard, the fallback check and the settle step live in targetReads.js, with behaviour tests.

New strings in all four catalogs: map_project.auto_match_target_repository_loading, map_project.auto_match_target_repository_failed, map_project.target_repository_not_loaded, common.try_again.

Design system

Uses MUI CircularProgress, Typography, a text Button and the ErrorOutlineOutlined icon with theme tokens (text.secondary, error.main), next to the existing RepoChip. The OCL v3 design system has no loading or progress pattern yet, so this is a gap: worth adding a small "loading in place of a chip" entry there.

Screenshots

Captured headless against a local mock, at 600px wide:

  • Loading: "Target repository:" followed by a small spinner; Submit disabled, with "Loading the target repository..." to its left.
  • Loaded: the CIEL · v2026-09-24 repository chip, and Submit enabled.
  • Failed: "Couldn't load." in red with an error icon and a Try again link where the chip goes; Submit disabled.

The rows below the chip sit at the same height in all three. The images will be attached in a comment.

Tests

Not covered

A saved version that's missing from the repository's version list still shows an empty "Target repository:" (unchanged behaviour; not loading and not a failed read).

Review

Codex lean loop; each pass is posted below.

🤖 Generated with Claude Code

https://claude.ai/code/session_01AaZ4qVXohXhqMLGigP4RHV

paynejd and others added 7 commits November 23, 2026 16:48
…e target repository loading or failed, and why Submit waits

While the target version loads, a progress indicator takes the repository
chip's place and "Loading the target repository..." sits beside the disabled
Submit. If the versions read fails, the dialog says so where the chip goes.
The row keeps the chip's height, so nothing moves when the version arrives.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qVXohXhqMLGigP4RHV
… failed, and the loading reason stays on one line

The versions read asks APIService for its raw result, so a 429 still shows
the app's countdown but then settles as failed rather than loading forever.
The reason beside Submit never wraps, so the footer keeps its height at
narrow widths when the version arrives.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qVXohXhqMLGigP4RHV
…ain in the dialog instead of a reload

Reloading could lose a new project's unsaved draft. Try again repeats the
same read (same repository, same saved or default version), and the dialog
shows the spinner again while it runs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qVXohXhqMLGigP4RHV
…sitory's own read too, and Try again repeats whichever read failed

A saved project with no mapped rows has no repository to fall back on when
the repository read fails, and AutoMatch needs it. That read now has a status
like the versions read (latest read only, raw so a 429 settles), the dialog
shows loading or failed for the two together, and Try again repeats the one
that failed. The source test now checks that each read's guard exists and
returns before anything is set.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qVXohXhqMLGigP4RHV
…rget repository state from both reads

MapProject passes the dialog its state (loading, failed, loaded or none)
rather than a combined status for it to interpret. Drops a test of error
shapes the raw reads no longer return.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qVXohXhqMLGigP4RHV
…check once

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qVXohXhqMLGigP4RHV
…s#3064)

The versions read keeps this branch's raw read and status, and main's guard
that ignores an answer after the page has left. Two source checks now allow
each other's line.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qVXohXhqMLGigP4RHV
@paynejd

paynejd commented Nov 24, 2026

Copy link
Copy Markdown
Member Author

Codex review, pass 1 (codex-cli 0.169.0, commit 2ffc662)

Verdict: findings (3 finding(s)).

  • F1.1 P1 src/components/map-projects/MapProject.jsx:3069: A rate-limited version read leaves AutoMatch loading indefinitely.
  • F1.2 P2 src/components/map-projects/MapProject.jsx:3075: The dialog still goes blank when the versions response cannot supply the project's target version.
  • F1.3 P2 src/components/map-projects/AutoMatchDialog.jsx:362: The footer can shrink when the version arrives, causing a layout jump.
findings.json
{
  "reviewer": "codex-cli 0.169.0",
  "perspective": "defects",
  "mode": "full",
  "commit": "2ffc662",
  "verdict": "findings",
  "prior": [],
  "findings": [
    {
      "id": "F1.1",
      "severity": "P1",
      "tag": null,
      "file": "src/components/map-projects/MapProject.jsx",
      "line": 3069,
      "claim": "A rate-limited version read leaves AutoMatch loading indefinitely.",
      "scenario": "The versions endpoint returns HTTP 429 while a saved project opens. The app shows its rate-limit countdown, but the request promise never settles. After the countdown expires, AutoMatch still shows the spinner and keeps Submit disabled.",
      "action": "Use an APIService request mode that settles on 429, preserve the app-wide countdown, and let the version read transition to failed. Cover that transition in a test.",
      "lines_delta": null,
      "confidence": "high"
    },
    {
      "id": "F1.2",
      "severity": "P2",
      "tag": null,
      "file": "src/components/map-projects/MapProject.jsx",
      "line": 3075,
      "claim": "The dialog still goes blank when the versions response cannot supply the project's target version.",
      "scenario": "A saved project points to a deleted source whose versions endpoint returns HTTP 200 with an empty array. The array clears the loading status, but version selection returns false. AutoMatch shows an empty target repository label and a disabled Submit with no explanation.",
      "action": "Set the final status from whether a usable target version was resolved. Show an unavailable-version message when the response has no usable target, and keep the project's saved version selection intact.",
      "lines_delta": null,
      "confidence": "high"
    },
    {
      "id": "F1.3",
      "severity": "P2",
      "tag": null,
      "file": "src/components/map-projects/AutoMatchDialog.jsx",
      "line": 362,
      "claim": "The footer can shrink when the version arrives, causing a layout jump.",
      "scenario": "At a 360px viewport width in Brazilian Portuguese, the loading message beside Enviar wraps onto two lines. When the version arrives, the message disappears, the footer shrinks to the button's height, and the centered dialog shifts.",
      "action": "Reserve space for the loading explanation across both states, including at narrow widths where the text wraps.",
      "lines_delta": null,
      "confidence": "high"
    }
  ]
}

Replies

Replies to Codex pass 1 (commit 2ffc662); fixes in the next commit.

  • F1.1 (P1) fixed: the versions read uses APIService's raw mode, so a 429 shows the app's countdown and then settles as failed; test added for a raw error reply.
  • F1.2 (P2) accepted: a saved version missing from the list (or an empty list) is neither loading nor a failed read. That behaviour predates this change and is outside #3067's criteria; it needs its own wording and next step.
  • F1.3 (P2) fixed: the loading reason is one line (noWrap with ellipsis), so the footer keeps its height. Checked at 360px in pt-BR and en: loading and loaded have identical geometry.

@paynejd

paynejd commented Nov 24, 2026

Copy link
Copy Markdown
Member Author

Codex review, pass 2 (codex-cli 0.169.0, commit 0ee1a77)

Verdict: findings (2 finding(s)).

  • Prior F1.1: resolved
  • Prior F1.2: unresolved
  • Prior F1.3: resolved
  • F2.1 P1 src/components/map-projects/AutoMatchDialog.jsx:219: The failure message tells users to reload when doing so can discard their project.
  • F2.2 P2 src/components/map-projects/AutoMatchDialog.jsx:209: A wide repository chip can resize the dialog when loading finishes.
findings.json
{
  "reviewer": "codex-cli 0.169.0",
  "perspective": "defects",
  "mode": "verify",
  "commit": "0ee1a77",
  "verdict": "findings",
  "prior": [
    {
      "id": "F1.1",
      "status": "resolved"
    },
    {
      "id": "F1.2",
      "status": "unresolved"
    },
    {
      "id": "F1.3",
      "status": "resolved"
    }
  ],
  "findings": [
    {
      "id": "F2.1",
      "severity": "P1",
      "tag": null,
      "file": "src/components/map-projects/AutoMatchDialog.jsx",
      "line": 219,
      "claim": "The failure message tells users to reload when doing so can discard their project.",
      "scenario": "A user uploads a spreadsheet for a new project, configures its columns, and selects a target whose versions request returns HTTP 503. The project cannot be saved without a target version, but AutoMatch is available once the file is loaded. If the user follows the reload instruction and confirms the browser warning, the upload and configuration are lost. Reloading the new-project page does not retry the selected target.",
      "action": "Offer an in-place retry for the selected target version so the user can recover without losing the draft.",
      "lines_delta": null,
      "confidence": "high"
    },
    {
      "id": "F2.2",
      "severity": "P2",
      "tag": null,
      "file": "src/components/map-projects/AutoMatchDialog.jsx",
      "line": 209,
      "claim": "A wide repository chip can resize the dialog when loading finishes.",
      "scenario": "On a desktop viewport, open AutoMatch for a project whose source short code and version ID together span about 100 characters. The dialog sizes to its content while the narrow spinner is shown. When the wide chip arrives, the dialog expands toward its maximum width and Submit shifts horizontally.",
      "action": "Use the same responsive dialog width in both states and constrain the chip to the space available.",
      "lines_delta": null,
      "confidence": "medium"
    }
  ]
}

Replies

Replies to Codex pass 2 (commit 0ee1a77); fix in 154e468.

  • F1.2 (P2) still accepted, as in pass 1: a saved version missing from the list predates this change and is outside #3067's criteria.
  • F2.1 (P1) fixed: the failure no longer says to reload. It reads "Couldn't load." with a Try again button that repeats the same versions read (MapProject keeps the last read's arguments); the spinner shows while it runs. Source test pins the wiring (targetVersionsStatus.test.js).
  • F2.2 (P2) accepted: the dialog's width comes from its other content (the algorithms line is wider than a real chip such as "CIEL · v2026-09-24"); only a short code plus version of about 100 characters would widen it.

@paynejd

paynejd commented Nov 24, 2026

Copy link
Copy Markdown
Member Author

Codex review, pass 3 (codex-cli 0.169.0, commit 154e468)

Verdict: findings (2 finding(s)).

  • Prior F1.1: resolved
  • Prior F1.2: unresolved
  • Prior F1.3: resolved
  • Prior F2.1: regressed
  • Prior F2.2: unresolved
  • F3.1 P1 src/components/map-projects/MapProject.jsx:6833: Try again can enable Submit while AutoMatch still lacks the repository metadata it needs.
  • F3.2 P2 src/components/map-projects/__tests__/targetVersionsStatus.test.js:40: The latest-request assertion passes when the request guard is absent.
findings.json
{
  "reviewer": "codex-cli 0.169.0",
  "perspective": "defects",
  "mode": "verify",
  "commit": "154e468",
  "verdict": "findings",
  "prior": [
    {
      "id": "F1.1",
      "status": "resolved"
    },
    {
      "id": "F1.2",
      "status": "unresolved"
    },
    {
      "id": "F1.3",
      "status": "resolved"
    },
    {
      "id": "F2.1",
      "status": "regressed"
    },
    {
      "id": "F2.2",
      "status": "unresolved"
    }
  ],
  "findings": [
    {
      "id": "F3.1",
      "severity": "P1",
      "tag": null,
      "file": "src/components/map-projects/MapProject.jsx",
      "line": 6833,
      "claim": "Try again can enable Submit while AutoMatch still lacks the repository metadata it needs.",
      "scenario": "Open a saved project with unmapped rows and OCL Search configured. If both the repository details and versions requests return HTTP 503, the repository is null. After the service recovers, Try again reloads the version and enables Submit. The first matching batch then throws while reading the repository owner, before sending a match request.",
      "action": "Recover the repository metadata along with the version and enable Submit once both are usable. Test recovery when both initial requests fail.",
      "lines_delta": null,
      "confidence": "high"
    },
    {
      "id": "F3.2",
      "severity": "P2",
      "tag": null,
      "file": "src/components/map-projects/__tests__/targetVersionsStatus.test.js",
      "line": 40,
      "claim": "The latest-request assertion passes when the request guard is absent.",
      "scenario": "Removing the guard leaves the test green because indexOf returns -1 for the missing guard. With that regression, a user can switch from repository A to B, see B load, and then lose B's selection when A's slower failure arrives.",
      "action": "Assert that the guard exists and returns before any state update, or test two reads that resolve out of order.",
      "lines_delta": null,
      "confidence": "high"
    }
  ]
}

Replies

Replies to Codex pass 3 (commit 154e468); fixes in 2684640.

  • F1.2 (P2) still accepted (see pass 1).
  • F2.1 marked regressed by F3.1: addressed by F3.1's fix below.
  • F2.2 (P2) still accepted (see pass 2).
  • F3.1 (P1) fixed: the repository read now has its own status (latest read only, raw so a 429 settles, falls back to the repository the saved rows name). The dialog shows loading/failed for the two reads together (getTargetReadStatus), so Submit waits for both, and Try again repeats whichever failed. Tests: getTargetReadStatus cases; targetReads.test.js checks both reads' wiring.
  • F3.2 (P2) fixed: the source test now requires each read's guard to open the reply and return before anything is set (mutation-checked: removing the versions guard fails it).

@paynejd

paynejd commented Nov 24, 2026

Copy link
Copy Markdown
Member Author

Simplification review run through Codex with the simplify prompt (codex-cli 0.169.0, commit 2684640), because the building session couldn't start a subagent

Verdict: findings (5 finding(s)).

  • S1 None src/components/map-projects/projectTargetRepo.js:8: The two status helpers and the intermediate targetReadStatus prop split one dialog-state decision across MapProject and AutoMatchDialog.
  • S2 None src/components/map-projects/MapProject.jsx:2178: Each read stores both a request counter and a fresh retry-argument array. The array already has a unique identity for that read.
  • S3 None src/components/map-projects/__tests__/projectTargetRepo.test.js:268: The HTML, detail-object, and string assertions duplicate the missing-data case through non-raw error shapes. The versions read now uses raw mode.
  • S4 None src/components/map-projects/MapProject.jsx:3103: Only the versions state needs the empty-array fallback. Both version selectors already return false for null.
  • S5 None src/components/map-projects/MapProject.jsx:3083: The comment above retryTargetReads repeats what the two failed-status checks say.
findings.json
{
  "reviewer": "codex-cli (standing in for a Claude subagent)",
  "perspective": "simplify",
  "mode": "full",
  "commit": "2684640e1a7ea47981f256153ce664d86b428bf8",
  "verdict": "findings",
  "prior": [],
  "findings": [
    {
      "id": "S1",
      "severity": null,
      "tag": "yagni",
      "file": "src/components/map-projects/projectTargetRepo.js",
      "line": 8,
      "claim": "The two status helpers and the intermediate targetReadStatus prop split one dialog-state decision across MapProject and AutoMatchDialog.",
      "scenario": null,
      "action": "Have MapProject call getTargetRepoState(repoVersion, repoStatus, versionsStatus) and pass the result as targetRepoState. Check for loading first, then failure, then a version URL in that helper. Carry the existing state cases and both-read wiring assertion over to the combined helper.",
      "lines_delta": -10,
      "confidence": "high"
    },
    {
      "id": "S2",
      "severity": null,
      "tag": "shrink",
      "file": "src/components/map-projects/MapProject.jsx",
      "line": 2178,
      "claim": "Each read stores both a request counter and a fresh retry-argument array. The array already has a unique identity for that read.",
      "scenario": null,
      "action": "Assign each new args array to its existing ref and guard the reply with `if(args !== argsRef.current) return`. Clear the ref where a selection change currently invalidates the counter. Retry only failed reads with an args array still present, and update the source assertions to check the same behavior.",
      "lines_delta": -2,
      "confidence": "high"
    },
    {
      "id": "S3",
      "severity": null,
      "tag": "dup-test",
      "file": "src/components/map-projects/__tests__/projectTargetRepo.test.js",
      "line": 268,
      "claim": "The HTML, detail-object, and string assertions duplicate the missing-data case through non-raw error shapes. The versions read now uses raw mode.",
      "scenario": null,
      "action": "Drop those three assertions and their shared comment. Keep the raw 429 regression case and the undefined result for a renewing session.",
      "lines_delta": -4,
      "confidence": "high"
    },
    {
      "id": "S4",
      "severity": null,
      "tag": "shrink",
      "file": "src/components/map-projects/MapProject.jsx",
      "line": 3103,
      "claim": "Only the versions state needs the empty-array fallback. Both version selectors already return false for null.",
      "scenario": null,
      "action": "Use `setVersions(fetchedVersions ?? [])` and pass `fetchedVersions` directly to both selectors.",
      "lines_delta": -1,
      "confidence": "high"
    },
    {
      "id": "S5",
      "severity": null,
      "tag": "delete",
      "file": "src/components/map-projects/MapProject.jsx",
      "line": 3083,
      "claim": "The comment above retryTargetReads repeats what the two failed-status checks say.",
      "scenario": null,
      "action": "nothing replaces it",
      "lines_delta": -1,
      "confidence": "high"
    }
  ]
}

Replies

Replies to the simplification review (Codex standing in for a Claude subagent: this run was a fork that can't start subagents), commit 2684640; cuts in cf4218e.

  • S1 (yagni) applied: one helper, getTargetRepoState(repoVersion, repoStatus, versionsStatus), called in MapProject; the dialog takes the state as a prop.
  • S2 (shrink) not applied: swapping the latest-read counter for array identity rewrites the existing guard for 2 lines; the counter pattern is already the file's.
  • S3 (dup-test) applied: dropped the non-raw error shapes; kept the raw 429 error and the 401 undefined.
  • S4 (shrink) applied: fetchedVersions goes straight to both selectors (they return false for null); setVersions(fetchedVersions || []).
  • S5 (delete) applied: removed the comment above retryTargetReads.

@paynejd

paynejd commented Nov 24, 2026

Copy link
Copy Markdown
Member Author

Codex check of commits after pass 3 (codex-cli 0.169.0, commit cf4218e)

Verdict: findings (1 finding(s)).

  • FC.1 P2 src/components/map-projects/MapProject.jsx:2187: The new rate-limit handling can mark the repository read as loaded using metadata from a different repository.
findings.json
{
  "reviewer": "codex-cli 0.169.0",
  "perspective": "defects",
  "mode": "final",
  "commit": "cf4218ec463f9ce59e4d67bdab92a49e66e0d106",
  "verdict": "findings",
  "prior": [],
  "findings": [
    {
      "id": "FC.1",
      "severity": "P2",
      "tag": null,
      "file": "src/components/map-projects/MapProject.jsx",
      "line": 2187,
      "claim": "The new rate-limit handling can mark the repository read as loaded using metadata from a different repository.",
      "scenario": "Reopen a project whose target changed from source A to source B and whose saved rows still contain mappings to A. If B's repository read returns 429 while its versions read succeeds, the raw reply makes fetchRepo install A as the fallback and clear the failure status. The dialog shows B's version and enables Submit. A match request then contains B's target URL and A's source ID.",
      "action": "Use the saved-row fallback only when its repository URL matches the requested target after stripping the version. Otherwise show the failed state and let Try again repeat the repository read. Add a regression test with saved mappings from a different source.",
      "lines_delta": null,
      "confidence": "high"
    }
  ]
}

Replies

  • FC.1 (P2) fixed in 08f9c31: the saved-row fallback is used only when it is the same repository (dropVersion of both URLs match); otherwise the read shows failed and Try again repeats it. Source test added.

@paynejd

paynejd commented Nov 24, 2026

Copy link
Copy Markdown
Member Author

Codex check of commit 08f9c31 (codex-cli 0.169.0), a later commit that was dropped before any push

Verdict: findings (2 finding(s)).

  • Prior FC.1: regressed
  • FC2.1 P1 src/components/map-projects/MapProject.jsx:2187: The new guard rejects the fallback even when the saved rows name the current target repository.
  • FC2.2 P2 src/components/map-projects/MapProject.jsx:2189: Rejecting the saved-row fallback leaves the row-level Refresh candidates action able to throw.
findings.json
{
  "reviewer": "codex-cli 0.169.0",
  "perspective": "defects",
  "mode": "final",
  "commit": "08f9c31",
  "verdict": "findings",
  "prior": [
    {
      "id": "FC.1",
      "status": "regressed"
    }
  ],
  "findings": [
    {
      "id": "FC2.1",
      "severity": "P1",
      "tag": null,
      "file": "src/components/map-projects/MapProject.jsx",
      "line": 2187,
      "claim": "The new guard rejects the fallback even when the saved rows name the current target repository.",
      "scenario": "Reopen a saved project with mapped rows from its current target. The repository GET returns 429 and the versions GET returns the pinned version. At line 1572, `data` is component state, so `_repo.url` is undefined even though the saved CSV contains the URL. Before this commit the dialog accepted the fallback. It now shows Try again and disables Submit until the repository GET succeeds.",
      "action": "Read the repository URL from the mapped row that supplies the fallback. Exercise the saved-project load with both matching and mismatched row URLs.",
      "lines_delta": null,
      "confidence": "high"
    },
    {
      "id": "FC2.2",
      "severity": "P2",
      "tag": null,
      "file": "src/components/map-projects/MapProject.jsx",
      "line": 2189,
      "claim": "Rejecting the saved-row fallback leaves the row-level Refresh candidates action able to throw.",
      "scenario": "Open a saved project whose repository GET fails and whose versions GET succeeds. When the fallback is rejected, `repo` becomes null. Open a row with an OCL Search algorithm configured and click Refresh candidates. The handler clears the row's cached candidates, then `getPayloadForMatching` throws while reading `_repo.owner`, before it sends a request.",
      "action": "Guard row-level candidate retrieval when the repository is unavailable, before clearing cached candidates.",
      "lines_delta": null,
      "confidence": "high"
    }
  ]
}

Replies

Replies to the second final check (commit 08f9c31).

  • FC2.1 (P1) valid: the saved-row fallback's url is always undefined, because MapProject reads data['__Repo URL__'] from component state outside the row loop (pre-existing, lines ~1571–1573). So the FC.1 guard rejected every fallback. Resolved by dropping 08f9c31 (it was never pushed); the branch head is back to cf4218e, which the first final check read.
  • FC2.2 (P2): caused by rejecting the fallback; gone with 08f9c31. The same crash (row-level Refresh candidates with a null repository) predates this change on a saved project with no mapped rows whose repository read fails.
  • FC.1 (P2) now accepted: the fallback to a repository named by older saved rows predates this change and already applies to any failed read (503 and so on); raw mode only adds 429 to the failures it covers. Fixing it properly needs the row-URL bug above fixed first: out of #3067's scope, a follow-up.

@paynejd

paynejd commented Nov 24, 2026

Copy link
Copy Markdown
Member Author

Simplification review (Claude subagent, Sonnet 5.5, commit cf4218e)

Verdict: findings (3 finding(s)).

  • S1 None src/components/map-projects/__tests__/targetReads.test.js:58: The 'the dialog gets both reads' state and Try again' test is a source-regex check of one prop-wiring line in MapProject. It pins formatting, not behavior. getTargetRepoState is already tested directly with both statuses, and the rate-limit, latest-read and retry tests pin the P1 fixes.
  • S2 None src/components/map-projects/__tests__/targetReads.test.js:40: The per-read 'starts loading and keeps its arguments for Try again' test is a whitespace-sensitive regex on two adjacent statements. The retry test already covers Try again repeating the failed read from those argument refs, and the status assertion in the latest-read test covers the failed and loading transitions.
  • S3 None src/components/map-projects/AutoMatchDialog.jsx:179: The check ['loading','failed'].includes(targetRepoState) is written twice, once for targetRepoStatusId and once for the chip guard.
findings.json
{
  "reviewer": "claude subagent",
  "perspective": "simplify",
  "mode": "full",
  "commit": "cf4218ec463f9ce59e4d67bdab92a49e66e0d106",
  "verdict": "findings",
  "prior": [],
  "findings": [
    {
      "id": "S1",
      "severity": null,
      "tag": "dup-test",
      "file": "src/components/map-projects/__tests__/targetReads.test.js",
      "line": 58,
      "claim": "The 'the dialog gets both reads' state and Try again' test is a source-regex check of one prop-wiring line in MapProject. It pins formatting, not behavior. getTargetRepoState is already tested directly with both statuses, and the rate-limit, latest-read and retry tests pin the P1 fixes.",
      "scenario": null,
      "action": "nothing replaces it",
      "lines_delta": -3,
      "confidence": "medium"
    },
    {
      "id": "S2",
      "severity": null,
      "tag": "dup-test",
      "file": "src/components/map-projects/__tests__/targetReads.test.js",
      "line": 40,
      "claim": "The per-read 'starts loading and keeps its arguments for Try again' test is a whitespace-sensitive regex on two adjacent statements. The retry test already covers Try again repeating the failed read from those argument refs, and the status assertion in the latest-read test covers the failed and loading transitions.",
      "scenario": null,
      "action": "Drop this test and the argsRef and args columns from the loop table. Keep the retry test, the raw 429 test and the latest-read test.",
      "lines_delta": -6,
      "confidence": "medium"
    },
    {
      "id": "S3",
      "severity": null,
      "tag": "shrink",
      "file": "src/components/map-projects/AutoMatchDialog.jsx",
      "line": 179,
      "claim": "The check ['loading','failed'].includes(targetRepoState) is written twice, once for targetRepoStatusId and once for the chip guard.",
      "scenario": null,
      "action": "Add `const targetRepoSettling = ['loading','failed'].includes(targetRepoState)`. Use it as `targetRepoSettling ? TARGET_REPO_STATUS_ID : undefined` and as `!targetRepoSettling && repoVersion?.id`.",
      "lines_delta": -1,
      "confidence": "low"
    }
  ]
}

Replies

Simplification review (Claude subagent, Sonnet 5.5, commit cf4218e): 3 items. An earlier simplify pass ran through Codex with the same prompt, because the building session couldn't start a subagent; its 4 applied cuts are in 2684640 and cf4218e.

  • S1 dup-test, declined: the check that MapProject passes the dialog its state and Try again is the only test of that wiring. The dialog can't be mounted in these tests.
  • S2 dup-test, declined: the premise doesn't hold. 'loading' is set only in the statement this test pins. The latest-read test checks only the failed/null outcome, and the retry test needs the stored arguments this test pins.
  • S3 shrink, applied in 26a7dab: the loading-or-failed check is named once (targetRepoSettling).

@paynejd

paynejd commented Nov 24, 2026

Copy link
Copy Markdown
Member Author

Codex check of commit 26a7dab (codex-cli 0.169.0)

Verdict: clean (0 finding(s)).

findings.json
{
  "reviewer": "codex-cli 0.169.0",
  "perspective": "defects",
  "mode": "final",
  "commit": "26a7dab4a2e7e8f8df4c6da72ac4005c81f0793d",
  "verdict": "clean",
  "prior": [],
  "findings": []
}

@paynejd
paynejd requested a review from snyaggarwal November 24, 2026 11:54
@paynejd

paynejd commented Nov 24, 2026

Copy link
Copy Markdown
Member Author

Codex check of the merge with main, which brought in OpenConceptLab/ocl_issues#3064 (codex-cli 0.169.0, commit 8e735b5)

Verdict: clean (0 finding(s)).

findings.json
{
  "reviewer": "codex-cli 0.169.0",
  "perspective": "defects",
  "mode": "final",
  "commit": "8e735b5775b53097afee083c4d1a6495e3693ed6",
  "verdict": "clean",
  "prior": [],
  "findings": []
}

The merge's one conflict was resolved by hand; the full test suite and ESLint pass after it.

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

Review of 8e735b5: approve, ready to merge. No blocking findings.

The state model holds up. getTargetRepoState is a pure function with direct tests. Each read has a latest-read guard, and onRepoChange bumps both request counters. Try again replays the stored arguments, so a saved version is kept and a new repository still gets its default. Submit now waits for loaded, which is stricter than the old version_url check and closes the Try-again/null-repo gap from pass 3. Raw mode lines up with handleAPIError: a 429 resolves with the AxiosError, and response?.data is undefined on that error, so both reads fall through to failed as intended. CI is green.

Non-blocking (inline):

  1. Pre-existing, now reachable through 429: the saved-row _repo fallback can install a different repository and report the read as loaded (Codex FC.1, still open after 08f9c31 was dropped). Worth a follow-up ticket, not this PR.
  2. A 429 fails at once, not after the countdown as the PR body says, so Try again during the countdown gets throttled again.
  3. Screen readers hear the loading text twice (spinner aria-label plus the role='status' line).
  4. "Couldn't load." doesn't say what failed when it's read out as Submit's description.
  5. fetchRepo has no isMountedRef check, unlike fetchVersions.
  6. Nit: the targetReads.test.js source-regex tests pin formatting, not behaviour (both simplify passes said so too).

Open-core check: nothing here crosses the line. The strings and UI are neutral, and useAutoMatchCheck is the existing checkpoint, unchanged.

APIService.new().overrideURL(url).get(undefined, undefined, undefined, true).then(response => {
if(request !== repoRequestRef.current)
return
const fetchedRepo = response?.data?.id ? response.data : _repo

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.

Pre-existing, non-blocking. _repo comes from the saved rows' last mapped concept. If the project's target changed since those rows were mapped, this installs the old repository, and setRepoStatus(null) then reports it as loaded. Before this PR a 503 already took this path. Now a 429 does too, because raw mode settles it. The match request at L2272 would then pair the new target URL with the old source id. The guard tried in 08f9c31 broke the same-repo case (FC2.1) because data here is component state, not the saved row. A follow-up should compare against the row's own __map_repo_url__. Not for this PR.

repoArgsRef.current = [url, _repo]
setRepoStatus('loading')
APIService.new().overrideURL(url).get(undefined, undefined, undefined, true).then(response => {
if(request !== repoRequestRef.current)

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.

Nit: fetchVersions also returns on !isMountedRef.current (ocl_issues#3064), but this one doesn't. It's harmless in React 18, but the two reads would match if it did the same.

Suggested change
if(request !== repoRequestRef.current)
if(request !== repoRequestRef.current || !isMountedRef.current)

<ErrorOutlineIcon fontSize='small' />
{t('map_project.auto_match_target_repository_failed')}
</Typography>
<Button size='small' sx={{textTransform: 'none', marginLeft: '8px'}} onClick={onRetryTargetReads}>

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.

In raw mode handleAPIError returns the 429 error right away, so the read is marked failed while the app's countdown is still running (the PR body says it ends failed after the countdown). Clicking Try again before the countdown ends just gets throttled again. That's acceptable, since it lands back in failed, but you could either disable Try again while throttled or reword the PR body.

{
repoVersion?.id &&
targetRepoState === 'loading' &&
<CircularProgress size={20} sx={{marginLeft: '12px'}} aria-label={t('map_project.auto_match_target_repository_loading')} />

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.

A11y nit: the footer role='status' line already announces "Loading the target repository...". With this aria-label on the progressbar, some screen readers will read it twice. Consider aria-hidden on the spinner, or a shorter label.

"auto_match_nothing_to_run": "AutoMatch had nothing to run: no matching algorithm is selected, and the OCL AI Assistant has no rows to analyze.",
"auto_match_target_repository": "Target repository:",
"auto_match_target_repository_loading": "Loading the target repository...",
"auto_match_target_repository_failed": "Couldn't load.",

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.

Nit: this text is Submit's aria-describedby and the role='alert' announcement. Read out alone, "Couldn't load." doesn't say what failed. Something like "Couldn't load the target repository." still fits on one line at 360px in English. The other three catalogs would need the same change.

]) {
const body = functionSource(name)

test(`${name} starts loading and keeps its arguments for Try again`, () => {

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.

Nit (non-blocking): these regexes depend on statement order and whitespace inside MapProject.jsx, so a harmless reformat breaks them while a real logic change might not. Both simplify passes flagged this too. Fine for now, since MapProject can't be mounted here. If fetchRepo/fetchVersions move into a small hook later, these can become behaviour tests.

…y for the project's own target; Refresh waits for the repository; Try again waits out a 429; spinner read once; read guards as a tested module

- A failed repository read falls back to the saved rows' repository only when
  that row's repository URL (or, without one, its id) is the project's
  target, so a changed target can't pair the new URL with the old source.
- Row-level candidate fetches (Refresh, load more, filters) say the target
  repository isn't loaded instead of throwing on a null repository.
- A rate-limited target read disables Try again until the app's countdown ends.
- The loading spinner is hidden from screen readers (the footer status already
  says it); the failed alert reads "Target repository: Couldn't load."
- fetchRepo ignores a reply after the page has left, like fetchVersions.
- The latest-read guard, fallback check and settle step move to
  targetReads.js, with behaviour tests replacing the source-regex tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@snyaggarwal

Copy link
Copy Markdown
Contributor

Addressed the review in 38538df:

  1. The saved rows' repository stands in for a failed read only when that row's repository URL (or, without one, its id) is the project's target. The URL now comes from the row itself, not component state (FC.1 / FC2.1).
  2. Row-level Refresh, load more and filters show "the target repository isn't loaded" instead of throwing on a null repository (FC2.2).
  3. A 429 disables Try again until the app's countdown ends. PR body corrected.
  4. The spinner is aria-hidden. The failed alert, which is also Submit's description, reads "Target repository: Couldn't load." through visually hidden text, so the visible row is unchanged.
  5. fetchRepo ignores a reply after the page has left.
  6. The read guards moved to targetReads.js, and behaviour tests replace the source-regex ones.

npm test 734 pass, npm run test:integration 13 pass, ESLint clean, production build compiles. Not yet checked in a browser.

snyaggarwal and others added 2 commits November 24, 2026 18:21
…s#3068)

The one conflict was adjacent imports in MapProject.jsx (targetReads and projectLogSync); both kept.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…y: Couldn't load." with a space

Found checking the dialog in a browser against a mock API: the visually hidden label ran into the message.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@snyaggarwal

Copy link
Copy Markdown
Contributor

Merged main (#137, ocl_issues#3068) in 119cf0a. The only conflict was adjacent imports in MapProject.jsx; both kept. 755 unit and 13 integration tests pass, ESLint is clean and the production build compiles.

Checked in a browser against a mock API, with a saved project:

  • Loaded: the CIEL · v2026-09-24 chip shows and Submit is enabled.
  • Loading (slow reads): a spinner (aria-hidden) and the footer status line, which describes the disabled Submit. The row stays 36px and the footer 30.75px when the version arrives.
  • Versions read fails (503): "Couldn't load." and Try again. Try again repeats only the failed read, keeps the saved version and enables Submit, without leaving the page.
  • 429: the app's countdown shows, Try again stays disabled until it ends, then enables.
  • Repository read fails, saved rows from another repository (LOINC): shows failed; LOINC isn't used in its place. With saved rows from CIEL, CIEL stands in and Submit is enabled.
  • Row Refresh with no repository: shows "The target repository isn't loaded…", with no TypeError.

The check found one issue, fixed in bf9b901: the hidden label ran into the message ("Target repository:Couldn't load.").

@snyaggarwal
snyaggarwal merged commit 329e4c5 into main Nov 24, 2026
2 checks passed
@snyaggarwal
snyaggarwal deleted the issues#3067 branch November 24, 2026 12:56
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.

Mapper: the AutoMatch dialog gives no sign that the target repository is still loading, and Submit is disabled with no reason

2 participants