Repository navigation
Feat/xplane - #105
Feat/xplane#105
Conversation
…rts and improve removal artifact generation
| console.error(`Error fetching offline state for ${airport}:`, error); | ||
| this.offlineStateCache.delete(normalizedAirport); | ||
| return []; | ||
| if (this.offlineStateCache.get(normalizedAirport)?.inFlight === inFlight) { |
|
| 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), | ||
| ]); |
There was a problem hiding this 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.
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.| @@ -804,7 +1185,12 @@ export class Connection { | |||
|
|
|||
| this.markAirportStateDirty(airport); | |||
|
|
|||
| return { updates: normalizedUpdates, timestamp: now, airport }; | |||
| return { | |||
| updates: normalizedUpdates, | |||
| senderUpdates: getGeneratedAliasUpdates(normalizedUpdates, requestedObjectIds), | |||
There was a problem hiding this comment.
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.| 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)); | ||
| } |
There was a problem hiding this comment.
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.| 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); |
There was a problem hiding this comment.
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.| 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; |
There was a problem hiding this 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.
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.| "vars": { | ||
| "DEBUG": "true", | ||
| "VATSIM_CLIENT_ID": "1562", // Change this for local testing | ||
| "POSTHOG_HOST": "https://a.stopbars.com", |
There was a problem hiding this 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.
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.| # Local development tests | ||
| *.test.ts |
There was a problem hiding this comment.
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.
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
Author Information
VATSIM CID: 1658308
Checklist: