Skip to content

P6 Task 7: Modify index.ts and endpoint.spec.ts — Remove CSAPI Exports and Tests #123

Closed

Description

@Sam-Bolling

Task

Modify two files: (1) Remove all ~183 lines of CSAPI exports from src/index.ts (lines 45–227), and (2) Remove 3 CSAPI method tests from src/ogc-api/endpoint.spec.ts that were migrated to factory.spec.ts or are obsolete. After this task, index.ts has zero CSAPI references and the endpoint test suite reflects the new architecture.

ROADMAP Reference: Phase 6, Task 7 — Modify index.ts and endpoint.spec.ts (~0.5 hours, Low complexity)
Implementation Branch: phase-6


Files to Create or Modify

File Action Lines Removed Lines Added Net Purpose
src/index.ts Modify ~183 0 −183 Remove all CSAPI export lines
src/ogc-api/endpoint.spec.ts Modify ~30 0 −30 Remove 3 migrated/obsolete CSAPI tests

Total: 2 files modified, ~213 lines removed, 0 lines added

Blueprint Reference

  • src/index.ts current state (252 lines) — lines 45–227 are the CSAPI exports being removed
  • src/ogc-api/endpoint.spec.ts current state (2,888 lines) — CSAPI test block at lines 2836–2887
  • P6 Implementation Guide §7.2 — Complete index.ts modification specification
  • P6 Implementation Guide §7.3 — Complete endpoint.spec.ts modification specification with test disposition table

Scope — What to Implement

index.ts — Remove CSAPI Exports

Remove all CSAPI export lines (lines 45–227). These are all re-export statements (export { ... } from '...'), not import statements — removal creates no unused imports.

What stays:

  • Lines 1–43: WFS, WMS, WMTS, shared model exports
  • Line 44: export * from './ogc-api/model.js' (OGC API shared types — NOT CSAPI)
  • Lines 228+: TMS, STAC, cache, shared utilities, worker exports (renumbered after removal)

Result: src/index.ts shrinks from 252 lines to ~69 lines.

Verification:

git grep "csapi\|CSAPI" src/index.ts
# Expected: 0 matches

endpoint.spec.ts — Remove 3 Tests

Remove 3 tests from the CSAPI block (lines 2836–2887). The remaining 3 tests stay.

Test disposition (6 tests in the CSAPI block):

Test Line Decision Reason
detects Connected Systems support 2845 Stays Tests hasConnectedSystems (still on endpoint)
can list all CSAPI collections 2849 Stays Tests csapiCollections (still on endpoint)
can produce a CSAPI query builder 2854 Remove Migrated to factory.spec.ts (Task 5)
caches the CSAPI query builder 2862 Remove No auto-caching in factory — behavior no longer exists
reports no Connected Systems support 2877 Stays Tests non-CSAPI endpoint
throws an error when calling csapi() 2881 Remove Migrated to factory.spec.ts (Task 5)

Remaining CSAPI block in endpoint.spec.ts (3 tests):

describe('OgcApiEndpoint with CSAPI', () => {
  let endpoint: OgcApiEndpoint;
  describe('nominal case', () => {
    beforeEach(() => {
      endpoint = new OgcApiEndpoint('http://local/csapi/sample-data-hub');
    });
    it('detects Connected Systems support', async () => {
      await expect(endpoint.hasConnectedSystems).resolves.toBe(true);
    });
    it('can list all CSAPI collections', async () => {
      await expect(endpoint.csapiCollections).resolves.toEqual([
        'iot-sensors',
      ]);
    });
  });
  describe('non-CSAPI endpoint', () => {
    beforeEach(() => {
      endpoint = new OgcApiEndpoint('http://local/sample-data/');
    });
    it('reports no Connected Systems support', async () => {
      await expect(endpoint.hasConnectedSystems).resolves.toBe(false);
    });
  });
});

Verification

# Zero CSAPI references in index.ts
git grep "csapi\|CSAPI" src/index.ts
# Expected: 0 matches

# TypeScript compiles cleanly
npx tsc --noEmit

# All tests pass (including the 3 remaining endpoint CSAPI tests + 2 factory tests)
npm run test:browser

# ESLint passes
npx eslint src/index.ts src/ogc-api/endpoint.spec.ts

Testing Requirements

  • npm run test:browser must pass with all tests — the 3 removed tests should no longer appear
  • The 3 remaining endpoint CSAPI tests must still pass (hasConnectedSystems, csapiCollections, non-CSAPI endpoint)
  • The 2 factory tests (Task 5) must still pass
  • Total test count should decrease by exactly 3

Scope — What NOT to Touch

  • ❌ Do NOT modify endpoint.ts — that was done in Task 6
  • ❌ Do NOT modify factory.ts or factory.spec.ts — those were created in Task 5
  • ❌ Do NOT modify the barrel file csapi/index.ts — that was created in Task 4b
  • ❌ Do NOT modify package.json — that belongs to Task 8
  • ❌ Do NOT remove the hasConnectedSystems or csapiCollections tests — those test endpoint functionality that remains
  • ❌ Do NOT modify lines 1–44 or lines 228+ of index.ts — only remove lines 45–227
  • ❌ Do NOT change any CSAPI business logic (types, builders, parsers)
  • ❌ Do NOT refactor existing code beyond the specified removals

Acceptance Criteria

  • src/index.ts reduced from ~252 to ~69 lines
  • All CSAPI export lines (45–227) removed from index.ts
  • git grep "csapi\|CSAPI" src/index.ts returns 0 matches
  • Non-CSAPI exports in index.ts (WFS, WMS, WMTS, TMS, STAC, shared, cache, worker) are unchanged
  • 3 CSAPI method tests removed from endpoint.spec.ts
  • 3 CSAPI endpoint tests remain (hasConnectedSystems, csapiCollections, non-CSAPI)
  • npx tsc --noEmit passes
  • npm run test:browser passes — all remaining tests pass, total count decreased by 3
  • npx eslint src/index.ts src/ogc-api/endpoint.spec.ts passes

Dependencies

Blocked by: Task 6 — Modify endpoint.ts (CSAPI method removed first, then tests referencing it are removed here)
Blocks: Task 8 — Modify package.json, Task 9 — Verify and Commit (Commit 15)


Operational Constraints

⚠️ MANDATORY: Before starting work on this issue, review docs/governance/AI_OPERATIONAL_CONSTRAINTS.md.

For Phase 6 issues: Review the P6 Implementation Guide §7.2–7.3 for the complete index.ts and endpoint.spec.ts modification specifications.

Key constraints for this task:

  • Precedence: OGC specifications → AI Collaboration Agreement → This issue description → Existing code → Conversational context
  • No scope expansion: Do not infer unstated requirements or add unrequested features
  • No refactoring: Do not rename, restructure, or "improve" code outside this issue's scope
  • Minimal diffs: Prefer the smallest change that satisfies the acceptance criteria
  • Ask when unclear: If intent is ambiguous, stop and ask for clarification
  • Zero business logic changes: Phase 6 touches the integration boundary only

Phase 6 Architectural Constraints

  • CSAPI symbols must not appear in root index.ts: This is jahow's explicit requirement Phase 1.1: Create Type System (csapi/model.ts) #1. After this task, consumers must import CSAPI via @camptocamp/ogc-client/csapi.
  • Test migration is complete: The 2 migrated tests already exist in factory.spec.ts (Task 5). This task only removes the originals.
  • No unused imports created: The removed lines are all re-exports, not imports.

Phase 6 Task-Specific Scope Boundaries

  • Task 7 (this task) must NOT modify endpoint.ts or factory.ts — modifies index.ts and endpoint.spec.ts only
  • Task 6 must NOT modify index.ts or endpoint.spec.ts — modifies endpoint.ts only
  • Task 8 must NOT modify any TypeScript files — modifies package.json only

References

Primary References (must read)

# Document What It Provides
1 P6 Implementation Guide §7.2 Complete index.ts modification — which lines to remove, what stays
2 P6 Implementation Guide §7.3 Test disposition table — which 3 tests to remove, which 3 stay
3 P6 ROADMAP Task 7 Task definition, deliverables, dependencies
4 P6 Contribution Goal Criteria A1 (zero CSAPI in index.ts), B1/B2 (hasConnectedSystems/csapiCollections preserved)

Convention Quick Reference

Rule Example
Removal verification git grep "csapi|CSAPI" src/index.ts → 0 matches
Test count change Exactly 3 tests removed from endpoint.spec.ts
What stays in index.ts Lines 1–44 (core exports) + Lines 228+ (TMS, STAC, etc.)
What stays in endpoint.spec.ts 3 tests: hasConnectedSystems, csapiCollections, non-CSAPI

Activity

  1. Sam-Bolling commented on Feb 24, 2026

    @Sam-Bolling
    Author

    Task 7 Complete — Remove CSAPI Exports and Migrated Tests

    Commit: ed27108 on phase-6

    src/index.ts (252 → 66 lines, −186)

    • Removed all CSAPI export lines (lines 45–227)
    • git grep "csapi\|CSAPI" src/index.ts → 0 matches
    • Non-CSAPI exports unchanged (WFS, WMS, WMTS, TMS, STAC, shared, cache, worker)

    src/ogc-api/endpoint.spec.ts (2886 → 2805 lines, −81)

    Test Decision
    detects Connected Systems support ✅ Stays
    can list all CSAPI collections ✅ Stays
    can produce a CSAPI query builder ❌ Removed (migrated to factory.spec.ts)
    caches the CSAPI query builder ❌ Removed (obsolete — no auto-caching)
    reports no Connected Systems support ✅ Stays
    throws an error when calling csapi() ❌ Removed (migrated to factory.spec.ts)

    Verification

    • ✅ npx tsc --noEmit — zero errors
    • ✅ npx prettier --check — compliant
    • ✅ npx eslint — zero warnings
    • ✅ git grep "csapi\|CSAPI" src/index.ts — 0 matches
    • ✅ npm run test:browser -- --testPathPattern endpoint — 80/80 pass (was 83, −3 exactly)
    • ✅ npm run test:browser -- --testPathPattern factory — 2/2 pass

    Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions