Skip to content

feat: upgrade OINK to 1.1 with maintainable site extensions - #496

Open
imbajin wants to merge 6 commits into
masterfrom
oink-1.1
Open

imbajin wants to merge 6 commits into
masterfrom
oink-1.1

Conversation

@imbajin

@imbajin imbajin commented Sep 22, 2026

Copy link
Copy Markdown
Member

Purpose of the PR

Upgrade OINK from 1.0.0 to 1.1.0 and make future theme updates repeatable without mixing upstream behavior with HugeGraph customizations.

  • Replace sidebar DOM/state patches and the hand-built Ask AI search row with OINK's public APIs. Preserve version/locale-scoped preferences, consent-gated AI loading, cancellation and focus handling.
  • Reconcile the Print override with 1.1's plain/book return contract and inherit generic Chinese translations from the theme.
  • Use go.mod / go.sum for current and historical builds. Add a manual upgrade command with reviewed override/API/CSS fingerprints and full regression gates; refresh README, contribution guidance and AGENTS.md.
Explicit version → dependency update → customization change report
                                      ↓ reviewed / unaffected
                          build all versions → browser checks → ready for review

Maintenance and breaking-change recovery: OINK upgrade SOP.
Upstream: v1.1.0, sidebar API #41, search-tail API #40.

Kapa rollout preparation

Validation

  • Full scripts/update-oink.sh v1.1.0 --resume run passed locally: strict build, latest/1.7/1.5/1.3/1.0 builds and aggregate validation.
  • 180 Python tests (the rendered-output check runs separately after assembly), 35 UI unit tests and 3 workflow contracts passed.
  • 72 Chromium checks and 8 visual captures passed. Search cases now have individual test budgets without relaxing assertions.
  • Independent final-diff review and git diff --check passed.
  • The follow-up module-pin/configuration changes passed 12 targeted tests. Real Kapa end-to-end acceptance remains pending; source ingestion and mocked tests do not replace it.

The upgrade command does not commit or publish. Production publication remains the existing merge workflow.

CI queue efficiency

  • Superseded runs can cancel the final gate and report uploads; cancelled work no longer waits for an always() job to acquire a runner.
  • Assemble the site and run the unchanged blocking browser suite on one runner using its local artifact, removing one serial job allocation and one aggregate download. Parallel version builds and advisory visual checks remain.
  • Keep the required deploy check, approval rules and publication permissions. This reduces avoidable queueing; it cannot fix shared runner capacity.
  • Validation: actionlint, six workflow contracts (including execution of failure/skipped/cancelled gate cases), and independent diff review. Remote execution remains subject to runner availability.

Latest-only staging artifact compatibility

The first real staging run built successfully but failed assembly because the pinned download-artifact action extracts a single match directly into the destination. Accept that layout only for a single selected version when the named directory is absent, preserving metadata identity/SHA and full artifact validation. Multi-version inputs still require separate version directories. All 76 versioning tests pass, including flat-layout identity and selection rejection cases; remote staging must be verified on the corrected candidate.

Before / after

Chinese desktop (dark)
OINK 1.0 OINK 1.1
Before: Chinese desktop After: Chinese desktop
Chinese mobile drawer (dark)
OINK 1.0 OINK 1.1
Before: mobile drawer After: mobile drawer

- adopt OINK 1.1 sidebar and search extension APIs
- reconcile print overrides and inherit upstream translations
- add reviewed upgrade tooling and compatibility checks
- refresh maintenance docs and regression coverage
- configure verified English and Chinese source groups
- document consent, staging checks and rollout blockers
- accept blank module checksum lines without relaxing checks
- consolidate module lock regression coverage
- allow superseded runs to cancel gates and reports
- combine assembly and browser checks on one runner
- preserve required checks and publication permissions
- test failure gates and document queue behavior

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Copilot review overview

Review effort: Lite
Findings: 2 Medium severity

Open (2)
What changed in this PR

Upgrades the site’s OINK theme dependency to v1.1.0 and refactors HugeGraph customizations to rely on OINK’s public extension APIs, while adding an explicit, review-gated upgrade workflow and strengthening regression coverage.

Changes:

  • Update OINK module pin (go.mod/go.sum) and adopt the new sidebar/search-tail public APIs in site JavaScript.
  • Add an “OINK upgrade SOP” + update-oink command that fingerprints reviewed upstream files and runs full validation gates.
  • Refresh and expand UI/E2E tests and CI workflow structure to match the new sidebar/search behavior and the upgraded print contract.
File Description
tests/​ui-ai/​ui-contract.test.cjs Updates contract assertions to ensure OINK public APIs are used (no legacy patches).
tests/​ui-ai/​sidebar-persistence.test.cjs Adds focused unit coverage for sidebar state persistence via OinkSidebar API.
tests/​ui-ai/​kapa-adapter.test.cjs Updates adapter tests for native search-tail registration + cancellation/focus behavior.
tests/​e2e/​workflow-contract.test.cjs Updates workflow contract expectations and adds new checks around cancellation/gating.
tests/​e2e/​visual.spec.js Stabilizes screenshots (fonts ready + animations disabled) and updates collapsed sidebar assertion.
tests/​e2e/​theme-upgrade.spec.js Adds upgrade regression coverage: print output correctness, no-JS nav, blocked storage behavior.
tests/​e2e/​search-ranking.spec.js Splits ranking cases into individual tests for clearer budgets and failures.
tests/​e2e/​platform.spec.js Aligns platform checks with OINK 1.1 sidebar/drawer inert/focus behaviors.
tests/​e2e/​package.json Runs new theme-upgrade spec in CI browser suite.
tests/​e2e/​ai.spec.js Switches AI-row selection to native option rows; adds keyboard/IME/cancellation coverage.
scripts/​versioning.py Switches to download_locked() for theme module resolution and integrity checks.
scripts/​update_oink.py New review-gated upgrade command that fingerprints upstream surfaces and runs full validation gates.
scripts/​update-oink.sh Shim wrapper to run the Python upgrade tool consistently.
scripts/​test_oink_upgrade.py Unit tests for upgrade preflight/review gating and baseline update behavior.
scripts/​test_oink_module.py Unit tests for strict module lock verification (no replace/exclude, checksum match, minimal graph).
scripts/​test_download_data.py Adjusts i18n expectations and adds rendered-output verification for inherited theme labels.
scripts/​oink_module.py New helper to strictly resolve/download/verify the pinned OINK module from go.mod/go.sum.
scripts/​oink-upgrade.md Adds SOP documentation for upgrade/review/rollback and maps customizations to regression evidence.
scripts/​oink-overrides.json Adds reviewed baseline fingerprints for upstream files relevant to overrides/extensions.
scripts/​kapa-rollout.md Adds rollout runbook for staged Kapa enablement, consent/CSP validation, and evidence requirements.
layouts/​_partials/​shell/​toc.html Updates comment/version annotation for the reviewed upstream base.
layouts/​_partials/​shell/​sidebar-panel.html Updates override header to reflect review against OINK v1.1.0.
layouts/​_partials/​shell/​config.html Updates override header to reflect review against OINK v1.1.0.
layouts/​_partials/​print/​page-content.html Updates print partial to return plain/book dict per OINK 1.1 contract and avoid parallel render races.
layouts/​_partials/​navbar.html Removes sidebar restore button markup now handled by OINK shell behavior.
layouts/​_partials/​navbar-item.html Updates override header to reflect review against OINK v1.1.0.
layouts/​_partials/​hooks/​body-end.html Removes labels no longer needed due to native theme search-tail rendering.
i18n/​zh-CN.yaml Reduces to HugeGraph-specific labels; relies on OINK for generic zh-CN UI strings.
i18n/​en.yaml Removes now-inherited UI strings (e.g., assets download row label).
hugo.yaml Records verified Kapa source-group IDs while keeping production AI disabled.
go.mod Pins OINK to v1.1.0.
go.sum Updates checksums for OINK v1.1.0 pin.
contribution.md Updates contributor guidance for module verification and adds CI queue/rerun notes.
assets/​scss/​_styles_project.scss Removes CSS for now-native sidebar restore and ask-ai search-tail row.
assets/​js/​kapa-adapter.js Refactors AI integration to register native search-tail extension; adds cancellation/focus/settlement handling.
assets/​js/​hugegraph-shell.js Refactors sidebar persistence to use OinkSidebar public API; removes sidebar inert/overlay patching.
README.md Updates module verification instructions and documents the upgrade command.
NOTICE Removes hard-coded OINK version reference.
AGENTS.md Replaces outdated assistant guidance with current entry points, constraints, and validation expectations.
.github/​workflows/​hugo.yml Updates module verification step, merges assembly + browser checks onto one runner, improves cancellation behavior.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread assets/js/kapa-adapter.js
Comment on lines +262 to +264
function activate(query, submit, trigger, context) {
if (state === 'loading' || state === 'consent') return;
if (context && context.signal.aborted) return Promise.resolve();
Comment thread scripts/versioning.py
Comment on lines +4073 to +4075
go_executable = shutil.which(os.environ.get("GO_BIN", "go"))
if go_executable is None:
fail(f"Go executable is unavailable: {go}")
module_result = subprocess.run(
[
go_executable,
"mod",
"download",
"-json",
"github.com/pgsty/oink@v1.0.0",
],
cwd=assembly,
check=True,
stdout=subprocess.PIPE,
text=True,
)
module = json.loads(module_result.stdout)
if (
module.get("Path") != "github.com/pgsty/oink"
or module.get("Version") != "v1.0.0"
or module.get("Sum") != "h1:E+WHFP9zSRT+5RKoIkWNp+ASRGS1BKG+rDEi9by/BjE="
):
fail(f"unexpected OINK module metadata: {module!r}")
fail("Go executable is unavailable")
- incorporate the reviewed master prerequisite
- retain baseline verification and its module lock checks
- preserve the already validated candidate file tree
- handle single-match artifact download layout
- retain metadata identity and source SHA validation
- reject flat inputs for multi-version assembly
- cover staging layout and invalid metadata
- use the declared artifact version selection
- keep historical print checks for full builds
- validate latest-only browser checks locally

@bitflicker64 bitflicker64 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Blocking: no. Summary: The OINK 1.1 migration uses the tagged sidebar and search-tail APIs as documented, the Print override matches the upstream plain/book contract, and the flattened-artifact fallback is limited to a single selected version. Two minor issues are in the new upgrade tooling: the CI baseline check reports any local override addition as an upstream change without naming the file, and the upgrade command leaves the previous version's checksums in go.sum. Evidence: diff a5a9861..67e73b5; go mod download -json github.com/pgsty/oink@v1.1.0 returns the go.sum hash; OINK v1.1.0 sidebar-state.js and command-palette.js read for the API contracts; update_oink.py --check-baseline passes at head and fails after copying upstream layouts/_partials/breadcrumb.html unchanged into the site; go get github.com/pgsty/oink@v1.0.0 on a copy of go.mod/go.sum leaves four go.sum lines; node --test tests/ui-ai/*.test.cjs (35 pass), test_oink_upgrade and the two changed test_versioning cases pass; the Build and deploy site run on this head is green.

Comment thread scripts/update_oink.py
baseline = json.loads(BASELINE.read_text())
if (baseline["version"] != module["Version"]
or changes(baseline["files"], snapshot(ROOT, Path(module["Dir"])))):
raise ValueError("OINK upstream files differ from reviewed baseline; follow scripts/oink-upgrade.md")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 This check fails for local changes too, but the message says upstream files differ and does not name any file. snapshot() builds its inventory from the site's own layouts/, assets/ and i18n/, so adding or removing a same-name override changes the key set while OINK stays at v1.1.0.

Reproduced at this head: --check-baseline prints Reviewed OINK upstream baseline matches. After copying upstream layouts/_partials/breadcrumb.html into the site byte for byte, it exits 1 with OINK upstream files differ from reviewed baseline; follow scripts/oink-upgrade.md. Changes and artifacts are retained. A contributor gets this from all five Build <version> jobs, and the SOP only describes the version-upgrade flow.

Please include changes(...) in the error and say whether a path was added, removed or changed. The SOP or contribution.md should also say that adding or removing an override needs scripts/update-oink.sh <pinned> --resume --accept-reviewed. The trailing "Changes and artifacts are retained" from __main__ does not apply to this read-only mode.

Comment thread scripts/update_oink.py
work = Path(tempfile.mkdtemp(prefix="hugegraph-oink-"))
print(f"Upgrade artifacts and review report: {work}", flush=True)
if not args.resume and locked_version(ROOT) != args.version:
command(["get", MODULE + "@" + args.version], ROOT)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 go get keeps the old version's checksums, so the documented upgrade leaves four lines in go.sum. The SOP says "The theme version and its two checksums live only in go.mod / go.sum", and it forbids go mod tidy, which would drop the require here because nothing imports the module.

Reproduced on a copy of this head's go.mod/go.sum: go get github.com/pgsty/oink@v1.0.0 rewrites the require but keeps both v1.1.0 lines next to the new v1.0.0 lines. download_locked() still passes, so nothing catches the leftovers, and they build up with each upgrade. This PR's go.sum has two lines, so it was cleaned by hand.

Please rewrite go.sum after go get to only the MODULE version and MODULE version/go.mod lines, or make download_locked() reject extra entries so the command and the SOP agree.

@imbajin
imbajin requested a balanced review from Copilot September 23, 2026 08:10

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Comment thread assets/js/kapa-adapter.js
Comment on lines 263 to +266
if (state === 'loading' || state === 'consent') return;
if (context && context.signal.aborted) return Promise.resolve();
lastTrigger = trigger || documentObject.activeElement;
var completion;
run: npm run test:ci
- name: Upload E2E report
if: always()
if: ${{ !cancelled() }}
npm run test:visual
- name: Upload advisory visual evidence
if: always()
if: ${{ !cancelled() }}
Comment thread assets/js/kapa-adapter.js
Comment on lines +359 to +366
rows: function (context) {
return [{
id: 'ask',
title: config.labels.ask + ': “' + context.query + '”',
description: config.historical ? config.labels.latest + '.' : '',
icon: 'fa-solid fa-wand-magic-sparkles',
}];
},

This branch has not been deployed

No deployments
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