Skip to content

Feat/xplane - #105

Merged
AussieScorcher merged 15 commits into
mainfrom
feat/xplane
Sep 17, 2026
Merged

AussieScorcher merged 15 commits into
mainfrom
feat/xplane

Conversation

@AussieScorcher

@AussieScorcher AussieScorcher commented Sep 17, 2026 •

Copy link
Copy Markdown
Member

Summary

Adds Core support for X-Plane contributions and Bridge package distribution, alongside improvements to contribution publishing, MSFS light removals, and realtime state handling.

Changes Made

  • Add X-Plane contribution generation, submission, approval, and regeneration, including removal manifests with apt.dat and DSF selectors.
  • Add versioned X-Plane Bridge package uploads and package discovery.
  • Bind contribution submissions to their tested generation using tokens and hashes, and publish artifacts under unique generation paths.
  • Add staff-managed contributor fast-track access, with expiry, publishing limits, decision tracking, and automatic revocation after rejection.
  • Improve MSFS removal generation with support placement contained within selected geometry, simulator-specific polygon handling, and calculated airport test radii.
  • Expose online pilots through WebSocket requests and support larger validated EuroScope lighting packets.
  • Improve WebSocket cleanup, state persistence, and synchronization between equivalent light objects.
  • Add scoped authentication for division-data automation and tighten airport mutation permissions.
  • Strengthen request parsing, prevent partial downloads from entering the full-response cache, and update lint tooling.

Author Information

VATSIM CID: 1658308

Checklist:

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?

Comment thread src/network/connection.ts
console.error(`Error fetching offline state for ${airport}:`, error);
this.offlineStateCache.delete(normalizedAirport);
return [];
if (this.offlineStateCache.get(normalizedAirport)?.inFlight === inFlight) {
@greptile-apps

greptile-apps Bot commented Sep 17, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 2/5

The PR is not safe to merge until tested artifacts are preserved through approval, equivalent-state batches remain synchronized for their sender, and generated MSFS test radii cover every exclusion corner.

Findings

  1. P1 Approval Discards Tested Artifacts ▶
  2. P1 Sender State Can Diverge ▶
  3. P1 Radius Omits Farthest Corners ▶
  4. P2 Large Packet Check Too Broad ▶
  5. P2 Removal Root Nesting Unchecked ▶
  6. P2 Production Debug Logging Enabled ▶
  7. P2 Regression Coverage Removed ▶
Fix with agent prompt
### Issue 1
src/services/contributions.ts:1023-1028
When a contribution is approved, this code reruns both generators from `submittedXml` instead of publishing the removal and BARS artifacts stored for its `generationToken`. If generation behavior changes while a contribution is pending, approval can publish outputs different from those the contributor tested, defeating the tested-generation guarantee and potentially shipping unvalidated simulator artifacts.

### Issue 2
src/network/connection.ts:1161-1190
If one `MULTI_STATE_UPDATE` gives conflicting states for two equivalent IDs, the updates run sequentially and the later state becomes canonical. Peers receive that final synchronized state, but both explicitly requested IDs are filtered out of `senderUpdates`, so the sending client receives no correction and remains out of sync with the server.

### Issue 3
src/services/msfs-removals.ts:187-193
The airport test radius measures only the southwest and northeast corners of each exclusion rectangle. When the airport lies northwest or southeast of an object-only exclusion, the farthest corner is one of the two omitted mixed corners. With no support geometry to compensate, the generated `airportTestRadius` can be too small to cover the removal area.

### Issue 4
src/network/euroscope-packets.ts:37-43
The large-packet exception treats every `MULTI_STATE_UPDATE` with at most 10,000 entries as EuroScope lighting traffic without validating its shape. Any authenticated controller can therefore send ordinary state batches up to 1 MB rather than the general 64 KB limit, causing as many as 10,000 updates plus equivalence expansion and broadcasts per message. Restricting the exception to the intended validated EuroScope format would avoid this extra processing cost.

### Issue 5
src/services/xplane-removals.ts:71-88
The scanner remembers that an `FSData` opening tag appeared, but it neither tracks the closing tag nor requires `XPlaneRemovals` to be nested inside it. A document such as `<FSData simulator="xplane"></FSData><XPlaneRemovals>…</XPlaneRemovals>` can therefore produce a manifest even though the removal section is outside the declared root. Enforcing root nesting would prevent malformed drafts from being accepted.

### Issue 6
wrangler.jsonc:28-31
`DEBUG` is enabled in the deployed Wrangler configuration, which activates per-heartbeat and per-packet WebSocket logging. These logs include connection CIDs, callsigns, and complete state payloads, creating substantial production log volume and retaining user and state data by default. This should be disabled by default or limited to an explicit development environment.

### Issue 7
.gitignore:179-180
This PR removes the backend and realtime behavior checks and their package scripts while globally ignoring every future `*.test.ts` file. The remaining CI only type-checks and builds, so the new contribution, geometry, parser, and realtime behavior has no executable regression coverage, and normal TypeScript test additions will not be tracked.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Summary

This PR adds X-Plane contribution and Bridge-package support, immutable contribution publication metadata, contributor fast-track publishing, redesigned MSFS removal geometry, broader realtime synchronization, division-data automation authentication, and new lint tooling.

  • Approval currently regenerates artifacts instead of publishing the exact tested generation.
  • Equivalent-object batch conflicts can leave the sender out of sync.
  • MSFS test-radius calculation can omit the farthest exclusion corner.
  • Additional parser, packet-bound, production logging, and regression-coverage concerns remain.

Reviews (1) · Last reviewed commit: "feat: update support service to handle s..."

Comment on lines +1023 to +1028
const [removalArtifact, barsXml] = await Promise.all([
contribution.simulator === 'xplane'
? Promise.resolve(generateXPlaneRemovalsJson(contribution.submittedXml, contribution.airportIcao))
: this.supportService.generateLightSupportsXML(contribution.submittedXml, contribution.airportIcao, contribution.simulator),
this.polygonService.processBarsXML(contribution.submittedXml, contribution.airportIcao),
]);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Approval Discards Tested Artifacts

When a contribution is approved, this code reruns both generators from submittedXml instead of publishing the removal and BARS artifacts stored for its generationToken. If generation behavior changes while a contribution is pending, approval can publish outputs different from those the contributor tested, defeating the tested-generation guarantee and potentially shipping unvalidated simulator artifacts.

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/services/contributions.ts
Line: 1023-1028

Comment:
**Approval Discards Tested Artifacts**

When a contribution is approved, this code reruns both generators from `submittedXml` instead of publishing the removal and BARS artifacts stored for its `generationToken`. If generation behavior changes while a contribution is pending, approval can publish outputs different from those the contributor tested, defeating the tested-generation guarantee and potentially shipping unvalidated simulator artifacts.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Comment thread src/network/connection.ts Outdated
Comment on lines +1161 to +1190
@@ -804,7 +1185,12 @@ export class Connection {

this.markAirportStateDirty(airport);

return { updates: normalizedUpdates, timestamp: now, airport };
return {
updates: normalizedUpdates,
senderUpdates: getGeneratedAliasUpdates(normalizedUpdates, requestedObjectIds),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Sender State Can Diverge

If one MULTI_STATE_UPDATE gives conflicting states for two equivalent IDs, the updates run sequentially and the later state becomes canonical. Peers receive that final synchronized state, but both explicitly requested IDs are filtered out of senderUpdates, so the sending client receives no correction and remains out of sync with the server.

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/network/connection.ts
Line: 1161-1190

Comment:
**Sender State Can Diverge**

If one `MULTI_STATE_UPDATE` gives conflicting states for two equivalent IDs, the updates run sequentially and the later state becomes canonical. Peers receive that final synchronized state, but both explicitly requested IDs are filtered out of `senderUpdates`, so the sending client receives no correction and remains out of sync with the server.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Comment on lines +187 to +193
for (const exclusion of exclusions) {
for (const point of [
{ lat: exclusion.latitudeMinimum, lon: exclusion.longitudeMinimum },
{ lat: exclusion.latitudeMaximum, lon: exclusion.longitudeMaximum },
]) {
furthest = Math.max(furthest, distanceMeters(airport, point));
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Radius Omits Farthest Corners

The airport test radius measures only the southwest and northeast corners of each exclusion rectangle. When the airport lies northwest or southeast of an object-only exclusion, the farthest corner is one of the two omitted mixed corners. With no support geometry to compensate, the generated airportTestRadius can be too small to cover the removal area.

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/services/msfs-removals.ts
Line: 187-193

Comment:
**Radius Omits Farthest Corners**

The airport test radius measures only the southwest and northeast corners of each exclusion rectangle. When the airport lies northwest or southeast of an object-only exclusion, the farthest corner is one of the two omitted mixed corners. With no support geometry to compensate, the generated `airportTestRadius` can be too small to cover the removal area.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Comment on lines +37 to +43
export function allowsLargeLightingPacket(value: unknown): boolean {
if (!dictionary(value)) return false;
if (value.type === 'MULTI_STATE_UPDATE') {
const updates = Array.isArray(value.data) ? value.data : dictionary(value.data) ? value.data.updates : undefined;
return Array.isArray(updates) && updates.length > 0 && updates.length <= MAX_LIGHTING_UPDATES;
}
return value.type === 'SHARED_STATE_UPDATE' && dictionary(value.data) && isEuroScopeGraphPatch(value.data.sharedStatePatch);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Large Packet Check Too Broad

The large-packet exception treats every MULTI_STATE_UPDATE with at most 10,000 entries as EuroScope lighting traffic without validating its shape. Any authenticated controller can therefore send ordinary state batches up to 1 MB rather than the general 64 KB limit, causing as many as 10,000 updates plus equivalence expansion and broadcasts per message. Restricting the exception to the intended validated EuroScope format would avoid this extra processing cost.

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/network/euroscope-packets.ts
Line: 37-43

Comment:
**Large Packet Check Too Broad**

The large-packet exception treats every `MULTI_STATE_UPDATE` with at most 10,000 entries as EuroScope lighting traffic without validating its shape. Any authenticated controller can therefore send ordinary state batches up to 1 MB rather than the general 64 KB limit, causing as many as 10,000 updates plus equivalence expansion and broadcasts per message. Restricting the exception to the intended validated EuroScope format would avoid this extra processing cost.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Comment on lines +71 to +88
if (parsed.name === 'FSData') {
if (sawFsData) throw new Error('Invalid X-Plane draft: multiple FSData roots');
sawFsData = true;
if (parsed.attributes.simulator?.toLowerCase() !== 'xplane') {
throw new Error('X-Plane draft is missing simulator="xplane"');
}
continue;
}

if (parsed.name === 'XPlaneRemovals') {
if (!sawFsData || sawRemovals || parsed.selfClosing) {
throw new Error('Invalid X-Plane draft: expected one non-empty XPlaneRemovals section');
}
version = parsed.attributes.version ?? '1';
if (!['1', '2'].includes(version)) throw new Error('Unsupported X-Plane removal version');
sawRemovals = true;
insideRemovals = true;
continue;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Removal Root Nesting Unchecked

The scanner remembers that an FSData opening tag appeared, but it neither tracks the closing tag nor requires XPlaneRemovals to be nested inside it. A document such as <FSData simulator="xplane"></FSData><XPlaneRemovals>…</XPlaneRemovals> can therefore produce a manifest even though the removal section is outside the declared root. Enforcing root nesting would prevent malformed drafts from being accepted.

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/services/xplane-removals.ts
Line: 71-88

Comment:
**Removal Root Nesting Unchecked**

The scanner remembers that an `FSData` opening tag appeared, but it neither tracks the closing tag nor requires `XPlaneRemovals` to be nested inside it. A document such as `<FSData simulator="xplane"></FSData><XPlaneRemovals>…</XPlaneRemovals>` can therefore produce a manifest even though the removal section is outside the declared root. Enforcing root nesting would prevent malformed drafts from being accepted.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Comment thread wrangler.jsonc
Comment on lines 28 to 31
"vars": {
"DEBUG": "true",
"VATSIM_CLIENT_ID": "1562", // Change this for local testing
"POSTHOG_HOST": "https://a.stopbars.com",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Production Debug Logging Enabled

DEBUG is enabled in the deployed Wrangler configuration, which activates per-heartbeat and per-packet WebSocket logging. These logs include connection CIDs, callsigns, and complete state payloads, creating substantial production log volume and retaining user and state data by default. This should be disabled by default or limited to an explicit development environment.

Prompt To Fix With AI
This is a comment left during a code review.
Path: wrangler.jsonc
Line: 28-31

Comment:
**Production Debug Logging Enabled**

`DEBUG` is enabled in the deployed Wrangler configuration, which activates per-heartbeat and per-packet WebSocket logging. These logs include connection CIDs, callsigns, and complete state payloads, creating substantial production log volume and retaining user and state data by default. This should be disabled by default or limited to an explicit development environment.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Comment thread .gitignore
Comment on lines +179 to +180
# Local development tests
*.test.ts

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Regression Coverage Removed

This PR removes the backend and realtime behavior checks and their package scripts while globally ignoring every future *.test.ts file. The remaining CI only type-checks and builds, so the new contribution, geometry, parser, and realtime behavior has no executable regression coverage, and normal TypeScript test additions will not be tracked.

Prompt To Fix With AI
This is a comment left during a code review.
Path: .gitignore
Line: 179-180

Comment:
**Regression Coverage Removed**

This PR removes the backend and realtime behavior checks and their package scripts while globally ignoring every future `*.test.ts` file. The remaining CI only type-checks and builds, so the new contribution, geometry, parser, and realtime behavior has no executable regression coverage, and normal TypeScript test additions will not be tracked.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

@AussieScorcher
AussieScorcher merged commit 6685593 into main Sep 17, 2026
5 checks passed
@AussieScorcher
AussieScorcher deleted the feat/xplane branch October 2, 2026 23:57
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.

1 participant