Skip to content

Conversation

@MantisClone
Copy link
Member

@MantisClone MantisClone commented Dec 2, 2025

Problem

  • Root URL (https://requestnetwork.github.io/request-token-list/) returns 404 when clicking the GitHub Pages link in the Actions workflow summary
  • Timestamp was being manually edited instead of auto-set during deployment
  • Missing vX.Y.json aliases for historical versions (e.g., v1.1.json, v1.2.json)
  • Missing vX.json aliases for historical major versions (e.g., v0.json for all v0.x.x releases)
Screenshot 2025-12-02 at 10 53 20 AM

Solution

  • Add index.html that redirects to latest.json
  • Enforce timestamp placeholder "Set automatically during deployment" in source file (actual timestamp set during deployment)
  • Update schema to accept both placeholder and date-time (so consumers can use schema for deployed lists)
  • Update validation script to require placeholder in source file
  • Update tests to use placeholder
  • Generate vX.Y.json aliases for all historical versions (highest patch wins)
  • Generate vX.json aliases for historical major versions (highest minor.patch wins)
  • Bump version to 1.3.1 to trigger deployment with new features

Version alias example

Given current version 1.3.1 and historical versions v0.5.0, v0.6.0, v0.6.1, v1.0.0, v1.1.0, v1.2.0, v1.2.1:

Historical major aliases (vX.json):

  • v0.json → points to v0.6.1 (highest v0.x.x)

Historical minor aliases (vX.Y.json):

  • v0.5.json → points to v0.5.0
  • v0.6.json → points to v0.6.1 (highest patch)
  • v1.0.json → points to v1.0.0
  • v1.1.json → points to v1.1.0
  • v1.2.json → points to v1.2.1 (highest patch)

Current version aliases (always created from current version):

  • v1.json → points to v1.3.1 (current)
  • v1.3.json → points to v1.3.1 (current)

Changes

  • .github/workflows/deploy.yml: Add index.html generation and historical version aliases
  • src/schemas/token-list-schema.json: Allow both timestamp formats (placeholder for source, date-time for deployed)
  • src/validation/validate.ts: Enforce timestamp placeholder in source file
  • tests/validation.test.ts: Update tests to use timestamp placeholder
  • tokens/token-list.json: Update timestamp to placeholder, bump version to 1.3.1

Summary by CodeRabbit

  • New Features

    • Improved deployment output: generates versioned JSON files, creates additional historical aliases, and adds a redirect to the latest manifest.
    • Deployment now inserts an automatic timestamp into token lists.
  • Refactor

    • Validation updated to require a timestamp placeholder during development; CI/release replaces it with the real timestamp.
  • Tests

    • Test suite extended to cover the placeholder timestamp behavior and related validation scenarios.

✏️ Tip: You can customize this high-level summary in your review settings.

Copilot AI review requested due to automatic review settings December 2, 2025 15:54
@coderabbitai
Copy link

coderabbitai bot commented Dec 2, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Walkthrough

CI deployment workflow now generates full historical-version files and alias redirects and emits a redirecting dist/index.html. Token list timestamp is replaced by a deployment placeholder; schema and validation accept (or require) that placeholder. TIMESTAMP_PLACEHOLDER was added to src/types and tests updated accordingly.

Changes

Cohort / File(s) Summary
CI workflow & deployment logic
.github/workflows/deploy.yml
Replaced simple historical-copy with enhanced logic that copies full historical version files, tracks highest patch per major.minor and highest minor.patch per major to create v{MAJOR}.{MINOR} and v{MAJOR} aliases (skips current-version aliases when appropriate), and generates dist/index.html redirecting to latest.json.
Token list instance
tokens/token-list.json
Replaced concrete ISO timestamp with the placeholder string "Set automatically during deployment" and incremented patch version (0 → 1).
Schema change
src/schemas/token-list-schema.json
Relaxed timestamp schema: replaced strict date-time requirement with a oneOf allowing either a date-time string or the literal "Set automatically during deployment"; other top-level properties unchanged.
Types export
src/types/index.ts
Added exported constant TIMESTAMP_PLACEHOLDER = "Set automatically during deployment".
Validation logic
src/validation/validate.ts
Imported TIMESTAMP_PLACEHOLDER from ../types; replaced previous date-parsing timestamp validation with isValidTimestamp that enforces the exact placeholder string and logs an error for deviations; added explanatory comment about CI/deployment.
Tests
tests/validation.test.ts
Replaced concrete timestamps with TIMESTAMP_PLACEHOLDER; added tests rejecting real timestamps and invalid formats; adjusted multiple validation tests to expect the placeholder.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

  • Inspect .github/workflows/deploy.yml aliasing algorithm for correctness and edge cases (highest-patch/minor selection and skipping current-version aliases).
  • Verify dist/index.html redirect content and paths.
  • Confirm oneOf schema behavior with existing validators and downstream tools.
  • Review isValidTimestamp change in src/validation/validate.ts for unintended impacts on other consumers.
  • Run and validate updated tests in tests/validation.test.ts and ensure TIMESTAMP_PLACEHOLDER export in src/types/index.ts is correct and used consistently.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes all four main objectives: index.html redirect, historical version aliases, timestamp placeholder enforcement, and version bump.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/add-index-html-redirect

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds an index.html redirect page to resolve the 404 error when accessing the root URL of the GitHub Pages deployment. The redirect automatically sends visitors to latest.json, ensuring the workflow summary URL is functional.

Key Changes:

  • Added HTML redirect page generation in deployment workflow that redirects to latest.json
  • Bumped minor version from 1.2 to 1.3 in the token list

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.

File Description
.github/workflows/deploy.yml Added step to generate index.html with meta refresh redirect to latest.json
tokens/token-list.json Bumped minor version from 1.2 to 1.3

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@MantisClone MantisClone marked this pull request as draft December 2, 2025 15:58
@MantisClone MantisClone force-pushed the fix/add-index-html-redirect branch 3 times, most recently from 4a84a6f to e44df88 Compare December 2, 2025 16:10
This fixes the 404 when clicking the GitHub Pages URL in the
workflow summary. The root URL now redirects to latest.json.
@MantisClone MantisClone force-pushed the fix/add-index-html-redirect branch from e44df88 to 67f620f Compare December 2, 2025 16:11
Creates major.minor aliases (e.g., v1.2.json) for all historical
versions in the versions/ directory. The highest patch version
for each major.minor combination is used for the alias.
@MantisClone MantisClone changed the title fix: Add index.html redirect to latest.json fix: Add index.html redirect, historical version aliases, and bump to 1.3.1 Dec 2, 2025
@MantisClone MantisClone changed the title fix: Add index.html redirect, historical version aliases, and bump to 1.3.1 fix: Add index.html redirect, historical version aliases, timestamp placeholder, and bump to 1.3.1 Dec 2, 2025
@MantisClone MantisClone marked this pull request as ready for review December 2, 2025 17:29
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
.github/workflows/deploy.yml (1)

127-139: Minor: Consider a brief inline comment for the semver comparison logic.

The nested condition at line 134 (if [ "$FILE_MINOR" -gt "$CURRENT_M" ] || ([ "$FILE_MINOR" = "$CURRENT_M" ] && [ "$FILE_PATCH" -gt "$CURRENT_P" ])) correctly implements "highest minor.patch within a major version," but a one-line comment explaining this would improve clarity for future maintainers.

                # Create/update major alias (e.g., v1.json) - only for non-current majors
                if [ "$FILE_MAJOR" != "$MAJOR" ]; then
                  MAJOR_ALIAS="v${FILE_MAJOR}.json"
                  # Compare as "minor.patch" to find highest version within major
                  CURRENT_MINOR_PATCH=${highest_minor[$FILE_MAJOR]:-"-1.-1"}
                  CURRENT_M=$(echo $CURRENT_MINOR_PATCH | cut -d. -f1)
                  CURRENT_P=$(echo $CURRENT_MINOR_PATCH | cut -d. -f2)
+                 # Update if this version is newer (higher minor, or same minor but higher patch)
                  if [ "$FILE_MINOR" -gt "$CURRENT_M" ] || ([ "$FILE_MINOR" = "$CURRENT_M" ] && [ "$FILE_PATCH" -gt "$CURRENT_P" ]); then
                    cp "$version_file" "dist/${MAJOR_ALIAS}"
                    highest_minor[$FILE_MAJOR]="${FILE_MINOR}.${FILE_PATCH}"
                    echo "Created/updated alias ${MAJOR_ALIAS} from $(basename $version_file)"
                  fi
                fi
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a09a07c and f15ff1c.

📒 Files selected for processing (5)
  • .github/workflows/deploy.yml (1 hunks)
  • src/schemas/token-list-schema.json (1 hunks)
  • src/validation/validate.ts (1 hunks)
  • tests/validation.test.ts (11 hunks)
  • tokens/token-list.json (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • tokens/token-list.json
🧰 Additional context used
🧬 Code graph analysis (1)
tests/validation.test.ts (2)
src/types/index.ts (1)
  • TokenList (14-23)
src/validation/validate.ts (1)
  • validateTokenList (17-60)
🔇 Additional comments (4)
.github/workflows/deploy.yml (2)

91-142: ✓ Historical version aliasing logic is correct and well-protected.

The semver comparison and aliasing strategy is sound:

  • Current version's aliases (v{MAJOR}.json, v{MAJOR}.{MINOR}.json) are created first, then protected from overwrite by historical versions (lines 108, 128)
  • Each historical major.minor gets a single highest-patch alias (lines 117–125)
  • Each historical major gets a single highest-minor.patch alias, skipped only for the current major (lines 127–139)
  • Defensive directory and file existence checks in place

The trace-through: current v1.3.0 creates v1.json/v1.3.json/latest.json; historical v1.2.3 creates only v1.2.json (skips v1.json); historical v0.9.1 creates both v0.9.json and v0.json. Correct precedence.


145-158: ✓ index.html redirect is properly implemented.

Valid HTML5 structure with lang="en" (addressing the prior review comment), meta charset, proper http-equiv refresh directive, and fallback link for browsers that don't auto-redirect. Redirect target (latest.json) is correct for serving the root as the latest version.

src/schemas/token-list-schema.json (1)

10-17: LGTM! Schema change allows both placeholder and deployed timestamps.

The oneOf constraint elegantly handles both scenarios: source files with the placeholder during CI validation, and deployed files with actual RFC 3339 timestamps. This design allows the same schema to validate files at different stages of the deployment pipeline.

tests/validation.test.ts (1)

123-143: LGTM! Good test coverage for placeholder enforcement.

The new tests appropriately verify that:

  1. Real ISO 8601 timestamps are rejected (lines 123-132)
  2. Invalid timestamp strings are rejected (lines 134-143)

This ensures the validation enforces the placeholder in the source file as intended.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
tests/validation.test.ts (1)

131-140: Consider clarifying the test name.

The test name "should reject invalid timestamp format" implies format validation, but the validation logic rejects any value that isn't the exact placeholder string. The test still passes correctly, but the name could be more precise.

-  it("should reject invalid timestamp format", async () => {
+  it("should reject non-placeholder timestamp values", async () => {
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f15ff1c and 6040998.

📒 Files selected for processing (3)
  • src/types/index.ts (1 hunks)
  • src/validation/validate.ts (2 hunks)
  • tests/validation.test.ts (11 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
tests/validation.test.ts (2)
src/types/index.ts (2)
  • TIMESTAMP_PLACEHOLDER (61-61)
  • TokenList (14-23)
src/validation/validate.ts (1)
  • validateTokenList (18-61)
src/validation/validate.ts (1)
src/types/index.ts (1)
  • TIMESTAMP_PLACEHOLDER (61-61)
🔇 Additional comments (5)
src/validation/validate.ts (2)

11-11: LGTM! Past review feedback addressed.

The TIMESTAMP_PLACEHOLDER is now correctly imported from the shared ../types module, eliminating the duplication that was flagged in the previous review.


116-132: Well-documented validation logic.

The JSDoc clearly explains the dual-validation approach: the JSON schema allows both formats for consumer flexibility, while this validation script enforces the placeholder for source files. The implementation correctly uses the shared constant.

src/types/index.ts (1)

57-61: Good addition of the shared constant.

The TIMESTAMP_PLACEHOLDER constant is well-documented and appropriately placed alongside other shared constants like CHAIN_IDS. This establishes a single source of truth for the placeholder value.

tests/validation.test.ts (2)

3-3: Past review feedback addressed.

The TIMESTAMP_PLACEHOLDER is now correctly imported from the shared types module instead of being duplicated locally.


120-129: Good test coverage for placeholder enforcement.

This test correctly verifies that real ISO timestamps are rejected, ensuring the source file validation enforces the placeholder requirement.

@MantisClone MantisClone self-assigned this Dec 2, 2025
@MantisClone MantisClone merged commit 5436e4f into main Dec 4, 2025
2 checks passed
@MantisClone MantisClone deleted the fix/add-index-html-redirect branch December 4, 2025 18:26
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.

3 participants