Skip to content

Confirmed code-level defects: expansion cache key omits no-cache/language, + several latent bugs #252

@jmandel

Description

@jmandel

Confirmed-by-reading defects in main, as a checklist. Most are not reachable via the public HTTP API (read-only store / output not echoed), so no live curl — line refs are main.

Expansion cache key omits inputs that change the result

  • no-cache is a no-op. tx/params.js:142case 'no-cache': … this.uid = crypto.randomUUID(), but the cache key (params.js:549 hashSource) reads this.FUid, never uid (which is written-only). So no-cache=true does not bust the expansion cache.
  • Language never enters the cache key. tx/params.js:295get hasHTTPLanguages(){ return this.FHTTPLanguages && this.FHTTPLanguages.source; } (and the displayLanguage sibling). Languages has no .source, so these are always falsy ⇒ the language-folding blocks in hashSource() are dead ⇒ a cached expansion can be served in the wrong language.

Other confirmed defects

  • isMoreRecent returns a number, not a boolean. tx/library/canonical-resource.js:132-133:
    case 'alpha': return this.version.localeCompare(other.version) > 0;  // boolean
    default:      return this.version.localeCompare(other.version);      // -1/0/1 — -1 is truthy
    Used as a boolean by provider.ts ⇒ inverted "is more recent" for a non-standard versionAlgorithm.
  • UCUM °C/°F special-unit handlers register under key undefined. tx/library/ucum-types.js:942register(h){ this.handlers.set(h.code, h); } keys on .code, but CelsiusHandler/FahrenheitHandler only override getCode() and never set .code ⇒ both register as undefined (Fahrenheit overwrites Celsius) ⇒ exists('Cel')/exists('[degF]') false ⇒ canonicalizing °C/°F throws "Not handled yet (special unit)".

Dead / latent (would only throw if the path were reached)

  • tx/provider.js:508deleteCodeSystem re-inserts the deleted CodeSystem (this.codeSystems.set(cs.url, cs); should be existing) ⇒ the delete reverts itself.
  • tx/library.js:658-659loadUrl calls cp.codeSystems.set(...) on a CodeSystem[] (arrays have no .set; the sibling loadNpm uses .push) ⇒ a url:/url/cs: source throws at load.
  • tx/operation-context.js:394 — the stats() method is shadowed by the this.stats field (:59) ⇒ the cache-statistics accessor is unreachable (TypeError if called).
  • tx/library/designations.js:49if (this.null) but the getter is isNull (:38) ⇒ an empty text filter returns false for everything (matches nothing) in isolation.

Confirmed against main; the TS port preserves several of these with documenting comments.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions