Skip to content

feat(vehicles): day log, timeline clamp, overlay chrome #1067

feat(vehicles): day log, timeline clamp, overlay chrome

feat(vehicles): day log, timeline clamp, overlay chrome #1067

name: si-canonical-gate
# Phase-44 / observability-batch / Prompt F7 β€” SI Canonical Gate.
#
# Blocks PRs that introduce NEW legacy unit-suffixed Go field names,
# JSON tags, or DB column references. The Phase-48 mandate is clear:
# we ship SI only. Pre-existing legacy identifiers in the codebase
# (~7 files at gate inception) are grandfathered via the
# CI_ALLOWLIST_PATHS variable; everything else is rejected.
#
# Two passes:
#
# 1. Backend Go β€” bans Go identifiers / JSON tags / struct fields /
# DB column literals containing legacy unit suffixes.
#
# 2. Frontend TS β€” bans new callers of the @deprecated unit
# conversion helpers in web/src/lib/unitConversion.ts.
#
# The gate inspects ADDED lines only via `git diff origin/main...HEAD`,
# so refactors that move existing legacy identifiers between files do
# NOT trip the gate (the moved + added cancel out at line-count level
# but ADDED lines do appear in the diff β€” the allowlist therefore
# applies to both pre-existing files and the legacy-suffix patterns
# themselves).
on:
push:
pull_request:
workflow_dispatch:
inputs:
runner:
description: 'Runner to use (manual runs only)'
type: choice
options:
- arc-runner
- ubuntu-latest
default: ubuntu-latest
concurrency:
group: si-canonical-gate-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
permissions:
contents: read
jobs:
check:
name: Block new legacy unit-suffixed identifiers
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
# Fetch enough history to compute the diff against the merge
# base. depth: 0 is wasteful but reliable on shallow clones.
fetch-depth: 0
- name: Compute diff against PR base
id: diff
run: |
set -euo pipefail
BASE="${GITHUB_BASE_REF:-main}"
git fetch --no-tags --depth=200 origin "+refs/heads/${BASE}:refs/remotes/origin/${BASE}"
# Use the merge-base so file moves and rebases don't false-positive.
MERGE_BASE=$(git merge-base "origin/${BASE}" HEAD)
echo "merge_base=${MERGE_BASE}" >>"$GITHUB_OUTPUT"
git diff --unified=0 "${MERGE_BASE}...HEAD" -- \
'internal/**/*.go' 'cmd/**/*.go' \
'web/src/**/*.ts' 'web/src/**/*.tsx' \
'migrations/**/*.sql' \
> /tmp/si.diff || true
wc -l /tmp/si.diff
- name: Check for new legacy unit-suffixed Go identifiers
run: python3 .github/scripts/si_canonical_gate.py go
- name: Check for new callers of @deprecated unit conversion helpers
run: python3 .github/scripts/si_canonical_gate.py fe