Skip to content

OpenConceptLab/ocl_issues#3021 | History lists each version under the repo version that has it - #100

Merged
snyaggarwal merged 3 commits into
mainfrom
issues#3021
Nov 11, 2026
Merged

snyaggarwal merged 3 commits into
mainfrom
issues#3021

Conversation

@paynejd

@paynejd paynejd commented Nov 10, 2026

Copy link
Copy Markdown
Member

closes OpenConceptLab/ocl_issues#3021

What was wrong

The History tab on a concept or mapping treated the last item of its repo version list as HEAD, and filed every version it couldn't place there. That list was:

  • inside a repo page: RepoHome's first page of 10 versions, or the collection's versions on a collection page;
  • elsewhere: the API's default page of 25.

For a source with more versions than that, such as CIEL with 55, versions that are only in HEAD were listed under an old version. Every listed repo version was shown, even with nothing under it.

What changed

  • historyGroups.js (new, unit-tested) groups versions by repo version:

    • each version goes under the newest repo version in its source_versions;
    • the latest version, if no repo version contains it, goes under HEAD, which is found by its id;
    • an earlier version that no repo version contains goes under the first repo version created after it, or under HEAD if there's none.

    It ignores a list that belongs to another repo, and gives a version missing from the list its own group. Repo versions with nothing under them are left out.

  • ConceptHome and MappingHome load every version of the resource's own source (limit: 1000, once per source) instead of taking RepoHome's page, so RepoHome no longer passes repoVersions to them.

  • "Created on" falls back to created_at, which is what the versions list returns. It used to show today's date.

Before and after

CIEL 170921 (Tavapadon) has three versions, all only in HEAD.

Before (production) After (this branch)

The issues#3021-screenshots branch holds only these images and can be deleted after review.

Testing

  • npm test passes (136 tests, including 8 new ones in historyGroups.test.js), and ESLint is clean with CI's command.
  • I ran a local dev build against the production API, signed in, with every write request blocked, and checked History in five places:
    • CIEL 170921 from the source page: HEAD, with 3 versions.
    • CIEL 5089, from the source page and from a collection page: each version under the newest release that contains it.
    • A CIEL mapping only in HEAD: HEAD, with 1 version.
    • A concept opened from global search: grouped correctly.

🤖 Generated with Claude Code

…der the repo version that has it

The History tab treated the last item of its repo version list as HEAD and filed every
version it couldn't place there. Inside a repo page that list was RepoHome's first page of
10 versions (or a collection's versions), and on its own it was the API's default page of 25,
so for a source with more versions, concepts and mappings only in HEAD showed under an old
version, and every listed version showed even when empty.

- historyGroups.js groups versions by repo version from each version's own source_versions,
  finds HEAD by id, and doesn't rely on the list being complete or of the right repo.
- ConceptHome and MappingHome load every version of the resource's own source (limit 1000),
  once per source, instead of taking RepoHome's page.
- Repo versions with nothing under them are left out, and "created on" falls back to
  created_at.

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

paynejd commented Nov 10, 2026

Copy link
Copy Markdown
Member Author

Codex review, pass 1 (codex-cli 0.167.0, commit 19d62a2)

Verdict: findings (2 findings)

  • F1.1 P1 src/components/concepts/ConceptHome.jsx:158: Failed source-version requests are cached as successful empty lists in both history loaders. Response: Fixed: both loaders cache the list only when the request returns one, so a failed request is retried. oclweb3 has no component test harness (its tests cover pure modules), so this one is checked by reading the code.
  • F1.2 P2 src/components/concepts/ConceptHome.jsx:157: Requesting limit=1000 does not load the full source-version list. Response: Accepted (P2): the largest source on production has 352 versions. Past 1,000, every version still gets a group from its own source_versions; only placement of never-released versions before the oldest fetched version and some dates degrade.
findings.json
{
  "reviewer": "codex-cli 0.167.0",
  "perspective": "defects",
  "mode": "full",
  "commit": "19d62a23",
  "verdict": "findings",
  "prior": [],
  "findings": [
    {
      "id": "F1.1",
      "severity": "P1",
      "tag": null,
      "file": "src/components/concepts/ConceptHome.jsx",
      "line": 158,
      "claim": "Failed source-version requests are cached as successful empty lists in both history loaders.",
      "scenario": "If the source versions request returns a transient HTTP error, APIService resolves with the error body. This stores an empty list alongside the source URL. Opening another resource from that source then skips fetching, even after the API recovers. Earlier uncontained versions remain incorrectly grouped under HEAD, and release dates remain missing until the component remounts. Previously, an empty list allowed another fetch.",
      "action": "Validate a successful response before caching its source URL in ConceptHome and MappingHome. Leave failed requests retryable and test failure followed by navigation to another resource.",
      "lines_delta": null,
      "confidence": "high"
    },
    {
      "id": "F1.2",
      "severity": "P2",
      "tag": null,
      "file": "src/components/concepts/ConceptHome.jsx",
      "line": 157,
      "claim": "Requesting limit=1000 does not load the full source-version list.",
      "scenario": "For a source with releases v1 through v1001 plus HEAD, both loaders fetch only v1001 through v2. An earlier uncontained resource version created before v1 is consequently grouped under v2 instead of v1. Groups reconstructed for v1 and HEAD also lack their creation dates. This violates the acceptance criteria for sources with any number of versions.",
      "action": "Follow pagination through all source versions in both ConceptHome and MappingHome before caching the list. Add coverage spanning more than 1,000 entries.",
      "lines_delta": null,
      "confidence": "high"
    }
  ]
}

…ist that failed to load

Codex pass 1, F1.1: a failed request was kept as an empty list for that source, so History
never asked again until the panel remounted.

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

paynejd commented Nov 10, 2026

Copy link
Copy Markdown
Member Author

Codex review, pass 2 (codex-cli 0.167.0, commit d065ba1)

Verdict: clean

Earlier findings: F1.1 resolved, F1.2 unresolved

findings.json
{
  "reviewer": "codex-cli 0.167.0",
  "perspective": "defects",
  "mode": "verify",
  "commit": "d065ba11",
  "verdict": "clean",
  "prior": [
    {
      "id": "F1.1",
      "status": "resolved"
    },
    {
      "id": "F1.2",
      "status": "unresolved"
    }
  ],
  "findings": []
}

F1.2 stays open as accepted in pass 1 (largest production source: 352 versions). No P0 or P1 is open.

…uses createdOn

Simplification review S2 and S4.

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

paynejd commented Nov 10, 2026

Copy link
Copy Markdown
Member Author

Simplification review (Claude subagent, commit d065ba1)

Verdict: findings (4 findings)

  • S1 src/components/mappings/MappingHome.jsx:120: fetchRepoVersions is duplicated almost verbatim in ConceptHome.jsx and MappingHome.jsx (url-equality check, limit 1000 fetch, array guard, setLoading). Extract one shared helper/hook. Response: Kept: a shared hook would be a new layer for two short functions, and each Home already defines its own fetchVersions the same way.
  • S2 src/components/concepts/historyGroups.js:71: Final ordering builds result, then filters it twice (HEAD first, others sorted by sortTime). sortTime's fallback to the max resource-version date only matters for groups built from toRepoVersion with no date, which can be folded into one comparator. Response: Applied in be0c2d9: one sort, HEAD first.
  • S3 src/components/concepts/__tests__/historyGroups.test.js:88: The 'no repo version list at all' test mostly overlaps the 'repo version missing from the list' test, since both exercise the fallback to toRepoVersion and HEAD synthesis. Response: Kept: 'no list at all' is the state after a failed fetch (the F1.1 path), which the missing-version test doesn't cover.
  • S4 src/components/concepts/History.jsx:235: The conditional created-on render computes repoVersion.created_on || repoVersion.created_at twice and duplicates the createdOn helper in historyGroups.js. Response: Applied in be0c2d9: History.jsx uses createdOn from historyGroups.js.
findings.json
{
  "perspective": "simplify",
  "mode": "full",
  "reviewer": "claude subagent",
  "commit": "d065ba11",
  "verdict": "findings",
  "prior": [],
  "findings": [
    {
      "id": "S1",
      "tag": "yagni",
      "file": "src/components/mappings/MappingHome.jsx",
      "line": 120,
      "claim": "fetchRepoVersions is duplicated almost verbatim in ConceptHome.jsx and MappingHome.jsx (url-equality check, limit 1000 fetch, array guard, setLoading). Extract one shared helper/hook.",
      "action": "Move the shared fetch-and-cache logic into one helper (e.g. in historyGroups.js or a small hook) and call it from both Homes.",
      "lines_delta": -12,
      "confidence": 0.4,
      "severity": null,
      "scenario": null
    },
    {
      "id": "S2",
      "tag": "shrink",
      "file": "src/components/concepts/historyGroups.js",
      "line": 71,
      "claim": "Final ordering builds `result`, then filters it twice (HEAD first, others sorted by sortTime). sortTime's fallback to the max resource-version date only matters for groups built from toRepoVersion with no date, which can be folded into one comparator.",
      "action": "Sort once with a comparator that puts isHead first, then orders by sortTime desc, instead of two filters plus spread.",
      "lines_delta": -3,
      "confidence": 0.4,
      "severity": null,
      "scenario": null
    },
    {
      "id": "S3",
      "tag": "dup-test",
      "file": "src/components/concepts/__tests__/historyGroups.test.js",
      "line": 88,
      "claim": "The 'no repo version list at all' test mostly overlaps the 'repo version missing from the list' test, since both exercise the fallback to toRepoVersion and HEAD synthesis.",
      "action": "Merge into one test or drop the 'no list at all' case.",
      "lines_delta": -6,
      "confidence": 0.3,
      "severity": null,
      "scenario": null
    },
    {
      "id": "S4",
      "tag": "shrink",
      "file": "src/components/concepts/History.jsx",
      "line": 235,
      "claim": "The conditional created-on render computes `repoVersion.created_on || repoVersion.created_at` twice and duplicates the createdOn helper in historyGroups.js.",
      "action": "Export createdOn from historyGroups.js and use `const date = createdOn(repoVersion)` in the JSX.",
      "lines_delta": -2,
      "confidence": 0.4,
      "severity": null,
      "scenario": null
    }
  ]
}

Tests rerun after the cuts: 136 pass, ESLint clean.

@paynejd

paynejd commented Nov 10, 2026

Copy link
Copy Markdown
Member Author

Codex check of commits d065ba1..be0c2d9 (codex-cli 0.167.0)

Verdict: clean

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

@paynejd
paynejd marked this pull request as ready for review November 10, 2026 21:34
@paynejd
paynejd requested a review from snyaggarwal November 10, 2026 21:34
@snyaggarwal
snyaggarwal merged commit cde24f4 into main Nov 11, 2026
2 checks passed
@snyaggarwal
snyaggarwal deleted the issues#3021 branch November 11, 2026 05:07
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.

History tab lists HEAD-only versions under the wrong repo version

2 participants