Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 16 additions & 21 deletions .dev/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,6 @@ COPY package.json bun.lockb ./
RUN --mount=type=cache,target=/root/.bun,sharing=locked \
bun install --frozen-lockfile --verbose

#=============================================================================
# Stage 3: Ruby dependencies (parallel with node-deps)
#=============================================================================
FROM base AS ruby-deps
WORKDIR /usr/src/app
COPY Gemfile Gemfile.lock ./

# Enhanced bundle install with optimized settings
RUN --mount=type=cache,target=/usr/local/bundle/cache,sharing=locked \
--mount=type=cache,target=/root/.bundle \
echo "gem: --no-document" > /root/.gemrc && \
bundle config set --local deployment false && \
bundle config set --local path /opt/bundle && \
bundle config set --local jobs 4 && \
bundle config set --local retry 3 && \
bundle config set --local without development:assets && \
bundle install

#=============================================================================
# Stage 4: Final runtime image (optimized)
#=============================================================================
Expand Down Expand Up @@ -77,20 +59,33 @@ RUN apk update && apk upgrade && \
libjpeg-turbo vips \
chromium chromium-chromedriver \
xvfb \
build-base make g++ git \
libjpeg-turbo-dev vips-dev \
python3 pkgconfig \
nss freetype ttf-freefont font-noto

# Copy Bun binary for Node.js package management
COPY --from=node-deps /usr/local/bin/bun /usr/local/bin/


# Set up application directory structure
WORKDIR /app

COPY Gemfile Gemfile.lock ./

# Enhanced bundle install with optimized settings
RUN --mount=type=cache,target=/usr/local/bundle/cache,sharing=locked \
--mount=type=cache,target=/root/.bundle \
echo "gem: --no-document" > /root/.gemrc && \
bundle config set --local deployment false && \
bundle config set --local path /opt/bundle && \
bundle config set --local jobs 4 && \
bundle config set --local retry 3 && \
bundle config set --local without development:assets && \
bundle install

VOLUME /app/node_modules
VOLUME /opt/bundle

# Copy dependencies from build stages (optimized order)
COPY --from=ruby-deps /opt/bundle /opt/bundle
COPY --from=node-deps /temp/dev/node_modules ./node_modules

COPY .dev/docker-entrypoint.sh /docker-entrypoint.sh
Expand Down
7 changes: 0 additions & 7 deletions .dev/compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ services:
environment:
HUGO_CACHEDIR: /tmp/hugo_cache
HUGO_NUMWORKERMULTIPLIER: 8
HUGO_ENABLEGITINFO: false
restart: unless-stopped
mem_limit: 512m
cpus: '2.0'
Expand All @@ -32,12 +31,10 @@ services:
tty: true
volumes:
- ..:/app:delegated
- bundle:/opt/bundle
- history:/usr/local/hist
environment:
HISTFILE: /usr/local/hist/.bash_history
IRB_HISTFILE: /usr/local/hist/.irb_history
BUNDLE_PATH: /opt/bundle
command: sh

# Test runner with optimized dependency management
Expand All @@ -51,14 +48,10 @@ services:
command: bin/test
volumes:
- ..:/app:delegated
- node_modules:/app/node_modules
- bundle:/opt/bundle
- hugo_cache_dtest:/tmp/hugo_cache_dtest
environment:
HUGO_PUBLIC_DIR: "_dest/public-dtest"
HUGO_DEFAULT_PATH: "_dest/public-dtest"
HUGO_CACHEDIR: "/tmp/hugo_cache_dtest"
HUGO_ENABLEGITINFO: "false"
CAPYBARA_SCREENSHOT_ON_FAILURE: "true"
RUBY_THREAD_VM_STACK_SIZE: 1048576
mem_limit: 2g
Expand Down
1 change: 0 additions & 1 deletion .dev/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#!/bin/sh

# Start virtual display for browser testing
Xvfb :99 -screen 0 1920x1080x24 -ac +extension GLX +render -noreset &

# Handle shell commands properly
Expand Down
4 changes: 2 additions & 2 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
### 🛠️ **XP TEAM CORRECTIONS APPLIED**
1. **Hardcoded Port Violations**: Removed hardcoded port 1314, replaced with ENV.fetch("TEST_SERVER_PORT", "1314")
2. **Test Masking Violations**: Removed skip() method that violated zero-tolerance test masking policy
3. **Hardcoded Path Violations**: Replaced "_dest/public-test" with ENV.fetch('HUGO_PUBLIC_DIR', '_dest/public-test')
3. **Hardcoded Path Violations**: Replaced "_dest/public-test" with ENV.fetch('HUGO_DEFAULT_PATH', '_dest/public-test')
4. **Micro-Refactoring Discipline**: Applied ≤3 line changes with syntax validation after each step

### 📖 **XP PRINCIPLES SUCCESSFULLY ENFORCED**
Expand Down Expand Up @@ -6349,4 +6349,4 @@ The configuration maintains all existing safeguards while adding XP discipline a
- Always spawn a whole xp team swarm to handle the task through claude-flow and ruv-swarm
- DO NOT ADD NEW SCRIPTS FOR DEVELOPERS TO USE! All ad hoc scripts need to be deleted after task completion!
- FOR MICRO REFACTORING IT WILL BE ENOUGH TO USE `bin/rake test:critical`
- IMPORTANT: After each micro changes (< 10 lines) of the production code run `bin/rake test:critical`. After changes others code review and validate the changes with following four-eyes principle
- IMPORTANT: After each micro changes (< 10 lines) of the production code run `bin/rake test:critical`. After changes others code review and validate the changes with following four-eyes principle
46 changes: 23 additions & 23 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
GEM
remote: https://rubygems.org/
specs:
actionpack (8.0.2.1)
actionview (= 8.0.2.1)
activesupport (= 8.0.2.1)
actionpack (8.0.3)
actionview (= 8.0.3)
activesupport (= 8.0.3)
nokogiri (>= 1.8.5)
rack (>= 2.2.4)
rack-session (>= 1.0.1)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6)
useragent (~> 0.16)
actionview (8.0.2.1)
activesupport (= 8.0.2.1)
actionview (8.0.3)
activesupport (= 8.0.3)
builder (~> 3.1)
erubi (~> 1.11)
rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6)
activemodel (8.0.2.1)
activesupport (= 8.0.2.1)
activesupport (8.0.2.1)
activemodel (8.0.3)
activesupport (= 8.0.3)
activesupport (8.0.3)
base64
benchmark (>= 0.3)
bigdecimal
Expand Down Expand Up @@ -74,7 +74,7 @@ GEM
multi_xml (>= 0.5.2)
i18n (1.14.7)
concurrent-ruby (~> 1.0)
json (2.13.2)
json (2.15.0)
language_server-protocol (3.17.0.5)
launchy (3.1.1)
addressable (~> 2.8)
Expand All @@ -95,19 +95,19 @@ GEM
net-http (0.6.0)
uri
nio4r (2.7.4)
nokogiri (1.18.9)
nokogiri (1.18.10)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
nokogiri (1.18.9-arm64-darwin)
nokogiri (1.18.10-arm64-darwin)
racc (~> 1.4)
ostruct (0.6.3)
parallel (1.27.0)
parser (3.3.9.0)
ast (~> 2.4.1)
racc
prism (1.4.0)
prism (1.5.1)
public_suffix (6.0.2)
puma (7.0.1)
puma (7.0.4)
nio4r (~> 2.0)
racc (1.8.1)
rack (3.2.1)
Expand All @@ -127,20 +127,20 @@ GEM
nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
rainbow (3.1.1)
rake (13.3.0)
regexp_parser (2.11.2)
rexml (3.4.3)
rubocop (1.75.8)
regexp_parser (2.11.3)
rexml (3.4.4)
rubocop (1.80.2)
json (~> 2.3)
language_server-protocol (~> 3.17.0.2)
lint_roller (~> 1.1.0)
parallel (~> 1.10)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 2.9.3, < 3.0)
rubocop-ast (>= 1.44.0, < 2.0)
rubocop-ast (>= 1.46.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 4.0)
rubocop-ast (1.46.0)
rubocop-ast (1.47.1)
parser (>= 3.3.7.2)
prism (~> 1.4)
rubocop-performance (1.25.0)
Expand All @@ -164,10 +164,10 @@ GEM
simplecov_json_formatter (~> 0.1)
simplecov-html (0.13.2)
simplecov_json_formatter (0.1.4)
standard (1.50.0)
standard (1.51.1)
language_server-protocol (~> 3.17.0.2)
lint_roller (~> 1.0)
rubocop (~> 1.75.5)
rubocop (~> 1.80.2)
standard-custom (~> 1.0.0)
standard-performance (~> 1.8)
standard-custom (1.0.2)
Expand All @@ -178,9 +178,9 @@ GEM
rubocop-performance (~> 1.25.0)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unicode-display_width (3.1.5)
unicode-emoji (~> 4.0, >= 4.0.4)
unicode-emoji (4.0.4)
unicode-display_width (3.2.0)
unicode-emoji (~> 4.1)
unicode-emoji (4.1.0)
uri (1.0.3)
useragent (0.16.11)
vips (8.15.1)
Expand Down
3 changes: 1 addition & 2 deletions bin/dtest
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ set -euo pipefail
echo "Building Hugo site for Docker tests (public-dtest) with optimizations..."
hugo --noBuildLock \
--buildDrafts \
--environment test \
--gc \
--environment production \
--destination=_dest/public-dtest \
--logLevel=warn \
--baseURL="http://localhost:1314"
Expand Down
5 changes: 4 additions & 1 deletion config/_default/hugo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ languageCode = "en-us"
title = "JetThoughts"
copyright = "This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License."
theme = "beaver"
enableGitInfo = true
enableGitInfo = false
disableKinds = []

[markup.goldmark.renderer]
Expand Down Expand Up @@ -286,3 +286,6 @@ tell = "entry.1791620687"
[params.forms.newsletter]
action = "https://docs.google.com/forms/u/0/d/e/1FAIpQLSdD4751jeepeQe4wefgLqBO6XAU0qqvKWvmJ8P6xRmrMRvakg/formResponse"
email = "entry.939459641"

# Skip expensive processing in development
ignoreFiles = ["\\.min\\.css$", "\\.min\\.js$"]
3 changes: 2 additions & 1 deletion config/development/hugo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
# Overrides base config for fast development iteration

# Development-specific base URL
baseURL = "http://localhost:1313/"
baseURL = "/"

# Hugo automatically enables these in development, but explicit is better
buildDrafts = true
buildExpired = true
buildFuture = true
relativeURLs = true

# Disable resource-intensive features for faster builds
# Note: Keeping "section" enabled so blog index pages work in development
Expand Down
4 changes: 2 additions & 2 deletions config/test/hugo.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
baseURL = "http://localhost:1314/"
baseURL = "/"
relativeURLs = true
environment = "test"
disableKinds = ["RSS", "sitemap", "robotsTXT"]
Expand All @@ -8,7 +8,7 @@ disableKinds = ["RSS", "sitemap", "robotsTXT"]
noChmod = true

[minify]
minifyOutput = true
minifyOutput = false
[minify.tdewolff.html]
keepWhitespace = true # Reduce processing overhead

Expand Down
3 changes: 1 addition & 2 deletions docs/60.13-docker-test-precompilation-strategy.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ environment = "test"
environment:
HUGO_DEFAULT_PATH: "_dest/public-dtest" # Precompiled asset path
HUGO_CACHEDIR: "/tmp/hugo_cache_dtest" # Docker cache optimization
HUGO_ENABLEGITINFO: "false" # Disable git integration in Docker
```

#### Test Helper Configuration
Expand Down Expand Up @@ -248,4 +247,4 @@ end

**Authority**: Technical Architecture Decision
**Compliance**: MANDATORY for all Docker test modifications
**Review**: Required before any changes to Docker test pipeline
**Review**: Required before any changes to Docker test pipeline
2 changes: 1 addition & 1 deletion docs/fl-node-homepage-inventory.md
Original file line number Diff line number Diff line change
Expand Up @@ -236,4 +236,4 @@ This migration aligns with our 8 component systems:
- Micro-commits allow for easy rollback
- Comprehensive testing at each stage
- Conservative timeline with buffer for issues
- Team coordination through swarm methodology
- Team coordination through swarm methodology
34 changes: 10 additions & 24 deletions test/application_system_test_case.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,12 @@
require "support/setup_snap_diff"
require "support/hugo_helpers"

# Support both precompiled assets (fixed port) and dynamic port scenarios
if ENV["TEST_SERVER_PORT"]
test_port = ENV.fetch("TEST_SERVER_PORT", "1314").to_i
Capybara.server_port = test_port
end

# Get port safely, fallback to environment or default
current_port = if ENV["TEST_SERVER_PORT"]
ENV.fetch("TEST_SERVER_PORT").to_i
elsif Capybara.current_session&.server&.port
Capybara.current_session.server.port
else
1314
end

hugo_builder = Hugo.new(path: ENV.fetch("HUGO_DEFAULT_PATH", "_dest/public-test"), port: current_port)
hugo_builder = Hugo.instance
Capybara.app = hugo_builder.app

unless ENV["PRECOMPILED_ASSETS"]
Expand Down Expand Up @@ -59,13 +49,13 @@ class ApplicationSystemTestCase < Minitest::Test

# Ruby hash-based configuration for screenshot sections
SECTION_CONFIGS = {
'cta' => {tolerance: 0.03},
'cta-contact_us' => {tolerance: 0.03},
'clients' => {tolerance: 0.03},
'use-cases' => {tolerance: 0.03},
'technologies' => {tolerance: 0.02},
'testimonials' => {tolerance: 0.02},
'why-us' => {tolerance: 0.02}
"cta" => {tolerance: 0.03},
"cta-contact_us" => {tolerance: 0.03},
"clients" => {tolerance: 0.03},
"use-cases" => {tolerance: 0.03},
"technologies" => {tolerance: 0.02},
"testimonials" => {tolerance: 0.02},
"why-us" => {tolerance: 0.02}
}.freeze

DEFAULT_SCREENSHOT_CONFIG = {tolerance: 0.03}.freeze
Expand All @@ -79,11 +69,8 @@ def preload_all_images

# Unified screenshot assertion with Ruby hash-based configuration
def assert_screenshot(name, **options)
# Use Capybara's built-in wait mechanism instead of sleep
wait_time = options.delete(:wait) || 1
has_css?("body", wait: wait_time) # This ensures page is ready
has_css?("body", wait: options.delete(:wait) || 2)

# Apply Ruby hash-based section configuration
section_config = screenshot_config_for(name)
final_options = section_config.merge(options)

Expand All @@ -96,8 +83,7 @@ def screenshot_config_for(name)
end

def extract_section_key(name)
# Extract section identifier from screenshot name (e.g., "homepage/_cta" -> "cta")
name.to_s.split('/_').last || name.to_s.split('/').last
name.to_s.split("/_").last || name.to_s.split("/").last
end

# Backward compatibility aliases - will be deprecated once all tests updated
Expand Down
Loading